pax_global_header00006660000000000000000000000064150752004720014514gustar00rootroot0000000000000052 comment=4243418d67528aaeff0047e3be36e61afca38161 hdf-eos5-2.0/000077500000000000000000000000001507520047200127675ustar00rootroot00000000000000hdf-eos5-2.0/Makefile.am000066400000000000000000000002571507520047200150270ustar00rootroot00000000000000# Top-level Makefile for HDF-EOS5 # Include boilerplate include $(top_srcdir)/config/include.am # List of subdirectories. SUBDIRS=include gctp src samples testdrivers doc hdf-eos5-2.0/Makefile.in000066400000000000000000000604651507520047200150470ustar00rootroot00000000000000# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # Top-level Makefile for HDF-EOS5 VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(top_srcdir)/config/include.am $(srcdir)/Makefile.in \ $(srcdir)/Makefile.am $(top_srcdir)/configure \ $(am__configure_deps) config/compile config/config.guess \ config/config.sub config/depcomp config/install-sh \ config/missing config/ltmain.sh \ $(top_srcdir)/config/config.guess \ $(top_srcdir)/config/config.sub \ $(top_srcdir)/config/install-sh $(top_srcdir)/config/ltmain.sh \ $(top_srcdir)/config/missing subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/stdlib.m4 $(top_srcdir)/m4/stdinc.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/HE5_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ cscope distdir dist dist-all distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags CSCOPE = cscope DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best DIST_TARGETS = dist-gzip distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FC = @FC@ FCFLAGS = @FCFLAGS@ FFLAGS = @FFLAGS@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ ac_ct_FC = @ac_ct_FC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ LIBHDFEOS5 = $(top_builddir)/src/libhe5_hdfeos.la LIBGCTP = $(top_builddir)/gctp/src/libGctp.la # Include boilerplate # List of subdirectories. SUBDIRS = include gctp src samples testdrivers doc all: all-recursive .SUFFIXES: am--refresh: Makefile @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/include.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/config/include.am: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool config.lt # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscope: cscope.files test ! -s cscope.files \ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) clean-cscope: -rm -f cscope.files cscope.files: clean-cscope cscopelist cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files distdir: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__post_remove_distdir) dist dist-all: $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) mkdir $(distdir)/_build $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-libtool \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--refresh check check-am clean clean-cscope clean-generic \ clean-libtool cscope cscopelist-am ctags ctags-am dist \ dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \ dist-xz dist-zip distcheck distclean distclean-generic \ distclean-libtool distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ ps ps-am tags tags-am uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: hdf-eos5-2.0/aclocal.m4000066400000000000000000001152571507520047200146420ustar00rootroot00000000000000# generated automatically by aclocal 1.13.4 -*- Autoconf -*- # Copyright (C) 1996-2013 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) # Copyright (C) 2002-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.13' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.13.4], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.13.4])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to # '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each '.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) AM_MISSING_PROG([AUTOCONF], [autoconf]) AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) AM_MISSING_PROG([AUTOHEADER], [autoheader]) AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering # Copyright (C) 1996-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAINTAINER_MODE([DEFAULT-MODE]) # ---------------------------------- # Control maintainer-specific portions of Makefiles. # Default is to disable them, unless 'enable' is passed literally. # For symmetry, 'disable' may be passed as well. Anyway, the user # can override the default with the --enable/--disable switch. AC_DEFUN([AM_MAINTAINER_MODE], [m4_case(m4_default([$1], [disable]), [enable], [m4_define([am_maintainer_other], [disable])], [disable], [m4_define([am_maintainer_other], [enable])], [m4_define([am_maintainer_other], [enable]) m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode's default is 'disable' unless 'enable' is passed AC_ARG_ENABLE([maintainer-mode], [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode], am_maintainer_other[ make rules and dependencies not useful (and sometimes confusing) to the casual installer])], [USE_MAINTAINER_MODE=$enableval], [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST([MAINT])dnl ] ) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it is modern enough. # If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT([yes]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar # AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} for _am_tool in $_am_tools; do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works. rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([m4/libtool.m4]) m4_include([m4/ltoptions.m4]) m4_include([m4/ltsugar.m4]) m4_include([m4/ltversion.m4]) m4_include([m4/lt~obsolete.m4]) hdf-eos5-2.0/config/000077500000000000000000000000001507520047200142345ustar00rootroot00000000000000hdf-eos5-2.0/config/compile000077500000000000000000000162451507520047200156220ustar00rootroot00000000000000#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2012-10-14.11; # UTC # Copyright (C) 1999-2014 Free Software Foundation, Inc. # Written by Tom Tromey . # # 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, see . # 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 file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: hdf-eos5-2.0/config/config.guess000077500000000000000000001303611507520047200165600ustar00rootroot00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2013 Free Software Foundation, Inc. timestamp='2013-06-10' # 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 3 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, see . # # 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 Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # # Please send patches with a ChangeLog entry to config-patches@gnu.org. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "${UNAME_SYSTEM}" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval $set_cc_for_build cat <<-EOF > $dummy.c #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` ;; esac # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW64*:*) echo ${UNAME_MACHINE}-pc-mingw64 exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="gnulibc1" ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; or1k:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; or32:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-${LIBC} exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-${LIBC} exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown eval $set_cc_for_build if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac eval $set_cc_for_build cat >$dummy.c < # include #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 printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: hdf-eos5-2.0/config/config.sub000077500000000000000000001053151507520047200162240ustar00rootroot00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2013 Free Software Foundation, Inc. timestamp='2013-04-24' # 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 3 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, see . # # 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 Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches with a ChangeLog entry to config-patches@gnu.org. # # 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. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 \ | or1k | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i386-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-* | ppc64p7-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -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* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or1k-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: hdf-eos5-2.0/config/depcomp000077500000000000000000000560161507520047200156210ustar00rootroot00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2013-05-30.07; # UTC # Copyright (C) 1999-2013 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, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interferences from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The second -e expression handles DOS-style file names with drive # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: hdf-eos5-2.0/config/include.am000066400000000000000000000003311507520047200161730ustar00rootroot00000000000000## config/include.am ## ## This file is included in the beginning of each Makefile.am. It contains ## shared definitions. LIBHDFEOS5=$(top_builddir)/src/libhe5_hdfeos.la LIBGCTP=$(top_builddir)/gctp/src/libGctp.la hdf-eos5-2.0/config/install-sh000077500000000000000000000332551507520047200162500ustar00rootroot00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2011-11-20.07; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: hdf-eos5-2.0/config/ltmain.sh000066400000000000000000010515221507520047200160620ustar00rootroot00000000000000 # libtool (GNU libtool) 2.4.2 # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, # 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, # or obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Usage: $progname [OPTION]... [MODE-ARG]... # # Provide generalized library-building support services. # # --config show all configuration variables # --debug enable verbose shell tracing # -n, --dry-run display commands without modifying any files # --features display basic configuration information and exit # --mode=MODE use operation mode MODE # --preserve-dup-deps don't remove duplicate dependency libraries # --quiet, --silent don't print informational messages # --no-quiet, --no-silent # print informational messages (default) # --no-warn don't display warning messages # --tag=TAG use configuration variables from tag TAG # -v, --verbose print more informational messages than default # --no-verbose don't print the extra informational messages # --version print version information # -h, --help, --help-all print short, long, or detailed help message # # MODE must be one of the following: # # clean remove files from the build directory # compile compile a source file into a libtool object # execute automatically set library path, then run a program # finish complete the installation of libtool libraries # install install libraries or executables # link create a library or an executable # uninstall remove libraries from an installed directory # # MODE-ARGS vary depending on the MODE. When passed as first option, # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. # Try `$progname --help --mode=MODE' for a more detailed description of MODE. # # When reporting a bug, please describe a test case to reproduce it and # include the following information: # # host-triplet: $host # shell: $SHELL # compiler: $LTCC # compiler flags: $LTCFLAGS # linker: $LD (gnu? $with_gnu_ld) # $progname: (GNU libtool) 2.4.2 # automake: $automake_version # autoconf: $autoconf_version # # Report bugs to . # GNU libtool home page: . # General help using GNU software: . PROGRAM=libtool PACKAGE=libtool VERSION=2.4.2 TIMESTAMP="" package_revision=1.3337 # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } # NLS nuisances: We save the old values to restore during execute mode. lt_user_locale= lt_safe_locale= for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${$lt_var+set}\" = set; then save_$lt_var=\$$lt_var $lt_var=C export $lt_var lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" fi" done LC_ALL=C LANGUAGE=C export LANGUAGE LC_ALL $lt_unset CDPATH # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" : ${CP="cp -f"} test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} : ${Xsed="$SED -e 1s/^X//"} # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. exit_status=$EXIT_SUCCESS # Make sure IFS has a sensible default lt_nl=' ' IFS=" $lt_nl" dirname="s,/[^/]*$,," basename="s,^.*/,," # func_dirname file append nondir_replacement # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. func_dirname () { func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi } # func_dirname may be replaced by extended shell implementation # func_basename file func_basename () { func_basename_result=`$ECHO "${1}" | $SED "$basename"` } # func_basename may be replaced by extended shell implementation # func_dirname_and_basename file append nondir_replacement # perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # Implementation must be kept synchronized with func_dirname # and func_basename. For efficiency, we do not delegate to # those functions but instead duplicate the functionality here. func_dirname_and_basename () { # Extract subdirectory from the argument. func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` } # func_dirname_and_basename may be replaced by extended shell implementation # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # func_strip_suffix prefix name func_stripname () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname may be replaced by extended shell implementation # These SED scripts presuppose an absolute path with a trailing slash. pathcar='s,^/\([^/]*\).*$,\1,' pathcdr='s,^/[^/]*,,' removedotparts=':dotsl s@/\./@/@g t dotsl s,/\.$,/,' collapseslashes='s@/\{1,\}@/@g' finalslash='s,/*$,/,' # func_normal_abspath PATH # Remove doubled-up and trailing slashes, "." path components, # and cancel out any ".." path components in PATH after making # it an absolute path. # value returned in "$func_normal_abspath_result" func_normal_abspath () { # Start from root dir and reassemble the path. func_normal_abspath_result= func_normal_abspath_tpath=$1 func_normal_abspath_altnamespace= case $func_normal_abspath_tpath in "") # Empty path, that just means $cwd. func_stripname '' '/' "`pwd`" func_normal_abspath_result=$func_stripname_result return ;; # The next three entries are used to spot a run of precisely # two leading slashes without using negated character classes; # we take advantage of case's first-match behaviour. ///*) # Unusual form of absolute path, do nothing. ;; //*) # Not necessarily an ordinary path; POSIX reserves leading '//' # and for example Cygwin uses it to access remote file shares # over CIFS/SMB, so we conserve a leading double slash if found. func_normal_abspath_altnamespace=/ ;; /*) # Absolute path, do nothing. ;; *) # Relative path, prepend $cwd. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath ;; esac # Cancel out all the simple stuff to save iterations. We also want # the path to end with a slash for ease of parsing, so make sure # there is one (and only one) here. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` while :; do # Processed it all yet? if test "$func_normal_abspath_tpath" = / ; then # If we ascended to the root using ".." the result may be empty now. if test -z "$func_normal_abspath_result" ; then func_normal_abspath_result=/ fi break fi func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$pathcar"` func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$pathcdr"` # Figure out what to do with it case $func_normal_abspath_tcomponent in "") # Trailing empty path component, ignore it. ;; ..) # Parent dir; strip last assembled component from result. func_dirname "$func_normal_abspath_result" func_normal_abspath_result=$func_dirname_result ;; *) # Actual path component, append it. func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent ;; esac done # Restore leading double-slash if one was found on entry. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result } # func_relative_path SRCDIR DSTDIR # generates a relative path from SRCDIR to DSTDIR, with a trailing # slash if non-empty, suitable for immediately appending a filename # without needing to append a separator. # value returned in "$func_relative_path_result" func_relative_path () { func_relative_path_result= func_normal_abspath "$1" func_relative_path_tlibdir=$func_normal_abspath_result func_normal_abspath "$2" func_relative_path_tbindir=$func_normal_abspath_result # Ascend the tree starting from libdir while :; do # check if we have found a prefix of bindir case $func_relative_path_tbindir in $func_relative_path_tlibdir) # found an exact match func_relative_path_tcancelled= break ;; $func_relative_path_tlibdir*) # found a matching prefix func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" func_relative_path_tcancelled=$func_stripname_result if test -z "$func_relative_path_result"; then func_relative_path_result=. fi break ;; *) func_dirname $func_relative_path_tlibdir func_relative_path_tlibdir=${func_dirname_result} if test "x$func_relative_path_tlibdir" = x ; then # Have to descend all the way to the root! func_relative_path_result=../$func_relative_path_result func_relative_path_tcancelled=$func_relative_path_tbindir break fi func_relative_path_result=../$func_relative_path_result ;; esac done # Now calculate path; take care to avoid doubling-up slashes. func_stripname '' '/' "$func_relative_path_result" func_relative_path_result=$func_stripname_result func_stripname '/' '/' "$func_relative_path_tcancelled" if test "x$func_stripname_result" != x ; then func_relative_path_result=${func_relative_path_result}/${func_stripname_result} fi # Normalisation. If bindir is libdir, return empty string, # else relative path ending with a slash; either way, target # file name can be directly appended. if test ! -z "$func_relative_path_result"; then func_stripname './' '' "$func_relative_path_result/" func_relative_path_result=$func_stripname_result fi } # The name of this program: func_dirname_and_basename "$progpath" progname=$func_basename_result # Make sure we have an absolute path for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) progdir=$func_dirname_result progdir=`cd "$progdir" && pwd` progpath="$progdir/$progname" ;; *) save_IFS="$IFS" IFS=${PATH_SEPARATOR-:} for progdir in $PATH; do IFS="$save_IFS" test -x "$progdir/$progname" && break done IFS="$save_IFS" test -n "$progdir" || progdir=`pwd` progpath="$progdir/$progname" ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed="${SED}"' -e 1s/^X//' sed_quote_subst='s/\([`"$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution that turns a string into a regex matching for the # string literally. sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' # Sed substitution that converts a w32 file name or path # which contains forward slashes, into one that contains # (escaped) backslashes. A very naive implementation. lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Re-`\' parameter expansions in output of double_quote_subst that were # `\'-ed in input to the same. If an odd number of `\' preceded a '$' # in input to double_quote_subst, that '$' was protected from expansion. # Since each input `\' is now two `\'s, look for any number of runs of # four `\'s followed by two `\'s and then a '$'. `\' that '$'. bs='\\' bs2='\\\\' bs4='\\\\\\\\' dollar='\$' sed_double_backslash="\ s/$bs4/&\\ /g s/^$bs2$dollar/$bs&/ s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g s/\n//g" # Standard options: opt_dry_run=false opt_help=false opt_quiet=false opt_verbose=false opt_warning=: # func_echo arg... # Echo program name prefixed message, along with the current mode # name if it has been set yet. func_echo () { $ECHO "$progname: ${opt_mode+$opt_mode: }$*" } # func_verbose arg... # Echo program name prefixed message in verbose mode only. func_verbose () { $opt_verbose && func_echo ${1+"$@"} # A bug in bash halts the script if the last line of a function # fails when set -e is in force, so we need another command to # work around that: : } # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } # func_error arg... # Echo program name prefixed message to standard error. func_error () { $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 } # func_warning arg... # Echo program name prefixed warning message to standard error. func_warning () { $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 # bash bug again: : } # func_fatal_error arg... # Echo program name prefixed message to standard error, and exit. func_fatal_error () { func_error ${1+"$@"} exit $EXIT_FAILURE } # func_fatal_help arg... # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { func_error ${1+"$@"} func_fatal_error "$help" } help="Try \`$progname --help' for more information." ## default # func_grep expression filename # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { $GREP "$1" "$2" >/dev/null 2>&1 } # func_mkdir_p directory-path # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { my_directory_path="$1" my_dir_list= if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then # Protect directory names starting with `-' case $my_directory_path in -*) my_directory_path="./$my_directory_path" ;; esac # While some portion of DIR does not yet exist... while test ! -d "$my_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list incase some portion of path contains whitespace. my_dir_list="$my_directory_path:$my_dir_list" # If the last portion added has no slash in it, the list is done case $my_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` done my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` save_mkdir_p_IFS="$IFS"; IFS=':' for my_dir in $my_dir_list; do IFS="$save_mkdir_p_IFS" # mkdir can fail with a `File exist' error if two processes # try to create one of the directories concurrently. Don't # stop in that case! $MKDIR "$my_dir" 2>/dev/null || : done IFS="$save_mkdir_p_IFS" # Bail out if we (or some other process) failed to create a directory. test -d "$my_directory_path" || \ func_fatal_error "Failed to create \`$1'" fi } # func_mktempdir [string] # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, STRING is the basename for that directory. func_mktempdir () { my_template="${TMPDIR-/tmp}/${1-$progname}" if test "$opt_dry_run" = ":"; then # Return a directory name, but don't create it in dry-run mode my_tmpdir="${my_template}-$$" else # If mktemp works, use that first and foremost my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` if test ! -d "$my_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race my_tmpdir="${my_template}-${RANDOM-0}$$" save_mktempdir_umask=`umask` umask 0077 $MKDIR "$my_tmpdir" umask $save_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$my_tmpdir" || \ func_fatal_error "cannot create temporary directory \`$my_tmpdir'" fi $ECHO "$my_tmpdir" } # func_quote_for_eval arg # Aesthetically quote ARG to be evaled later. # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT # is double-quoted, suitable for a subsequent eval, whereas # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters # which are still active within double quotes backslashified. func_quote_for_eval () { case $1 in *[\\\`\"\$]*) func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; *) func_quote_for_eval_unquoted_result="$1" ;; esac case $func_quote_for_eval_unquoted_result in # Double-quote args containing shell metacharacters to delay # word splitting, command substitution and and variable # expansion for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" ;; *) func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" esac } # func_quote_for_expand arg # Aesthetically quote ARG to be evaled later; same as above, # but do not quote variable references. func_quote_for_expand () { case $1 in *[\\\`\"]*) my_arg=`$ECHO "$1" | $SED \ -e "$double_quote_subst" -e "$sed_double_backslash"` ;; *) my_arg="$1" ;; esac case $my_arg in # Double-quote args containing shell metacharacters to delay # word splitting and command substitution for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") my_arg="\"$my_arg\"" ;; esac func_quote_for_expand_result="$my_arg" } # func_show_eval cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$my_cmd" my_status=$? if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_show_eval_locale cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$lt_user_locale $my_cmd" my_status=$? eval "$lt_safe_locale" if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_tr_sh # Turn $1 into a string suitable for a shell variable name. # Result is stored in $func_tr_sh_result. All characters # not in the set a-zA-Z0-9_ are replaced with '_'. Further, # if $1 begins with a digit, a '_' is prepended as well. func_tr_sh () { case $1 in [0-9]* | *[!a-zA-Z0-9_]*) func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` ;; * ) func_tr_sh_result=$1 ;; esac } # func_version # Echo version message to standard output and exit. func_version () { $opt_debug $SED -n '/(C)/!b go :more /\./!{ N s/\n# / / b more } :go /^# '$PROGRAM' (GNU /,/# warranty; / { s/^# // s/^# *$// s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ p }' < "$progpath" exit $? } # func_usage # Echo short help message to standard output and exit. func_usage () { $opt_debug $SED -n '/^# Usage:/,/^# *.*--help/ { s/^# // s/^# *$// s/\$progname/'$progname'/ p }' < "$progpath" echo $ECHO "run \`$progname --help | more' for full usage" exit $? } # func_help [NOEXIT] # Echo long help message to standard output and exit, # unless 'noexit' is passed as argument. func_help () { $opt_debug $SED -n '/^# Usage:/,/# Report bugs to/ { :print s/^# // s/^# *$// s*\$progname*'$progname'* s*\$host*'"$host"'* s*\$SHELL*'"$SHELL"'* s*\$LTCC*'"$LTCC"'* s*\$LTCFLAGS*'"$LTCFLAGS"'* s*\$LD*'"$LD"'* s/\$with_gnu_ld/'"$with_gnu_ld"'/ s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/ s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/ p d } /^# .* home page:/b print /^# General help using/b print ' < "$progpath" ret=$? if test -z "$1"; then exit $ret fi } # func_missing_arg argname # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { $opt_debug func_error "missing argument for $1." exit_cmd=exit } # func_split_short_opt shortopt # Set func_split_short_opt_name and func_split_short_opt_arg shell # variables after splitting SHORTOPT after the 2nd character. func_split_short_opt () { my_sed_short_opt='1s/^\(..\).*$/\1/;q' my_sed_short_rest='1s/^..\(.*\)$/\1/;q' func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` } # func_split_short_opt may be replaced by extended shell implementation # func_split_long_opt longopt # Set func_split_long_opt_name and func_split_long_opt_arg shell # variables after splitting LONGOPT at the `=' sign. func_split_long_opt () { my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' my_sed_long_arg='1s/^--[^=]*=//' func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` } # func_split_long_opt may be replaced by extended shell implementation exit_cmd=: magic="%%%MAGIC variable%%%" magic_exe="%%%MAGIC EXE variable%%%" # Global variables. nonopt= preserve_args= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" extracted_archives= extracted_serial=0 # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= # func_append var value # Append VALUE to the end of shell variable VAR. func_append () { eval "${1}=\$${1}\${2}" } # func_append may be replaced by extended shell implementation # func_append_quoted var value # Quote VALUE and append to the end of shell variable VAR, separated # by a space. func_append_quoted () { func_quote_for_eval "${2}" eval "${1}=\$${1}\\ \$func_quote_for_eval_result" } # func_append_quoted may be replaced by extended shell implementation # func_arith arithmetic-term... func_arith () { func_arith_result=`expr "${@}"` } # func_arith may be replaced by extended shell implementation # func_len string # STRING may not start with a hyphen. func_len () { func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` } # func_len may be replaced by extended shell implementation # func_lo2o object func_lo2o () { func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` } # func_lo2o may be replaced by extended shell implementation # func_xform libobj-or-source func_xform () { func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` } # func_xform may be replaced by extended shell implementation # func_fatal_configuration arg... # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func_error ${1+"$@"} func_error "See the $PACKAGE documentation for more information." func_fatal_error "Fatal configuration error." } # func_config # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $? } # func_features # Display the features supported by this script. func_features () { echo "host: $host" if test "$build_libtool_libs" = yes; then echo "enable shared libraries" else echo "disable shared libraries" fi if test "$build_old_libs" = yes; then echo "enable static libraries" else echo "disable static libraries" fi exit $? } # func_enable_tag tagname # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname="$1" re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf="/$re_begincf/,/$re_endcf/p" # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable quotes within backquotes within # quotes we have to do it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } # func_check_version_match # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set dummy --mode clean ${1+"$@"}; shift ;; compile|compil|compi|comp|com|co|c) shift; set dummy --mode compile ${1+"$@"}; shift ;; execute|execut|execu|exec|exe|ex|e) shift; set dummy --mode execute ${1+"$@"}; shift ;; finish|finis|fini|fin|fi|f) shift; set dummy --mode finish ${1+"$@"}; shift ;; install|instal|insta|inst|ins|in|i) shift; set dummy --mode install ${1+"$@"}; shift ;; link|lin|li|l) shift; set dummy --mode link ${1+"$@"}; shift ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; esac # Option defaults: opt_debug=: opt_dry_run=false opt_config=false opt_preserve_dup_deps=false opt_features=false opt_finish=false opt_help=false opt_help_all=false opt_silent=: opt_warning=: opt_verbose=: opt_silent=false opt_verbose=false # Parse options once, thoroughly. This comes as soon as possible in the # script to make things like `--version' happen as quickly as we can. { # this just eases exit handling while test $# -gt 0; do opt="$1" shift case $opt in --debug|-x) opt_debug='set -x' func_echo "enabling shell trace mode" $opt_debug ;; --dry-run|--dryrun|-n) opt_dry_run=: ;; --config) opt_config=: func_config ;; --dlopen|-dlopen) optarg="$1" opt_dlopen="${opt_dlopen+$opt_dlopen }$optarg" shift ;; --preserve-dup-deps) opt_preserve_dup_deps=: ;; --features) opt_features=: func_features ;; --finish) opt_finish=: set dummy --mode finish ${1+"$@"}; shift ;; --help) opt_help=: ;; --help-all) opt_help_all=: opt_help=': help-all' ;; --mode) test $# = 0 && func_missing_arg $opt && break optarg="$1" opt_mode="$optarg" case $optarg in # Valid mode arguments: clean|compile|execute|finish|install|link|relink|uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $opt" exit_cmd=exit break ;; esac shift ;; --no-silent|--no-quiet) opt_silent=false func_append preserve_args " $opt" ;; --no-warning|--no-warn) opt_warning=false func_append preserve_args " $opt" ;; --no-verbose) opt_verbose=false func_append preserve_args " $opt" ;; --silent|--quiet) opt_silent=: func_append preserve_args " $opt" opt_verbose=false ;; --verbose|-v) opt_verbose=: func_append preserve_args " $opt" opt_silent=false ;; --tag) test $# = 0 && func_missing_arg $opt && break optarg="$1" opt_tag="$optarg" func_append preserve_args " $opt $optarg" func_enable_tag "$optarg" shift ;; -\?|-h) func_usage ;; --help) func_help ;; --version) func_version ;; # Separate optargs to long options: --*=*) func_split_long_opt "$opt" set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} shift ;; # Separate non-argument short options: -\?*|-h*|-n*|-v*) func_split_short_opt "$opt" set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} shift ;; --) break ;; -*) func_fatal_help "unrecognized option \`$opt'" ;; *) set dummy "$opt" ${1+"$@"}; shift; break ;; esac done # Validate options: # save first non-option argument if test "$#" -gt 0; then nonopt="$opt" shift fi # preserve --debug test "$opt_debug" = : || func_append preserve_args " --debug" case $host in *cygwin* | *mingw* | *pw32* | *cegcc*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps ;; esac $opt_help || { # Sanity checks first: func_check_version_match if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then func_fatal_configuration "not configured to build any kind of library" fi # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$opt_dlopen" && test "$opt_mode" != execute; then func_error "unrecognized option \`-dlopen'" $ECHO "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$progname --help --mode=$opt_mode' for more information." } # Bail if the options were screwed $exit_cmd $EXIT_FAILURE } ## ----------- ## ## Main. ## ## ----------- ## # func_lalib_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && $SED -e 4q "$1" 2>/dev/null \ | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # func_lalib_unsafe_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be # fatal anyway. Works if `file' does not exist. func_lalib_unsafe_p () { lalib_p=no if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read lalib_p_line case "$lalib_p_line" in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi test "$lalib_p" = yes } # func_ltwrapper_script_p file # True iff FILE is a libtool wrapper script # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_script_p () { func_lalib_p "$1" } # func_ltwrapper_executable_p file # True iff FILE is a libtool wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_executable_p () { func_ltwrapper_exec_suffix= case $1 in *.exe) ;; *) func_ltwrapper_exec_suffix=.exe ;; esac $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 } # func_ltwrapper_scriptname file # Assumes file is an ltwrapper_executable # uses $file to determine the appropriate filename for a # temporary ltwrapper_script. func_ltwrapper_scriptname () { func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" } # func_ltwrapper_p file # True iff FILE is a libtool wrapper script or wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_p () { func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" } # func_execute_cmds commands fail_cmd # Execute tilde-delimited COMMANDS. # If FAIL_CMD is given, eval that upon failure. # FAIL_CMD may read-access the current command in variable CMD! func_execute_cmds () { $opt_debug save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$save_ifs eval cmd=\"$cmd\" func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs } # func_source file # Source FILE, adding directory component if necessary. # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. func_source () { $opt_debug case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; esac } # func_resolve_sysroot PATH # Replace a leading = in PATH with a sysroot. Store the result into # func_resolve_sysroot_result func_resolve_sysroot () { func_resolve_sysroot_result=$1 case $func_resolve_sysroot_result in =*) func_stripname '=' '' "$func_resolve_sysroot_result" func_resolve_sysroot_result=$lt_sysroot$func_stripname_result ;; esac } # func_replace_sysroot PATH # If PATH begins with the sysroot, replace it with = and # store the result into func_replace_sysroot_result. func_replace_sysroot () { case "$lt_sysroot:$1" in ?*:"$lt_sysroot"*) func_stripname "$lt_sysroot" '' "$1" func_replace_sysroot_result="=$func_stripname_result" ;; *) # Including no sysroot. func_replace_sysroot_result=$1 ;; esac } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { $opt_debug if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case "$@ " in " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with \`--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_write_libtool_object output_name pic_name nonpic_name # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. func_write_libtool_object () { write_libobj=${1} if test "$build_libtool_libs" = yes; then write_lobj=\'${2}\' else write_lobj=none fi if test "$build_old_libs" = yes; then write_oldobj=\'${3}\' else write_oldobj=none fi $opt_dry_run || { cat >${write_libobj}T </dev/null` if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | $SED -e "$lt_sed_naive_backslashify"` else func_convert_core_file_wine_to_w32_result= fi fi } # end: func_convert_core_file_wine_to_w32 # func_convert_core_path_wine_to_w32 ARG # Helper function used by path conversion functions when $build is *nix, and # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly # configured wine environment available, with the winepath program in $build's # $PATH. Assumes ARG has no leading or trailing path separator characters. # # ARG is path to be converted from $build format to win32. # Result is available in $func_convert_core_path_wine_to_w32_result. # Unconvertible file (directory) names in ARG are skipped; if no directory names # are convertible, then the result may be empty. func_convert_core_path_wine_to_w32 () { $opt_debug # unfortunately, winepath doesn't convert paths, only file names func_convert_core_path_wine_to_w32_result="" if test -n "$1"; then oldIFS=$IFS IFS=: for func_convert_core_path_wine_to_w32_f in $1; do IFS=$oldIFS func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" if test -n "$func_convert_core_file_wine_to_w32_result" ; then if test -z "$func_convert_core_path_wine_to_w32_result"; then func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" else func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" fi fi done IFS=$oldIFS fi } # end: func_convert_core_path_wine_to_w32 # func_cygpath ARGS... # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or # (2), returns the Cygwin file name or path in func_cygpath_result (input # file name or path is assumed to be in w32 format, as previously converted # from $build's *nix or MSYS format). In case (3), returns the w32 file name # or path in func_cygpath_result (input file name or path is assumed to be in # Cygwin format). Returns an empty string on error. # # ARGS are passed to cygpath, with the last one being the file name or path to # be converted. # # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH # environment variable; do not put it in $PATH. func_cygpath () { $opt_debug if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` if test "$?" -ne 0; then # on failure, ensure result is empty func_cygpath_result= fi else func_cygpath_result= func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" fi } #end: func_cygpath # func_convert_core_msys_to_w32 ARG # Convert file name or path ARG from MSYS format to w32 format. Return # result in func_convert_core_msys_to_w32_result. func_convert_core_msys_to_w32 () { $opt_debug # awkward: cmd appends spaces to result func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` } #end: func_convert_core_msys_to_w32 # func_convert_file_check ARG1 ARG2 # Verify that ARG1 (a file name in $build format) was converted to $host # format in ARG2. Otherwise, emit an error message, but continue (resetting # func_to_host_file_result to ARG1). func_convert_file_check () { $opt_debug if test -z "$2" && test -n "$1" ; then func_error "Could not determine host file name corresponding to" func_error " \`$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: func_to_host_file_result="$1" fi } # end func_convert_file_check # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH # Verify that FROM_PATH (a path in $build format) was converted to $host # format in TO_PATH. Otherwise, emit an error message, but continue, resetting # func_to_host_file_result to a simplistic fallback value (see below). func_convert_path_check () { $opt_debug if test -z "$4" && test -n "$3"; then func_error "Could not determine the host path corresponding to" func_error " \`$3'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This is a deliberately simplistic "conversion" and # should not be "improved". See libtool.info. if test "x$1" != "x$2"; then lt_replace_pathsep_chars="s|$1|$2|g" func_to_host_path_result=`echo "$3" | $SED -e "$lt_replace_pathsep_chars"` else func_to_host_path_result="$3" fi fi } # end func_convert_path_check # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT # and appending REPL if ORIG matches BACKPAT. func_convert_path_front_back_pathsep () { $opt_debug case $4 in $1 ) func_to_host_path_result="$3$func_to_host_path_result" ;; esac case $4 in $2 ) func_append func_to_host_path_result "$3" ;; esac } # end func_convert_path_front_back_pathsep ################################################## # $build to $host FILE NAME CONVERSION FUNCTIONS # ################################################## # invoked via `$to_host_file_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # Result will be available in $func_to_host_file_result. # func_to_host_file ARG # Converts the file name ARG from $build format to $host format. Return result # in func_to_host_file_result. func_to_host_file () { $opt_debug $to_host_file_cmd "$1" } # end func_to_host_file # func_to_tool_file ARG LAZY # converts the file name ARG from $build format to toolchain format. Return # result in func_to_tool_file_result. If the conversion in use is listed # in (the comma separated) LAZY, no conversion takes place. func_to_tool_file () { $opt_debug case ,$2, in *,"$to_tool_file_cmd",*) func_to_tool_file_result=$1 ;; *) $to_tool_file_cmd "$1" func_to_tool_file_result=$func_to_host_file_result ;; esac } # end func_to_tool_file # func_convert_file_noop ARG # Copy ARG to func_to_host_file_result. func_convert_file_noop () { func_to_host_file_result="$1" } # end func_convert_file_noop # func_convert_file_msys_to_w32 ARG # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_file_result. func_convert_file_msys_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_to_host_file_result="$func_convert_core_msys_to_w32_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_w32 # func_convert_file_cygwin_to_w32 ARG # Convert file name ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_file_cygwin_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then # because $build is cygwin, we call "the" cygpath in $PATH; no need to use # LT_CYGPATH in this case. func_to_host_file_result=`cygpath -m "$1"` fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_cygwin_to_w32 # func_convert_file_nix_to_w32 ARG # Convert file name ARG from *nix to w32 format. Requires a wine environment # and a working winepath. Returns result in func_to_host_file_result. func_convert_file_nix_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_file_wine_to_w32 "$1" func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_w32 # func_convert_file_msys_to_cygwin ARG # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_file_msys_to_cygwin () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_cygpath -u "$func_convert_core_msys_to_w32_result" func_to_host_file_result="$func_cygpath_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_cygwin # func_convert_file_nix_to_cygwin ARG # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed # in a wine environment, working winepath, and LT_CYGPATH set. Returns result # in func_to_host_file_result. func_convert_file_nix_to_cygwin () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. func_convert_core_file_wine_to_w32 "$1" func_cygpath -u "$func_convert_core_file_wine_to_w32_result" func_to_host_file_result="$func_cygpath_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_cygwin ############################################# # $build to $host PATH CONVERSION FUNCTIONS # ############################################# # invoked via `$to_host_path_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # The result will be available in $func_to_host_path_result. # # Path separators are also converted from $build format to $host format. If # ARG begins or ends with a path separator character, it is preserved (but # converted to $host format) on output. # # All path conversion functions are named using the following convention: # file name conversion function : func_convert_file_X_to_Y () # path conversion function : func_convert_path_X_to_Y () # where, for any given $build/$host combination the 'X_to_Y' value is the # same. If conversion functions are added for new $build/$host combinations, # the two new functions must follow this pattern, or func_init_to_host_path_cmd # will break. # func_init_to_host_path_cmd # Ensures that function "pointer" variable $to_host_path_cmd is set to the # appropriate value, based on the value of $to_host_file_cmd. to_host_path_cmd= func_init_to_host_path_cmd () { $opt_debug if test -z "$to_host_path_cmd"; then func_stripname 'func_convert_file_' '' "$to_host_file_cmd" to_host_path_cmd="func_convert_path_${func_stripname_result}" fi } # func_to_host_path ARG # Converts the path ARG from $build format to $host format. Return result # in func_to_host_path_result. func_to_host_path () { $opt_debug func_init_to_host_path_cmd $to_host_path_cmd "$1" } # end func_to_host_path # func_convert_path_noop ARG # Copy ARG to func_to_host_path_result. func_convert_path_noop () { func_to_host_path_result="$1" } # end func_convert_path_noop # func_convert_path_msys_to_w32 ARG # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_path_result. func_convert_path_msys_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # Remove leading and trailing path separator characters from ARG. MSYS # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; # and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result="$func_convert_core_msys_to_w32_result" func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_msys_to_w32 # func_convert_path_cygwin_to_w32 ARG # Convert path ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_path_cygwin_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_cygwin_to_w32 # func_convert_path_nix_to_w32 ARG # Convert path ARG from *nix to w32 format. Requires a wine environment and # a working winepath. Returns result in func_to_host_file_result. func_convert_path_nix_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_nix_to_w32 # func_convert_path_msys_to_cygwin ARG # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_path_msys_to_cygwin () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_msys_to_w32_result" func_to_host_path_result="$func_cygpath_result" func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_msys_to_cygwin # func_convert_path_nix_to_cygwin ARG # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a # a wine environment, working winepath, and LT_CYGPATH set. Returns result in # func_to_host_file_result. func_convert_path_nix_to_cygwin () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them # into '.;' and ';.', and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" func_to_host_path_result="$func_cygpath_result" func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_nix_to_cygwin # func_mode_compile arg... func_mode_compile () { $opt_debug # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= pie_flag= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify \`-o' more than once" arg_mode=target continue ;; -pie | -fpie | -fPIE) func_append pie_flag " $arg" continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) func_append later " $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" func_append_quoted lastarg "$arg" done IFS="$save_ifs" func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result # Add the arguments to base_compile. func_append base_compile " $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. func_append_quoted base_compile "$lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with \`-o'" ;; *) # Get the name of the library object. test -z "$libobj" && { func_basename "$srcfile" libobj="$func_basename_result" } ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo case $libobj in *.[cCFSifmso] | \ *.ada | *.adb | *.ads | *.asm | \ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) func_xform "$libobj" libobj=$func_xform_result ;; esac case $libobj in *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; *) func_fatal_error "cannot determine name of library object from \`$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done func_quote_for_eval "$libobj" test "X$libobj" != "X$func_quote_for_eval_result" \ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ && func_warning "libobj name \`$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" objname="$func_basename_result" xdir="$func_dirname_result" lobj=${xdir}$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2* | cegcc*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $ECHO "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi func_append removelist " $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist func_append removelist " $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 srcfile=$func_to_tool_file_result func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result # Only build a PIC object if we are building libtool libraries. if test "$build_libtool_libs" = yes; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test "$pic_mode" != no; then command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code command="$base_compile $qsrcfile" fi func_mkdir_p "$xdir$objdir" if test -z "$output_obj"; then # Place PIC objects in $objdir func_append command " -o $lobj" fi func_show_eval_locale "$command" \ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then func_show_eval '$MV "$output_obj" "$lobj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi # Allow error messages only from the first compilation. if test "$suppress_opt" = yes; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. if test "$build_old_libs" = yes; then if test "$pic_mode" != yes; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test "$compiler_c_o" = yes; then func_append command " -o $obj" fi # Suppress compiler output if we already did a PIC compilation. func_append command "$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then func_show_eval '$MV "$output_obj" "$obj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi fi $opt_dry_run || { func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" # Unlock the critical section if it was locked if test "$need_locks" != no; then removelist=$lockfile $RM "$lockfile" fi } exit $EXIT_SUCCESS } $opt_help || { test "$opt_mode" = compile && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. case $opt_mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $ECHO \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $ECHO \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to build PIC objects only -prefer-non-pic try to build non-PIC objects only -shared do not build a \`.o' file suitable for static linking -static only build a \`.o' file suitable for static linking -Wc,FLAG pass FLAG directly to the compiler COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $ECHO \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $ECHO \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $ECHO \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $ECHO \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -bindir BINDIR specify path to binaries directory (for systems where libraries must be found in the PATH setting at runtime) -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface -Wc,FLAG -Xcompiler FLAG pass linker-specific FLAG directly to the compiler -Wl,FLAG -Xlinker FLAG pass linker-specific FLAG directly to the linker -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $ECHO \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode \`$opt_mode'" ;; esac echo $ECHO "Try \`$progname --help' for more information about other modes." } # Now that we've collected a possible --mode arg, show help if necessary if $opt_help; then if test "$opt_help" = :; then func_mode_help else { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do func_mode_help done } | sed -n '1p; 2,$s/^Usage:/ or: /p' { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do echo func_mode_help done } | sed '1d /^When reporting/,/^Report/{ H d } $x /information about other modes/d /more detailed .*MODE/d s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' fi exit $? fi # func_mode_execute arg... func_mode_execute () { $opt_debug # The first argument is the command name. cmd="$nonopt" test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $opt_dlopen; do test -f "$file" \ || func_fatal_help "\`$file' is not a file" dir= case $file in *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= func_source "$file" # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "\`$file' was not linked with \`-export-dynamic'" continue fi func_dirname "$file" "" "." dir="$func_dirname_result" if test -f "$dir/$objdir/$dlname"; then func_append dir "/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" fi fi ;; *.lo) # Just add the directory containing the .lo file. func_dirname "$file" "" "." dir="$func_dirname_result" ;; *) func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -* | *.la | *.lo ) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then func_source "$file" # Transform arg to wrapped name. file="$progdir/$program" elif func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" func_source "$func_ltwrapper_scriptname_result" # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). func_append_quoted args "$file" done if test "X$opt_dry_run" = Xfalse; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var else $lt_unset $lt_var fi" done # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" echo "export $shlibpath_var" fi $ECHO "$cmd$args" exit $EXIT_SUCCESS fi } test "$opt_mode" = execute && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $opt_debug libs= libdirs= admincmds= for opt in "$nonopt" ${1+"$@"} do if test -d "$opt"; then func_append libdirs " $opt" elif test -f "$opt"; then if func_lalib_unsafe_p "$opt"; then func_append libs " $opt" else func_warning "\`$opt' is not a valid libtool archive" fi else func_fatal_error "invalid argument \`$opt'" fi done if test -n "$libs"; then if test -n "$lt_sysroot"; then sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" else sysroot_cmd= fi # Remove sysroot references if $opt_dry_run; then for lib in $libs; do echo "removing references to $lt_sysroot and \`=' prefixes from $lib" done else tmpdir=`func_mktempdir` for lib in $libs; do sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ > $tmpdir/tmp-la mv -f $tmpdir/tmp-la $lib done ${RM}r "$tmpdir" fi fi if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds '"$cmd"'"' fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $opt_dry_run || eval "$cmds" || func_append admincmds " $cmds" fi done fi # Exit here if they wanted silent mode. $opt_silent && exit $EXIT_SUCCESS if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" for libdir in $libdirs; do $ECHO " $libdir" done echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" echo "specify the full pathname of the library, or use the \`-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then echo " - add LIBDIR to the \`$shlibpath_var' environment variable" echo " during execution" fi if test -n "$runpath_var"; then echo " - add LIBDIR to the \`$runpath_var' environment variable" echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $ECHO " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $ECHO " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi echo echo "See any operating system documentation about shared libraries for" case $host in solaris2.[6789]|solaris2.1[0-9]) echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" echo "pages." ;; *) echo "more information, such as the ld(1) and ld.so(8) manual pages." ;; esac echo "----------------------------------------------------------------------" fi exit $EXIT_SUCCESS } test "$opt_mode" = finish && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { $opt_debug # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. case $nonopt in *shtool*) :;; *) false;; esac; then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " arg=$1 shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" func_append install_prog "$func_quote_for_eval_result" install_shared_prog=$install_prog case " $install_prog " in *[\\\ /]cp\ *) install_cp=: ;; *) install_cp=false ;; esac # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= no_mode=: for arg do arg2= if test -n "$dest"; then func_append files " $dest" dest=$arg continue fi case $arg in -d) isdir=yes ;; -f) if $install_cp; then :; else prev=$arg fi ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then if test "x$prev" = x-m && test -n "$install_override_mode"; then arg2=$install_override_mode no_mode=false fi prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. func_quote_for_eval "$arg" func_append install_prog " $func_quote_for_eval_result" if test -n "$arg2"; then func_quote_for_eval "$arg2" fi func_append install_shared_prog " $func_quote_for_eval_result" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the \`$prev' option requires an argument" if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else func_quote_for_eval "$install_override_mode" func_append install_shared_prog " -m $func_quote_for_eval_result" fi fi if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. func_stripname '' '/' "$dest" dest=$func_stripname_result # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else func_dirname_and_basename "$dest" "" "." destdir="$func_dirname_result" destname="$func_basename_result" # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ func_fatal_help "\`$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "\`$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. func_append staticlibs " $file" ;; *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$file' is not a valid libtool archive" library_names= old_library= relink_command= func_source "$file" # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) func_append current_libdirs " $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) func_append future_libdirs " $libdir" ;; esac fi func_dirname "$file" "/" "" dir="$func_dirname_result" func_append dir "$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking \`$file'" func_show_eval "$relink_command" \ 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' fi # See the names of the shared library. set dummy $library_names; shift if test -n "$1"; then realname="$1" shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme="$stripme" case $host_os in cygwin* | mingw* | pw32* | cegcc*) case $realname in *.dll.a) tstripme="" ;; esac ;; esac if test -n "$tstripme" && test -n "$striplib"; then func_show_eval "$striplib $destdir/$realname" 'exit $?' fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try `ln -sf' first, because the `ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do test "$linkname" != "$realname" \ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" done fi # Do each command in the postinstall commands. lib="$destdir/$realname" func_execute_cmds "$postinstall_cmds" 'exit $?' fi # Install the pseudo-library for information purposes. func_basename "$file" name="$func_basename_result" instname="$dir/$name"i func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. test -n "$old_library" && func_append staticlibs " $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) func_lo2o "$destfile" staticdest=$func_lo2o_result ;; *.$objext) staticdest="$destfile" destfile= ;; *) func_fatal_help "cannot copy a libtool object to \`$destfile'" ;; esac # Install the libtool object if requested. test -n "$destfile" && \ func_show_eval "$install_prog $file $destfile" 'exit $?' # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then func_stripname '' '.exe' "$file" file=$func_stripname_result stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin* | *mingw*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result else func_stripname '' '.exe' "$file" wrapper=$func_stripname_result fi ;; *) wrapper=$file ;; esac if func_ltwrapper_script_p "$wrapper"; then notinst_deplibs= relink_command= func_source "$wrapper" # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ func_fatal_error "invalid libtool wrapper script \`$wrapper'" finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then func_warning "\`$lib' has not been installed in \`$libdir'" finalize=no fi done relink_command= func_source "$wrapper" outputname= if test "$fast_install" = no && test -n "$relink_command"; then $opt_dry_run || { if test "$finalize" = yes; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" file="$func_basename_result" outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_silent || { func_quote_for_expand "$relink_command" eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else func_error "error: relink \`$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi file="$outputname" else func_warning "cannot relink \`$file'" fi } else # Install the binary that we compiled earlier. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) func_stripname '' '.exe' "$destfile" destfile=$func_stripname_result ;; esac ;; esac func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' $opt_dry_run || if test -n "$outputname"; then ${RM}r "$tmpdir" fi ;; esac done for file in $staticlibs; do func_basename "$file" name="$func_basename_result" # Set up the ranlib parameters. oldlib="$destdir/$name" func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then func_show_eval "$old_striplib $tool_oldlib" 'exit $?' fi # Do each command in the postinstall commands. func_execute_cmds "$old_postinstall_cmds" 'exit $?' done test -n "$future_libdirs" && \ func_warning "remember to run \`$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. $opt_dry_run && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } test "$opt_mode" = install && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { $opt_debug my_outputname="$1" my_originator="$2" my_pic_p="${3-no}" my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms="${my_outputname}S.c" else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${my_outputname}.nm" func_show_eval "$RM $nlist ${nlist}S ${nlist}T" # Parse the name list into a source file. func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" #endif /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then func_verbose "generating symbol list for \`$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do func_to_tool_file "$progfile" func_convert_file_msys_to_w32 func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $opt_dry_run || { eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi if test -n "$export_symbols_regex"; then $opt_dry_run || { eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$outputname.exp" $opt_dry_run || { $RM $export_symbols eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac } else $opt_dry_run || { eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac } fi fi for dlprefile in $dlprefiles; do func_verbose "extracting global C symbols from \`$dlprefile'" func_basename "$dlprefile" name="$func_basename_result" case $host in *cygwin* | *mingw* | *cegcc* ) # if an import library, we need to obtain dlname if func_win32_import_lib_p "$dlprefile"; then func_tr_sh "$dlprefile" eval "curr_lafile=\$libfile_$func_tr_sh_result" dlprefile_dlbasename="" if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then # Use subshell, to avoid clobbering current variable values dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` if test -n "$dlprefile_dlname" ; then func_basename "$dlprefile_dlname" dlprefile_dlbasename="$func_basename_result" else # no lafile. user explicitly requested -dlpreopen . $sharedlib_from_linklib_cmd "$dlprefile" dlprefile_dlbasename=$sharedlib_from_linklib_result fi fi $opt_dry_run || { if test -n "$dlprefile_dlbasename" ; then eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' else func_warning "Could not compute DLL name from $name" eval '$ECHO ": $name " >> "$nlist"' fi func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" } else # not an import lib $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } fi ;; *) $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } ;; esac done $opt_dry_run || { # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $MV "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; extern LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[]; LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = {\ { \"$my_originator\", (void *) 0 }," case $need_lib_prefix in no) eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; *) eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " } # !$opt_dry_run pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) if test "X$my_pic_p" != Xno; then pic_flag_for_symtable=" $pic_flag" fi ;; esac ;; esac symtab_cflags= for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; *) func_append symtab_cflags " $arg" ;; esac done # Now compile the dynamic symbol file. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' # Clean up the generated files. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' # Transform the symbol file into the correct name. symfileobj="$output_objdir/${my_outputname}S.$objext" case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` fi ;; *) compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` ;; esac ;; *) func_fatal_error "unknown suffix for \`$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` fi } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. # Despite the name, also deal with 64 bit binaries. func_win32_libid () { $opt_debug win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then func_to_tool_file "$1" func_convert_file_msys_to_w32 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | $SED -n -e ' 1,100{ / I /{ s,.*,import, p q } }'` case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $ECHO "$win32_libid_type" } # func_cygming_dll_for_implib ARG # # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib () { $opt_debug sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` } # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs # # The is the core of a fallback implementation of a # platform-specific function to extract the name of the # DLL associated with the specified import library LIBNAME. # # SECTION_NAME is either .idata$6 or .idata$7, depending # on the platform and compiler that created the implib. # # Echos the name of the DLL associated with the # specified import library. func_cygming_dll_for_implib_fallback_core () { $opt_debug match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` $OBJDUMP -s --section "$1" "$2" 2>/dev/null | $SED '/^Contents of section '"$match_literal"':/{ # Place marker at beginning of archive member dllname section s/.*/====MARK====/ p d } # These lines can sometimes be longer than 43 characters, but # are always uninteresting /:[ ]*file format pe[i]\{,1\}-/d /^In archive [^:]*:/d # Ensure marker is printed /^====MARK====/p # Remove all lines with less than 43 characters /^.\{43\}/!d # From remaining lines, remove first 43 characters s/^.\{43\}//' | $SED -n ' # Join marker and all lines until next marker into a single line /^====MARK====/ b para H $ b para b :para x s/\n//g # Remove the marker s/^====MARK====// # Remove trailing dots and whitespace s/[\. \t]*$// # Print /./p' | # we now have a list, one entry per line, of the stringified # contents of the appropriate section of all members of the # archive which possess that section. Heuristic: eliminate # all those which have a first or second character that is # a '.' (that is, objdump's representation of an unprintable # character.) This should work for all archives with less than # 0x302f exports -- but will fail for DLLs whose name actually # begins with a literal '.' or a single character followed by # a '.'. # # Of those that remain, print the first one. $SED -e '/^\./d;/^.\./d;q' } # func_cygming_gnu_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is a GNU/binutils-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_gnu_implib_p () { $opt_debug func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` test -n "$func_cygming_gnu_implib_tmp" } # func_cygming_ms_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is an MS-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_ms_implib_p () { $opt_debug func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` test -n "$func_cygming_ms_implib_tmp" } # func_cygming_dll_for_implib_fallback ARG # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # # This fallback implementation is for use when $DLLTOOL # does not support the --identify-strict option. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib_fallback () { $opt_debug if func_cygming_gnu_implib_p "$1" ; then # binutils import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` elif func_cygming_ms_implib_p "$1" ; then # ms-generated import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` else # unknown sharedlib_from_linklib_result="" fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { $opt_debug f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" if test "$lock_old_archive_extraction" = yes; then lockfile=$f_ex_an_ar_oldlib.lock until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done fi func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 'stat=$?; rm -f "$lockfile"; exit $stat' if test "$lock_old_archive_extraction" = yes; then $opt_dry_run || rm -f "$lockfile" fi if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" fi } # func_extract_archives gentop oldlib ... func_extract_archives () { $opt_debug my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac func_basename "$my_xlib" my_xlib="$func_basename_result" my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) func_arith $extracted_serial + 1 extracted_serial=$func_arith_result my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir="$my_gentop/$my_xlib_u" func_mkdir_p "$my_xdir" case $host in *-darwin*) func_verbose "Extracting $my_xabs" # Do not bother doing anything if just a dry run $opt_dry_run || { darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`basename "$darwin_archive"` darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" func_extract_an_archive "`pwd`" "${darwin_base_archive}" cd "$darwin_curdir" $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" done # $darwin_arches ## Okay now we've a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches } # !$opt_dry_run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # func_emit_wrapper [arg=no] # # Emit a libtool wrapper script on stdout. # Don't directly open a file because we may want to # incorporate the script contents within a cygwin/mingw # wrapper executable. Must ONLY be called from within # func_mode_link because it depends on a number of variables # set therein. # # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script # will assume that the directory in which it is stored is # the $objdir directory. This is a cygwin/mingw-specific # behavior. func_emit_wrapper () { func_emit_wrapper_arg1=${1-no} $ECHO "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='$sed_quote_subst' # Be Bourne compatible if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variables: generated_by_libtool_version='$macro_version' notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$ECHO are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then file=\"\$0\"" qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` $ECHO "\ # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } ECHO=\"$qECHO\" fi # Very basic option parsing. These options are (a) specific to # the libtool wrapper, (b) are identical between the wrapper # /script/ and the wrapper /executable/ which is used only on # windows platforms, and (c) all begin with the string "--lt-" # (application programs are unlikely to have options which match # this pattern). # # There are only two supported options: --lt-debug and # --lt-dump-script. There is, deliberately, no --lt-help. # # The first argument to this parsing function should be the # script's $0 value, followed by "$@". lt_option_debug= func_parse_lt_options () { lt_script_arg0=\$0 shift for lt_opt do case \"\$lt_opt\" in --lt-debug) lt_option_debug=1 ;; --lt-dump-script) lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` cat \"\$lt_dump_D/\$lt_dump_F\" exit 0 ;; --lt-*) \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 exit 1 ;; esac done # Print the debug banner immediately: if test -n \"\$lt_option_debug\"; then echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 fi } # Used when --lt-debug. Prints its arguments to stdout # (redirection is the responsibility of the caller) func_lt_dump_args () { lt_dump_args_N=1; for lt_arg do \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` done } # Core function for launching the target application func_exec_program_core () { " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2* | *-cegcc*) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $ECHO "\ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 exit 1 } # A function to encapsulate launching the target application # Strips options in the --lt-* namespace from \$@ and # launches target application with the remaining arguments. func_exec_program () { case \" \$* \" in *\\ --lt-*) for lt_wr_arg do case \$lt_wr_arg in --lt-*) ;; *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; esac shift done ;; esac func_exec_program_core \${1+\"\$@\"} } # Parse options func_parse_lt_options \"\$0\" \${1+\"\$@\"} # Find the directory that this script lives in. thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` done # Usually 'no', except on cygwin/mingw when embedded into # the cwrapper. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then thisdir=\`pwd\` fi # remove .libs from thisdir case \"\$thisdir\" in *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $ECHO "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $MKDIR \"\$progdir\" else $RM \"\$progdir/\$file\" fi" $ECHO "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $ECHO \"\$relink_command_output\" >&2 $RM \"\$progdir/\$file\" exit 1 fi fi $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $RM \"\$progdir/\$program\"; $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } $RM \"\$progdir/\$file\" fi" else $ECHO "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $ECHO "\ if test -f \"\$progdir/\$program\"; then" # fixup the dll searchpath if we need to. # # Fix the DLL searchpath if we need to. Do this before prepending # to shlibpath, because on Windows, both are PATH and uninstalled # libraries must come first. if test -n "$dllsearchpath"; then $ECHO "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` export $shlibpath_var " fi $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. func_exec_program \${1+\"\$@\"} fi else # The program doesn't exist. \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " } # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout # Must ONLY be called from within func_mode_link because # it depends on a number of variable set therein. func_emit_cwrapperexe_src () { cat < #include #ifdef _MSC_VER # include # include # include #else # include # include # ifdef __CYGWIN__ # include # endif #endif #include #include #include #include #include #include #include #include /* declarations of non-ANSI functions */ #if defined(__MINGW32__) # ifdef __STRICT_ANSI__ int _putenv (const char *); # endif #elif defined(__CYGWIN__) # ifdef __STRICT_ANSI__ char *realpath (const char *, char *); int putenv (char *); int setenv (const char *, const char *, int); # endif /* #elif defined (other platforms) ... */ #endif /* portability defines, excluding path handling macros */ #if defined(_MSC_VER) # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv # define S_IXUSR _S_IEXEC # ifndef _INTPTR_T_DEFINED # define _INTPTR_T_DEFINED # define intptr_t int # endif #elif defined(__MINGW32__) # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv #elif defined(__CYGWIN__) # define HAVE_SETENV # define FOPEN_WB "wb" /* #elif defined (other platforms) ... */ #endif #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef S_IXOTH # define S_IXOTH 0 #endif #ifndef S_IXGRP # define S_IXGRP 0 #endif /* path handling portability macros */ #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # define FOPEN_WB "wb" # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #ifndef FOPEN_WB # define FOPEN_WB "w" #endif #ifndef _O_BINARY # define _O_BINARY 0 #endif #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) #if defined(LT_DEBUGWRAPPER) static int lt_debug = 1; #else static int lt_debug = 0; #endif const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ void *xmalloc (size_t num); char *xstrdup (const char *string); const char *base_name (const char *name); char *find_executable (const char *wrapper); char *chase_symlinks (const char *pathspec); int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); void lt_debugprintf (const char *file, int line, const char *fmt, ...); void lt_fatal (const char *file, int line, const char *message, ...); static const char *nonnull (const char *s); static const char *nonempty (const char *s); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); char **prepare_spawn (char **argv); void lt_dump_script (FILE *f); EOF cat <= 0) && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) return 1; else return 0; } int make_executable (const char *path) { int rval = 0; struct stat st; lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", nonempty (path)); if ((!path) || (!*path)) return 0; if (stat (path, &st) >= 0) { rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); } return rval; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise Does not chase symlinks, even on platforms that support them. */ char * find_executable (const char *wrapper) { int has_slash = 0; const char *p; const char *p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char *concat_name; lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", nonempty (wrapper)); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char *path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char *q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR (*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); return NULL; } char * chase_symlinks (const char *pathspec) { #ifndef S_ISLNK return xstrdup (pathspec); #else char buf[LT_PATHMAX]; struct stat s; char *tmp_pathspec = xstrdup (pathspec); char *p; int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { lt_debugprintf (__FILE__, __LINE__, "checking path component for symlinks: %s\n", tmp_pathspec); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) { has_symlinks = 1; break; } /* search backwards for last DIR_SEPARATOR */ p = tmp_pathspec + strlen (tmp_pathspec) - 1; while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) p--; if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) { /* no more DIR_SEPARATORS left */ break; } *p = '\0'; } else { lt_fatal (__FILE__, __LINE__, "error accessing file \"%s\": %s", tmp_pathspec, nonnull (strerror (errno))); } } XFREE (tmp_pathspec); if (!has_symlinks) { return xstrdup (pathspec); } tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { lt_fatal (__FILE__, __LINE__, "could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif } char * strendzap (char *str, const char *pat) { size_t len, patlen; assert (str != NULL); assert (pat != NULL); len = strlen (str); patlen = strlen (pat); if (patlen <= len) { str += len - patlen; if (strcmp (str, pat) == 0) *str = '\0'; } return str; } void lt_debugprintf (const char *file, int line, const char *fmt, ...) { va_list args; if (lt_debug) { (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); va_start (args, fmt); (void) vfprintf (stderr, fmt, args); va_end (args); } } static void lt_error_core (int exit_status, const char *file, int line, const char *mode, const char *message, va_list ap) { fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *file, int line, const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); va_end (ap); } static const char * nonnull (const char *s) { return s ? s : "(null)"; } static const char * nonempty (const char *s) { return (s && !*s) ? "(empty)" : nonnull (s); } void lt_setenv (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_setenv) setting '%s' to '%s'\n", nonnull (name), nonnull (value)); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ char *str = xstrdup (value); setenv (name, str, 1); #else int len = strlen (name) + 1 + strlen (value) + 1; char *str = XMALLOC (char, len); sprintf (str, "%s=%s", name, value); if (putenv (str) != EXIT_SUCCESS) { XFREE (str); } #endif } } char * lt_extend_str (const char *orig_value, const char *add, int to_end) { char *new_value; if (orig_value && *orig_value) { int orig_value_len = strlen (orig_value); int add_len = strlen (add); new_value = XMALLOC (char, add_len + orig_value_len + 1); if (to_end) { strcpy (new_value, orig_value); strcpy (new_value + orig_value_len, add); } else { strcpy (new_value, add); strcpy (new_value + add_len, orig_value); } } else { new_value = xstrdup (add); } return new_value; } void lt_update_exe_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); /* some systems can't cope with a ':'-terminated path #' */ int len = strlen (new_value); while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { new_value[len-1] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); } } void lt_update_lib_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); } } EOF case $host_os in mingw*) cat <<"EOF" /* Prepares an argument vector before calling spawn(). Note that spawn() does not by itself call the command interpreter (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&v); v.dwPlatformId == VER_PLATFORM_WIN32_NT; }) ? "cmd.exe" : "command.com"). Instead it simply concatenates the arguments, separated by ' ', and calls CreateProcess(). We must quote the arguments since Win32 CreateProcess() interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a special way: - Space and tab are interpreted as delimiters. They are not treated as delimiters if they are surrounded by double quotes: "...". - Unescaped double quotes are removed from the input. Their only effect is that within double quotes, space and tab are treated like normal characters. - Backslashes not followed by double quotes are not special. - But 2*n+1 backslashes followed by a double quote become n backslashes followed by a double quote (n >= 0): \" -> " \\\" -> \" \\\\\" -> \\" */ #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" char ** prepare_spawn (char **argv) { size_t argc; char **new_argv; size_t i; /* Count number of arguments. */ for (argc = 0; argv[argc] != NULL; argc++) ; /* Allocate new argument vector. */ new_argv = XMALLOC (char *, argc + 1); /* Put quoted arguments into the new argument vector. */ for (i = 0; i < argc; i++) { const char *string = argv[i]; if (string[0] == '\0') new_argv[i] = xstrdup ("\"\""); else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) { int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); size_t length; unsigned int backslashes; const char *s; char *quoted_string; char *p; length = 0; backslashes = 0; if (quote_around) length++; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') length += backslashes + 1; length++; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) length += backslashes + 1; quoted_string = XMALLOC (char, length + 1); p = quoted_string; backslashes = 0; if (quote_around) *p++ = '"'; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') { unsigned int j; for (j = backslashes + 1; j > 0; j--) *p++ = '\\'; } *p++ = c; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) { unsigned int j; for (j = backslashes; j > 0; j--) *p++ = '\\'; *p++ = '"'; } *p = '\0'; new_argv[i] = quoted_string; } else new_argv[i] = (char *) string; } new_argv[argc] = NULL; return new_argv; } EOF ;; esac cat <<"EOF" void lt_dump_script (FILE* f) { EOF func_emit_wrapper yes | $SED -n -e ' s/^\(.\{79\}\)\(..*\)/\1\ \2/ h s/\([\\"]\)/\\\1/g s/$/\\n/ s/\([^\n]*\).*/ fputs ("\1", f);/p g D' cat <<"EOF" } EOF } # end: func_emit_cwrapperexe_src # func_win32_import_lib_p ARG # True if ARG is an import lib, as indicated by $file_magic_cmd func_win32_import_lib_p () { $opt_debug case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in *import*) : ;; *) false ;; esac } # func_mode_link arg... func_mode_link () { $opt_debug case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args=$nonopt base_compile="$nonopt $@" compile_command=$nonopt finalize_command=$nonopt compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= new_inherited_linker_flags= avoid_version=no bindir= dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=no prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= single_module="${wl}-single_module" func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift func_quote_for_eval "$arg" qarg=$func_quote_for_eval_unquoted_result func_append libtool_args " $func_quote_for_eval_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) func_append compile_command " @OUTPUT@" func_append finalize_command " @OUTPUT@" ;; esac case $prev in bindir) bindir="$arg" prev= continue ;; dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then func_append dlfiles " $arg" else func_append dlprefiles " $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" test -f "$arg" \ || func_fatal_error "symbol file \`$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) func_append deplibs " $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat "$save_arg"` do # func_append moreargs " $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi done else func_fatal_error "link input file \`$arg' does not exist" fi arg=$save_arg prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) func_append rpath " $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) func_append xrpath " $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds="$arg" prev= continue ;; weak) func_append weak_libs " $arg" prev= continue ;; xcclinker) func_append linker_flags " $qarg" func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) func_append linker_flags " $qarg" func_append compiler_flags " $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then # See comment for -static flag below, for more details. func_append compile_command " $link_static_flag" func_append finalize_command " $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "\`-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -bindir) prev=bindir continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) func_append compile_command " $arg" func_append finalize_command " $arg" ;; esac continue ;; -L*) func_stripname "-L" '' "$arg" if test -z "$func_stripname_result"; then if test "$#" -gt 0; then func_fatal_error "require no space between \`-L' and \`$1'" else func_fatal_error "need path for \`-L' option" fi fi func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of \`$dir'" dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "* | *" $arg "*) # Will only happen for absolute or sysroot arguments ;; *) # Preserve sysroot, but never include relative directories case $dir in [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; *) func_append deplibs " -L$dir" ;; esac func_append lib_search_path " $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; *) func_append dllsearchpath ":$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework func_append deplibs " System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test "X$arg" = "X-lc" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test "X$arg" = "X-lc" && continue ;; esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi func_append deplibs " $arg" continue ;; -module) module=yes continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. -model|-arch|-isysroot|--sysroot) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; * ) func_append new_inherited_linker_flags " $arg" ;; esac continue ;; -multi_module) single_module="${wl}-multi_module" continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. func_warning "\`-no-install' is ignored for $host" func_warning "assuming \`-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) func_stripname '-R' '' "$arg" dir=$func_stripname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; =*) func_stripname '=' '' "$dir" dir=$lt_sysroot$func_stripname_result ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" func_append arg " $func_quote_for_eval_result" func_append compiler_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Wl,*) func_stripname '-Wl,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" func_append arg " $wl$func_quote_for_eval_result" func_append compiler_flags " $wl$func_quote_for_eval_result" func_append linker_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # -msg_* for osf cc -msg_*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; # Flags to be passed through unchanged, with rationale: # -64, -mips[0-9] enable 64-bit mode for the SGI compiler # -r[0-9][0-9]* specify processor for the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler # +DA*, +DD* enable 64-bit mode for the HP compiler # -q* compiler args for the IBM compiler # -m*, -t[45]*, -txscale* architecture-specific flags for GCC # -F/path path to uninstalled frameworks, gcc on darwin # -p, -pg, --coverage, -fprofile-* profiling flags for GCC # @file GCC response files # -tp=* Portland pgcc target processor selection # --sysroot=* for sysroot support # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -O*|-flto*|-fwhopr*|-fuse-linker-plugin) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" func_append compile_command " $arg" func_append finalize_command " $arg" func_append compiler_flags " $arg" continue ;; # Some other compiler flag. -* | +*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; *.$objext) # A standard object. func_append objs " $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi ;; *.$libext) # An archive. func_append deplibs " $arg" func_append old_deplibs " $arg" continue ;; *.la) # A libtool-controlled library. func_resolve_sysroot "$arg" if test "$prev" = dlfiles; then # This library was specified with -dlopen. func_append dlfiles " $func_resolve_sysroot_result" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. func_append dlprefiles " $func_resolve_sysroot_result" prev= else func_append deplibs " $func_resolve_sysroot_result" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then func_append compile_command " $arg" func_append finalize_command " $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the \`$prevarg' option requires an argument" if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" func_append compile_command " $arg" func_append finalize_command " $arg" fi oldlibs= # calculate the name of the file, without its directory func_basename "$output" outputname="$func_basename_result" libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" func_dirname "$output" "/" "" output_objdir="$func_dirname_result$objdir" func_to_tool_file "$output_objdir/" tool_output_objdir=$func_to_tool_file_result # Create the object directory. func_mkdir_p "$output_objdir" # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_preserve_dup_deps ; then case "$libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append libs " $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; esac func_append pre_post_deps " $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do # The preopen pass in lib mode reverses $deplibs; put it back here # so that -L comes before libs that need it for instance... if test "$linkmode,$pass" = "lib,link"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done deplibs="$tmp_deplibs" fi if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi if test "$linkmode,$pass" = "lib,dlpreopen"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= func_resolve_sysroot "$lib" case $lib in *.la) func_source "$func_resolve_sysroot_result" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do func_basename "$deplib" deplib_base=$func_basename_result case " $weak_libs " in *" $deplib_base "*) ;; *) func_append deplibs " $deplib" ;; esac done done libs="$dlprefiles" fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append compiler_flags " $deplib" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then func_warning "\`-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result if test "$linkmode" = lib; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" fi for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if func_lalib_p "$lib"; then library_names= old_library= func_source "$lib" for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no func_dirname "$lib" "" "." ladir="$func_dirname_result" lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l *.ltframework) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; *) func_warning "\`-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then func_stripname '-R' '' "$deplib" func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) func_resolve_sysroot "$deplib" lib=$func_resolve_sysroot_result ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $deplib "*) ;; *) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then echo $ECHO "*** Warning: Trying to link with static lib archive $deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because the file extensions .$libext of this argument makes me believe" echo "*** that it is just a static archive that I should not use here." else echo $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi ;; esac continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. func_append newdlprefiles " $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append newdlfiles " $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" fi # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$lib" \ || func_fatal_error "\`$lib' is not a valid libtool archive" func_dirname "$lib" "" "." ladir="$func_dirname_result" dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file func_source "$lib" # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; esac done fi dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && func_append dlfiles " $dlopen" test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. func_append convenience " $ladir/$objdir/$old_library" func_append old_convenience " $ladir/$objdir/$old_library" elif test "$linkmode" != prog && test "$linkmode" != lib; then func_fatal_error "\`$lib' is not a convenience library" fi tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done continue fi # $pass = conv # Get the name of the library we link against. linklib= if test -n "$old_library" && { test "$prefer_static_libs" = yes || test "$prefer_static_libs,$installed" = "built,no"; }; then linklib=$old_library else for l in $old_library $library_names; do linklib="$l" done fi if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then func_fatal_error "cannot -dlopen a convenience library: \`$lib'" fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. func_append dlprefiles " $lib $dependency_libs" else func_append newdlfiles " $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of \`$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir="$ladir" fi ;; esac func_basename "$lib" laname="$func_basename_result" # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library \`$lib' was moved." dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$lt_sysroot$libdir" absdir="$lt_sysroot$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later func_append notinst_path " $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later func_append notinst_path " $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" name=$func_stripname_result # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir" && test "$linkmode" = prog; then func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi case "$host" in # special handling for platforms with PE-DLLs. *cygwin* | *mingw* | *cegcc* ) # Linker will automatically link against shared library if both # static and shared are present. Therefore, ensure we extract # symbols from the import library if a shared library is present # (otherwise, the dlopen module name will be incorrect). We do # this by putting the import library name into $newdlprefiles. # We recover the dlopen module name by 'saving' the la file # name in a special purpose variable, and (later) extracting the # dlname from the la file. if test -n "$dlname"; then func_tr_sh "$dir/$linklib" eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" func_append newdlprefiles " $dir/$linklib" else func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" fi ;; * ) # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then func_append newdlprefiles " $dir/$dlname" else func_append newdlprefiles " $dir/$linklib" fi ;; esac fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { { test "$prefer_static_libs" = no || test "$prefer_static_libs,$installed" = "built,yes"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. case "$temp_rpath:" in *"$absdir:"*) ;; *) func_append temp_rpath "$absdir:" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test "$use_static_libs" = built && test "$installed" = yes; then use_static_libs=no fi if test -n "$library_names" && { test "$use_static_libs" = no || test -z "$old_library"; }; then case $host in *cygwin* | *mingw* | *cegcc*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" need_relink=no ;; *) if test "$installed" = no; then func_append notinst_deplibs " $lib" need_relink=yes fi ;; esac # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule="" for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule="$dlpremoduletest" break fi done if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then echo if test "$linkmode" = prog; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi $ECHO "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names shift realname="$1" shift libname=`eval "\\$ECHO \"$libname_spec\""` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw* | *cegcc*) func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" func_basename "$soroot" soname="$func_basename_result" func_stripname 'lib' '.dll' "$soname" newlib=libimp-$func_stripname_result.a # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else func_verbose "extracting exported symbol list from \`$soname'" func_execute_cmds "$extract_expsyms_cmds" 'exit $?' fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else func_verbose "generating import library for \`$soname'" func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$opt_mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; *-*-sysv4*uw2*) add_dir="-L$dir" ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we can not # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP ": [^:]* bundle" >/dev/null ; then if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library" ; then echo echo "*** And there doesn't seem to be a static archive available" echo "*** The link will probably fail, sorry" else add="$dir/$old_library" fi elif test -n "$old_library"; then add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$absdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) func_append compile_shlibpath "$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && test "$hardcode_minus_L" != yes && test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$opt_mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. echo $ECHO "*** Warning: This system can not link to static lib archive $lib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then echo "*** But as you try to build a module library, libtool will still create " echo "*** a static module, that should work as long as the dlopening application" echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) func_stripname '-R' '' "$libdir" temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; *) func_append xrpath " $temp_xrpath";; esac;; *) func_append temp_deplibs " $libdir";; esac done dependency_libs="$temp_deplibs" fi func_append newlib_search_path " $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result";; *) func_resolve_sysroot "$deplib" ;; esac if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $func_resolve_sysroot_result "*) func_append specialdeplibs " $func_resolve_sysroot_result" ;; esac fi func_append tmp_libs " $func_resolve_sysroot_result" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do path= case $deplib in -L*) path="$deplib" ;; *.la) func_resolve_sysroot "$deplib" deplib=$func_resolve_sysroot_result func_dirname "$deplib" "" "." dir=$func_dirname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of \`$dir'" absdir="$dir" fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl" ; then depdepl="$absdir/$objdir/$depdepl" darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` if test -z "$darwin_install_name"; then darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" path= fi fi ;; *) path="-L$absdir/$objdir" ;; esac else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "\`$deplib' seems to be moved" path="-L$absdir" fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs if test "$pass" = link; then if test "$linkmode" = "prog"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) func_append lib_search_path " $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) func_append tmp_libs " $deplib" ;; esac ;; *) func_append tmp_libs " $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" fi if test "$linkmode" = prog || test "$linkmode" = lib; then dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for archives" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for archives" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "\`-R' is ignored for archives" test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "\`-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "\`-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" func_append objs "$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) func_stripname 'lib' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test "$module" = no && \ func_fatal_help "libtool library \`$output' must begin with \`lib'" if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required func_stripname '' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else func_stripname '' '.la' "$outputname" libname=$func_stripname_result fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else echo $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" func_append libobjs " $objs" fi fi test "$dlself" != no && \ func_warning "\`-dlopen self' is ignored for libtool libraries" set dummy $rpath shift test "$#" -gt 1 && \ func_warning "ignoring multiple \`-rpath's for a libtool library" install_libdir="$1" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "\`-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 shift IFS="$save_ifs" test -n "$7" && \ func_fatal_help "too many parameters to \`-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$1" number_minor="$2" number_revision="$3" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in # correct linux to gnu/linux during the next big refactor darwin|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|qnx|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_minor" lt_irix_increment=no ;; esac ;; no) current="$1" revision="$2" age="$3" ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "CURRENT \`$current' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "REVISION \`$revision' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "AGE \`$age' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE \`$age' is greater than the current interface number \`$current'" func_fatal_error "\`$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... func_arith $current + 1 minor_current=$func_arith_result xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current" ;; irix | nonstopux) if test "X$lt_irix_increment" = "Xno"; then func_arith $current - $age else func_arith $current - $age + 1 fi major=$func_arith_result case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do func_arith $revision - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) # correct to gnu/linux during the next big refactor func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" ;; osf) func_arith $current - $age major=.$func_arith_result versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do func_arith $current - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring:${iface}.0" done # Make executables depend on our current version. func_append verstring ":${current}.0" ;; qnx) major=".$current" versuffix=".$current" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; *) func_fatal_configuration "unknown library version type \`$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then func_warning "undefined symbols not allowed in $host shared libraries" build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi func_generate_dlsyms "$libname" "$libname" "yes" func_append libobjs " $symfileobj" test "X$libobjs" = "X " && libobjs= if test "$opt_mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$ECHO "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext | *.gcno) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi func_append removelist " $p" ;; *) ;; esac done test -n "$removelist" && \ func_show_eval "${RM}r \$removelist" fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then func_append oldlibs " $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do func_replace_sysroot "$libdir" func_append temp_xrpath " -R$func_replace_sysroot_result" case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) func_append dlfiles " $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) func_append dlprefiles " $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework func_append deplibs " System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then func_append deplibs " -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $opt_dry_run || $RM conftest.c cat > conftest.c </dev/null` $nocaseglob else potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` fi for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a file magic. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do case $a_deplib in -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) func_append newdeplibs " $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval "\\$ECHO \"$libname_spec\""` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a regex pattern. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` done fi case $tmp_deplibs in *[!\ \ ]*) echo if test "X$deplibs_check_method" = "Xnone"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." fi echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes ;; esac ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" echo "*** a static module, that should work as long as the dlopening" echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then echo echo "*** Since this library must not contain undefined symbols," echo "*** because either the platform does not support them or" echo "*** it was explicitly requested with -no-undefined," echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done deplibs="$new_libs" # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then # Remove ${wl} instances when linking with ld. # FIXME: should test the right _cmds variable. case $archive_cmds in *\$LD\ *) wl= ;; esac if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$opt_mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then func_replace_sysroot "$libdir" libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append dep_rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names shift realname="$1" shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" linknames= for link do func_append linknames " $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols="$output_objdir/$libname.uexp" func_append delfiles " $export_symbols" fi orig_export_symbols= case $host_os in cygwin* | mingw* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile if test "x`$SED 1q $export_symbols`" != xEXPORTS; then # and it's NOT already a .def file. Must figure out # which of the given symbols are data symbols and tag # them as such. So, trigger use of export_symbols_cmds. # export_symbols gets reassigned inside the "prepare # the list of exported symbols" if statement, so the # include_expsyms logic still works. orig_export_symbols="$export_symbols" export_symbols= always_export_symbols=yes fi fi ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd1 in $cmds; do IFS="$save_ifs" # Take the normal branch if the nm_file_list_spec branch # doesn't work or if tool conversion is not needed. case $nm_file_list_spec~$to_tool_file_cmd in *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) try_normal_branch=yes eval cmd=\"$cmd1\" func_len " $cmd" len=$func_len_result ;; *) try_normal_branch=no ;; esac if test "$try_normal_branch" = yes \ && { test "$len" -lt "$max_cmd_len" \ || test "$max_cmd_len" -le -1; } then func_show_eval "$cmd" 'exit $?' skipped_export=false elif test -n "$nm_file_list_spec"; then func_basename "$output" output_la=$func_basename_result save_libobjs=$libobjs save_output=$output output=${output_objdir}/${output_la}.nm func_to_tool_file "$output" libobjs=$nm_file_list_spec$func_to_tool_file_result func_append delfiles " $output" func_verbose "creating $NM input file list: $output" for obj in $save_libobjs; do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > "$output" eval cmd=\"$cmd1\" func_show_eval "$cmd" 'exit $?' output=$save_output libobjs=$save_libobjs skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS="$save_ifs" if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) func_append tmp_deplibs " $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec" && test "$compiler_needs_object" = yes && test -z "$libobjs"; then # extract the archives, so we have objects to list. # TODO: could optimize this to just extract one archive. whole_archive_flag_spec= fi if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= else gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $convenience func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" func_append linker_flags " $flag" fi # Make a backup of the uninstalled library when relinking if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && func_len " $test_cmds" && len=$func_len_result && test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output func_basename "$output" output_la=$func_basename_result # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= last_robj= k=1 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then output=${output_objdir}/${output_la}.lnkscript func_verbose "creating GNU ld script: $output" echo 'INPUT (' > $output for obj in $save_libobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done echo ')' >> $output func_append delfiles " $output" func_to_tool_file "$output" output=$func_to_tool_file_result elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then output=${output_objdir}/${output_la}.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= if test "$compiler_needs_object" = yes; then firstobj="$1 " shift fi for obj do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done func_append delfiles " $output" func_to_tool_file "$output" output=$firstobj\"$file_list_spec$func_to_tool_file_result\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." output=$output_objdir/$output_la-${k}.$objext eval test_cmds=\"$reload_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 # Loop over the list of objects to be linked. for obj in $save_libobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result if test "X$objlist" = X || test "$len" -lt "$max_cmd_len"; then func_append objlist " $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. reload_objs=$objlist eval concat_cmds=\"$reload_cmds\" else # All subsequent reloadable object files will link in # the last one created. reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-${k}.$objext objlist=" $obj" func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ reload_objs="$objlist $last_robj" eval concat_cmds=\"\${concat_cmds}$reload_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" fi func_append delfiles " $output" else output= fi if ${skipped_export-false}; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols libobjs=$output # Append the command to create the export file. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi fi test -n "$save_libobjs" && func_verbose "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" if test -n "$export_symbols_regex" && ${skipped_export-false}; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi if ${skipped_export-false}; then if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi fi libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi fi if test -n "$delfiles"; then # Append the command to remove temporary files to $cmds. eval cmds=\"\$cmds~\$RM $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then func_show_eval '${RM}r "$gentop"' fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for objects" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for objects" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "\`-R' is ignored for objects" test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for objects" test -n "$release" && \ func_warning "\`-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object \`$output' from non-libtool objects" libobj=$output func_lo2o "$libobj" obj=$func_lo2o_result ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $opt_dry_run || $RM $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec and hope we can get by with # turning comma into space.. wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` else gentop="$output_objdir/${obj}x" func_append generated " $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # If we're not building shared, we need to use non_pic_objs test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" # Create the old-style object. reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" func_execute_cmds "$reload_cmds" 'exit $?' # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" func_execute_cmds "$reload_cmds" 'exit $?' fi if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) func_stripname '' '.exe' "$output" output=$func_stripname_result.exe;; esac test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for programs" test -n "$release" && \ func_warning "\`-release' is ignored for programs" test "$preload" = yes \ && test "$dlopen_support" = unknown \ && test "$dlopen_self" = unknown \ && test "$dlopen_self_static" = unknown && \ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors # But is supposedly fixed on 10.4 or later (yay!). if test "$tagname" = CXX ; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) func_append compile_command " ${wl}-bind_at_load" func_append finalize_command " ${wl}-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done compile_deplibs="$new_libs" func_append compile_command " $compile_deplibs" func_append finalize_command " $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; *) func_append dllsearchpath ":$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) func_append finalize_perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" "no" # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi wrappers_required=yes case $host in *cegcc* | *mingw32ce*) # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. wrappers_required=no ;; *cygwin* | *mingw* ) if test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; *) if test "$need_relink" = no || test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; esac if test "$wrappers_required" = no; then # Replace the output file specification. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' fi exit $exit_status fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do func_append rpath "$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" func_warning "this platform does not like uninstalled shared libraries" func_warning "\`$output' will be relinked during installation" else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output_objdir/$outputname" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Now create the wrapper script. func_verbose "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. $opt_dry_run || { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) func_stripname '' '.exe' "$output" output=$func_stripname_result ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe func_stripname '' '.exe' "$outputname" outputname=$func_stripname_result ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result cwrappersource="$output_path/$objdir/lt-$output_name.c" cwrapper="$output_path/$output_name.exe" $RM $cwrappersource $cwrapper trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 func_emit_cwrapperexe_src > $cwrappersource # The wrapper executable is built using the $host compiler, # because it contains $host paths and files. If cross- # compiling, it, like the target executable, must be # executed on the $host or under an emulation environment. $opt_dry_run || { $LTCC $LTCFLAGS -o $cwrapper $cwrappersource $STRIP $cwrapper } # Now, create the wrapper script for func_source use: func_ltwrapper_scriptname $cwrapper $RM $func_ltwrapper_scriptname_result trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 $opt_dry_run || { # note: this script will not be executed, so do not chmod. if test "x$build" = "x$host" ; then $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result else func_emit_wrapper no > $func_ltwrapper_scriptname_result fi } ;; * ) $RM $output trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 func_emit_wrapper no > $output chmod +x $output ;; esac } exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save $symfileobj" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" if test "$preload" = yes && test -f "$symfileobj"; then func_append oldobjs " $symfileobj" fi fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $addlibs func_append oldobjs " $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append oldobjs " $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do func_basename "$obj" $ECHO "$func_basename_result" done | sort | sort -uc >/dev/null 2>&1); then : else echo "copying selected object files to avoid basename conflicts..." gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do func_basename "$obj" objbase="$func_basename_result" case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase func_arith $counter + 1 counter=$func_arith_result case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" func_append oldobjs " $gentop/$newobj" ;; *) func_append oldobjs " $obj" ;; esac done fi func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result eval cmds=\"$old_archive_cmds\" func_len " $cmds" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds elif test -n "$archiver_list_spec"; then func_verbose "using command file archive linking..." for obj in $oldobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > $output_objdir/$libname.libcmd func_to_tool_file "$output_objdir/$libname.libcmd" oldobjs=" $archiver_list_spec$func_to_tool_file_result" cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs oldobjs= # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done eval test_cmds=\"$old_archive_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 for obj in $save_oldobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result func_append objlist " $obj" if test "$len" -lt "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= len=$len0 fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi func_execute_cmds "$cmds" 'exit $?' done test -n "$generated" && \ func_show_eval "${RM}r$generated" # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" func_verbose "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) func_basename "$deplib" name="$func_basename_result" func_resolve_sysroot "$deplib" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" ;; -L*) func_stripname -L '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -L$func_replace_sysroot_result" ;; -R*) func_stripname -R '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -R$func_replace_sysroot_result" ;; *) func_append newdependency_libs " $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do case $lib in *.la) func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" ;; *) func_append newdlfiles " $lib" ;; esac done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" ;; esac done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlfiles " $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlprefiles " $abs" done dlprefiles="$newdlprefiles" fi $RM $output # place dlname in correct position for cygwin # In fact, it would be nice if we could use this code for all target # systems that can't hard-code library paths into their executables # and that have no shared library path variable independent of PATH, # but it turns out we can't easily determine that from inspecting # libtool variables, so we have to hard-code the OSs to which it # applies here; at the moment, that means platforms that use the PE # object format with DLL files. See the long comment at the top of # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) # If a -bindir argument was supplied, place the dll there. if test "x$bindir" != x ; then func_relative_path "$install_libdir" "$bindir" tdlname=$func_relative_path_result$dlname else # Otherwise fall back on heuristic. tdlname=../bin/$dlname fi ;; esac $ECHO > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that can not go in dependency_libs. inherited_linker_flags='$new_inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi done } # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' ;; esac exit $EXIT_SUCCESS } { test "$opt_mode" = link || test "$opt_mode" = relink; } && func_mode_link ${1+"$@"} # func_mode_uninstall arg... func_mode_uninstall () { $opt_debug RM="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) func_append RM " $arg"; rmforce=yes ;; -*) func_append RM " $arg" ;; *) func_append files " $arg" ;; esac done test -z "$RM" && \ func_fatal_help "you must specify an RM program" rmdirs= for file in $files; do func_dirname "$file" "" "." dir="$func_dirname_result" if test "X$dir" = X.; then odir="$objdir" else odir="$dir/$objdir" fi func_basename "$file" name="$func_basename_result" test "$opt_mode" = uninstall && odir="$dir" # Remember odir for removal later, being careful to avoid duplicates if test "$opt_mode" = clean; then case " $rmdirs " in *" $odir "*) ;; *) func_append rmdirs " $odir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if { test -L "$file"; } >/dev/null 2>&1 || { test -h "$file"; } >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if func_lalib_p "$file"; then func_source $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do func_append rmfiles " $odir/$n" done test -n "$old_library" && func_append rmfiles " $odir/$old_library" case "$opt_mode" in clean) case " $library_names " in *" $dlname "*) ;; *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; esac test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if func_lalib_p "$file"; then # Read the .lo file func_source $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test "$pic_object" != none; then func_append rmfiles " $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test "$non_pic_object" != none; then func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) if test "$opt_mode" = clean ; then noexename=$name case $file in *.exe) func_stripname '' '.exe' "$file" file=$func_stripname_result func_stripname '' '.exe' "$name" noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe func_append rmfiles " $file" ;; esac # Do a test to see if this is a libtool program. if func_ltwrapper_p "$file"; then if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result func_append rmfiles " $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename fi # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles func_append rmfiles " $odir/$name $odir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then func_append rmfiles " $odir/lt-$name" fi if test "X$noexename" != "X$name" ; then func_append rmfiles " $odir/lt-${noexename}.c" fi fi fi ;; esac func_show_eval "$RM $rmfiles" 'exit_status=1' done # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then func_show_eval "rmdir $dir >/dev/null 2>&1" fi done exit $exit_status } { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && func_mode_uninstall ${1+"$@"} test -z "$opt_mode" && { help="$generic_help" func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode \`$opt_mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi exit $exit_status # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: # vi:sw=2 hdf-eos5-2.0/config/missing000077500000000000000000000153311507520047200156360ustar00rootroot00000000000000#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2012-06-26.16; # UTC # Copyright (C) 1996-2013 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=http://www.perl.org/ flex_URL=http://flex.sourceforge.net/ gnu_software_URL=http://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'automa4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: hdf-eos5-2.0/config/test-driver000077500000000000000000000076111507520047200164370ustar00rootroot00000000000000#! /bin/sh # test-driver - basic testsuite driver script. scriptversion=2012-06-27.10; # UTC # Copyright (C) 2011-2013 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, see . # 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 file is maintained in Automake, please report # bugs to or send patches to # . # Make unconditional expansion of undefined variables an error. This # helps a lot in preventing typo-related bugs. set -u usage_error () { echo "$0: $*" >&2 print_usage >&2 exit 2 } print_usage () { cat <$log_file 2>&1 estatus=$? if test $enable_hard_errors = no && test $estatus -eq 99; then estatus=1 fi case $estatus:$expect_failure in 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; 0:*) col=$grn res=PASS recheck=no gcopy=no;; 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; *:*) col=$red res=FAIL recheck=yes gcopy=yes;; esac # Report outcome to console. echo "${col}${res}${std}: $test_name" # Register the test result, and other relevant metadata. echo ":test-result: $res" > $trs_file echo ":global-test-result: $res" >> $trs_file echo ":recheck: $recheck" >> $trs_file echo ":copy-in-global-log: $gcopy" >> $trs_file # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: hdf-eos5-2.0/configure000077500000000000000000027320451507520047200147130ustar00rootroot00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for hdf-eos5 2.0. # # Report bugs to . # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and null@bogus.email $0: about your system, including any error possibly output $0: before this message. Then install a modern shell, or $0: manually run the script under such a shell if you do $0: have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" SHELL=${CONFIG_SHELL-/bin/sh} test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='hdf-eos5' PACKAGE_TARNAME='hdf-eos5' PACKAGE_VERSION='2.0' PACKAGE_STRING='hdf-eos5 2.0' PACKAGE_BUGREPORT='null@bogus.email' PACKAGE_URL='' # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS SZIP_ENCODER_CONDITIONAL_FALSE SZIP_ENCODER_CONDITIONAL_TRUE F2CFORTRAN_32PTR_CONDITIONAL_FALSE F2CFORTRAN_32PTR_CONDITIONAL_TRUE F2CFORTRAN_90_CONDITIONAL_FALSE F2CFORTRAN_90_CONDITIONAL_TRUE F2CFORTRAN_CONDITIONAL_FALSE F2CFORTRAN_CONDITIONAL_TRUE LIBOBJS GCTP_INCLUDE_CONDITIONAL_FALSE GCTP_INCLUDE_CONDITIONAL_TRUE HDF5_THREADSAFE_FALSE HDF5_THREADSAFE_TRUE ac_ct_FC FCFLAGS FC ac_ct_F77 FFLAGS F77 CPP OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL RANLIB ac_ct_AR AR DLLTOOL OBJDUMP LN_S NM ac_ct_DUMPBIN DUMPBIN LD FGREP EGREP GREP SED am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC host_os host_vendor host_cpu host build_os build_vendor build_cpu build LIBTOOL MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_maintainer_mode enable_shared enable_static with_pic enable_fast_install enable_dependency_tracking with_gnu_ld with_sysroot enable_libtool_lock with_zlib enable_fortran with_szlib with_hdf5 enable_gctp_include ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP F77 FFLAGS FC FCFLAGS' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures hdf-eos5 2.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/hdf-eos5] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of hdf-eos5 2.0:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --enable-shared[=PKGS] build shared libraries [default=no] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build --disable-libtool-lock avoid locking (might break parallel builds) --enable-fortran Enable fortran components/tests --enable-gctp-include Enable installation of GCTP library headers Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot=DIR Search for dependent libraries within DIR (or the compiler's sysroot if not specified). --with-zlib=DIR Specify path to external zlib library. Linker must be able to find zlib if HDF4 was built with zlib. [default=yes] --with-szlib=DIR Use szlib library for external szlib I/O filter. Linker must be able to find szlib if HDF4 was build with szip. --with-hdf5=DIR Specify path to HDF5 library to use while building [default=yes] Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor F77 Fortran 77 compiler command FFLAGS Fortran 77 compiler flags FC Fortran compiler command FCFLAGS Fortran compiler flags Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF hdf-eos5 configure 2.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_compute_int LINENO EXPR VAR INCLUDES # -------------------------------------------- # Tries to find the compile-time value of EXPR in a program that includes # INCLUDES, setting VAR accordingly. Returns whether the value could be # computed ac_fn_c_compute_int () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) >= 0)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_lo=0 ac_mid=0 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=$ac_mid; break else as_fn_arith $ac_mid + 1 && ac_lo=$as_val if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) < 0)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=-1 ac_mid=-1 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) >= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_lo=$ac_mid; break else as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=$ac_mid else as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in #(( ?*) eval "$3=\$ac_lo"; ac_retval=0 ;; '') ac_retval=1 ;; esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 static long int longval () { return $2; } static unsigned long int ulongval () { return $2; } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (($2) < 0) { long int i = longval (); if (i != ($2)) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ($2)) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : echo >>conftest.val; read $3 &5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_f77_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_f77_try_compile # ac_fn_f77_try_link LINENO # ------------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_f77_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_f77_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_f77_try_link # ac_fn_fc_try_compile LINENO # --------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_fc_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_fc_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_fc_try_compile # ac_fn_fc_try_link LINENO # ------------------------ # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_fc_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_fc_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_fc_try_link # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( $as_echo "## ------------------------------- ## ## Report this to null@bogus.email ## ## ------------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by hdf-eos5 $as_me 2.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in config "$srcdir"/config; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in config \"$srcdir\"/config" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. am__api_version='1.13' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='hdf-eos5' VERSION='2.0' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar pax cpio none' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } # Check whether --enable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then : enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 $as_echo "$USE_MAINTAINER_MODE" >&6; } if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE ## Note we disable shared libraries otherwise gfortran fails linking against the resulting ## libX.la files. With shared libraries disables, libtool links gfortran against the static ## library libX.a. If fortran is disabled, this can be overridden using --enabled-shared ## with configure # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac else enable_shared=no fi case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.4.2' macro_revision='1.3337' ltmain="$ac_aux_dir/ltmain.sh" # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac # Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "" } case "$ECHO" in printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 $as_echo "printf" >&6; } ;; print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 $as_echo "print -r" >&6; } ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 $as_echo "cat" >&6; } ;; esac DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_FGREP" || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 $as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else if test -n "$ac_tool_prefix"; then for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n $lt_cv_sys_max_cmd_len ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 $as_echo "$xsi_shell" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 $as_echo_n "checking whether the shell understands \"+=\"... " >&6; } lt_shell_append=no ( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 $as_echo "$lt_shell_append" >&6; } if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 $as_echo_n "checking how to convert $build file names to $host format... " >&6; } if ${lt_cv_to_host_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 $as_echo "$lt_cv_to_host_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 $as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } if ${lt_cv_to_tool_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 $as_echo "$lt_cv_to_tool_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) if test "$GCC" != yes; then reload_cmds=false fi ;; darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given extended regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 $as_echo_n "checking how to associate runtime and link libraries... " >&6; } if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 $as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then for ac_prog in ar do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} : ${AR_FLAGS=cru} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 $as_echo_n "checking for archiver @FILE support... " >&6; } if ${lt_cv_ar_at_file+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 $as_echo "$lt_cv_ar_at_file" >&6; } if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 $as_echo "failed" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then nm_file_list_spec='@' fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 $as_echo_n "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. if test "${with_sysroot+set}" = set; then : withval=$with_sysroot; else with_sysroot=no fi lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 $as_echo "${with_sysroot}" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 $as_echo "${lt_sysroot:-no}" >&6; } # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } if ${lt_cv_cc_needs_belf+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_cc_needs_belf=yes else lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; *-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD="${LD-ld}_sol2" fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 $as_echo "$MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 $as_echo "$ac_ct_MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 $as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if ${lt_cv_path_mainfest_tool+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 $as_echo "$lt_cv_path_mainfest_tool" >&6; } if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&5 # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test $_lt_result -eq 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } if ${lt_cv_ld_exported_symbols_list+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_ld_exported_symbols_list=yes else lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 $as_echo_n "checking for -force_load linker flag... " >&6; } if ${lt_cv_ld_force_load+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cru libconftest.a conftest.o" >&5 $AR cru libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&5 elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then lt_cv_ld_force_load=yes else cat conftest.err >&5 fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 $as_echo "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[91]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[012]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in dlfcn.h do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF fi done # Set options enable_dlopen=no enable_win32_dll=no # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac else enable_static=yes fi # Check whether --with-pic was given. if test "${with_pic+set}" = set; then : withval=$with_pic; lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for lt_pkg in $withval; do IFS="$lt_save_ifs" if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS="$lt_save_ifs" ;; esac else pic_mode=default fi test -z "$pic_mode" && pic_mode=default # Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac else enable_fast_install=yes fi # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF #define LT_OBJDIR "$lt_cv_objdir/" _ACEOF case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/${ac_tool_prefix}file; then lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/file; then lt_cv_path_MAGIC_CMD="$ac_dir/file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC="$CC" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; *) lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl='-Xlinker ' if test -n "$lt_prog_compiler_pic"; then lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; *Sun\ F* | *Sun*Fortran*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Intel*\ [CF]*Compiler*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; *Portland\ Group*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 $as_echo "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test x"$lt_cv_prog_compiler_pic_works" = xyes; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test x"$lt_cv_prog_compiler_static_works" = xyes; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test "$hard_links" = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; *\ \(GNU\ Binutils\)\ [3-9]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' export_dynamic_flag_spec='${wl}--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; haiku*) archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' link_all_deplibs=yes ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi export_dynamic_flag_spec='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' ${wl}-bernotok' allow_undefined_flag=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes file_list_spec='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported if test "$lt_cv_ld_force_load" = "yes"; then whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes allow_undefined_flag="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 $as_echo_n "checking if $CC understands -b... " >&6; } if ${lt_cv_prog_compiler__b+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler__b=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler__b=yes fi else lt_cv_prog_compiler__b=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 $as_echo "$lt_cv_prog_compiler__b" >&6; } if test x"$lt_cv_prog_compiler__b" = xyes; then archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_irix_exported_symbol=yes else lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$lt_cv_irix_exported_symbol" >&6; } if test "$lt_cv_irix_exported_symbol" = yes; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' ;; *) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='${wl}-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='${wl}-z,text' allow_undefined_flag='${wl}-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='${wl}-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test "$ld_shlibs" = no && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no else lt_cv_archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 $as_echo "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's,/\([A-Za-z]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Add ABI-specific directories to the system library path. sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test "X$hardcode_automatic" = "Xyes" ; then # We can hardcode non-existent directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } if test "$hardcode_action" = relink || test "$inherit_rpath" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes; then : lt_cv_dlopen="shl_load" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes; then : lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes; then : lt_cv_dlopen="dlopen" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes; then : lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" fi fi fi fi fi fi ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 $as_echo_n "checking whether stripping libraries is possible... " >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac fi # Report which library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" ac_config_commands="$ac_config_commands libtool" # Only expand once: ################################### # Files that need to be configured ################################### ac_config_headers="$ac_config_headers include/HE5_config.h" ac_config_files="$ac_config_files Makefile include/Makefile src/Makefile gctp/Makefile gctp/include/Makefile gctp/src/Makefile samples/Makefile testdrivers/Makefile testdrivers/grid/Makefile testdrivers/point/Makefile testdrivers/swath/Makefile testdrivers/za/Makefile testdrivers/threads/Makefile doc/Makefile" ################################### # Additional Macros ################################### ################################################################################# ## Utility functions for testing the availability of generic libraries ## on a list of paths ################################################################################# # HDF_CHECK_LIB_PATH([lib],[func],[path1,path2,path3]) ################################################################################# ## Utility functions for testing the availability of generic libraries ################################################################################# # HDF_CHECK_LIB([zlib],[z],[compress2],[path]) ################################################################################# ## Utility functions for testing the availability a given header file ## on a list of paths ################################################################################# # HDF_CHECK_INC_PATH([header],[path1,path2,path3]) ################################### # Start checks ################################### ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Check for the math library that HDF4 needs # { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ceil in -lm" >&5 $as_echo_n "checking for ceil in -lm... " >&6; } if ${ac_cv_lib_m_ceil+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char ceil (); int main () { return ceil (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_m_ceil=yes else ac_cv_lib_m_ceil=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_ceil" >&5 $as_echo "$ac_cv_lib_m_ceil" >&6; } if test "x$ac_cv_lib_m_ceil" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBM 1 _ACEOF LIBS="-lm $LIBS" fi ###################################################################### # Check size of some types # We pass these through directly via the cpp flags rather than the config # file to make it easier (given the current code state) to get it where # it needs to go. ###################################################################### # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 $as_echo_n "checking size of long... " >&6; } if ${ac_cv_sizeof_long+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then : else if test "$ac_cv_type_long" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_long=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5 $as_echo "$ac_cv_sizeof_long" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG $ac_cv_sizeof_long _ACEOF CPPFLAGS="${CPPFLAGS} -DSIZEOF_LONG=$ac_cv_sizeof_long" ################################### # Check endian-ness ################################### { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } if ${ac_cv_c_bigendian+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_bigendian=unknown # See if we're dealing with a universal compiler. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __APPLE_CC__ not a universal capable compiler #endif typedef int dummy; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # Check for potential -arch flags. It is not universal unless # there are at least two -arch flags with different values. ac_arch= ac_prev= for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do if test -n "$ac_prev"; then case $ac_word in i?86 | x86_64 | ppc | ppc64) if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then ac_arch=$ac_word else ac_cv_c_bigendian=universal break fi ;; esac ac_prev= elif test "x$ac_word" = "x-arch"; then ac_prev=arch fi done fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_c_bigendian = unknown; then # See if sys/param.h defines the BYTE_ORDER macro. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ && LITTLE_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # It does; now see whether it defined to BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # It does; now see whether it defined to _BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #ifndef _BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # Compile a test program. if test "$cross_compiling" = yes; then : # Try to guess by grepping values from an object file. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; int use_ascii (int i) { return ascii_mm[i] + ascii_ii[i]; } short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; int use_ebcdic (int i) { return ebcdic_mm[i] + ebcdic_ii[i]; } extern int foo; int main () { return use_ascii (foo) == use_ebcdic (foo); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then ac_cv_c_bigendian=yes fi if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then if test "$ac_cv_c_bigendian" = unknown; then ac_cv_c_bigendian=no else # finding both strings is unlikely to happen, but who knows? ac_cv_c_bigendian=unknown fi fi fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* Are we little or big endian? From Harbison&Steele. */ union { long int l; char c[sizeof (long int)]; } u; u.l = 1; return u.c[sizeof (long int) - 1] == 1; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_c_bigendian=no else ac_cv_c_bigendian=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 $as_echo "$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in #( yes) $as_echo "#define BIG_ENDIAN 1" >>confdefs.h CPPFLAGS="${CPPFLAGS} -DBIG_ENDIAN=1" ;; #( no) ;; #( universal) $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h ;; #( *) as_fn_error $? "unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac ################################### # pthread library checks # This will be needed if the HDF5 # library is threaded, otherwise it # will be ignored. ################################### { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 $as_echo_n "checking for pthread_create in -lpthread... " >&6; } if ${ac_cv_lib_pthread_pthread_create+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_create (); int main () { return pthread_create (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_pthread_pthread_create=yes else ac_cv_lib_pthread_pthread_create=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 $as_echo "$ac_cv_lib_pthread_pthread_create" >&6; } if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBPTHREAD 1 _ACEOF LIBS="-lpthread $LIBS" fi ################################### # ZLIB library checks ################################### # HDFEOS does not need libz directly, but the HDF library might. This means # we only need to find the libary, not the header files. # Check whether --with-zlib was given. if test "${with_zlib+set}" = set; then : withval=$with_zlib; else withval=yes fi if ## --with- with no directory. We must find it. ## test "x$withval" == "xyes"; then : lib_path= if test "x$ac_cv_lib_z_compress2" != "xyes"; then : unset ac_cv_lib_z_compress2 saved_LDFLAGS="$LDFLAGS" if test -n "$lib_path"; then : LDFLAGS="$LDFLAGS -L$lib_path" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compress2 in -lz" >&5 $as_echo_n "checking for compress2 in -lz... " >&6; } if ${ac_cv_lib_z_compress2+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lz $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char compress2 (); int main () { return compress2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_z_compress2=yes else ac_cv_lib_z_compress2=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_compress2" >&5 $as_echo "$ac_cv_lib_z_compress2" >&6; } if test "x$ac_cv_lib_z_compress2" = xyes; then : ac_cv_lib_z_compress2="yes" HAVE_LIBZ="yes" lib_name=HAVE_LIBZ cat >>confdefs.h <<_ACEOF #define $lib_name 1 _ACEOF LIBS="-lz $LIBS" else LDFLAGS="$saved_LDFLAGS" ac_cv_lib_z_compress2="no" fi fi lib_path=/usr/local/lib if test "x$ac_cv_lib_z_compress2" != "xyes"; then : unset ac_cv_lib_z_compress2 saved_LDFLAGS="$LDFLAGS" if test -n "$lib_path"; then : LDFLAGS="$LDFLAGS -L$lib_path" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compress2 in -lz" >&5 $as_echo_n "checking for compress2 in -lz... " >&6; } if ${ac_cv_lib_z_compress2+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lz $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char compress2 (); int main () { return compress2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_z_compress2=yes else ac_cv_lib_z_compress2=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_compress2" >&5 $as_echo "$ac_cv_lib_z_compress2" >&6; } if test "x$ac_cv_lib_z_compress2" = xyes; then : ac_cv_lib_z_compress2="yes" HAVE_LIBZ="yes" lib_name=HAVE_LIBZ cat >>confdefs.h <<_ACEOF #define $lib_name 1 _ACEOF LIBS="-lz $LIBS" else LDFLAGS="$saved_LDFLAGS" ac_cv_lib_z_compress2="no" fi fi lib_path=/opt/local/lib if test "x$ac_cv_lib_z_compress2" != "xyes"; then : unset ac_cv_lib_z_compress2 saved_LDFLAGS="$LDFLAGS" if test -n "$lib_path"; then : LDFLAGS="$LDFLAGS -L$lib_path" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compress2 in -lz" >&5 $as_echo_n "checking for compress2 in -lz... " >&6; } if ${ac_cv_lib_z_compress2+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lz $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char compress2 (); int main () { return compress2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_z_compress2=yes else ac_cv_lib_z_compress2=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_compress2" >&5 $as_echo "$ac_cv_lib_z_compress2" >&6; } if test "x$ac_cv_lib_z_compress2" = xyes; then : ac_cv_lib_z_compress2="yes" HAVE_LIBZ="yes" lib_name=HAVE_LIBZ cat >>confdefs.h <<_ACEOF #define $lib_name 1 _ACEOF LIBS="-lz $LIBS" else LDFLAGS="$saved_LDFLAGS" ac_cv_lib_z_compress2="no" fi fi lib_path=/usr/lib64 if test "x$ac_cv_lib_z_compress2" != "xyes"; then : unset ac_cv_lib_z_compress2 saved_LDFLAGS="$LDFLAGS" if test -n "$lib_path"; then : LDFLAGS="$LDFLAGS -L$lib_path" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compress2 in -lz" >&5 $as_echo_n "checking for compress2 in -lz... " >&6; } if ${ac_cv_lib_z_compress2+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lz $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char compress2 (); int main () { return compress2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_z_compress2=yes else ac_cv_lib_z_compress2=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_compress2" >&5 $as_echo "$ac_cv_lib_z_compress2" >&6; } if test "x$ac_cv_lib_z_compress2" = xyes; then : ac_cv_lib_z_compress2="yes" HAVE_LIBZ="yes" lib_name=HAVE_LIBZ cat >>confdefs.h <<_ACEOF #define $lib_name 1 _ACEOF LIBS="-lz $LIBS" else LDFLAGS="$saved_LDFLAGS" ac_cv_lib_z_compress2="no" fi fi elif ## --without- ## Nothing to do - library just does not get added. ## test "x$withval" == "xno"; then : else ## All other cases ## if test -z "$withval"; then : as_fn_error $? "no zlib library path provided" "$LINENO" 5 else LDFLAGS="$LDFLAGS -L$withval" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compress2 in -lz" >&5 $as_echo_n "checking for compress2 in -lz... " >&6; } if ${ac_cv_lib_z_compress2+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lz $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char compress2 (); int main () { return compress2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_z_compress2=yes else ac_cv_lib_z_compress2=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_compress2" >&5 $as_echo "$ac_cv_lib_z_compress2" >&6; } if test "x$ac_cv_lib_z_compress2" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBZ 1 _ACEOF LIBS="-lz $LIBS" else as_fn_error $? "couldn't find zlib library" "$LINENO" 5 fi fi fi if test -z "$HAVE_LIBZ"; then : as_fn_error $? "unable to find libz" "$LINENO" 5 fi ################################### # FORTRAN compiler check ################################### # User may enable fortran components explicity with --enable-fortran # or --enable-fortran=yes ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn nagfor do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_F77+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$F77"; then ac_cv_prog_F77="$F77" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_F77="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi F77=$ac_cv_prog_F77 if test -n "$F77"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $F77" >&5 $as_echo "$F77" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$F77" && break done fi if test -z "$F77"; then ac_ct_F77=$F77 for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn nagfor do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_F77+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_F77"; then ac_cv_prog_ac_ct_F77="$ac_ct_F77" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_F77="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_F77=$ac_cv_prog_ac_ct_F77 if test -n "$ac_ct_F77"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_F77" >&5 $as_echo "$ac_ct_F77" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_F77" && break done if test "x$ac_ct_F77" = x; then F77="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac F77=$ac_ct_F77 fi fi # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for Fortran 77 compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done rm -f a.out # If we don't use `.F' as extension, the preprocessor is not run on the # input file. (Note that this only needs to work for GNU compilers.) ac_save_ext=$ac_ext ac_ext=F { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU Fortran 77 compiler" >&5 $as_echo_n "checking whether we are using the GNU Fortran 77 compiler... " >&6; } if ${ac_cv_f77_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat > conftest.$ac_ext <<_ACEOF program main #ifndef __GNUC__ choke me #endif end _ACEOF if ac_fn_f77_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_f77_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_f77_compiler_gnu" >&5 $as_echo "$ac_cv_f77_compiler_gnu" >&6; } ac_ext=$ac_save_ext ac_test_FFLAGS=${FFLAGS+set} ac_save_FFLAGS=$FFLAGS FFLAGS= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $F77 accepts -g" >&5 $as_echo_n "checking whether $F77 accepts -g... " >&6; } if ${ac_cv_prog_f77_g+:} false; then : $as_echo_n "(cached) " >&6 else FFLAGS=-g cat > conftest.$ac_ext <<_ACEOF program main end _ACEOF if ac_fn_f77_try_compile "$LINENO"; then : ac_cv_prog_f77_g=yes else ac_cv_prog_f77_g=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_f77_g" >&5 $as_echo "$ac_cv_prog_f77_g" >&6; } if test "$ac_test_FFLAGS" = set; then FFLAGS=$ac_save_FFLAGS elif test $ac_cv_prog_f77_g = yes; then if test "x$ac_cv_f77_compiler_gnu" = xyes; then FFLAGS="-g -O2" else FFLAGS="-g" fi else if test "x$ac_cv_f77_compiler_gnu" = xyes; then FFLAGS="-O2" else FFLAGS= fi fi if test $ac_compiler_gnu = yes; then G77=yes else G77= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu if test -z "$F77" || test "X$F77" = "Xno"; then _lt_disable_F77=yes fi archive_cmds_need_lc_F77=no allow_undefined_flag_F77= always_export_symbols_F77=no archive_expsym_cmds_F77= export_dynamic_flag_spec_F77= hardcode_direct_F77=no hardcode_direct_absolute_F77=no hardcode_libdir_flag_spec_F77= hardcode_libdir_separator_F77= hardcode_minus_L_F77=no hardcode_automatic_F77=no inherit_rpath_F77=no module_cmds_F77= module_expsym_cmds_F77= link_all_deplibs_F77=unknown old_archive_cmds_F77=$old_archive_cmds reload_flag_F77=$reload_flag reload_cmds_F77=$reload_cmds no_undefined_flag_F77= whole_archive_flag_spec_F77= enable_shared_with_static_runtimes_F77=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o objext_F77=$objext # No sense in running all these tests if we already determined that # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_F77" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} CFLAGS=$FFLAGS compiler=$CC compiler_F77=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` GCC=$G77 if test -n "$compiler"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } GCC_F77="$G77" LD_F77="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... lt_prog_compiler_wl_F77= lt_prog_compiler_pic_F77= lt_prog_compiler_static_F77= if test "$GCC" = yes; then lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_static_F77='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_F77='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic_F77='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic_F77='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_F77='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static_F77= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic_F77='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared_F77=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic_F77='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_F77=-Kconform_pic fi ;; *) lt_prog_compiler_pic_F77='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl_F77='-Xlinker ' if test -n "$lt_prog_compiler_pic_F77"; then lt_prog_compiler_pic_F77="-Xcompiler $lt_prog_compiler_pic_F77" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl_F77='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_F77='-Bstatic' else lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_F77='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl_F77='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_F77='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static_F77='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl_F77='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static_F77='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-fPIC' lt_prog_compiler_static_F77='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='--shared' lt_prog_compiler_static_F77='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl_F77='-Wl,-Wl,,' lt_prog_compiler_pic_F77='-PIC' lt_prog_compiler_static_F77='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-fpic' lt_prog_compiler_static_F77='-Bstatic' ;; ccc*) lt_prog_compiler_wl_F77='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static_F77='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-qpic' lt_prog_compiler_static_F77='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' lt_prog_compiler_wl_F77='' ;; *Sun\ F* | *Sun*Fortran*) lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' lt_prog_compiler_wl_F77='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' lt_prog_compiler_wl_F77='-Wl,' ;; *Intel*\ [CF]*Compiler*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-fPIC' lt_prog_compiler_static_F77='-static' ;; *Portland\ Group*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-fpic' lt_prog_compiler_static_F77='-Bstatic' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic_F77='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl_F77='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static_F77='-non_shared' ;; rdos*) lt_prog_compiler_static_F77='-non_shared' ;; solaris*) lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl_F77='-Qoption ld ';; *) lt_prog_compiler_wl_F77='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl_F77='-Qoption ld ' lt_prog_compiler_pic_F77='-PIC' lt_prog_compiler_static_F77='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic_F77='-Kconform_pic' lt_prog_compiler_static_F77='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' ;; unicos*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_can_build_shared_F77=no ;; uts4*) lt_prog_compiler_pic_F77='-pic' lt_prog_compiler_static_F77='-Bstatic' ;; *) lt_prog_compiler_can_build_shared_F77=no ;; esac fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_F77= ;; *) lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic_F77+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_F77=$lt_prog_compiler_pic_F77 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_F77" >&5 $as_echo "$lt_cv_prog_compiler_pic_F77" >&6; } lt_prog_compiler_pic_F77=$lt_cv_prog_compiler_pic_F77 # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_F77"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... " >&6; } if ${lt_cv_prog_compiler_pic_works_F77+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works_F77=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_F77" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works_F77=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_F77" >&5 $as_echo "$lt_cv_prog_compiler_pic_works_F77" >&6; } if test x"$lt_cv_prog_compiler_pic_works_F77" = xyes; then case $lt_prog_compiler_pic_F77 in "" | " "*) ;; *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;; esac else lt_prog_compiler_pic_F77= lt_prog_compiler_can_build_shared_F77=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_F77 eval lt_tmp_static_flag=\"$lt_prog_compiler_static_F77\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works_F77+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works_F77=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works_F77=yes fi else lt_cv_prog_compiler_static_works_F77=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_F77" >&5 $as_echo "$lt_cv_prog_compiler_static_works_F77" >&6; } if test x"$lt_cv_prog_compiler_static_works_F77" = xyes; then : else lt_prog_compiler_static_F77= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o_F77+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o_F77=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_F77=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_F77" >&5 $as_echo "$lt_cv_prog_compiler_c_o_F77" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o_F77+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o_F77=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_F77=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_F77" >&5 $as_echo "$lt_cv_prog_compiler_c_o_F77" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test "$hard_links" = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag_F77= always_export_symbols_F77=no archive_cmds_F77= archive_expsym_cmds_F77= compiler_needs_object_F77=no enable_shared_with_static_runtimes_F77=no export_dynamic_flag_spec_F77= export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic_F77=no hardcode_direct_F77=no hardcode_direct_absolute_F77=no hardcode_libdir_flag_spec_F77= hardcode_libdir_separator_F77= hardcode_minus_L_F77=no hardcode_shlibpath_var_F77=unsupported inherit_rpath_F77=no link_all_deplibs_F77=unknown module_cmds_F77= module_expsym_cmds_F77= old_archive_from_new_cmds_F77= old_archive_from_expsyms_cmds_F77= thread_safe_flag_spec_F77= whole_archive_flag_spec_F77= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms_F77= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms_F77='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs_F77=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; *\ \(GNU\ Binutils\)\ [3-9]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec_F77='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec_F77= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs_F77=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_F77='' ;; m68k) archive_cmds_F77='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_minus_L_F77=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_F77=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs_F77=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_F77='-L$libdir' export_dynamic_flag_spec_F77='${wl}--export-all-symbols' allow_undefined_flag_F77=unsupported always_export_symbols_F77=no enable_shared_with_static_runtimes_F77=yes export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms_F77='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_F77=no fi ;; haiku*) archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' link_all_deplibs_F77=yes ;; interix[3-9]*) hardcode_direct_F77=no hardcode_shlibpath_var_F77=no hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' export_dynamic_flag_spec_F77='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_F77='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec_F77= tmp_sharedflag='--shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object_F77=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec_F77='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object_F77=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds_F77='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds_F77='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec_F77='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds_F77='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs_F77=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs_F77=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_F77=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs_F77=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_F77=no fi ;; esac ;; sunos4*) archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_F77=no fi ;; esac if test "$ld_shlibs_F77" = no; then runpath_var= hardcode_libdir_flag_spec_F77= export_dynamic_flag_spec_F77= whole_archive_flag_spec_F77= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag_F77=unsupported always_export_symbols_F77=yes archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L_F77=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct_F77=unsupported fi ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_F77='' hardcode_direct_F77=yes hardcode_direct_absolute_F77=yes hardcode_libdir_separator_F77=':' link_all_deplibs_F77=yes file_list_spec_F77='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct_F77=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_F77=yes hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_libdir_separator_F77= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi export_dynamic_flag_spec_F77='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols_F77=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag_F77='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath__F77+:} false; then : $as_echo_n "(cached) " >&6 else cat > conftest.$ac_ext <<_ACEOF program main end _ACEOF if ac_fn_f77_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath__F77=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath__F77"; then lt_cv_aix_libpath__F77=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__F77"; then lt_cv_aix_libpath__F77="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath__F77 fi hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_F77='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag_F77="-z nodefs" archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath__F77+:} false; then : $as_echo_n "(cached) " >&6 else cat > conftest.$ac_ext <<_ACEOF program main end _ACEOF if ac_fn_f77_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath__F77=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath__F77"; then lt_cv_aix_libpath__F77=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__F77"; then lt_cv_aix_libpath__F77="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath__F77 fi hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_F77=' ${wl}-bernotok' allow_undefined_flag_F77=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec_F77='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_F77='$convenience' fi archive_cmds_need_lc_F77=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_F77='' ;; m68k) archive_cmds_F77='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_minus_L_F77=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec_F77=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC hardcode_libdir_flag_spec_F77=' ' allow_undefined_flag_F77=unsupported always_export_symbols_F77=yes file_list_spec_F77='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds_F77='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, F77)='true' enable_shared_with_static_runtimes_F77=yes exclude_expsyms_F77='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds_F77='chmod 644 $oldlib' postlink_cmds_F77='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper hardcode_libdir_flag_spec_F77=' ' allow_undefined_flag_F77=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds_F77='true' # FIXME: Should let the user specify the lib program. old_archive_cmds_F77='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes_F77=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc_F77=no hardcode_direct_F77=no hardcode_automatic_F77=yes hardcode_shlibpath_var_F77=unsupported if test "$lt_cv_ld_force_load" = "yes"; then whole_archive_flag_spec_F77='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' compiler_needs_object_F77=yes else whole_archive_flag_spec_F77='' fi link_all_deplibs_F77=yes allow_undefined_flag_F77="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all archive_cmds_F77="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds_F77="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds_F77="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" module_expsym_cmds_F77="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" else ld_shlibs_F77=no fi ;; dgux*) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_shlibpath_var_F77=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=yes hardcode_minus_L_F77=yes hardcode_shlibpath_var_F77=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds_F77='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds_F77='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' hardcode_libdir_separator_F77=: hardcode_direct_F77=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_F77=yes export_dynamic_flag_spec_F77='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then archive_cmds_F77='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' hardcode_libdir_separator_F77=: hardcode_direct_F77=yes hardcode_direct_absolute_F77=yes export_dynamic_flag_spec_F77='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_F77=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_F77='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_F77='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' hardcode_libdir_separator_F77=: case $host_cpu in hppa*64*|ia64*) hardcode_direct_F77=no hardcode_shlibpath_var_F77=no ;; *) hardcode_direct_F77=yes hardcode_direct_absolute_F77=yes export_dynamic_flag_spec_F77='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_F77=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" cat > conftest.$ac_ext <<_ACEOF subroutine foo end _ACEOF if ac_fn_f77_try_link "$LINENO"; then : lt_cv_irix_exported_symbol=yes else lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$lt_cv_irix_exported_symbol" >&6; } if test "$lt_cv_irix_exported_symbol" = yes; then archive_expsym_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc_F77='no' hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_F77=: inherit_rpath_F77=yes link_all_deplibs_F77=yes ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no ;; newsos6) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=yes hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_F77=: hardcode_shlibpath_var_F77=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct_F77=yes hardcode_shlibpath_var_F77=no hardcode_direct_absolute_F77=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' export_dynamic_flag_spec_F77='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_F77='-R$libdir' ;; *) archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs_F77=no fi ;; os2*) hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_minus_L_F77=yes allow_undefined_flag_F77=unsupported archive_cmds_F77='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_from_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag_F77=' -expect_unresolved \*' archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi archive_cmds_need_lc_F77='no' hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_F77=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_F77='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' else allow_undefined_flag_F77=' -expect_unresolved \*' archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_F77='-rpath $libdir' fi archive_cmds_need_lc_F77='no' hardcode_libdir_separator_F77=: ;; solaris*) no_undefined_flag_F77=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds_F77='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_F77='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' archive_cmds_F77='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_shlibpath_var_F77=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then whole_archive_flag_spec_F77='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs_F77=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_direct_F77=yes hardcode_minus_L_F77=yes hardcode_shlibpath_var_F77=no ;; sysv4) case $host_vendor in sni) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds_F77='$CC -r -o $output$reload_objs' hardcode_direct_F77=no ;; motorola) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var_F77=no ;; sysv4.3*) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_F77=no export_dynamic_flag_spec_F77='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_F77=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs_F77=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag_F77='${wl}-z,text' archive_cmds_need_lc_F77=no hardcode_shlibpath_var_F77=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_F77='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag_F77='${wl}-z,text' allow_undefined_flag_F77='${wl}-z,nodefs' archive_cmds_need_lc_F77=no hardcode_shlibpath_var_F77=no hardcode_libdir_flag_spec_F77='${wl}-R,$libdir' hardcode_libdir_separator_F77=':' link_all_deplibs_F77=yes export_dynamic_flag_spec_F77='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_F77='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_F77='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_F77='-L$libdir' hardcode_shlibpath_var_F77=no ;; *) ld_shlibs_F77=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec_F77='${wl}-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_F77" >&5 $as_echo "$ld_shlibs_F77" >&6; } test "$ld_shlibs_F77" = no && can_build_shared=no with_gnu_ld_F77=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_F77" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_F77=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds_F77 in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc_F77+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_F77 pic_flag=$lt_prog_compiler_pic_F77 compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_F77 allow_undefined_flag_F77= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_F77 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds_F77 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc_F77=no else lt_cv_archive_cmds_need_lc_F77=yes fi allow_undefined_flag_F77=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_F77" >&5 $as_echo "$lt_cv_archive_cmds_need_lc_F77" >&6; } archive_cmds_need_lc_F77=$lt_cv_archive_cmds_need_lc_F77 ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_F77\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_F77\"" cat > conftest.$ac_ext <<_ACEOF program main end _ACEOF if ac_fn_f77_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Add ABI-specific directories to the system library path. sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action_F77= if test -n "$hardcode_libdir_flag_spec_F77" || test -n "$runpath_var_F77" || test "X$hardcode_automatic_F77" = "Xyes" ; then # We can hardcode non-existent directories. if test "$hardcode_direct_F77" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, F77)" != no && test "$hardcode_minus_L_F77" != no; then # Linking always hardcodes the temporary library directory. hardcode_action_F77=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_F77=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_F77=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_F77" >&5 $as_echo "$hardcode_action_F77" >&6; } if test "$hardcode_action_F77" = relink || test "$inherit_rpath_F77" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi fi # test -n "$compiler" GCC=$lt_save_GCC CC="$lt_save_CC" CFLAGS="$lt_save_CFLAGS" fi # test "$_lt_disable_F77" != yes ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=${ac_fc_srcext-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_fc_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn nagfor xlf90 f90 pgf90 pghpf epcf90 g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_FC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$FC"; then ac_cv_prog_FC="$FC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_FC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi FC=$ac_cv_prog_FC if test -n "$FC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FC" >&5 $as_echo "$FC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$FC" && break done fi if test -z "$FC"; then ac_ct_FC=$FC for ac_prog in gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn nagfor xlf90 f90 pgf90 pghpf epcf90 g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_FC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_FC"; then ac_cv_prog_ac_ct_FC="$ac_ct_FC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_FC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_FC=$ac_cv_prog_ac_ct_FC if test -n "$ac_ct_FC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_FC" >&5 $as_echo "$ac_ct_FC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_FC" && break done if test "x$ac_ct_FC" = x; then FC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac FC=$ac_ct_FC fi fi # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for Fortran compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done rm -f a.out # If we don't use `.F' as extension, the preprocessor is not run on the # input file. (Note that this only needs to work for GNU compilers.) ac_save_ext=$ac_ext ac_ext=F { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU Fortran compiler" >&5 $as_echo_n "checking whether we are using the GNU Fortran compiler... " >&6; } if ${ac_cv_fc_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat > conftest.$ac_ext <<_ACEOF program main #ifndef __GNUC__ choke me #endif end _ACEOF if ac_fn_fc_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_fc_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_fc_compiler_gnu" >&5 $as_echo "$ac_cv_fc_compiler_gnu" >&6; } ac_ext=$ac_save_ext ac_test_FCFLAGS=${FCFLAGS+set} ac_save_FCFLAGS=$FCFLAGS FCFLAGS= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $FC accepts -g" >&5 $as_echo_n "checking whether $FC accepts -g... " >&6; } if ${ac_cv_prog_fc_g+:} false; then : $as_echo_n "(cached) " >&6 else FCFLAGS=-g cat > conftest.$ac_ext <<_ACEOF program main end _ACEOF if ac_fn_fc_try_compile "$LINENO"; then : ac_cv_prog_fc_g=yes else ac_cv_prog_fc_g=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_fc_g" >&5 $as_echo "$ac_cv_prog_fc_g" >&6; } if test "$ac_test_FCFLAGS" = set; then FCFLAGS=$ac_save_FCFLAGS elif test $ac_cv_prog_fc_g = yes; then if test "x$ac_cv_fc_compiler_gnu" = xyes; then FCFLAGS="-g -O2" else FCFLAGS="-g" fi else if test "x$ac_cv_fc_compiler_gnu" = xyes; then FCFLAGS="-O2" else FCFLAGS= fi fi if test $ac_compiler_gnu = yes; then GFC=yes else GFC= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu func_stripname_cnf () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname_cnf ac_ext=${ac_fc_srcext-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_fc_compiler_gnu if test -z "$FC" || test "X$FC" = "Xno"; then _lt_disable_FC=yes fi archive_cmds_need_lc_FC=no allow_undefined_flag_FC= always_export_symbols_FC=no archive_expsym_cmds_FC= export_dynamic_flag_spec_FC= hardcode_direct_FC=no hardcode_direct_absolute_FC=no hardcode_libdir_flag_spec_FC= hardcode_libdir_separator_FC= hardcode_minus_L_FC=no hardcode_automatic_FC=no inherit_rpath_FC=no module_cmds_FC= module_expsym_cmds_FC= link_all_deplibs_FC=unknown old_archive_cmds_FC=$old_archive_cmds reload_flag_FC=$reload_flag reload_cmds_FC=$reload_cmds no_undefined_flag_FC= whole_archive_flag_spec_FC= enable_shared_with_static_runtimes_FC=no # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o objext_FC=$objext # No sense in running all these tests if we already determined that # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_FC" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu compiler_FC=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` if test -n "$compiler"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } GCC_FC="$ac_cv_fc_compiler_gnu" LD_FC="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... # Dependencies to place before and after the object being linked: predep_objects_FC= postdep_objects_FC= predeps_FC= postdeps_FC= compiler_lib_search_path_FC= cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; esac if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case ${prev}${p} in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" || test $p = "-R"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test "$pre_test_object_deps_done" = no; then case ${prev} in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$compiler_lib_search_path_FC"; then compiler_lib_search_path_FC="${prev}${p}" else compiler_lib_search_path_FC="${compiler_lib_search_path_FC} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$postdeps_FC"; then postdeps_FC="${prev}${p}" else postdeps_FC="${postdeps_FC} ${prev}${p}" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$predep_objects_FC"; then predep_objects_FC="$p" else predep_objects_FC="$predep_objects_FC $p" fi else if test -z "$postdep_objects_FC"; then postdep_objects_FC="$p" else postdep_objects_FC="$postdep_objects_FC $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling FC test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken case " $postdeps_FC " in *" -lc "*) archive_cmds_need_lc_FC=no ;; esac compiler_lib_search_dirs_FC= if test -n "${compiler_lib_search_path_FC}"; then compiler_lib_search_dirs_FC=`echo " ${compiler_lib_search_path_FC}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` fi lt_prog_compiler_wl_FC= lt_prog_compiler_pic_FC= lt_prog_compiler_static_FC= if test "$GCC" = yes; then lt_prog_compiler_wl_FC='-Wl,' lt_prog_compiler_static_FC='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_FC='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic_FC='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic_FC='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic_FC='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_FC='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static_FC= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic_FC='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared_FC=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic_FC='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_FC=-Kconform_pic fi ;; *) lt_prog_compiler_pic_FC='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl_FC='-Xlinker ' if test -n "$lt_prog_compiler_pic_FC"; then lt_prog_compiler_pic_FC="-Xcompiler $lt_prog_compiler_pic_FC" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl_FC='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_FC='-Bstatic' else lt_prog_compiler_static_FC='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_FC='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl_FC='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_FC='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static_FC='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl_FC='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static_FC='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) lt_prog_compiler_wl_FC='-Wl,' lt_prog_compiler_pic_FC='-KPIC' lt_prog_compiler_static_FC='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl_FC='-Wl,' lt_prog_compiler_pic_FC='-fPIC' lt_prog_compiler_static_FC='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl_FC='-Wl,' lt_prog_compiler_pic_FC='--shared' lt_prog_compiler_static_FC='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl_FC='-Wl,-Wl,,' lt_prog_compiler_pic_FC='-PIC' lt_prog_compiler_static_FC='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_FC='-Wl,' lt_prog_compiler_pic_FC='-fpic' lt_prog_compiler_static_FC='-Bstatic' ;; ccc*) lt_prog_compiler_wl_FC='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static_FC='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl_FC='-Wl,' lt_prog_compiler_pic_FC='-qpic' lt_prog_compiler_static_FC='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic_FC='-KPIC' lt_prog_compiler_static_FC='-Bstatic' lt_prog_compiler_wl_FC='' ;; *Sun\ F* | *Sun*Fortran*) lt_prog_compiler_pic_FC='-KPIC' lt_prog_compiler_static_FC='-Bstatic' lt_prog_compiler_wl_FC='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic_FC='-KPIC' lt_prog_compiler_static_FC='-Bstatic' lt_prog_compiler_wl_FC='-Wl,' ;; *Intel*\ [CF]*Compiler*) lt_prog_compiler_wl_FC='-Wl,' lt_prog_compiler_pic_FC='-fPIC' lt_prog_compiler_static_FC='-static' ;; *Portland\ Group*) lt_prog_compiler_wl_FC='-Wl,' lt_prog_compiler_pic_FC='-fpic' lt_prog_compiler_static_FC='-Bstatic' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic_FC='-KPIC' lt_prog_compiler_static_FC='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic_FC='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl_FC='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static_FC='-non_shared' ;; rdos*) lt_prog_compiler_static_FC='-non_shared' ;; solaris*) lt_prog_compiler_pic_FC='-KPIC' lt_prog_compiler_static_FC='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl_FC='-Qoption ld ';; *) lt_prog_compiler_wl_FC='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl_FC='-Qoption ld ' lt_prog_compiler_pic_FC='-PIC' lt_prog_compiler_static_FC='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl_FC='-Wl,' lt_prog_compiler_pic_FC='-KPIC' lt_prog_compiler_static_FC='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic_FC='-Kconform_pic' lt_prog_compiler_static_FC='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl_FC='-Wl,' lt_prog_compiler_pic_FC='-KPIC' lt_prog_compiler_static_FC='-Bstatic' ;; unicos*) lt_prog_compiler_wl_FC='-Wl,' lt_prog_compiler_can_build_shared_FC=no ;; uts4*) lt_prog_compiler_pic_FC='-pic' lt_prog_compiler_static_FC='-Bstatic' ;; *) lt_prog_compiler_can_build_shared_FC=no ;; esac fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_FC= ;; *) lt_prog_compiler_pic_FC="$lt_prog_compiler_pic_FC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic_FC+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_FC=$lt_prog_compiler_pic_FC fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_FC" >&5 $as_echo "$lt_cv_prog_compiler_pic_FC" >&6; } lt_prog_compiler_pic_FC=$lt_cv_prog_compiler_pic_FC # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_FC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_FC works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_FC works... " >&6; } if ${lt_cv_prog_compiler_pic_works_FC+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works_FC=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_FC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works_FC=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_FC" >&5 $as_echo "$lt_cv_prog_compiler_pic_works_FC" >&6; } if test x"$lt_cv_prog_compiler_pic_works_FC" = xyes; then case $lt_prog_compiler_pic_FC in "" | " "*) ;; *) lt_prog_compiler_pic_FC=" $lt_prog_compiler_pic_FC" ;; esac else lt_prog_compiler_pic_FC= lt_prog_compiler_can_build_shared_FC=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_FC eval lt_tmp_static_flag=\"$lt_prog_compiler_static_FC\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works_FC+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works_FC=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works_FC=yes fi else lt_cv_prog_compiler_static_works_FC=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_FC" >&5 $as_echo "$lt_cv_prog_compiler_static_works_FC" >&6; } if test x"$lt_cv_prog_compiler_static_works_FC" = xyes; then : else lt_prog_compiler_static_FC= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o_FC+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o_FC=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_FC=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_FC" >&5 $as_echo "$lt_cv_prog_compiler_c_o_FC" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o_FC+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o_FC=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_FC=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_FC" >&5 $as_echo "$lt_cv_prog_compiler_c_o_FC" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o_FC" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test "$hard_links" = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag_FC= always_export_symbols_FC=no archive_cmds_FC= archive_expsym_cmds_FC= compiler_needs_object_FC=no enable_shared_with_static_runtimes_FC=no export_dynamic_flag_spec_FC= export_symbols_cmds_FC='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic_FC=no hardcode_direct_FC=no hardcode_direct_absolute_FC=no hardcode_libdir_flag_spec_FC= hardcode_libdir_separator_FC= hardcode_minus_L_FC=no hardcode_shlibpath_var_FC=unsupported inherit_rpath_FC=no link_all_deplibs_FC=unknown module_cmds_FC= module_expsym_cmds_FC= old_archive_from_new_cmds_FC= old_archive_from_expsyms_cmds_FC= thread_safe_flag_spec_FC= whole_archive_flag_spec_FC= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms_FC= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms_FC='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs_FC=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; *\ \(GNU\ Binutils\)\ [3-9]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_FC='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec_FC='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_FC="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec_FC= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs_FC=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_FC='' ;; m68k) archive_cmds_FC='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_FC='-L$libdir' hardcode_minus_L_FC=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_FC=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_FC='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs_FC=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, FC) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_FC='-L$libdir' export_dynamic_flag_spec_FC='${wl}--export-all-symbols' allow_undefined_flag_FC=unsupported always_export_symbols_FC=no enable_shared_with_static_runtimes_FC=yes export_symbols_cmds_FC='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms_FC='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds_FC='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_FC=no fi ;; haiku*) archive_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' link_all_deplibs_FC=yes ;; interix[3-9]*) hardcode_direct_FC=no hardcode_shlibpath_var_FC=no hardcode_libdir_flag_spec_FC='${wl}-rpath,$libdir' export_dynamic_flag_spec_FC='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_FC='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_FC='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec_FC='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers whole_archive_flag_spec_FC='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec_FC= tmp_sharedflag='--shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 whole_archive_flag_spec_FC='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object_FC=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec_FC='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object_FC=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds_FC='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds_FC='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec_FC='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec_FC='${wl}-rpath ${wl}$libdir' archive_cmds_FC='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds_FC='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs_FC=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds_FC='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds_FC='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_FC='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs_FC=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds_FC='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_FC='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_FC=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs_FC=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec_FC='${wl}-rpath ${wl}$libdir' archive_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_FC=no fi ;; esac ;; sunos4*) archive_cmds_FC='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct_FC=yes hardcode_shlibpath_var_FC=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds_FC='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_FC='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs_FC=no fi ;; esac if test "$ld_shlibs_FC" = no; then runpath_var= hardcode_libdir_flag_spec_FC= export_dynamic_flag_spec_FC= whole_archive_flag_spec_FC= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag_FC=unsupported always_export_symbols_FC=yes archive_expsym_cmds_FC='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L_FC=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct_FC=unsupported fi ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds_FC='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_FC='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_FC='' hardcode_direct_FC=yes hardcode_direct_absolute_FC=yes hardcode_libdir_separator_FC=':' link_all_deplibs_FC=yes file_list_spec_FC='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct_FC=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_FC=yes hardcode_libdir_flag_spec_FC='-L$libdir' hardcode_libdir_separator_FC= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi export_dynamic_flag_spec_FC='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols_FC=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag_FC='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath__FC+:} false; then : $as_echo_n "(cached) " >&6 else cat > conftest.$ac_ext <<_ACEOF program main end _ACEOF if ac_fn_fc_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath__FC=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath__FC"; then lt_cv_aix_libpath__FC=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__FC"; then lt_cv_aix_libpath__FC="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath__FC fi hardcode_libdir_flag_spec_FC='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_FC='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec_FC='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag_FC="-z nodefs" archive_expsym_cmds_FC="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath__FC+:} false; then : $as_echo_n "(cached) " >&6 else cat > conftest.$ac_ext <<_ACEOF program main end _ACEOF if ac_fn_fc_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath__FC=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath__FC"; then lt_cv_aix_libpath__FC=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__FC"; then lt_cv_aix_libpath__FC="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath__FC fi hardcode_libdir_flag_spec_FC='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_FC=' ${wl}-bernotok' allow_undefined_flag_FC=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec_FC='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_FC='$convenience' fi archive_cmds_need_lc_FC=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds_FC="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_FC='' ;; m68k) archive_cmds_FC='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec_FC='-L$libdir' hardcode_minus_L_FC=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec_FC=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC hardcode_libdir_flag_spec_FC=' ' allow_undefined_flag_FC=unsupported always_export_symbols_FC=yes file_list_spec_FC='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds_FC='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' archive_expsym_cmds_FC='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, FC)='true' enable_shared_with_static_runtimes_FC=yes exclude_expsyms_FC='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' export_symbols_cmds_FC='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds_FC='chmod 644 $oldlib' postlink_cmds_FC='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper hardcode_libdir_flag_spec_FC=' ' allow_undefined_flag_FC=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds_FC='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds_FC='true' # FIXME: Should let the user specify the lib program. old_archive_cmds_FC='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes_FC=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc_FC=no hardcode_direct_FC=no hardcode_automatic_FC=yes hardcode_shlibpath_var_FC=unsupported if test "$lt_cv_ld_force_load" = "yes"; then whole_archive_flag_spec_FC='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' compiler_needs_object_FC=yes else whole_archive_flag_spec_FC='' fi link_all_deplibs_FC=yes allow_undefined_flag_FC="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all archive_cmds_FC="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds_FC="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds_FC="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" module_expsym_cmds_FC="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" else ld_shlibs_FC=no fi ;; dgux*) archive_cmds_FC='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_FC='-L$libdir' hardcode_shlibpath_var_FC=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds_FC='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec_FC='-R$libdir' hardcode_direct_FC=yes hardcode_shlibpath_var_FC=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) archive_cmds_FC='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_FC=yes hardcode_minus_L_FC=yes hardcode_shlibpath_var_FC=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds_FC='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_FC='-R$libdir' hardcode_direct_FC=yes hardcode_shlibpath_var_FC=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds_FC='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds_FC='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec_FC='${wl}+b ${wl}$libdir' hardcode_libdir_separator_FC=: hardcode_direct_FC=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_FC=yes export_dynamic_flag_spec_FC='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then archive_cmds_FC='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_FC='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec_FC='${wl}+b ${wl}$libdir' hardcode_libdir_separator_FC=: hardcode_direct_FC=yes hardcode_direct_absolute_FC=yes export_dynamic_flag_spec_FC='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_FC=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds_FC='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_FC='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_FC='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds_FC='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds_FC='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_FC='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec_FC='${wl}+b ${wl}$libdir' hardcode_libdir_separator_FC=: case $host_cpu in hppa*64*|ia64*) hardcode_direct_FC=no hardcode_shlibpath_var_FC=no ;; *) hardcode_direct_FC=yes hardcode_direct_absolute_FC=yes export_dynamic_flag_spec_FC='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L_FC=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds_FC='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" cat > conftest.$ac_ext <<_ACEOF subroutine foo end _ACEOF if ac_fn_fc_try_link "$LINENO"; then : lt_cv_irix_exported_symbol=yes else lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$lt_cv_irix_exported_symbol" >&6; } if test "$lt_cv_irix_exported_symbol" = yes; then archive_expsym_cmds_FC='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else archive_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_FC='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc_FC='no' hardcode_libdir_flag_spec_FC='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_FC=: inherit_rpath_FC=yes link_all_deplibs_FC=yes ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds_FC='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds_FC='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec_FC='-R$libdir' hardcode_direct_FC=yes hardcode_shlibpath_var_FC=no ;; newsos6) archive_cmds_FC='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_FC=yes hardcode_libdir_flag_spec_FC='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_FC=: hardcode_shlibpath_var_FC=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct_FC=yes hardcode_shlibpath_var_FC=no hardcode_direct_absolute_FC=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds_FC='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_FC='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec_FC='${wl}-rpath,$libdir' export_dynamic_flag_spec_FC='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds_FC='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_FC='-R$libdir' ;; *) archive_cmds_FC='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_FC='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs_FC=no fi ;; os2*) hardcode_libdir_flag_spec_FC='-L$libdir' hardcode_minus_L_FC=yes allow_undefined_flag_FC=unsupported archive_cmds_FC='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_from_new_cmds_FC='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag_FC=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_FC='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag_FC=' -expect_unresolved \*' archive_cmds_FC='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi archive_cmds_need_lc_FC='no' hardcode_libdir_flag_spec_FC='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_FC=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag_FC=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_FC='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_FC='${wl}-rpath ${wl}$libdir' else allow_undefined_flag_FC=' -expect_unresolved \*' archive_cmds_FC='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_FC='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_FC='-rpath $libdir' fi archive_cmds_need_lc_FC='no' hardcode_libdir_separator_FC=: ;; solaris*) no_undefined_flag_FC=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds_FC='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_FC='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds_FC='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_FC='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' archive_cmds_FC='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_FC='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec_FC='-R$libdir' hardcode_shlibpath_var_FC=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then whole_archive_flag_spec_FC='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else whole_archive_flag_spec_FC='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs_FC=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds_FC='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_FC='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec_FC='-L$libdir' hardcode_direct_FC=yes hardcode_minus_L_FC=yes hardcode_shlibpath_var_FC=no ;; sysv4) case $host_vendor in sni) archive_cmds_FC='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_FC=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds_FC='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds_FC='$CC -r -o $output$reload_objs' hardcode_direct_FC=no ;; motorola) archive_cmds_FC='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct_FC=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var_FC=no ;; sysv4.3*) archive_cmds_FC='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_FC=no export_dynamic_flag_spec_FC='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds_FC='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var_FC=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs_FC=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag_FC='${wl}-z,text' archive_cmds_need_lc_FC=no hardcode_shlibpath_var_FC=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_FC='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_FC='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_FC='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_FC='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag_FC='${wl}-z,text' allow_undefined_flag_FC='${wl}-z,nodefs' archive_cmds_need_lc_FC=no hardcode_shlibpath_var_FC=no hardcode_libdir_flag_spec_FC='${wl}-R,$libdir' hardcode_libdir_separator_FC=':' link_all_deplibs_FC=yes export_dynamic_flag_spec_FC='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds_FC='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_FC='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds_FC='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_FC='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds_FC='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec_FC='-L$libdir' hardcode_shlibpath_var_FC=no ;; *) ld_shlibs_FC=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec_FC='${wl}-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_FC" >&5 $as_echo "$ld_shlibs_FC" >&6; } test "$ld_shlibs_FC" = no && can_build_shared=no with_gnu_ld_FC=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_FC" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_FC=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds_FC in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc_FC+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_FC pic_flag=$lt_prog_compiler_pic_FC compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_FC allow_undefined_flag_FC= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_FC 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds_FC 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc_FC=no else lt_cv_archive_cmds_need_lc_FC=yes fi allow_undefined_flag_FC=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_FC" >&5 $as_echo "$lt_cv_archive_cmds_need_lc_FC" >&6; } archive_cmds_need_lc_FC=$lt_cv_archive_cmds_need_lc_FC ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_FC\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_FC\"" cat > conftest.$ac_ext <<_ACEOF program main end _ACEOF if ac_fn_fc_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Add ABI-specific directories to the system library path. sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action_FC= if test -n "$hardcode_libdir_flag_spec_FC" || test -n "$runpath_var_FC" || test "X$hardcode_automatic_FC" = "Xyes" ; then # We can hardcode non-existent directories. if test "$hardcode_direct_FC" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, FC)" != no && test "$hardcode_minus_L_FC" != no; then # Linking always hardcodes the temporary library directory. hardcode_action_FC=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_FC=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_FC=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_FC" >&5 $as_echo "$hardcode_action_FC" >&6; } if test "$hardcode_action_FC" = relink || test "$inherit_rpath_FC" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test "$_lt_disable_FC" != yes ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Check whether --enable-fortran was given. if test "${enable_fortran+set}" = set; then : enableval=$enable_fortran; fi # Check to see if explicitly disabled if test "x$enable_fortran" != "xyes"; then : FC="" F77="" fi if test -n "$FC"; then : # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int*" >&5 $as_echo_n "checking size of int*... " >&6; } if ${ac_cv_sizeof_intp+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int*))" "ac_cv_sizeof_intp" "$ac_includes_default"; then : else if test "$ac_cv_type_intp" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (int*) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_intp=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_intp" >&5 $as_echo "$ac_cv_sizeof_intp" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_INTP $ac_cv_sizeof_intp _ACEOF if test "x$ac_cv_sizeof_intp" == "x4"; then : F2CFORTRAN_32PTR="yes" else { $as_echo "$as_me:${as_lineno-$LINENO}: Non-32 bit system; some fortran tests will be skipped" >&5 $as_echo "$as_me: Non-32 bit system; some fortran tests will be skipped" >&6;} fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking fortran compiler" >&5 $as_echo_n "checking fortran compiler... " >&6; } ac_ext=${ac_fc_srcext-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_fc_compiler_gnu cat > conftest.$ac_ext <<_ACEOF program main INTEGER :: I REAL :: R I=TRANSFER(R,I) end _ACEOF if ac_fn_fc_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: Fortran 90 code was successfully compiled; assume f90 or later" >&5 $as_echo "Fortran 90 code was successfully compiled; assume f90 or later" >&6; } F2CFORTRAN_90="yes" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: Fortran 90 code format was not compiled; assume f77" >&5 $as_echo "Fortran 90 code format was not compiled; assume f77" >&6; } fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu F2CFORTRAN_MACRO="yes" CPPFLAGS="$CPPFLAGS -Df2cFortran=1" else { $as_echo "$as_me:${as_lineno-$LINENO}: Fortran compiler not found" >&5 $as_echo "$as_me: Fortran compiler not found" >&6;} F2CFORTRAN_MACRO="no" fi ################################### # SZLIB checks ################################### # Check whether --with-szlib was given. if test "${with_szlib+set}" = set; then : withval=$with_szlib; else withval=default fi if ## if withval==no szlib is disabled ## test "x$withval" == "xno"; then : HAVE_LIBSZ="no" elif ## Look for it, but do not abort if we can't find it ## test "x$withval" == "xdefault"; then : inc_path= if test "x$ac_cv_header_szlib_h" != "xyes"; then : saved_CPPFLAGS="$CPPFLAGS" if test -n "$inc_path"; then : CPPFLAGS="$CPPFLAGS -I$inc_path" fi unset ac_cv_header_szlib_h for ac_header in szlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "szlib.h" "ac_cv_header_szlib_h" "$ac_includes_default" if test "x$ac_cv_header_szlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SZLIB_H 1 _ACEOF else CPPFLAGS="$saved_CPPFLAGS" fi done fi inc_path=/usr/local/include if test "x$ac_cv_header_szlib_h" != "xyes"; then : saved_CPPFLAGS="$CPPFLAGS" if test -n "$inc_path"; then : CPPFLAGS="$CPPFLAGS -I$inc_path" fi unset ac_cv_header_szlib_h for ac_header in szlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "szlib.h" "ac_cv_header_szlib_h" "$ac_includes_default" if test "x$ac_cv_header_szlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SZLIB_H 1 _ACEOF else CPPFLAGS="$saved_CPPFLAGS" fi done fi inc_path=/opt/local/include if test "x$ac_cv_header_szlib_h" != "xyes"; then : saved_CPPFLAGS="$CPPFLAGS" if test -n "$inc_path"; then : CPPFLAGS="$CPPFLAGS -I$inc_path" fi unset ac_cv_header_szlib_h for ac_header in szlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "szlib.h" "ac_cv_header_szlib_h" "$ac_includes_default" if test "x$ac_cv_header_szlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SZLIB_H 1 _ACEOF else CPPFLAGS="$saved_CPPFLAGS" fi done fi inc_path=/opt/local/lib/libaec/include if test "x$ac_cv_header_szlib_h" != "xyes"; then : saved_CPPFLAGS="$CPPFLAGS" if test -n "$inc_path"; then : CPPFLAGS="$CPPFLAGS -I$inc_path" fi unset ac_cv_header_szlib_h for ac_header in szlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "szlib.h" "ac_cv_header_szlib_h" "$ac_includes_default" if test "x$ac_cv_header_szlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SZLIB_H 1 _ACEOF else CPPFLAGS="$saved_CPPFLAGS" fi done fi lib_path= if test "x$ac_cv_lib_sz_SZ_BufftoBuffCompress" != "xyes"; then : unset ac_cv_lib_sz_SZ_BufftoBuffCompress saved_LDFLAGS="$LDFLAGS" if test -n "$lib_path"; then : LDFLAGS="$LDFLAGS -L$lib_path" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SZ_BufftoBuffCompress in -lsz" >&5 $as_echo_n "checking for SZ_BufftoBuffCompress in -lsz... " >&6; } if ${ac_cv_lib_sz_SZ_BufftoBuffCompress+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsz $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char SZ_BufftoBuffCompress (); int main () { return SZ_BufftoBuffCompress (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_sz_SZ_BufftoBuffCompress=yes else ac_cv_lib_sz_SZ_BufftoBuffCompress=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sz_SZ_BufftoBuffCompress" >&5 $as_echo "$ac_cv_lib_sz_SZ_BufftoBuffCompress" >&6; } if test "x$ac_cv_lib_sz_SZ_BufftoBuffCompress" = xyes; then : ac_cv_lib_sz_SZ_BufftoBuffCompress="yes" HAVE_LIBSZ="yes" lib_name=HAVE_LIBSZ cat >>confdefs.h <<_ACEOF #define $lib_name 1 _ACEOF LIBS="-lsz $LIBS" else LDFLAGS="$saved_LDFLAGS" ac_cv_lib_sz_SZ_BufftoBuffCompress="no" fi fi lib_path=/usr/local/lib if test "x$ac_cv_lib_sz_SZ_BufftoBuffCompress" != "xyes"; then : unset ac_cv_lib_sz_SZ_BufftoBuffCompress saved_LDFLAGS="$LDFLAGS" if test -n "$lib_path"; then : LDFLAGS="$LDFLAGS -L$lib_path" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SZ_BufftoBuffCompress in -lsz" >&5 $as_echo_n "checking for SZ_BufftoBuffCompress in -lsz... " >&6; } if ${ac_cv_lib_sz_SZ_BufftoBuffCompress+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsz $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char SZ_BufftoBuffCompress (); int main () { return SZ_BufftoBuffCompress (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_sz_SZ_BufftoBuffCompress=yes else ac_cv_lib_sz_SZ_BufftoBuffCompress=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sz_SZ_BufftoBuffCompress" >&5 $as_echo "$ac_cv_lib_sz_SZ_BufftoBuffCompress" >&6; } if test "x$ac_cv_lib_sz_SZ_BufftoBuffCompress" = xyes; then : ac_cv_lib_sz_SZ_BufftoBuffCompress="yes" HAVE_LIBSZ="yes" lib_name=HAVE_LIBSZ cat >>confdefs.h <<_ACEOF #define $lib_name 1 _ACEOF LIBS="-lsz $LIBS" else LDFLAGS="$saved_LDFLAGS" ac_cv_lib_sz_SZ_BufftoBuffCompress="no" fi fi lib_path=/opt/local/lib if test "x$ac_cv_lib_sz_SZ_BufftoBuffCompress" != "xyes"; then : unset ac_cv_lib_sz_SZ_BufftoBuffCompress saved_LDFLAGS="$LDFLAGS" if test -n "$lib_path"; then : LDFLAGS="$LDFLAGS -L$lib_path" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SZ_BufftoBuffCompress in -lsz" >&5 $as_echo_n "checking for SZ_BufftoBuffCompress in -lsz... " >&6; } if ${ac_cv_lib_sz_SZ_BufftoBuffCompress+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsz $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char SZ_BufftoBuffCompress (); int main () { return SZ_BufftoBuffCompress (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_sz_SZ_BufftoBuffCompress=yes else ac_cv_lib_sz_SZ_BufftoBuffCompress=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sz_SZ_BufftoBuffCompress" >&5 $as_echo "$ac_cv_lib_sz_SZ_BufftoBuffCompress" >&6; } if test "x$ac_cv_lib_sz_SZ_BufftoBuffCompress" = xyes; then : ac_cv_lib_sz_SZ_BufftoBuffCompress="yes" HAVE_LIBSZ="yes" lib_name=HAVE_LIBSZ cat >>confdefs.h <<_ACEOF #define $lib_name 1 _ACEOF LIBS="-lsz $LIBS" else LDFLAGS="$saved_LDFLAGS" ac_cv_lib_sz_SZ_BufftoBuffCompress="no" fi fi lib_path=/opt/local/lib/libaec/lib if test "x$ac_cv_lib_sz_SZ_BufftoBuffCompress" != "xyes"; then : unset ac_cv_lib_sz_SZ_BufftoBuffCompress saved_LDFLAGS="$LDFLAGS" if test -n "$lib_path"; then : LDFLAGS="$LDFLAGS -L$lib_path" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SZ_BufftoBuffCompress in -lsz" >&5 $as_echo_n "checking for SZ_BufftoBuffCompress in -lsz... " >&6; } if ${ac_cv_lib_sz_SZ_BufftoBuffCompress+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsz $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char SZ_BufftoBuffCompress (); int main () { return SZ_BufftoBuffCompress (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_sz_SZ_BufftoBuffCompress=yes else ac_cv_lib_sz_SZ_BufftoBuffCompress=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sz_SZ_BufftoBuffCompress" >&5 $as_echo "$ac_cv_lib_sz_SZ_BufftoBuffCompress" >&6; } if test "x$ac_cv_lib_sz_SZ_BufftoBuffCompress" = xyes; then : ac_cv_lib_sz_SZ_BufftoBuffCompress="yes" HAVE_LIBSZ="yes" lib_name=HAVE_LIBSZ cat >>confdefs.h <<_ACEOF #define $lib_name 1 _ACEOF LIBS="-lsz $LIBS" else LDFLAGS="$saved_LDFLAGS" ac_cv_lib_sz_SZ_BufftoBuffCompress="no" fi fi lib_path=/usr/lib64 if test "x$ac_cv_lib_sz_SZ_BufftoBuffCompress" != "xyes"; then : unset ac_cv_lib_sz_SZ_BufftoBuffCompress saved_LDFLAGS="$LDFLAGS" if test -n "$lib_path"; then : LDFLAGS="$LDFLAGS -L$lib_path" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SZ_BufftoBuffCompress in -lsz" >&5 $as_echo_n "checking for SZ_BufftoBuffCompress in -lsz... " >&6; } if ${ac_cv_lib_sz_SZ_BufftoBuffCompress+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsz $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char SZ_BufftoBuffCompress (); int main () { return SZ_BufftoBuffCompress (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_sz_SZ_BufftoBuffCompress=yes else ac_cv_lib_sz_SZ_BufftoBuffCompress=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sz_SZ_BufftoBuffCompress" >&5 $as_echo "$ac_cv_lib_sz_SZ_BufftoBuffCompress" >&6; } if test "x$ac_cv_lib_sz_SZ_BufftoBuffCompress" = xyes; then : ac_cv_lib_sz_SZ_BufftoBuffCompress="yes" HAVE_LIBSZ="yes" lib_name=HAVE_LIBSZ cat >>confdefs.h <<_ACEOF #define $lib_name 1 _ACEOF LIBS="-lsz $LIBS" else LDFLAGS="$saved_LDFLAGS" ac_cv_lib_sz_SZ_BufftoBuffCompress="no" fi fi elif ## if withval==yes We need to find szlib ## test "x$withval" == "xyes"; then : inc_path= if test "x$ac_cv_header_szlib_h" != "xyes"; then : saved_CPPFLAGS="$CPPFLAGS" if test -n "$inc_path"; then : CPPFLAGS="$CPPFLAGS -I$inc_path" fi unset ac_cv_header_szlib_h for ac_header in szlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "szlib.h" "ac_cv_header_szlib_h" "$ac_includes_default" if test "x$ac_cv_header_szlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SZLIB_H 1 _ACEOF else CPPFLAGS="$saved_CPPFLAGS" fi done fi inc_path=/usr/local/include if test "x$ac_cv_header_szlib_h" != "xyes"; then : saved_CPPFLAGS="$CPPFLAGS" if test -n "$inc_path"; then : CPPFLAGS="$CPPFLAGS -I$inc_path" fi unset ac_cv_header_szlib_h for ac_header in szlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "szlib.h" "ac_cv_header_szlib_h" "$ac_includes_default" if test "x$ac_cv_header_szlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SZLIB_H 1 _ACEOF else CPPFLAGS="$saved_CPPFLAGS" fi done fi inc_path=/opt/local/include if test "x$ac_cv_header_szlib_h" != "xyes"; then : saved_CPPFLAGS="$CPPFLAGS" if test -n "$inc_path"; then : CPPFLAGS="$CPPFLAGS -I$inc_path" fi unset ac_cv_header_szlib_h for ac_header in szlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "szlib.h" "ac_cv_header_szlib_h" "$ac_includes_default" if test "x$ac_cv_header_szlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SZLIB_H 1 _ACEOF else CPPFLAGS="$saved_CPPFLAGS" fi done fi inc_path=/opt/local/lib/libaec/include if test "x$ac_cv_header_szlib_h" != "xyes"; then : saved_CPPFLAGS="$CPPFLAGS" if test -n "$inc_path"; then : CPPFLAGS="$CPPFLAGS -I$inc_path" fi unset ac_cv_header_szlib_h for ac_header in szlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "szlib.h" "ac_cv_header_szlib_h" "$ac_includes_default" if test "x$ac_cv_header_szlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SZLIB_H 1 _ACEOF else CPPFLAGS="$saved_CPPFLAGS" fi done fi if test "x$ac_cv_header_szlib_h" != "xyes"; then : as_fn_error $? "couldn't find szlib header" "$LINENO" 5 fi lib_path= if test "x$ac_cv_lib_sz_SZ_BufftoBuffCompress" != "xyes"; then : unset ac_cv_lib_sz_SZ_BufftoBuffCompress saved_LDFLAGS="$LDFLAGS" if test -n "$lib_path"; then : LDFLAGS="$LDFLAGS -L$lib_path" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SZ_BufftoBuffCompress in -lsz" >&5 $as_echo_n "checking for SZ_BufftoBuffCompress in -lsz... " >&6; } if ${ac_cv_lib_sz_SZ_BufftoBuffCompress+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsz $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char SZ_BufftoBuffCompress (); int main () { return SZ_BufftoBuffCompress (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_sz_SZ_BufftoBuffCompress=yes else ac_cv_lib_sz_SZ_BufftoBuffCompress=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sz_SZ_BufftoBuffCompress" >&5 $as_echo "$ac_cv_lib_sz_SZ_BufftoBuffCompress" >&6; } if test "x$ac_cv_lib_sz_SZ_BufftoBuffCompress" = xyes; then : ac_cv_lib_sz_SZ_BufftoBuffCompress="yes" HAVE_LIBSZ="yes" lib_name=HAVE_LIBSZ cat >>confdefs.h <<_ACEOF #define $lib_name 1 _ACEOF LIBS="-lsz $LIBS" else LDFLAGS="$saved_LDFLAGS" ac_cv_lib_sz_SZ_BufftoBuffCompress="no" fi fi lib_path=/usr/local/lib if test "x$ac_cv_lib_sz_SZ_BufftoBuffCompress" != "xyes"; then : unset ac_cv_lib_sz_SZ_BufftoBuffCompress saved_LDFLAGS="$LDFLAGS" if test -n "$lib_path"; then : LDFLAGS="$LDFLAGS -L$lib_path" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SZ_BufftoBuffCompress in -lsz" >&5 $as_echo_n "checking for SZ_BufftoBuffCompress in -lsz... " >&6; } if ${ac_cv_lib_sz_SZ_BufftoBuffCompress+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsz $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char SZ_BufftoBuffCompress (); int main () { return SZ_BufftoBuffCompress (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_sz_SZ_BufftoBuffCompress=yes else ac_cv_lib_sz_SZ_BufftoBuffCompress=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sz_SZ_BufftoBuffCompress" >&5 $as_echo "$ac_cv_lib_sz_SZ_BufftoBuffCompress" >&6; } if test "x$ac_cv_lib_sz_SZ_BufftoBuffCompress" = xyes; then : ac_cv_lib_sz_SZ_BufftoBuffCompress="yes" HAVE_LIBSZ="yes" lib_name=HAVE_LIBSZ cat >>confdefs.h <<_ACEOF #define $lib_name 1 _ACEOF LIBS="-lsz $LIBS" else LDFLAGS="$saved_LDFLAGS" ac_cv_lib_sz_SZ_BufftoBuffCompress="no" fi fi lib_path=/opt/local/lib if test "x$ac_cv_lib_sz_SZ_BufftoBuffCompress" != "xyes"; then : unset ac_cv_lib_sz_SZ_BufftoBuffCompress saved_LDFLAGS="$LDFLAGS" if test -n "$lib_path"; then : LDFLAGS="$LDFLAGS -L$lib_path" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SZ_BufftoBuffCompress in -lsz" >&5 $as_echo_n "checking for SZ_BufftoBuffCompress in -lsz... " >&6; } if ${ac_cv_lib_sz_SZ_BufftoBuffCompress+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsz $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char SZ_BufftoBuffCompress (); int main () { return SZ_BufftoBuffCompress (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_sz_SZ_BufftoBuffCompress=yes else ac_cv_lib_sz_SZ_BufftoBuffCompress=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sz_SZ_BufftoBuffCompress" >&5 $as_echo "$ac_cv_lib_sz_SZ_BufftoBuffCompress" >&6; } if test "x$ac_cv_lib_sz_SZ_BufftoBuffCompress" = xyes; then : ac_cv_lib_sz_SZ_BufftoBuffCompress="yes" HAVE_LIBSZ="yes" lib_name=HAVE_LIBSZ cat >>confdefs.h <<_ACEOF #define $lib_name 1 _ACEOF LIBS="-lsz $LIBS" else LDFLAGS="$saved_LDFLAGS" ac_cv_lib_sz_SZ_BufftoBuffCompress="no" fi fi lib_path=/opt/local/lib/libaec/lib if test "x$ac_cv_lib_sz_SZ_BufftoBuffCompress" != "xyes"; then : unset ac_cv_lib_sz_SZ_BufftoBuffCompress saved_LDFLAGS="$LDFLAGS" if test -n "$lib_path"; then : LDFLAGS="$LDFLAGS -L$lib_path" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SZ_BufftoBuffCompress in -lsz" >&5 $as_echo_n "checking for SZ_BufftoBuffCompress in -lsz... " >&6; } if ${ac_cv_lib_sz_SZ_BufftoBuffCompress+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsz $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char SZ_BufftoBuffCompress (); int main () { return SZ_BufftoBuffCompress (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_sz_SZ_BufftoBuffCompress=yes else ac_cv_lib_sz_SZ_BufftoBuffCompress=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sz_SZ_BufftoBuffCompress" >&5 $as_echo "$ac_cv_lib_sz_SZ_BufftoBuffCompress" >&6; } if test "x$ac_cv_lib_sz_SZ_BufftoBuffCompress" = xyes; then : ac_cv_lib_sz_SZ_BufftoBuffCompress="yes" HAVE_LIBSZ="yes" lib_name=HAVE_LIBSZ cat >>confdefs.h <<_ACEOF #define $lib_name 1 _ACEOF LIBS="-lsz $LIBS" else LDFLAGS="$saved_LDFLAGS" ac_cv_lib_sz_SZ_BufftoBuffCompress="no" fi fi lib_path=/usr/lib64 if test "x$ac_cv_lib_sz_SZ_BufftoBuffCompress" != "xyes"; then : unset ac_cv_lib_sz_SZ_BufftoBuffCompress saved_LDFLAGS="$LDFLAGS" if test -n "$lib_path"; then : LDFLAGS="$LDFLAGS -L$lib_path" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SZ_BufftoBuffCompress in -lsz" >&5 $as_echo_n "checking for SZ_BufftoBuffCompress in -lsz... " >&6; } if ${ac_cv_lib_sz_SZ_BufftoBuffCompress+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsz $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char SZ_BufftoBuffCompress (); int main () { return SZ_BufftoBuffCompress (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_sz_SZ_BufftoBuffCompress=yes else ac_cv_lib_sz_SZ_BufftoBuffCompress=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sz_SZ_BufftoBuffCompress" >&5 $as_echo "$ac_cv_lib_sz_SZ_BufftoBuffCompress" >&6; } if test "x$ac_cv_lib_sz_SZ_BufftoBuffCompress" = xyes; then : ac_cv_lib_sz_SZ_BufftoBuffCompress="yes" HAVE_LIBSZ="yes" lib_name=HAVE_LIBSZ cat >>confdefs.h <<_ACEOF #define $lib_name 1 _ACEOF LIBS="-lsz $LIBS" else LDFLAGS="$saved_LDFLAGS" ac_cv_lib_sz_SZ_BufftoBuffCompress="no" fi fi if test "x$HAVE_LIBSZ" != "xyes"; then : as_fn_error $? "couldn't find szlib library" "$LINENO" 5 fi else ## Else ## szlib_inc="`echo $withval |awk -F, '{print $1}'`" szlib_lib="`echo $withval |awk -F, '{print $2}'`" if test -z "$szlib_inc"; then : # No options provided at all else # A single option provided - use it for both inc and lib, but add suffix if test -z "$szlib_lib"; then : szlib_lib="$szlib_inc/lib" szlib_inc="$szlib_inc/include" fi CPPFLAGS="$CPPFLAGS -I$szlib_inc" LDFLAGS="$LDFLAGS -L$szlib_lib" fi for ac_header in szlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "szlib.h" "ac_cv_header_szlib_h" "$ac_includes_default" if test "x$ac_cv_header_szlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SZLIB_H 1 _ACEOF else as_fn_error $? "couldn't find szlib header file" "$LINENO" 5 fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SZ_BufftoBuffCompress in -lsz" >&5 $as_echo_n "checking for SZ_BufftoBuffCompress in -lsz... " >&6; } if ${ac_cv_lib_sz_SZ_BufftoBuffCompress+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsz $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char SZ_BufftoBuffCompress (); int main () { return SZ_BufftoBuffCompress (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_sz_SZ_BufftoBuffCompress=yes else ac_cv_lib_sz_SZ_BufftoBuffCompress=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sz_SZ_BufftoBuffCompress" >&5 $as_echo "$ac_cv_lib_sz_SZ_BufftoBuffCompress" >&6; } if test "x$ac_cv_lib_sz_SZ_BufftoBuffCompress" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBSZ 1 _ACEOF LIBS="-lsz $LIBS" else as_fn_error $? "couldn't find szlib library" "$LINENO" 5 fi HAVE_LIBSZ="yes" fi # If szlib is available, additional checks are required to determine the # available functionality. By default decoding is assumed. We are really just # interested in whether or not encoding is also enabled. if test "x$HAVE_LIBSZ" == "xyes"; then : # Check for encoding functionality { $as_echo "$as_me:${as_lineno-$LINENO}: checking if szlib is functional" >&5 $as_echo_n "checking if szlib is functional... " >&6; } if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling See \`config.log' for more details" "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main(void) { SZ_encoder_enabled(); exit(0); } _ACEOF if ac_fn_c_try_run "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else as_fn_error $? "szlib is not functional" "$LINENO" 5 fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi $as_echo "#define HAVE_FILTER_SZIP 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking szlib encoding" >&5 $as_echo_n "checking szlib encoding... " >&6; } if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling See \`config.log' for more details" "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main(void) { /* SZ_encoder_enabled returns 1 if encoder is present */ if(SZ_encoder_enabled() == 1) exit(0); else exit(1); } _ACEOF if ac_fn_c_try_run "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } $as_echo "#define HAVE_FILTER_SZIP_ENCODER 1" >>confdefs.h USE_SZIP_ENCODER="yes" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi ################################### # Check for HDF5 library ################################### # Note that this is a required component - we cannot build HDF-EOS5 without it # Check whether --with-hdf5 was given. if test "${with_hdf5+set}" = set; then : withval=$with_hdf5; else withval=yes fi if test "x$withval" == "xno"; then : as_fn_error $? "HDF5 is a required dependency." "$LINENO" 5 elif # No options, so we must try and find the HDF4 library test "x$withval" == "xyes"; then : # Test some library locations to see if we can find the HDF libraries lib_path= if test "x$ac_cv_lib_hdf5_H5Fcreate" != "xyes"; then : unset ac_cv_lib_hdf5_H5Fcreate saved_LDFLAGS="$LDFLAGS" if test -n "$lib_path"; then : LDFLAGS="$LDFLAGS -L$lib_path" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for H5Fcreate in -lhdf5" >&5 $as_echo_n "checking for H5Fcreate in -lhdf5... " >&6; } if ${ac_cv_lib_hdf5_H5Fcreate+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lhdf5 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char H5Fcreate (); int main () { return H5Fcreate (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_hdf5_H5Fcreate=yes else ac_cv_lib_hdf5_H5Fcreate=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_hdf5_H5Fcreate" >&5 $as_echo "$ac_cv_lib_hdf5_H5Fcreate" >&6; } if test "x$ac_cv_lib_hdf5_H5Fcreate" = xyes; then : ac_cv_lib_hdf5_H5Fcreate="yes" HAVE_LIBHDF5="yes" lib_name=HAVE_LIBHDF5 cat >>confdefs.h <<_ACEOF #define $lib_name 1 _ACEOF LIBS="-lhdf5 $LIBS" else LDFLAGS="$saved_LDFLAGS" ac_cv_lib_hdf5_H5Fcreate="no" fi fi lib_path=/usr/local/lib if test "x$ac_cv_lib_hdf5_H5Fcreate" != "xyes"; then : unset ac_cv_lib_hdf5_H5Fcreate saved_LDFLAGS="$LDFLAGS" if test -n "$lib_path"; then : LDFLAGS="$LDFLAGS -L$lib_path" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for H5Fcreate in -lhdf5" >&5 $as_echo_n "checking for H5Fcreate in -lhdf5... " >&6; } if ${ac_cv_lib_hdf5_H5Fcreate+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lhdf5 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char H5Fcreate (); int main () { return H5Fcreate (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_hdf5_H5Fcreate=yes else ac_cv_lib_hdf5_H5Fcreate=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_hdf5_H5Fcreate" >&5 $as_echo "$ac_cv_lib_hdf5_H5Fcreate" >&6; } if test "x$ac_cv_lib_hdf5_H5Fcreate" = xyes; then : ac_cv_lib_hdf5_H5Fcreate="yes" HAVE_LIBHDF5="yes" lib_name=HAVE_LIBHDF5 cat >>confdefs.h <<_ACEOF #define $lib_name 1 _ACEOF LIBS="-lhdf5 $LIBS" else LDFLAGS="$saved_LDFLAGS" ac_cv_lib_hdf5_H5Fcreate="no" fi fi lib_path=/opt/local/lib if test "x$ac_cv_lib_hdf5_H5Fcreate" != "xyes"; then : unset ac_cv_lib_hdf5_H5Fcreate saved_LDFLAGS="$LDFLAGS" if test -n "$lib_path"; then : LDFLAGS="$LDFLAGS -L$lib_path" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for H5Fcreate in -lhdf5" >&5 $as_echo_n "checking for H5Fcreate in -lhdf5... " >&6; } if ${ac_cv_lib_hdf5_H5Fcreate+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lhdf5 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char H5Fcreate (); int main () { return H5Fcreate (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_hdf5_H5Fcreate=yes else ac_cv_lib_hdf5_H5Fcreate=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_hdf5_H5Fcreate" >&5 $as_echo "$ac_cv_lib_hdf5_H5Fcreate" >&6; } if test "x$ac_cv_lib_hdf5_H5Fcreate" = xyes; then : ac_cv_lib_hdf5_H5Fcreate="yes" HAVE_LIBHDF5="yes" lib_name=HAVE_LIBHDF5 cat >>confdefs.h <<_ACEOF #define $lib_name 1 _ACEOF LIBS="-lhdf5 $LIBS" else LDFLAGS="$saved_LDFLAGS" ac_cv_lib_hdf5_H5Fcreate="no" fi fi lib_path=/usr/lib64 if test "x$ac_cv_lib_hdf5_H5Fcreate" != "xyes"; then : unset ac_cv_lib_hdf5_H5Fcreate saved_LDFLAGS="$LDFLAGS" if test -n "$lib_path"; then : LDFLAGS="$LDFLAGS -L$lib_path" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for H5Fcreate in -lhdf5" >&5 $as_echo_n "checking for H5Fcreate in -lhdf5... " >&6; } if ${ac_cv_lib_hdf5_H5Fcreate+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lhdf5 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char H5Fcreate (); int main () { return H5Fcreate (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_hdf5_H5Fcreate=yes else ac_cv_lib_hdf5_H5Fcreate=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_hdf5_H5Fcreate" >&5 $as_echo "$ac_cv_lib_hdf5_H5Fcreate" >&6; } if test "x$ac_cv_lib_hdf5_H5Fcreate" = xyes; then : ac_cv_lib_hdf5_H5Fcreate="yes" HAVE_LIBHDF5="yes" lib_name=HAVE_LIBHDF5 cat >>confdefs.h <<_ACEOF #define $lib_name 1 _ACEOF LIBS="-lhdf5 $LIBS" else LDFLAGS="$saved_LDFLAGS" ac_cv_lib_hdf5_H5Fcreate="no" fi fi lib_path=/usr/lib/x86_64-linux-gnu/hdf5/serial if test "x$ac_cv_lib_hdf5_H5Fcreate" != "xyes"; then : unset ac_cv_lib_hdf5_H5Fcreate saved_LDFLAGS="$LDFLAGS" if test -n "$lib_path"; then : LDFLAGS="$LDFLAGS -L$lib_path" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for H5Fcreate in -lhdf5" >&5 $as_echo_n "checking for H5Fcreate in -lhdf5... " >&6; } if ${ac_cv_lib_hdf5_H5Fcreate+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lhdf5 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char H5Fcreate (); int main () { return H5Fcreate (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_hdf5_H5Fcreate=yes else ac_cv_lib_hdf5_H5Fcreate=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_hdf5_H5Fcreate" >&5 $as_echo "$ac_cv_lib_hdf5_H5Fcreate" >&6; } if test "x$ac_cv_lib_hdf5_H5Fcreate" = xyes; then : ac_cv_lib_hdf5_H5Fcreate="yes" HAVE_LIBHDF5="yes" lib_name=HAVE_LIBHDF5 cat >>confdefs.h <<_ACEOF #define $lib_name 1 _ACEOF LIBS="-lhdf5 $LIBS" else LDFLAGS="$saved_LDFLAGS" ac_cv_lib_hdf5_H5Fcreate="no" fi fi # Check to see if we can find the HDF5 header file inc_path= if test "x$ac_cv_header_hdf5_h" != "xyes"; then : saved_CPPFLAGS="$CPPFLAGS" if test -n "$inc_path"; then : CPPFLAGS="$CPPFLAGS -I$inc_path" fi unset ac_cv_header_hdf5_h for ac_header in hdf5.h do : ac_fn_c_check_header_mongrel "$LINENO" "hdf5.h" "ac_cv_header_hdf5_h" "$ac_includes_default" if test "x$ac_cv_header_hdf5_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_HDF5_H 1 _ACEOF else CPPFLAGS="$saved_CPPFLAGS" fi done fi inc_path=/usr/local/include if test "x$ac_cv_header_hdf5_h" != "xyes"; then : saved_CPPFLAGS="$CPPFLAGS" if test -n "$inc_path"; then : CPPFLAGS="$CPPFLAGS -I$inc_path" fi unset ac_cv_header_hdf5_h for ac_header in hdf5.h do : ac_fn_c_check_header_mongrel "$LINENO" "hdf5.h" "ac_cv_header_hdf5_h" "$ac_includes_default" if test "x$ac_cv_header_hdf5_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_HDF5_H 1 _ACEOF else CPPFLAGS="$saved_CPPFLAGS" fi done fi inc_path=/opt/local/include if test "x$ac_cv_header_hdf5_h" != "xyes"; then : saved_CPPFLAGS="$CPPFLAGS" if test -n "$inc_path"; then : CPPFLAGS="$CPPFLAGS -I$inc_path" fi unset ac_cv_header_hdf5_h for ac_header in hdf5.h do : ac_fn_c_check_header_mongrel "$LINENO" "hdf5.h" "ac_cv_header_hdf5_h" "$ac_includes_default" if test "x$ac_cv_header_hdf5_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_HDF5_H 1 _ACEOF else CPPFLAGS="$saved_CPPFLAGS" fi done fi inc_path=/usr/include/hdf5/serial if test "x$ac_cv_header_hdf5_h" != "xyes"; then : saved_CPPFLAGS="$CPPFLAGS" if test -n "$inc_path"; then : CPPFLAGS="$CPPFLAGS -I$inc_path" fi unset ac_cv_header_hdf5_h for ac_header in hdf5.h do : ac_fn_c_check_header_mongrel "$LINENO" "hdf5.h" "ac_cv_header_hdf5_h" "$ac_includes_default" if test "x$ac_cv_header_hdf5_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_HDF5_H 1 _ACEOF else CPPFLAGS="$saved_CPPFLAGS" fi done fi else # A user specified directory (one or two) hdf5_inc="`echo $withval |awk -F, '{print $1}'`" hdf5_lib="`echo $withval |awk -F, '{print $2}'`" if test -z "$hdf5_lib"; then : hdf5_lib="$hdf5_inc/lib" hdf5_inc="$hdf5_inc/include" fi lib_path= if test "x$ac_cv_lib_hdf5_H5Fcreate" != "xyes"; then : unset ac_cv_lib_hdf5_H5Fcreate saved_LDFLAGS="$LDFLAGS" if test -n "$lib_path"; then : LDFLAGS="$LDFLAGS -L$lib_path" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for H5Fcreate in -lhdf5" >&5 $as_echo_n "checking for H5Fcreate in -lhdf5... " >&6; } if ${ac_cv_lib_hdf5_H5Fcreate+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lhdf5 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char H5Fcreate (); int main () { return H5Fcreate (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_hdf5_H5Fcreate=yes else ac_cv_lib_hdf5_H5Fcreate=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_hdf5_H5Fcreate" >&5 $as_echo "$ac_cv_lib_hdf5_H5Fcreate" >&6; } if test "x$ac_cv_lib_hdf5_H5Fcreate" = xyes; then : ac_cv_lib_hdf5_H5Fcreate="yes" HAVE_LIBHDF5="yes" lib_name=HAVE_LIBHDF5 cat >>confdefs.h <<_ACEOF #define $lib_name 1 _ACEOF LIBS="-lhdf5 $LIBS" else LDFLAGS="$saved_LDFLAGS" ac_cv_lib_hdf5_H5Fcreate="no" fi fi lib_path=$hdf5_lib if test "x$ac_cv_lib_hdf5_H5Fcreate" != "xyes"; then : unset ac_cv_lib_hdf5_H5Fcreate saved_LDFLAGS="$LDFLAGS" if test -n "$lib_path"; then : LDFLAGS="$LDFLAGS -L$lib_path" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for H5Fcreate in -lhdf5" >&5 $as_echo_n "checking for H5Fcreate in -lhdf5... " >&6; } if ${ac_cv_lib_hdf5_H5Fcreate+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lhdf5 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char H5Fcreate (); int main () { return H5Fcreate (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_hdf5_H5Fcreate=yes else ac_cv_lib_hdf5_H5Fcreate=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_hdf5_H5Fcreate" >&5 $as_echo "$ac_cv_lib_hdf5_H5Fcreate" >&6; } if test "x$ac_cv_lib_hdf5_H5Fcreate" = xyes; then : ac_cv_lib_hdf5_H5Fcreate="yes" HAVE_LIBHDF5="yes" lib_name=HAVE_LIBHDF5 cat >>confdefs.h <<_ACEOF #define $lib_name 1 _ACEOF LIBS="-lhdf5 $LIBS" else LDFLAGS="$saved_LDFLAGS" ac_cv_lib_hdf5_H5Fcreate="no" fi fi inc_path= if test "x$ac_cv_header_hdf5_h" != "xyes"; then : saved_CPPFLAGS="$CPPFLAGS" if test -n "$inc_path"; then : CPPFLAGS="$CPPFLAGS -I$inc_path" fi unset ac_cv_header_hdf5_h for ac_header in hdf5.h do : ac_fn_c_check_header_mongrel "$LINENO" "hdf5.h" "ac_cv_header_hdf5_h" "$ac_includes_default" if test "x$ac_cv_header_hdf5_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_HDF5_H 1 _ACEOF else CPPFLAGS="$saved_CPPFLAGS" fi done fi inc_path=$hdf5_inc if test "x$ac_cv_header_hdf5_h" != "xyes"; then : saved_CPPFLAGS="$CPPFLAGS" if test -n "$inc_path"; then : CPPFLAGS="$CPPFLAGS -I$inc_path" fi unset ac_cv_header_hdf5_h for ac_header in hdf5.h do : ac_fn_c_check_header_mongrel "$LINENO" "hdf5.h" "ac_cv_header_hdf5_h" "$ac_includes_default" if test "x$ac_cv_header_hdf5_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_HDF5_H 1 _ACEOF else CPPFLAGS="$saved_CPPFLAGS" fi done fi fi # Verify presence of all required headers and libraries if test -z "$HAVE_LIBHDF5"; then : as_fn_error $? "unable to find HDF5 library" "$LINENO" 5 fi if test "x$ac_cv_header_hdf5_h" != "xyes"; then : as_fn_error $? "couldn't find HDF5 library header files" "$LINENO" 5 fi ################################### # Check for High Level HDF5 lib ################################### { $as_echo "$as_me:${as_lineno-$LINENO}: checking for H5DSset_label in -lhdf5_hl" >&5 $as_echo_n "checking for H5DSset_label in -lhdf5_hl... " >&6; } if ${ac_cv_lib_hdf5_hl_H5DSset_label+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lhdf5_hl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char H5DSset_label (); int main () { return H5DSset_label (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_hdf5_hl_H5DSset_label=yes else ac_cv_lib_hdf5_hl_H5DSset_label=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_hdf5_hl_H5DSset_label" >&5 $as_echo "$ac_cv_lib_hdf5_hl_H5DSset_label" >&6; } if test "x$ac_cv_lib_hdf5_hl_H5DSset_label" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBHDF5_HL 1 _ACEOF LIBS="-lhdf5_hl $LIBS" fi ################################### # Check for thread safety in # HDF5 library ################################### { $as_echo "$as_me:${as_lineno-$LINENO}: checking if HDF5 threadsafe mode is enabled" >&5 $as_echo_n "checking if HDF5 threadsafe mode is enabled... " >&6; } if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling See \`config.log' for more details" "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #ifdef H5_HAVE_THREADSAFE return 0; #else return 1; #endif ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } HDF5_THREADSAFE="yes" if test "x$ac_cv_lib_pthread_pthread_create" == "xno"; then : as_fn_error $? "HDF5 is multi-threaded, but no threading library found" "$LINENO" 5 fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } HDF5_THREADSAFE="no" fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi # Record threadsafe status in config.h and for Makefiles if test "x$HDF5_THREADSAFE" = "xyes"; then $as_echo "#define _HDFEOS5_THREADSAFE 1" >>confdefs.h fi if test "x$HDF5_THREADSAFE" = "xyes"; then HDF5_THREADSAFE_TRUE= HDF5_THREADSAFE_FALSE='#' else HDF5_THREADSAFE_TRUE='#' HDF5_THREADSAFE_FALSE= fi ################################### # Check for H5free_memory in # HDF5 library ################################### for ac_func in H5free_memory do : ac_fn_c_check_func "$LINENO" "H5free_memory" "ac_cv_func_H5free_memory" if test "x$ac_cv_func_H5free_memory" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_H5FREE_MEMORY 1 _ACEOF fi done ################################### # Check for SZIP in HDF5 library ################################### # At this point, we know we can link against hdf5. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for hdf5 szip decoding filter" >&5 $as_echo_n "checking for hdf5 szip decoding filter... " >&6; } if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling See \`config.log' for more details" "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { herr_t ret; unsigned int flags = 0; int decoder = 0; ret = H5Zget_filter_info(H5Z_FILTER_SZIP, &flags); if (ret < 0) exit(1); decoder = flags & H5Z_FILTER_CONFIG_DECODE_ENABLED; if (decoder) exit(0); else exit(1); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } # HDF5 supports decoding. We have to make sure szlib is included. In the case # of static library linkage, this would already have been verified (the program # wouldn't run), but shared object libraries might use lazy resolution, so we # verify if test "x$HAVE_LIBSZ" != "xyes"; then : as_fn_error $? "HDF5 requires SZIP, please use --with-szlib" "$LINENO" 5 fi $as_echo "#define HAVE_HDF5_SZIP_DECODER 1" >>confdefs.h $as_echo "#define H5_HAVE_FILTER_SZIP 1" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for hdf5 szip encoding support" >&5 $as_echo_n "checking for hdf5 szip encoding support... " >&6; } if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling See \`config.log' for more details" "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { herr_t ret; unsigned int flags = 0; int encoder = 0; ret = H5Zget_filter_info(H5Z_FILTER_SZIP, &flags); if (ret < 0) exit(1); encoder = flags & H5Z_FILTER_CONFIG_ENCODE_ENABLED; if (encoder) exit(0); else exit(1); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } if test "x$USE_SZIP_ENCODER" != "xyes"; then : as_fn_error $? "HDF5 requires SZIP with encoding support" "$LINENO" 5 fi $as_echo "#define HAVE_HDF5_SZIP_ENCODER 1" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi ################################### # Enable/disable installation of # GCTP headers (usually not needed) ################################### # Check whether --enable-gctp-include was given. if test "${enable_gctp_include+set}" = set; then : enableval=$enable_gctp_include; fi if test "x$enable_gctp_include" == "xyes"; then GCTP_INCLUDE_CONDITIONAL_TRUE= GCTP_INCLUDE_CONDITIONAL_FALSE='#' else GCTP_INCLUDE_CONDITIONAL_TRUE='#' GCTP_INCLUDE_CONDITIONAL_FALSE= fi ################################### # Miscellaneous checks ################################### CFLAGS=$CFLAGS # Checks for programs. ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi # Checks for libraries. # Checks for header files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi for ac_header in limits.h malloc.h stdlib.h string.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # Checks for typedefs, structures, and compiler characteristics. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if ${ac_cv_c_const+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __cplusplus /* Ultrix mips cc rejects this sort of thing. */ typedef int charset[2]; const charset cs = { 0, 0 }; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* 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"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this sort of thing. */ char tx; char *t = &tx; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 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 sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; } bx; struct s *b = &bx; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes else ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then $as_echo "#define const /**/" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default" if test "x$ac_cv_type_off_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define off_t long int _ACEOF fi ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi # Checks for library functions. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working memcmp" >&5 $as_echo_n "checking for working memcmp... " >&6; } if ${ac_cv_func_memcmp_working+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_memcmp_working=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* Some versions of memcmp are not 8-bit clean. */ char c0 = '\100', c1 = '\200', c2 = '\201'; if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0) return 1; /* The Next x86 OpenStep bug shows up only when comparing 16 bytes or more and with at least one buffer not starting on a 4-byte boundary. William Lewis provided this test program. */ { char foo[21]; char bar[21]; int i; for (i = 0; i < 4; i++) { char *a = foo + i; char *b = bar + i; strcpy (a, "--------01111111"); strcpy (b, "--------10000000"); if (memcmp (a, b, 16) >= 0) return 1; } return 0; } ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_memcmp_working=yes else ac_cv_func_memcmp_working=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_memcmp_working" >&5 $as_echo "$ac_cv_func_memcmp_working" >&6; } test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in *" memcmp.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS memcmp.$ac_objext" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for error_at_line" >&5 $as_echo_n "checking for error_at_line... " >&6; } if ${ac_cv_lib_error_at_line+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { error_at_line (0, 0, "", 0, "an error occurred"); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_error_at_line=yes else ac_cv_lib_error_at_line=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_error_at_line" >&5 $as_echo "$ac_cv_lib_error_at_line" >&6; } if test $ac_cv_lib_error_at_line = no; then case " $LIBOBJS " in *" error.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS error.$ac_objext" ;; esac fi for ac_func in memchr memmove memset pow sqrt strchr strstr do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done # Use version 1 of the hdf5 API $as_echo "#define H5_USE_16_API 1" >>confdefs.h if test "x$F2CFORTRAN_MACRO" = "xyes"; then F2CFORTRAN_CONDITIONAL_TRUE= F2CFORTRAN_CONDITIONAL_FALSE='#' else F2CFORTRAN_CONDITIONAL_TRUE='#' F2CFORTRAN_CONDITIONAL_FALSE= fi if test "x$F2CFORTRAN_90" = "xyes"; then F2CFORTRAN_90_CONDITIONAL_TRUE= F2CFORTRAN_90_CONDITIONAL_FALSE='#' else F2CFORTRAN_90_CONDITIONAL_TRUE='#' F2CFORTRAN_90_CONDITIONAL_FALSE= fi if test "x$F2CFORTRAN_32PTR" = "xyes"; then F2CFORTRAN_32PTR_CONDITIONAL_TRUE= F2CFORTRAN_32PTR_CONDITIONAL_FALSE='#' else F2CFORTRAN_32PTR_CONDITIONAL_TRUE='#' F2CFORTRAN_32PTR_CONDITIONAL_FALSE= fi if test "x$H5_HAVE_FILTER_SZIP" = "xyes"; then SZIP_ENCODER_CONDITIONAL_TRUE= SZIP_ENCODER_CONDITIONAL_FALSE='#' else SZIP_ENCODER_CONDITIONAL_TRUE='#' SZIP_ENCODER_CONDITIONAL_FALSE= fi cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs { $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 $as_echo_n "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HDF5_THREADSAFE_TRUE}" && test -z "${HDF5_THREADSAFE_FALSE}"; then as_fn_error $? "conditional \"HDF5_THREADSAFE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${GCTP_INCLUDE_CONDITIONAL_TRUE}" && test -z "${GCTP_INCLUDE_CONDITIONAL_FALSE}"; then as_fn_error $? "conditional \"GCTP_INCLUDE_CONDITIONAL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${F2CFORTRAN_CONDITIONAL_TRUE}" && test -z "${F2CFORTRAN_CONDITIONAL_FALSE}"; then as_fn_error $? "conditional \"F2CFORTRAN_CONDITIONAL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${F2CFORTRAN_90_CONDITIONAL_TRUE}" && test -z "${F2CFORTRAN_90_CONDITIONAL_FALSE}"; then as_fn_error $? "conditional \"F2CFORTRAN_90_CONDITIONAL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${F2CFORTRAN_32PTR_CONDITIONAL_TRUE}" && test -z "${F2CFORTRAN_32PTR_CONDITIONAL_FALSE}"; then as_fn_error $? "conditional \"F2CFORTRAN_32PTR_CONDITIONAL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${SZIP_ENCODER_CONDITIONAL_TRUE}" && test -z "${SZIP_ENCODER_CONDITIONAL_FALSE}"; then as_fn_error $? "conditional \"SZIP_ENCODER_CONDITIONAL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by hdf-eos5 $as_me 2.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ hdf-eos5 config.status 2.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`' predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`' postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`' predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`' postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`' compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`' LD_F77='`$ECHO "$LD_F77" | $SED "$delay_single_quote_subst"`' LD_FC='`$ECHO "$LD_FC" | $SED "$delay_single_quote_subst"`' reload_flag_F77='`$ECHO "$reload_flag_F77" | $SED "$delay_single_quote_subst"`' reload_flag_FC='`$ECHO "$reload_flag_FC" | $SED "$delay_single_quote_subst"`' reload_cmds_F77='`$ECHO "$reload_cmds_F77" | $SED "$delay_single_quote_subst"`' reload_cmds_FC='`$ECHO "$reload_cmds_FC" | $SED "$delay_single_quote_subst"`' old_archive_cmds_F77='`$ECHO "$old_archive_cmds_F77" | $SED "$delay_single_quote_subst"`' old_archive_cmds_FC='`$ECHO "$old_archive_cmds_FC" | $SED "$delay_single_quote_subst"`' compiler_F77='`$ECHO "$compiler_F77" | $SED "$delay_single_quote_subst"`' compiler_FC='`$ECHO "$compiler_FC" | $SED "$delay_single_quote_subst"`' GCC_F77='`$ECHO "$GCC_F77" | $SED "$delay_single_quote_subst"`' GCC_FC='`$ECHO "$GCC_FC" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag_F77='`$ECHO "$lt_prog_compiler_no_builtin_flag_F77" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag_FC='`$ECHO "$lt_prog_compiler_no_builtin_flag_FC" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic_F77='`$ECHO "$lt_prog_compiler_pic_F77" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic_FC='`$ECHO "$lt_prog_compiler_pic_FC" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl_F77='`$ECHO "$lt_prog_compiler_wl_F77" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl_FC='`$ECHO "$lt_prog_compiler_wl_FC" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static_F77='`$ECHO "$lt_prog_compiler_static_F77" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static_FC='`$ECHO "$lt_prog_compiler_static_FC" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o_F77='`$ECHO "$lt_cv_prog_compiler_c_o_F77" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o_FC='`$ECHO "$lt_cv_prog_compiler_c_o_FC" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc_F77='`$ECHO "$archive_cmds_need_lc_F77" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc_FC='`$ECHO "$archive_cmds_need_lc_FC" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes_F77='`$ECHO "$enable_shared_with_static_runtimes_F77" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes_FC='`$ECHO "$enable_shared_with_static_runtimes_FC" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec_F77='`$ECHO "$export_dynamic_flag_spec_F77" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec_FC='`$ECHO "$export_dynamic_flag_spec_FC" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec_F77='`$ECHO "$whole_archive_flag_spec_F77" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec_FC='`$ECHO "$whole_archive_flag_spec_FC" | $SED "$delay_single_quote_subst"`' compiler_needs_object_F77='`$ECHO "$compiler_needs_object_F77" | $SED "$delay_single_quote_subst"`' compiler_needs_object_FC='`$ECHO "$compiler_needs_object_FC" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds_F77='`$ECHO "$old_archive_from_new_cmds_F77" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds_FC='`$ECHO "$old_archive_from_new_cmds_FC" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds_F77='`$ECHO "$old_archive_from_expsyms_cmds_F77" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds_FC='`$ECHO "$old_archive_from_expsyms_cmds_FC" | $SED "$delay_single_quote_subst"`' archive_cmds_F77='`$ECHO "$archive_cmds_F77" | $SED "$delay_single_quote_subst"`' archive_cmds_FC='`$ECHO "$archive_cmds_FC" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds_F77='`$ECHO "$archive_expsym_cmds_F77" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds_FC='`$ECHO "$archive_expsym_cmds_FC" | $SED "$delay_single_quote_subst"`' module_cmds_F77='`$ECHO "$module_cmds_F77" | $SED "$delay_single_quote_subst"`' module_cmds_FC='`$ECHO "$module_cmds_FC" | $SED "$delay_single_quote_subst"`' module_expsym_cmds_F77='`$ECHO "$module_expsym_cmds_F77" | $SED "$delay_single_quote_subst"`' module_expsym_cmds_FC='`$ECHO "$module_expsym_cmds_FC" | $SED "$delay_single_quote_subst"`' with_gnu_ld_F77='`$ECHO "$with_gnu_ld_F77" | $SED "$delay_single_quote_subst"`' with_gnu_ld_FC='`$ECHO "$with_gnu_ld_FC" | $SED "$delay_single_quote_subst"`' allow_undefined_flag_F77='`$ECHO "$allow_undefined_flag_F77" | $SED "$delay_single_quote_subst"`' allow_undefined_flag_FC='`$ECHO "$allow_undefined_flag_FC" | $SED "$delay_single_quote_subst"`' no_undefined_flag_F77='`$ECHO "$no_undefined_flag_F77" | $SED "$delay_single_quote_subst"`' no_undefined_flag_FC='`$ECHO "$no_undefined_flag_FC" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec_F77='`$ECHO "$hardcode_libdir_flag_spec_F77" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec_FC='`$ECHO "$hardcode_libdir_flag_spec_FC" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator_F77='`$ECHO "$hardcode_libdir_separator_F77" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator_FC='`$ECHO "$hardcode_libdir_separator_FC" | $SED "$delay_single_quote_subst"`' hardcode_direct_F77='`$ECHO "$hardcode_direct_F77" | $SED "$delay_single_quote_subst"`' hardcode_direct_FC='`$ECHO "$hardcode_direct_FC" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute_F77='`$ECHO "$hardcode_direct_absolute_F77" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute_FC='`$ECHO "$hardcode_direct_absolute_FC" | $SED "$delay_single_quote_subst"`' hardcode_minus_L_F77='`$ECHO "$hardcode_minus_L_F77" | $SED "$delay_single_quote_subst"`' hardcode_minus_L_FC='`$ECHO "$hardcode_minus_L_FC" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var_F77='`$ECHO "$hardcode_shlibpath_var_F77" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var_FC='`$ECHO "$hardcode_shlibpath_var_FC" | $SED "$delay_single_quote_subst"`' hardcode_automatic_F77='`$ECHO "$hardcode_automatic_F77" | $SED "$delay_single_quote_subst"`' hardcode_automatic_FC='`$ECHO "$hardcode_automatic_FC" | $SED "$delay_single_quote_subst"`' inherit_rpath_F77='`$ECHO "$inherit_rpath_F77" | $SED "$delay_single_quote_subst"`' inherit_rpath_FC='`$ECHO "$inherit_rpath_FC" | $SED "$delay_single_quote_subst"`' link_all_deplibs_F77='`$ECHO "$link_all_deplibs_F77" | $SED "$delay_single_quote_subst"`' link_all_deplibs_FC='`$ECHO "$link_all_deplibs_FC" | $SED "$delay_single_quote_subst"`' always_export_symbols_F77='`$ECHO "$always_export_symbols_F77" | $SED "$delay_single_quote_subst"`' always_export_symbols_FC='`$ECHO "$always_export_symbols_FC" | $SED "$delay_single_quote_subst"`' export_symbols_cmds_F77='`$ECHO "$export_symbols_cmds_F77" | $SED "$delay_single_quote_subst"`' export_symbols_cmds_FC='`$ECHO "$export_symbols_cmds_FC" | $SED "$delay_single_quote_subst"`' exclude_expsyms_F77='`$ECHO "$exclude_expsyms_F77" | $SED "$delay_single_quote_subst"`' exclude_expsyms_FC='`$ECHO "$exclude_expsyms_FC" | $SED "$delay_single_quote_subst"`' include_expsyms_F77='`$ECHO "$include_expsyms_F77" | $SED "$delay_single_quote_subst"`' include_expsyms_FC='`$ECHO "$include_expsyms_FC" | $SED "$delay_single_quote_subst"`' prelink_cmds_F77='`$ECHO "$prelink_cmds_F77" | $SED "$delay_single_quote_subst"`' prelink_cmds_FC='`$ECHO "$prelink_cmds_FC" | $SED "$delay_single_quote_subst"`' postlink_cmds_F77='`$ECHO "$postlink_cmds_F77" | $SED "$delay_single_quote_subst"`' postlink_cmds_FC='`$ECHO "$postlink_cmds_FC" | $SED "$delay_single_quote_subst"`' file_list_spec_F77='`$ECHO "$file_list_spec_F77" | $SED "$delay_single_quote_subst"`' file_list_spec_FC='`$ECHO "$file_list_spec_FC" | $SED "$delay_single_quote_subst"`' hardcode_action_F77='`$ECHO "$hardcode_action_F77" | $SED "$delay_single_quote_subst"`' hardcode_action_FC='`$ECHO "$hardcode_action_FC" | $SED "$delay_single_quote_subst"`' compiler_lib_search_dirs_F77='`$ECHO "$compiler_lib_search_dirs_F77" | $SED "$delay_single_quote_subst"`' compiler_lib_search_dirs_FC='`$ECHO "$compiler_lib_search_dirs_FC" | $SED "$delay_single_quote_subst"`' predep_objects_F77='`$ECHO "$predep_objects_F77" | $SED "$delay_single_quote_subst"`' predep_objects_FC='`$ECHO "$predep_objects_FC" | $SED "$delay_single_quote_subst"`' postdep_objects_F77='`$ECHO "$postdep_objects_F77" | $SED "$delay_single_quote_subst"`' postdep_objects_FC='`$ECHO "$postdep_objects_FC" | $SED "$delay_single_quote_subst"`' predeps_F77='`$ECHO "$predeps_F77" | $SED "$delay_single_quote_subst"`' predeps_FC='`$ECHO "$predeps_FC" | $SED "$delay_single_quote_subst"`' postdeps_F77='`$ECHO "$postdeps_F77" | $SED "$delay_single_quote_subst"`' postdeps_FC='`$ECHO "$postdeps_FC" | $SED "$delay_single_quote_subst"`' compiler_lib_search_path_F77='`$ECHO "$compiler_lib_search_path_F77" | $SED "$delay_single_quote_subst"`' compiler_lib_search_path_FC='`$ECHO "$compiler_lib_search_path_FC" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } # Quote evaled strings. for var in SHELL \ ECHO \ PATH_SEPARATOR \ SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ DLLTOOL \ sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ nm_file_list_spec \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_separator \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ install_override_mode \ finish_eval \ old_striplib \ striplib \ compiler_lib_search_dirs \ predep_objects \ postdep_objects \ predeps \ postdeps \ compiler_lib_search_path \ LD_F77 \ LD_FC \ reload_flag_F77 \ reload_flag_FC \ compiler_F77 \ compiler_FC \ lt_prog_compiler_no_builtin_flag_F77 \ lt_prog_compiler_no_builtin_flag_FC \ lt_prog_compiler_pic_F77 \ lt_prog_compiler_pic_FC \ lt_prog_compiler_wl_F77 \ lt_prog_compiler_wl_FC \ lt_prog_compiler_static_F77 \ lt_prog_compiler_static_FC \ lt_cv_prog_compiler_c_o_F77 \ lt_cv_prog_compiler_c_o_FC \ export_dynamic_flag_spec_F77 \ export_dynamic_flag_spec_FC \ whole_archive_flag_spec_F77 \ whole_archive_flag_spec_FC \ compiler_needs_object_F77 \ compiler_needs_object_FC \ with_gnu_ld_F77 \ with_gnu_ld_FC \ allow_undefined_flag_F77 \ allow_undefined_flag_FC \ no_undefined_flag_F77 \ no_undefined_flag_FC \ hardcode_libdir_flag_spec_F77 \ hardcode_libdir_flag_spec_FC \ hardcode_libdir_separator_F77 \ hardcode_libdir_separator_FC \ exclude_expsyms_F77 \ exclude_expsyms_FC \ include_expsyms_F77 \ include_expsyms_FC \ file_list_spec_F77 \ file_list_spec_FC \ compiler_lib_search_dirs_F77 \ compiler_lib_search_dirs_FC \ predep_objects_F77 \ predep_objects_FC \ postdep_objects_F77 \ postdep_objects_FC \ predeps_F77 \ predeps_FC \ postdeps_F77 \ postdeps_FC \ compiler_lib_search_path_F77 \ compiler_lib_search_path_FC; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ sys_lib_dlsearch_path_spec \ reload_cmds_F77 \ reload_cmds_FC \ old_archive_cmds_F77 \ old_archive_cmds_FC \ old_archive_from_new_cmds_F77 \ old_archive_from_new_cmds_FC \ old_archive_from_expsyms_cmds_F77 \ old_archive_from_expsyms_cmds_FC \ archive_cmds_F77 \ archive_cmds_FC \ archive_expsym_cmds_F77 \ archive_expsym_cmds_FC \ module_cmds_F77 \ module_cmds_FC \ module_expsym_cmds_F77 \ module_expsym_cmds_FC \ export_symbols_cmds_F77 \ export_symbols_cmds_FC \ prelink_cmds_F77 \ prelink_cmds_FC \ postlink_cmds_F77 \ postlink_cmds_FC; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' xsi_shell='$xsi_shell' lt_shell_append='$lt_shell_append' # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "include/HE5_config.h") CONFIG_HEADERS="$CONFIG_HEADERS include/HE5_config.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "gctp/Makefile") CONFIG_FILES="$CONFIG_FILES gctp/Makefile" ;; "gctp/include/Makefile") CONFIG_FILES="$CONFIG_FILES gctp/include/Makefile" ;; "gctp/src/Makefile") CONFIG_FILES="$CONFIG_FILES gctp/src/Makefile" ;; "samples/Makefile") CONFIG_FILES="$CONFIG_FILES samples/Makefile" ;; "testdrivers/Makefile") CONFIG_FILES="$CONFIG_FILES testdrivers/Makefile" ;; "testdrivers/grid/Makefile") CONFIG_FILES="$CONFIG_FILES testdrivers/grid/Makefile" ;; "testdrivers/point/Makefile") CONFIG_FILES="$CONFIG_FILES testdrivers/point/Makefile" ;; "testdrivers/swath/Makefile") CONFIG_FILES="$CONFIG_FILES testdrivers/swath/Makefile" ;; "testdrivers/za/Makefile") CONFIG_FILES="$CONFIG_FILES testdrivers/za/Makefile" ;; "testdrivers/threads/Makefile") CONFIG_FILES="$CONFIG_FILES testdrivers/threads/Makefile" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; "libtool":C) # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # The names of the tagged configurations supported by this script. available_tags="F77 FC " # ### BEGIN LIBTOOL CONFIG # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Whether or not to build static libraries. build_old_libs=$enable_static # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that protects backslashes. ECHO=$lt_ECHO # The PATH separator for the build system. PATH_SEPARATOR=$lt_PATH_SEPARATOR # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # convert \$build file names to \$host format. to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd # An object symbol dumper. OBJDUMP=$lt_OBJDUMP # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob=$lt_file_magic_glob # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob=$lt_want_nocaseglob # DLL creation program. DLLTOOL=$lt_DLLTOOL # Command to associate shared and link libraries. sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR # Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Whether to use a lock for old archive extraction. lock_old_archive_extraction=$lock_old_archive_extraction # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec # The root where to search for dependent libraries,and in which our libraries should be installed. lt_sysroot=$lt_sysroot # The name of the directory that contains temporary libtool files. objdir=$objdir # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Manifest tool. MANIFEST_TOOL=$lt_MANIFEST_TOOL # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Permission mode override for installation of shared libraries. install_override_mode=$lt_install_override_mode # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \${shlibpath_var} if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # The directories searched by this compiler when creating a shared library. compiler_lib_search_dirs=$lt_compiler_lib_search_dirs # Dependencies to place before and after the objects being linked to # create a shared library. predep_objects=$lt_predep_objects postdep_objects=$lt_postdep_objects predeps=$lt_predeps postdeps=$lt_postdeps # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain="$ac_aux_dir/ltmain.sh" # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) if test x"$xsi_shell" = xyes; then sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ func_dirname ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ } # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_basename ()$/,/^} # func_basename /c\ func_basename ()\ {\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ func_dirname_and_basename ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ func_stripname ()\ {\ \ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ \ # positional parameters, so assign one to ordinary parameter first.\ \ func_stripname_result=${3}\ \ func_stripname_result=${func_stripname_result#"${1}"}\ \ func_stripname_result=${func_stripname_result%"${2}"}\ } # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ func_split_long_opt ()\ {\ \ func_split_long_opt_name=${1%%=*}\ \ func_split_long_opt_arg=${1#*=}\ } # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ func_split_short_opt ()\ {\ \ func_split_short_opt_arg=${1#??}\ \ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ } # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ func_lo2o ()\ {\ \ case ${1} in\ \ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ \ *) func_lo2o_result=${1} ;;\ \ esac\ } # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_xform ()$/,/^} # func_xform /c\ func_xform ()\ {\ func_xform_result=${1%.*}.lo\ } # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_arith ()$/,/^} # func_arith /c\ func_arith ()\ {\ func_arith_result=$(( $* ))\ } # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_len ()$/,/^} # func_len /c\ func_len ()\ {\ func_len_result=${#1}\ } # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$lt_shell_append" = xyes; then sed -e '/^func_append ()$/,/^} # func_append /c\ func_append ()\ {\ eval "${1}+=\\${2}"\ } # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ func_append_quoted ()\ {\ \ func_quote_for_eval "${2}"\ \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ } # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 $as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} fi mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" cat <<_LT_EOF >> "$ofile" # ### BEGIN LIBTOOL TAG CONFIG: F77 # The linker used to build libraries. LD=$lt_LD_F77 # How to create reloadable object files. reload_flag=$lt_reload_flag_F77 reload_cmds=$lt_reload_cmds_F77 # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds_F77 # A language specific compiler. CC=$lt_compiler_F77 # Is the compiler the GNU compiler? with_gcc=$GCC_F77 # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77 # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_F77 # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_F77 # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_F77 # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_F77 # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77 # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77 # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77 # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object_F77 # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77 # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77 # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds_F77 archive_expsym_cmds=$lt_archive_expsym_cmds_F77 # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds_F77 module_expsym_cmds=$lt_module_expsym_cmds_F77 # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld_F77 # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_F77 # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_F77 # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77 # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77 # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct_F77 # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \${shlibpath_var} if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute_F77 # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L_F77 # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_F77 # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic_F77 # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath_F77 # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_F77 # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols_F77 # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_F77 # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_F77 # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_F77 # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds_F77 # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds_F77 # Specify filename containing input files. file_list_spec=$lt_file_list_spec_F77 # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_F77 # The directories searched by this compiler when creating a shared library. compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_F77 # Dependencies to place before and after the objects being linked to # create a shared library. predep_objects=$lt_predep_objects_F77 postdep_objects=$lt_postdep_objects_F77 predeps=$lt_predeps_F77 postdeps=$lt_postdeps_F77 # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_F77 # ### END LIBTOOL TAG CONFIG: F77 _LT_EOF cat <<_LT_EOF >> "$ofile" # ### BEGIN LIBTOOL TAG CONFIG: FC # The linker used to build libraries. LD=$lt_LD_FC # How to create reloadable object files. reload_flag=$lt_reload_flag_FC reload_cmds=$lt_reload_cmds_FC # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds_FC # A language specific compiler. CC=$lt_compiler_FC # Is the compiler the GNU compiler? with_gcc=$GCC_FC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_FC # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_FC # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_FC # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_FC # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_FC # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_FC # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_FC # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_FC # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_FC # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object_FC # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_FC # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_FC # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds_FC archive_expsym_cmds=$lt_archive_expsym_cmds_FC # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds_FC module_expsym_cmds=$lt_module_expsym_cmds_FC # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld_FC # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_FC # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_FC # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_FC # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_FC # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct_FC # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \${shlibpath_var} if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute_FC # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L_FC # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_FC # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic_FC # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath_FC # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_FC # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols_FC # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_FC # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_FC # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_FC # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds_FC # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds_FC # Specify filename containing input files. file_list_spec=$lt_file_list_spec_FC # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_FC # The directories searched by this compiler when creating a shared library. compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_FC # Dependencies to place before and after the objects being linked to # create a shared library. predep_objects=$lt_predep_objects_FC postdep_objects=$lt_postdep_objects_FC predeps=$lt_predeps_FC postdeps=$lt_postdeps_FC # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_FC # ### END LIBTOOL TAG CONFIG: FC _LT_EOF ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi ################################### # SUMMARY ################################### { $as_echo "$as_me:${as_lineno-$LINENO}: ------------------------------------------" >&5 $as_echo "$as_me: ------------------------------------------" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: Configuration Summary" >&5 $as_echo "$as_me: Configuration Summary" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: ------------------------------------------" >&5 $as_echo "$as_me: ------------------------------------------" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: " >&5 $as_echo "$as_me: " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: CC: $CC" >&5 $as_echo "$as_me: CC: $CC" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: FC: $FC" >&5 $as_echo "$as_me: FC: $FC" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: F77: $F77" >&5 $as_echo "$as_me: F77: $F77" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: C flags: $CFLAGS" >&5 $as_echo "$as_me: C flags: $CFLAGS" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: CPP flags: $CPPFLAGS" >&5 $as_echo "$as_me: CPP flags: $CPPFLAGS" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: LD flags: $LDFLAGS" >&5 $as_echo "$as_me: LD flags: $LDFLAGS" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: LIB flags: $LIBS" >&5 $as_echo "$as_me: LIB flags: $LIBS" >&6;} hdf-eos5-2.0/configure.ac000077500000000000000000000372011507520047200152630ustar00rootroot00000000000000################################### # -*- Autoconf -*- ################################### ################################### # Boilerplate autoconf setup ################################### AC_PREREQ([2.59]) AC_INIT([hdf-eos5], [2.0], null@bogus.email) AC_CONFIG_AUX_DIR([config]) AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([foreign]) AM_MAINTAINER_MODE ## Note we disable shared libraries otherwise gfortran fails linking against the resulting ## libX.la files. With shared libraries disables, libtool links gfortran against the static ## library libX.a. If fortran is disabled, this can be overridden using --enabled-shared ## with configure AC_DISABLE_SHARED AC_PROG_LIBTOOL ################################### # Files that need to be configured ################################### AC_CONFIG_HEADER([include/HE5_config.h]) AC_CONFIG_FILES([Makefile include/Makefile src/Makefile gctp/Makefile gctp/include/Makefile gctp/src/Makefile samples/Makefile testdrivers/Makefile testdrivers/grid/Makefile testdrivers/point/Makefile testdrivers/swath/Makefile testdrivers/za/Makefile testdrivers/threads/Makefile doc/Makefile]) ################################### # Additional Macros ################################### m4_include(m4/stdlib.m4) m4_include(m4/stdinc.m4) ################################### # Start checks ################################### AC_LANG(C) # Check for the math library that HDF4 needs # AC_CHECK_LIB([m], [ceil]) ###################################################################### # Check size of some types # We pass these through directly via the cpp flags rather than the config # file to make it easier (given the current code state) to get it where # it needs to go. ###################################################################### AC_CHECK_SIZEOF(long) CPPFLAGS="${CPPFLAGS} -DSIZEOF_LONG=$ac_cv_sizeof_long" ################################### # Check endian-ness ################################### AC_C_BIGENDIAN([ AC_DEFINE([BIG_ENDIAN],[1],[Define if system is big-endian]) CPPFLAGS="${CPPFLAGS} -DBIG_ENDIAN=1" ]) ################################### # pthread library checks # This will be needed if the HDF5 # library is threaded, otherwise it # will be ignored. ################################### AC_CHECK_LIB([pthread], [pthread_create]) ################################### # ZLIB library checks ################################### # HDFEOS does not need libz directly, but the HDF library might. This means # we only need to find the libary, not the header files. HDF_CHECK_LIB([zlib],[z],[compress2],[,/usr/local/lib,/opt/local/lib,/usr/lib64]) AS_IF( [test -z "$HAVE_LIBZ"], [AC_MSG_ERROR(unable to find libz)] ) ################################### # FORTRAN compiler check ################################### # User may enable fortran components explicity with --enable-fortran # or --enable-fortran=yes AC_PROG_F77 AC_PROG_FC AC_ARG_ENABLE( [fortran], AS_HELP_STRING([--enable-fortran], [Enable fortran components/tests]),,) # Check to see if explicitly disabled AS_IF( [test "x$enable_fortran" != "xyes"], [ FC="" F77="" ]) AS_IF([test -n "$FC"], [ AC_CHECK_SIZEOF([int*]) AS_IF( [test "x$ac_cv_sizeof_intp" == "x4"], [ F2CFORTRAN_32PTR="yes" ],[ AC_MSG_NOTICE([Non-32 bit system; some fortran tests will be skipped]) ]) AC_MSG_CHECKING([fortran compiler]) AC_LANG_PUSH([Fortran]) AC_LINK_IFELSE( [ AC_LANG_PROGRAM([], [ INTEGER :: I REAL :: R I=TRANSFER(R,I) ]) ],[ AC_MSG_RESULT([Fortran 90 code was successfully compiled; assume f90 or later]) F2CFORTRAN_90="yes" ],[ AC_MSG_RESULT([Fortran 90 code format was not compiled; assume f77]) ]) AC_LANG_POP([Fortran]) F2CFORTRAN_MACRO="yes" CPPFLAGS="$CPPFLAGS -Df2cFortran=1" ],[ AC_MSG_NOTICE([Fortran compiler not found]) F2CFORTRAN_MACRO="no" ]) ################################### # SZLIB checks ################################### dnl -------------------------------------------------- dnl Check whether szlib is enabled. dnl If HDF4 is built with szlib, user should use --with-szlib=DIR option. dnl If this option is given, whether SZIP is decoder only or decoder plus encoder dnl should be checked. AC_ARG_WITH([szlib], [AC_HELP_STRING([--with-szlib=DIR], [Use szlib library for external szlib I/O filter. Linker must be able to find szlib if HDF4 was build with szip.])],, withval=default) AS_IF( ## if withval==no szlib is disabled ## [test "x$withval" == "xno"], [ HAVE_LIBSZ="no" ], ## Look for it, but do not abort if we can't find it ## [test "x$withval" == "xdefault"], [ HDF_CHECK_INC_PATH([szlib.h],[,/usr/local/include,/opt/local/include,/opt/local/lib/libaec/include]) HDF_CHECK_LIB_PATH([sz],[SZ_BufftoBuffCompress],[,/usr/local/lib,/opt/local/lib,/opt/local/lib/libaec/lib,/usr/lib64]) ], ## if withval==yes We need to find szlib ## [test "x$withval" == "xyes"], [ HDF_CHECK_INC_PATH([szlib.h],[,/usr/local/include,/opt/local/include,/opt/local/lib/libaec/include]) AS_IF( [test "x$ac_cv_header_szlib_h" != "xyes"], [AC_MSG_ERROR([couldn't find szlib header])] ) HDF_CHECK_LIB_PATH([sz],[SZ_BufftoBuffCompress],[,/usr/local/lib,/opt/local/lib,/opt/local/lib/libaec/lib,/usr/lib64]) AS_IF( [test "x$HAVE_LIBSZ" != "xyes"], [AC_MSG_ERROR([couldn't find szlib library])] ) ], ## Else ## [ szlib_inc="`echo $withval |awk -F, '{print $1}'`" szlib_lib="`echo $withval |awk -F, '{print $2}'`" AS_IF( [test -z "$szlib_inc"], [ # No options provided at all ], [ # A single option provided - use it for both inc and lib, but add suffix AS_IF( [test -z "$szlib_lib"], [ szlib_lib="$szlib_inc/lib" szlib_inc="$szlib_inc/include" ]) CPPFLAGS="$CPPFLAGS -I$szlib_inc" LDFLAGS="$LDFLAGS -L$szlib_lib" ]) AC_CHECK_HEADERS( [szlib.h],, [ AC_MSG_ERROR([couldn't find szlib header file]) ]) AC_CHECK_LIB( [sz], [SZ_BufftoBuffCompress],, [ AC_MSG_ERROR([couldn't find szlib library]) ]) HAVE_LIBSZ="yes" ]) # If szlib is available, additional checks are required to determine the # available functionality. By default decoding is assumed. We are really just # interested in whether or not encoding is also enabled. AS_IF( [test "x$HAVE_LIBSZ" == "xyes"], [ # Check for encoding functionality AC_MSG_CHECKING([if szlib is functional]) AC_TRY_RUN( [ #include #include int main(void) { SZ_encoder_enabled(); exit(0); } ],[ AC_MSG_RESULT([yes]) ],[ AC_MSG_ERROR([szlib is not functional]) ]) AC_DEFINE(HAVE_FILTER_SZIP, 1, [Define if support for szip filter is enabled]) AC_MSG_CHECKING([szlib encoding]) AC_TRY_RUN( [ #include #include int main(void) { /* SZ_encoder_enabled returns 1 if encoder is present */ if(SZ_encoder_enabled() == 1) exit(0); else exit(1); } ],[ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_FILTER_SZIP_ENCODER, 1, [Define if support for szip encoder filter is enabled]) USE_SZIP_ENCODER="yes" ],[ AC_MSG_RESULT([no]) ]) ]) ################################### # Check for HDF5 library ################################### # Note that this is a required component - we cannot build HDF-EOS5 without it AC_ARG_WITH( [hdf5], [AC_HELP_STRING( [--with-hdf5=DIR], [Specify path to HDF5 library to use while building [default=yes]] )],, withval=yes) AS_IF( [test "x$withval" == "xno"], [ AC_MSG_ERROR([HDF5 is a required dependency.]) ], # No options, so we must try and find the HDF4 library [test "x$withval" == "xyes"], [ # Test some library locations to see if we can find the HDF libraries HDF_CHECK_LIB_PATH([hdf5],[H5Fcreate],[,/usr/local/lib,/opt/local/lib,/usr/lib64,/usr/lib/x86_64-linux-gnu/hdf5/serial]) # Check to see if we can find the HDF5 header file HDF_CHECK_INC_PATH([hdf5.h],[,/usr/local/include,/opt/local/include,/usr/include/hdf5/serial]) ], # A user specified directory (one or two) [ hdf5_inc="`echo $withval |awk -F, '{print $1}'`" hdf5_lib="`echo $withval |awk -F, '{print $2}'`" AS_IF( [test -z "$hdf5_lib"], [ hdf5_lib="$hdf5_inc/lib" hdf5_inc="$hdf5_inc/include" ]) HDF_CHECK_LIB_PATH([hdf5],[H5Fcreate],[,$hdf5_lib]) HDF_CHECK_INC_PATH([hdf5.h],[,$hdf5_inc]) ]) # Verify presence of all required headers and libraries AS_IF( [test -z "$HAVE_LIBHDF5"], [AC_MSG_ERROR(unable to find HDF5 library)] ) AS_IF( [test "x$ac_cv_header_hdf5_h" != "xyes"], [AC_MSG_ERROR([couldn't find HDF5 library header files])] ) ################################### # Check for High Level HDF5 lib ################################### AC_CHECK_LIB([hdf5_hl],[H5DSset_label]) ################################### # Check for thread safety in # HDF5 library ################################### AC_MSG_CHECKING([if HDF5 threadsafe mode is enabled]) AC_RUN_IFELSE( [AC_LANG_PROGRAM( [ #include ],[ #ifdef H5_HAVE_THREADSAFE return 0; #else return 1; #endif ]) ],[ AC_MSG_RESULT([yes]) HDF5_THREADSAFE="yes" AS_IF( [test "x$ac_cv_lib_pthread_pthread_create" == "xno"], [ AC_MSG_ERROR([HDF5 is multi-threaded, but no threading library found]) ]) ], [ AC_MSG_RESULT([no]) HDF5_THREADSAFE="no" ]) # Record threadsafe status in config.h and for Makefiles if test "x$HDF5_THREADSAFE" = "xyes"; then AC_DEFINE([_HDFEOS5_THREADSAFE], [1], [Define if threadsafe HDF-EOS is enabled]) fi AM_CONDITIONAL([HDF5_THREADSAFE], [test "x$HDF5_THREADSAFE" = "xyes"]) ################################### # Check for H5free_memory in # HDF5 library ################################### AC_CHECK_FUNCS([H5free_memory]) ################################### # Check for SZIP in HDF5 library ################################### # At this point, we know we can link against hdf5. AC_MSG_CHECKING([for hdf5 szip decoding filter]) AC_RUN_IFELSE( [AC_LANG_PROGRAM( [ #include #include ],[ herr_t ret; unsigned int flags = 0; int decoder = 0; ret = H5Zget_filter_info(H5Z_FILTER_SZIP, &flags); if (ret < 0) exit(1); decoder = flags & H5Z_FILTER_CONFIG_DECODE_ENABLED; if (decoder) exit(0); else exit(1); ]) ], [ AC_MSG_RESULT([yes]) # HDF5 supports decoding. We have to make sure szlib is included. In the case # of static library linkage, this would already have been verified (the program # wouldn't run), but shared object libraries might use lazy resolution, so we # verify AS_IF( [test "x$HAVE_LIBSZ" != "xyes"], [ AC_MSG_ERROR([HDF5 requires SZIP, please use --with-szlib]) ]) AC_DEFINE(HAVE_HDF5_SZIP_DECODER, 1, [Defined if HDF5 has szip decoder filter]) AC_DEFINE(H5_HAVE_FILTER_SZIP, 1, [Define if HDF5 has szip any type of filter]) ],[ AC_MSG_RESULT([no]) ]) AC_MSG_CHECKING([for hdf5 szip encoding support]) AC_RUN_IFELSE( [AC_LANG_PROGRAM( [ #include #include ],[ herr_t ret; unsigned int flags = 0; int encoder = 0; ret = H5Zget_filter_info(H5Z_FILTER_SZIP, &flags); if (ret < 0) exit(1); encoder = flags & H5Z_FILTER_CONFIG_ENCODE_ENABLED; if (encoder) exit(0); else exit(1); ]) ],[ AC_MSG_RESULT([yes]) AS_IF( [test "x$USE_SZIP_ENCODER" != "xyes"], [ AC_MSG_ERROR([HDF5 requires SZIP with encoding support]) ]) AC_DEFINE(HAVE_HDF5_SZIP_ENCODER, 1, [Define if HDF5 has szip encoder filter]) ],[ AC_MSG_RESULT([no]) ]) ################################### # Enable/disable installation of # GCTP headers (usually not needed) ################################### AC_ARG_ENABLE( [gctp-include], AS_HELP_STRING([--enable-gctp-include], [Enable installation of GCTP library headers]),,) AM_CONDITIONAL([GCTP_INCLUDE_CONDITIONAL], [test "x$enable_gctp_include" == "xyes"]) ################################### # Miscellaneous checks ################################### CFLAGS=$CFLAGS # Checks for programs. AC_PROG_CC AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET # Checks for libraries. # Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([limits.h malloc.h stdlib.h string.h]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_OFF_T AC_TYPE_SIZE_T # Checks for library functions. AC_FUNC_MEMCMP AC_FUNC_ERROR_AT_LINE AC_CHECK_FUNCS([memchr memmove memset pow sqrt strchr strstr]) # Use version 1 of the hdf5 API AC_DEFINE([H5_USE_16_API], [1], [Define if HDF-EOS5 should use version 1 api]) AM_CONDITIONAL([F2CFORTRAN_CONDITIONAL], [test "x$F2CFORTRAN_MACRO" = "xyes"]) AM_CONDITIONAL([F2CFORTRAN_90_CONDITIONAL], [test "x$F2CFORTRAN_90" = "xyes"]) AM_CONDITIONAL([F2CFORTRAN_32PTR_CONDITIONAL], [test "x$F2CFORTRAN_32PTR" = "xyes"]) AM_CONDITIONAL([SZIP_ENCODER_CONDITIONAL], [test "x$H5_HAVE_FILTER_SZIP" = "xyes"]) AC_OUTPUT ################################### # SUMMARY ################################### AC_MSG_NOTICE([------------------------------------------]) AC_MSG_NOTICE([ Configuration Summary]) AC_MSG_NOTICE([------------------------------------------]) AC_MSG_NOTICE([ ]) AC_MSG_NOTICE([CC: $CC]) AC_MSG_NOTICE([FC: $FC]) AC_MSG_NOTICE([F77: $F77]) AC_MSG_NOTICE([C flags: $CFLAGS]) AC_MSG_NOTICE([CPP flags: $CPPFLAGS]) AC_MSG_NOTICE([LD flags: $LDFLAGS]) AC_MSG_NOTICE([LIB flags: $LIBS]) hdf-eos5-2.0/doc/000077500000000000000000000000001507520047200135345ustar00rootroot00000000000000hdf-eos5-2.0/doc/Makefile.am000066400000000000000000000001611507520047200155660ustar00rootroot00000000000000# HDF-EOS5 doc Makefile.am # Boilerplate definitions include $(top_srcdir)/config/include.am EXTRA_DIST=README hdf-eos5-2.0/doc/Makefile.in000066400000000000000000000276221507520047200156120ustar00rootroot00000000000000# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # HDF-EOS5 doc Makefile.am VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(top_srcdir)/config/include.am $(srcdir)/Makefile.in \ $(srcdir)/Makefile.am README subdir = doc ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/stdlib.m4 $(top_srcdir)/m4/stdinc.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/HE5_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FC = @FC@ FCFLAGS = @FCFLAGS@ FFLAGS = @FFLAGS@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ ac_ct_FC = @ac_ct_FC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ LIBHDFEOS5 = $(top_builddir)/src/libhe5_hdfeos.la LIBGCTP = $(top_builddir)/gctp/src/libGctp.la # Boilerplate definitions EXTRA_DIST = README all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/include.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign doc/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/config/include.am: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ cscopelist-am ctags-am distclean distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags-am uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: hdf-eos5-2.0/doc/README000077500000000000000000000172211507520047200144220ustar00rootroot00000000000000Installing HDF-EOS5 using Autoconf/Automake ------------------------------------------- Prerequisite ------------ The HDF-EOS5 library requires HDF5 library version 1.8.19 or later. You can download HDF5 from the HDF Group: https://www.hdfgroup.org/downloads/hdf5/ or, depending upon your system, you may be able to install it from a package. The HDF5 libary may depend upon other libraries, such as szip, z (compress). The HDF-EOS5 configure script will do its best to determine these dependencies and find the appropriate libraries, but it may occasionally need help. Please refer to the troubleshooting section at the bottom of this document. Configuring ----------- After downloading and unpacking the tar file, 'cd' into the hdfeos5 directory and type ./configure This will run a series of tests to determine the necessary library dependencies, and configure the makefiles accordingly. The configure script will output a summary of the configuration options at completion. These can be useful for troubleshooting. By default, the HDF-EOS5 libraries and include headers will be installed in /usr/local. This can be changed by using the --prefix option when running configure, e.g. ./configure --prefix=/custom/install/location A number of other options may be provided to the configure script. You can get details of these options using the command: ./configure --help Building -------- Once configured, you can build HDF-EOS5 by simply type make from the hdfeos5 directory. Tests ----- The HDF-EOS5 library comes with some tests. You can run these using the command make check from the hdfeos5 directory. These test may provide useful examples, but USE AT YOUR OWN RISK. Installing -------- To install HDF-EOS5, simply type make install from the hdfeos5 directory. You need to make sure you have the necessary permissions to install the files in the chosen location. Troubleshooting --------------- General ------- This section contains general troubleshooting tips. Additional sections below detail known issues for specific platforms. * Determining HDF5 Dependencies It can be difficult to find out what additional libraries HDF5 depends upon. This is usually just libz, but may also include libsz. You can get an idea of the dependencies by using the h5cc tool (you may have to search for this): h5cc -show This will produce output similar to the following: gcc -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_BSD_SOURCE -O0 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -L/usr/lib64 /usr/lib64/libhdf5_hl.a /usr/lib64/libhdf5.a -Wl,-z,relro -lsz -lz -ldl -lm -Wl,-rpath -Wl,/usr/lib64 It lists the libraries that HDF5 (and hence HDF-EOS5) programs will need to link against. In this case we can see both -lsz (libsz) and -lz (libz). * Finding libraries Most of the libraries need by HDF5 and HDF-EOS5 should be found automatically by the configure script, but if it cannot find them, you will need to provide that information to the configure script explicitly. If you need to find a library on your system, you can do this with a simple command: e.g. To find the sz library: find / -name 'libsz.*' This might produce output as follows: /usr/lib64/libsz.so /usr/lib64/libsz.so.2 /usr/lib64/libsz.so.2.0.1 In this case, we have a dynamic (shared) sz library in /usr/lib64 We can tell configure where to find it as follows: ./configure --with-szlib=/usr/lib64 If you cannot find a particular library, you will need to install the appropriate package. * Installing missing packages Linux distributions generally use a package manager to install software packages, though the specific tool varies depending upon the distribution. For example, Centos may use 'yum' while Ubuntu may use 'apt'. Max OSX systems, while 'Linux like', does not have an official package management tool like the Linux systems. However, there are independently developed tools such as MacPorts (https://www.macports.org/) and HomeBrew (https://brew.sh/) which are just as capable, and can provide everything you need. Packages often come in two different 'flavors' - regular, and 'devel'. The regular versions contain the libraries needed to run programs that use them. The 'devel' packages are developer oriented packages that include headers files needed to compile your own programs using that use the libraries. The following is a list of the key packages needed by HDF-EOS5: hdf5 The main HDF5 package. A 'devel' version is needed since HDF-EOS5 compiles against this library and needs the header files. zlib Compression library. A regular version can be used since HDF-EOS5 does not explicity invoke compression functions. aec Adaptive Entropy Encoding library (szip). This may or may not be needed, depending upon how HDF5 was built. If you have access to the h5cc commmand, you can use 'h5cc -show' to determine whether or not it is needed. If the output contains '-lsz', then you need aec. Most package versions of HDF5 do not use aec. If required, a regular version can be used. Examples of command to install packages on some of the common linux distributions are given below. Linux (Ubuntu/Debian) --------------------- * Finding/Installing packages These distributions tend to use 'apt' as the package manager. You can search for packages using apt as follows: apt-cache search hdf A package can be installed as follows: apt-get install libhdf4-dev One of the advantages of package managers is that if you install a package in this way, it will also install all the dependencies required by the package. You can see which additional packages a given package depends on as follows: apt-cache depends libhdf4-dev This is also a good way to determine whether or not aec is required. Linux (Redhat/Centos) --------------------- * Finding/Installing packages These distributions tend to use 'yum' as the package manager. You can search for packages using yum as follows: yum search hdf5 A package can be installed as follows: yum install hdf5-devel One of the advantages of package managers is that if you install a package in this way, it will also install all the dependencies required by the package. You can see which additional packages a given package depends on as follows: yum deplist hdf5-devel This is also a good way to determine whether or not aec is required. Mac OSX ------- * Finding/Installing packages using MacPorts You can search for packages using MacPorts as follows: port search --name "*hdf5*" A package can be installed as follows (you may need to run this using sudo): port install hdf5 As with Linux base package managers, MacPorts will also install all the depenencies required by a package. You can see which additional packages a given package depends on as follows: port info hdf5 Look for a line beginning 'Library Dependencies'. You can ignore any line beginning with 'Build Dependencies' since you will not be building HDF5. * Missing library 'System'. If your build fails with a message indicating it cannot find a library called 'System', try adding the following configure option: ./configure LDFLAGS=-L/usr/local This gives the location of the library to the linker. hdf-eos5-2.0/gctp/000077500000000000000000000000001507520047200137245ustar00rootroot00000000000000hdf-eos5-2.0/gctp/Makefile.am000077500000000000000000000003301507520047200157570ustar00rootroot00000000000000# GCTP library top-level Makefile # Boilerplate include (from HDF-EOS5 configuration) include $(top_srcdir)/config/include.am # Subdirectories if GCTP_INCLUDE_CONDITIONAL SUBDIRS=src include else SUBDIRS=src endif hdf-eos5-2.0/gctp/Makefile.in000066400000000000000000000443761507520047200160070ustar00rootroot00000000000000# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # GCTP library top-level Makefile VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(top_srcdir)/config/include.am $(srcdir)/Makefile.in \ $(srcdir)/Makefile.am subdir = gctp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/stdlib.m4 $(top_srcdir)/m4/stdinc.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/HE5_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = src include DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FC = @FC@ FCFLAGS = @FCFLAGS@ FFLAGS = @FFLAGS@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ ac_ct_FC = @ac_ct_FC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ LIBHDFEOS5 = $(top_builddir)/src/libhe5_hdfeos.la LIBGCTP = $(top_builddir)/gctp/src/libGctp.la @GCTP_INCLUDE_CONDITIONAL_FALSE@SUBDIRS = src # Boilerplate include (from HDF-EOS5 configuration) # Subdirectories @GCTP_INCLUDE_CONDITIONAL_TRUE@SUBDIRS = src include all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/include.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign gctp/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign gctp/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/config/include.am: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-libtool cscopelist-am ctags \ ctags-am distclean distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ ps ps-am tags tags-am uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: hdf-eos5-2.0/gctp/include/000077500000000000000000000000001507520047200153475ustar00rootroot00000000000000hdf-eos5-2.0/gctp/include/Makefile.am000077500000000000000000000005511507520047200174070ustar00rootroot00000000000000# GCTP include directory Makefile.am # Boilerplate definitions include $(top_srcdir)/config/include.am # Install these header files. ## Note that there are some files in hdfeos5/include with the same names. ## This doesn't currently cause problems, but could in the future. include_HEADERS = bcea.h cproj.h cproj_prototypes.h gctp_prototypes.h proj.h isin.h hdf-eos5-2.0/gctp/include/Makefile.in000066400000000000000000000404211507520047200174150ustar00rootroot00000000000000# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # GCTP include directory Makefile.am VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(top_srcdir)/config/include.am $(srcdir)/Makefile.in \ $(srcdir)/Makefile.am $(include_HEADERS) subdir = gctp/include ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/stdlib.m4 $(top_srcdir)/m4/stdinc.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/HE5_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(includedir)" HEADERS = $(include_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FC = @FC@ FCFLAGS = @FCFLAGS@ FFLAGS = @FFLAGS@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ ac_ct_FC = @ac_ct_FC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ LIBHDFEOS5 = $(top_builddir)/src/libhe5_hdfeos.la LIBGCTP = $(top_builddir)/gctp/src/libGctp.la # Boilerplate definitions # Install these header files. include_HEADERS = bcea.h cproj.h cproj_prototypes.h gctp_prototypes.h proj.h isin.h all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/include.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign gctp/include/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign gctp/include/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/config/include.am: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-includeHEADERS: $(include_HEADERS) @$(NORMAL_INSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ done uninstall-includeHEADERS: @$(NORMAL_UNINSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(HEADERS) installdirs: for dir in "$(DESTDIR)$(includedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-includeHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-includeHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool cscopelist-am ctags ctags-am distclean \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-includeHEADERS install-info install-info-am \ install-man install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ ps ps-am tags tags-am uninstall uninstall-am \ uninstall-includeHEADERS # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: hdf-eos5-2.0/gctp/include/bcea.h000077500000000000000000000004751507520047200164230ustar00rootroot00000000000000/* 27-June-00 AT added default radius and Ltruscale for BCEA projection */ #ifdef __cplusplus extern "C" { #endif #define PGSd_BCEA 98 #define PGSd_DEFAULT_BCEA_RADIUS 6371228.0 /*Earth radius for BCEA projection*/ #define PGSd_DEFAULT_BCEA_LTRUESCALE 30.0 /*Latitude of true scale */ #ifdef __cplusplus } #endif hdf-eos5-2.0/gctp/include/cproj.h000077500000000000000000000015141507520047200166410ustar00rootroot00000000000000#include #ifdef __cplusplus extern "C" { #endif #define PI 3.141592653589793238 #define HALF_PI (PI*0.5) #define TWO_PI (PI*2.0) #define EPSLN 1.0e-10 #define R2D 57.2957795131 /* #define D2R 0.0174532925199 */ #define D2R 1.745329251994328e-2 #define S2R 4.848136811095359e-6 #define OK 0 #define ERROR -1 #define IN_BREAK -2 /* Misc macros -----------*/ #define SQUARE(x) ((x) * (x)) /* x**2 */ #define CUBE(x) ((x) * (x) * (x)) /* x**3 */ #define QUAD(x) ((x) * (x) * (x) * (x)) /* x**4 */ #define GMAX(A, B) ((A) > (B) ? (A) : (B)) /* assign maximum of a and b */ #define GMIN(A, B) ((A) < (B) ? (A) : (B)) /* assign minimum of a and b */ #define IMOD(A, B) (A) - (((A) / (B)) * (B)) /* Integer mod function */ #include "cproj_prototypes.h" #ifdef __cplusplus } #endif hdf-eos5-2.0/gctp/include/cproj_prototypes.h000077500000000000000000000047721507520047200211620ustar00rootroot00000000000000/*-------------------------------------------------------------------------*/ /* */ /* COPYRIGHT[copyright mark] 1999, Raytheon Systems Company, its vendors, */ /* and suppliers. ALL RIGHTS RESERVED. */ /* */ /*-------------------------------------------------------------------------*/ /***************************************************************************** BEGIN_FILE_PROLOG: FILENAME: cproj_prototypes.h DESCRIPTION: This file contains function prototypes that are specific to the GCT Tools AUTHOR: Ray Milburn / Steven Myers & Associates HISTORY: 28-Jan-99 RM Initial version 02-Jul-03 Abe Taaheri Modified END_FILE_PROLOG: *****************************************************************************/ #ifndef cproj_prototypes_h #define cproj_prototypes_h #include "gctp_prototypes.h" /***************************************************************** Function prototypes. *****************************************************************/ void p_error(char *what, char *where); void ptitle(char *A); void tsincos(double val, double *sin_val, double *cos_val); double msfnz(double eccent, double sinphi, double cosphi); double qsfnz(double eccent, double sinphi, double cosphi); double tsfnz(double eccent, double phi, double sinphi); void radius2(double A, double B); void radius(double A); void stanparl(double A, double B); void cenlonmer(double A); void cenlon(double A); void cenlat(double A); void true_scale(double A); void origin(double A); void offsetp(double A, double B); double adjust_lon(double x); double phi1z(double eccent, double qs, long *flag); double phi2z(double eccent, double ts, long *flag); double phi3z(double ml, double e0, double e1, double e2, double e3, long *flag); double phi4z(double eccent, double e0, double e1, double e2, double e3, double a, double b, double *c, double *phi); double asinz(double con); int sign(double x); double e0fn(double x); double e1fn(double x); double e2fn(double x); double e3fn(double x); double e4fn(double x); double mlfn(double e0, double e1, double e2, double e3, double phi); double paksz(double ang, long *iflg); double pakcz(double pak); void stparl1(double A); void genrpt(double A, char *S); void genrpt_long(long A, char *S); void pblank(); int sphdz(long isph,double *parm,double *r_major,double *r_minor,double *radius); #endif hdf-eos5-2.0/gctp/include/gctp_prototypes.h000077500000000000000000000323761507520047200210030ustar00rootroot00000000000000/*-------------------------------------------------------------------------*/ /* */ /* COPYRIGHT[copyright mark] 1999, Raytheon Systems Company, its vendors, */ /* and suppliers. ALL RIGHTS RESERVED. */ /* */ /*-------------------------------------------------------------------------*/ /***************************************************************************** BEGIN_FILE_PROLOG: FILENAME: gctp_prototypes.H DESCRIPTION: This file contains function prototypes that are specific to the GCT Tools AUTHOR: Ray Milburn / Steven Myers & Associates Abe Taaheri / Emergent Information Tecnologies, Inc. HISTORY: 28-Jan-99 RM Initial version 27-June-00 AT added function prototypes for CEA projection END_FILE_PROLOG: *****************************************************************************/ #ifndef gctp_prototypes_h #define gctp_prototypes_h #ifndef PGS_GCT_Prototypes_h /***************************************************************** Function prototypes. *****************************************************************/ int stplnfor(double lon, double lat, double *x, double *y); int stplninv(double x, double y, double *lon, double *lat); int stplnforint(long zone, long sphere, char *fn27, char *fn83); int stplninvint(long zone, long sphere, char *fn27, char *fn83); int alberfor(double lon, double lat, double *x, double *y); int alberinv(double x, double y, double *lon, double *lat); int alberforint(double r_maj, double r_min, double lat1, double lat2, double lon0, double lat0, double false_east, double false_north); int alberinvint(double r_maj, double r_min, double lat1, double lat2, double lon0, double lat0, double false_east, double false_north); int lamccfor(double lon, double lat, double *x, double *y); int lamccinv(double x, double y, double *lon, double *lat); int lamccforint(double r_maj, double r_min, double lat1, double lat2, double c_lon, double c_lat, double false_east, double false_north); int lamccinvint(double r_maj, double r_min, double lat1, double lat2, double c_lon, double c_lat, double false_east, double false_north); int merfor(double lon, double lat, double *x, double *y); int merinv(double x, double y, double *lon, double *lat); int merforint(double r_maj, double r_min, double center_lon, double center_lat, double false_east, double false_north); int merinvint(double r_maj, double r_min, double center_lon, double center_lat, double false_east, double false_north); int psfor(double lon, double lat, double *x, double *y); int psinv(double x, double y, double *lon, double *lat); int psforint(double r_maj, double r_min, double c_lon, double c_lat, double false_east, double false_north); int psinvint(double r_maj, double r_min, double c_lon, double c_lat, double false_east, double false_north); int polyfor(double lon, double lat, double *x, double *y); int polyinv(double x, double y, double *lon, double *lat); int polyforint(double r_maj, double r_min, double center_lon, double center_lat, double false_east, double false_north); int polyinvint(double r_maj, double r_min, double center_lon, double center_lat, double false_east, double false_north); int eqconfor(double lon, double lat, double *x, double *y); int eqconinv(double x, double y, double *lon, double *lat); int eqconforint(double r_maj, double r_min, double lat1, double lat2, double center_lon, double center_lat, double false_east, double false_north, long mode); int eqconinvint(double r_maj, double r_min, double lat1, double lat2, double center_lon, double center_lat, double false_east, double false_north, long mode); int tmfor(double lon, double lat, double *x, double *y); int tminv(double x, double y, double *lon, double *lat); int tmforint(double r_maj, double r_min, double scale_fact, double center_lon, double center_lat, double false_east, double false_north); int tminvint(double r_maj, double r_min, double scale_fact, double center_lon, double center_lat, double false_east, double false_north); int sterfor(double lon, double lat, double *x, double *y); int sterinv(double x, double y, double *lon, double *lat); int sterforint(double r_maj, double center_lon, double center_lat, double false_east, double false_north); int sterinvint(double r_maj, double center_lon, double center_lat, double false_east, double false_north); int lamazfor(double lon, double lat, double *x, double *y); int lamazinv(double x, double y, double *lon, double *lat); int lamazforint(double r_maj, double r_min, double center_long, double center_lat, double false_east, double false_north); int lamazinvint(double r_maj, double r_min, double center_long, double center_lat, double false_east, double false_north); int azimfor(double lon, double lat, double *x, double *y); int aziminv(double x, double y, double *lon, double *lat); int azimforint(double r_maj, double center_lon, double center_lat, double false_east, double false_north); int aziminvint(double r_maj, double center_lon, double center_lat, double false_east, double false_north); int gnomfor(double lon, double lat, double *x, double *y); int gnominv(double x, double y, double *lon, double *lat); int gnomforint(double r, double center_long, double center_lat, double false_east, double false_north); int gnominvint(double r, double center_long, double center_lat, double false_east, double false_north); int orthfor(double lon, double lat, double *x, double *y); int orthinv(double x, double y, double *lon, double *lat); int orthforint(double r_maj, double center_lon, double center_lat, double false_east, double false_north); int orthinvint(double r_maj, double center_lon, double center_lat, double false_east, double false_north); int gvnspfor(double lon, double lat, double *x, double *y); int gvnspinv(double x, double y, double *lon, double *lat); int gvnspforint(double r, double h, double center_long, double center_lat, double false_east, double false_north); int gvnspinvint(double r, double h, double center_long, double center_lat, double false_east, double false_north); int sinfor(double lon, double lat, double *x, double *y); int sininv(double x, double y, double *lon, double *lat); int sinforint(double r_maj, double r_min, double center_long, double false_east, double false_north); int sininvint(double r_maj, double r_min, double center_long, double false_east, double false_north); int equifor(double lon, double lat, double *x, double *y); int equiinv(double x, double y, double *lon, double *lat); int equiforint(double r_maj, double center_lon, double lat1, double false_east, double false_north); int equiinvint(double r_maj, double center_lon, double lat1, double false_east, double false_north); int millfor(double lon, double lat, double *x, double *y); int millinv(double x, double y, double *lon, double *lat); int millforint(double r, double center_long, double false_east, double false_north); int millinvint(double r, double center_long, double false_east, double false_north); int vandgfor(double lon, double lat, double *x, double *y); int vandginv(double x, double y, double *lon, double *lat); int vandgforint(double r, double center_long, double false_east, double false_north); int vandginvint(double r, double center_long, double false_east, double false_north); int omerfor(double lon, double lat, double *x, double *y); int omerinv(double x, double y, double *lon, double *lat); int omerforint(double r_maj, double r_min, double scale_fact, double azimuth, double lon_orig, double lat_orig, double false_east, double false_north, double lon1, double lat1, double lon2, double lat2, long mode); int omerinvint(double r_maj, double r_min, double scale_fact, double azimuth, double lon_orig, double lat_orig, double false_east, double false_north, double lon1, double lat1, double lon2, double lat2, long mode); int somfor(double lon, double lat, double *x, double *y); int sominv(double x, double y, double *lon, double *lat); int somforint(double r_major, double r_minor, long satnum, long path, double alf_in, double lon, double false_east, double false_north, double time, long start1, long flag, double sat_ratio); int sominvint(double r_major, double r_minor, long satnum, long path, double alf_in, double lon, double false_east, double false_north, double time, long flag, double sat_ratio); int hamfor(double lon, double lat, double *x, double *y); int haminv(double x, double y, double *lon, double *lat); int hamforint(double r, double center_long, double false_east, double false_north); int haminvint(double r, double center_long, double false_east, double false_north); int robfor(double lon, double lat, double *x, double *y); int robinv(double x, double y, double *lon, double *lat); int robforint(double r, double center_long, double false_east, double false_north); int robinvint(double r, double center_long, double false_east, double false_north); int goodfor(double lon, double lat, double *x, double *y); int goodinv(double x, double y, double *lon, double *lat); int goodforint(double r); int goodinvint(double r); int molwfor(double lon, double lat, double *x, double *y); int molwinv(double x, double y, double *lon, double *lat); int molwforint(double r, double center_long, double false_east, double false_north); int molwinvint(double r, double center_long, double false_east, double false_north); int imolwfor(double lon, double lat, double *x, double *y); int imolwinv(double x, double y, double *lon, double *lat); int imolwforint(double r); int imolwinvint(double r); int alconfor(double lon, double lat, double *x, double *y); int alconinv(double x, double y, double *lon, double *lat); int alconforint(double r_maj, double r_min, double false_east, double false_north); int alconinvint(double r_maj, double r_min, double false_east, double false_north); int wivfor(double lon, double lat, double *x, double *y); int wivinv(double x, double y, double *lon, double *lat); int wivforint(double r, double center_long, double false_east, double false_north); int wivinvint(double r, double center_long, double false_east, double false_north); int wviifor(double lon, double lat, double *x, double *y); int wviiinv(double x, double y, double *lon, double *lat); int wviiforint(double r, double center_long, double false_east, double false_north); int wviiinvint(double r, double center_long, double false_east, double false_north); int obleqfor(double lon, double lat, double *x, double *y); int obleqinv(double x, double y, double *lon, double *lat); int obleqforint(double r, double center_long, double center_lat, double shape_m, double shape_n, double angle, double false_east, double false_north); int obleqinvint(double r, double center_long, double center_lat, double shape_m, double shape_n, double angle, double false_east, double false_north); int isinusfor(double lon, double lat, double *x, double *y); int isinusinv(double x, double y, double *lon, double *lat); int isinusforinit(double sphere, double lon_cen_mer, double false_east, double false_north, double dzone, double djustify); int isinusinvinit(double sphere, double lon_cen_mer, double false_east, double false_north, double dzone, double djustify); int utmfor(double lon, double lat, double *x, double *y); int utminv(double x, double y, double *lon, double *lat); int utmforint(double r_maj, double r_min, double scale_fact, long zone); int utminvint(double r_maj, double r_min, double scale_fact, long zone); long calc_utm_zone(double lon); int ceaforint(double r_maj, double r_min, double center_lon, double center_lat, double false_east, double false_north); int ceafor(double lon, double lat, double *x, double *y); int ceainvint(double r_maj, double r_min, double center_lon, double center_lat, double false_east, double false_north); int ceainv(double x, double y, double *lon, double *lat); int bceaforint(double r_maj, double r_min, double center_lon, double center_lat, double false_east, double false_north); int bceafor(double lon, double lat, double *x, double *y); int bceainvint(double r_maj, double r_min, double center_lon, double center_lat, double false_east, double false_north); int bceainv(double x, double y, double *lon, double *lat); #endif #endif hdf-eos5-2.0/gctp/include/isin.h000077500000000000000000000065531507520047200164760ustar00rootroot00000000000000/****************************************************************************** NAME ISIN.H PURPOSE: Integerized Sinusoidal Library Header - constants, data structures and prototypes for integerized sinusoidal library functions. PROGRAMMER DATE REASON ---------- ---- ------ Robert Wolfe (STX) 1-2-97 Initial version. Raj Gejjagaraguppe (ARC) 1-15-97 Modified the code to work with GCTP software. D*****************************************************************************/ #ifdef __cplusplus extern "C" { #endif /* Status returned */ #define ISIN_SUCCESS 0 /* Successful return */ #define ISIN_ERROR -1 /* Error return */ #define ISIN_ERANGE -2 /* Input variable out of range */ /* Data Structures */ /* Row Type; Information for Eash Row (longitudinal band) in Projection */ typedef struct { long ncol; /* Number of columns */ long icol_cen; /* Column number to left of center of grid */ double ncol_inv; /* Number of columns inverse */ } Isin_row_t; /* Handle Type; Values assigned in 'Isin_init' */ typedef struct { double false_east; /* Northing at projection origin */ double false_north; /* Easting at projection origin */ double sphere; /* Sphere radius (user's units) */ double sphere_inv; /* Sphere radius inverse (user's units) */ double ang_size_inv; /* Grid angular resolution inverse (1/rad)*/ long nrow; /* Number of rows (longitudinal zones) */ long nrow_half; /* Half of number of rows (longitudinal zones)*/ double ref_lon; /* Zero reference longitude (rad) */ double lon_cen_mer; /* Longitude of central meridian (rad) */ int ijustify; /* Justify flag (see Isin_init) */ double col_dist; /* Distance for one column in projection * (user's units) */ double col_dist_inv; /* Distance for one column in projection inverse * (user's units) */ Isin_row_t *row; /* Row data structure */ long key; /* Data structure key */ } Isin_t; /* Error Structure */ typedef struct { int num; /* Error number */ char *str; /* Error message */ } error_t; /* Prototypes */ /* Initialize integerized sinusoidal forward transformations */ int isinusforinit(double , double, double, double, double, double); Isin_t *Isin_for_init(double , double, double, double, long, int); /* Initialize integerized sinusoidal inverse transformations */ int isinusinvinit(double , double, double, double, double, double); Isin_t *Isin_inv_init(double , double, double, double, long, int); /* Forward mapping; converts geographic coordinates ('lon', 'lat') * to map projection coordinates ('x', 'y') */ int isinusfor(double, double, double *, double *); int Isin_fwd(const Isin_t *, double, double, double *, double *); /* Inverse mapping; converts map projection coordinates ('x', 'y') to * geographic coordinates ('lon', 'lat') */ int isinusinv(double, double, double *, double *); int Isin_inv(const Isin_t *, double, double, double *, double *); /* Deallocate the 'isin' data structure and array memory */ int Isin_for_free(Isin_t *); int Isin_inv_free(Isin_t *); /* Private function to handle errors */ static int Isin_error(const error_t *, const char *); #ifdef __cplusplus } #endif hdf-eos5-2.0/gctp/include/proj.h000077500000000000000000000043521507520047200165010ustar00rootroot00000000000000/* 0 = Geographic 1 = Universal Transverse Mercator (UTM) 2 = State Plane Coordinates 3 = Albers Conical Equal Area 4 = Lambert Conformal Conic 5 = Mercator 6 = Polar Stereographic 7 = Polyconic 8 = Equidistant Conic 9 = Transverse Mercator 10 = Stereographic 11 = Lambert Azimuthal Equal Area 12 = Azimuthal Equidistant 13 = Gnomonic 14 = Orthographic 15 = General Vertical Near-Side Perspective 16 = Sinusiodal 17 = Equirectangular 18 = Miller Cylindrical 19 = Van der Grinten 20 = (Hotine) Oblique Mercator 21 = Robinson 22 = Space Oblique Mercator (SOM) 23 = Alaska Conformal 24 = Interrupted Goode Homolosine 25 = Mollweide 26 = Interrupted Mollweide 27 = Hammer 28 = Wagner IV 29 = Wagner VII 30 = Oblated Equal Area 31 = Integerized Sinusoidal Grid (the same as 99) 97 = Cylindrical Equal Area (Grid corners set in meters for EASE grid) 98 = Cylindrical Equal Area (Grid corners set in DMS degs for EASE grid) 99 = Integerized Sinusoidal Grid (added by Raj Gejjagaraguppe ARC for MODIS) */ #ifdef __cplusplus extern "C" { #endif #define GEO 0 #define UTM 1 #define SPCS 2 #define ALBERS 3 #define LAMCC 4 #define MERCAT 5 #define PS 6 #define POLYC 7 #define EQUIDC 8 #define TM 9 #define STEREO 10 #define LAMAZ 11 #define AZMEQD 12 #define GNOMON 13 #define ORTHO 14 #define GVNSP 15 #define SNSOID 16 #define EQRECT 17 #define MILLER 18 #define VGRINT 19 #define HOM 20 #define ROBIN 21 #define SOM 22 #define ALASKA 23 #define GOODE 24 #define MOLL 25 #define IMOLL 26 #define HAMMER 27 #define WAGIV 28 #define WAGVII 29 #define OBEQA 30 #define ISINUS1 31 #define CEA 97 #define BCEA 98 #define ISINUS 99 #define IN_BREAK -2 #define COEFCT 15 /* projection coefficient count */ #define PROJCT 31 /* projection count */ #define DATMCT 20 /* datum count */ #define MAXPROJ 100 /* Maximum projection number */ #define MAXUNIT 5 /* Maximum unit code number */ #define GEO_TERM 0 /* Array index for print-to-term flag */ #define GEO_FILE 1 /* Array index for print-to-file flag */ #define GEO_TRUE 1 /* True value for geometric true/false flags */ #define GEO_FALSE -1 /* False val for geometric true/false flags */ #ifdef __cplusplus } #endif hdf-eos5-2.0/gctp/src/000077500000000000000000000000001507520047200145135ustar00rootroot00000000000000hdf-eos5-2.0/gctp/src/Makefile.am000077500000000000000000000030351507520047200165530ustar00rootroot00000000000000# GCTP source directory Makefile # Boilerplate definitions include $(top_srcdir)/config/include.am # Library to build lib_LTLIBRARIES = libGctp.la ## Normally DEFAULT_INCLUDES is supplied by Automake, but one of the ## directories included by default is $(top_builddir)/include, which ## contains several header files with the same names as files in the ## gctp/include directories. ## To work around this, override the DEFAULT_INCLUDES variable. DEFAULT_INCLUDES = -I. -I$(srcdir) # Include the libGCTP include directory AM_CPPFLAGS=-I$(srcdir)/../include/ # Library source files libGctp_la_SOURCES = gctp.c alberfor.c alberinv.c alconfor.c alconinv.c \ azimfor.c aziminv.c bceafor.c bceainv.c br_gctp.c ceafor.c \ ceainv.c cproj.c eqconfor.c eqconinv.c equifor.c equiinv.c \ for_init.c gnomfor.c gnominv.c goodfor.c goodinv.c gvnspfor.c \ gvnspinv.c hamfor.c haminv.c imolwfor.c imolwinv.c inv_init.c \ isinusfor.c isinusinv.c lamazfor.c lamazinv.c lamccfor.c \ lamccinv.c merfor.c merinv.c millfor.c millinv.c molwfor.c \ molwinv.c obleqfor.c obleqinv.c omerfor.c omerinv.c orthfor.c \ orthinv.c paksz.c polyfor.c polyinv.c psfor.c psinv.c report.c \ robfor.c robinv.c sinfor.c sininv.c sphdz.c somfor.c sominv.c \ sterfor.c sterinv.c stplnfor.c stplninv.c tmfor.c tminv.c untfz.c \ utmfor.c utminv.c vandgfor.c vandginv.c wivfor.c wivinv.c \ wviifor.c wviiinv.c hdf-eos5-2.0/gctp/src/Makefile.in000066400000000000000000000652151507520047200165710ustar00rootroot00000000000000# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # GCTP source directory Makefile VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(top_srcdir)/config/include.am $(srcdir)/Makefile.in \ $(srcdir)/Makefile.am $(top_srcdir)/config/depcomp subdir = gctp/src ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/stdlib.m4 $(top_srcdir)/m4/stdinc.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/HE5_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(libdir)" LTLIBRARIES = $(lib_LTLIBRARIES) libGctp_la_LIBADD = am_libGctp_la_OBJECTS = gctp.lo alberfor.lo alberinv.lo alconfor.lo \ alconinv.lo azimfor.lo aziminv.lo bceafor.lo bceainv.lo \ br_gctp.lo ceafor.lo ceainv.lo cproj.lo eqconfor.lo \ eqconinv.lo equifor.lo equiinv.lo for_init.lo gnomfor.lo \ gnominv.lo goodfor.lo goodinv.lo gvnspfor.lo gvnspinv.lo \ hamfor.lo haminv.lo imolwfor.lo imolwinv.lo inv_init.lo \ isinusfor.lo isinusinv.lo lamazfor.lo lamazinv.lo lamccfor.lo \ lamccinv.lo merfor.lo merinv.lo millfor.lo millinv.lo \ molwfor.lo molwinv.lo obleqfor.lo obleqinv.lo omerfor.lo \ omerinv.lo orthfor.lo orthinv.lo paksz.lo polyfor.lo \ polyinv.lo psfor.lo psinv.lo report.lo robfor.lo robinv.lo \ sinfor.lo sininv.lo sphdz.lo somfor.lo sominv.lo sterfor.lo \ sterinv.lo stplnfor.lo stplninv.lo tmfor.lo tminv.lo untfz.lo \ utmfor.lo utminv.lo vandgfor.lo vandginv.lo wivfor.lo \ wivinv.lo wviifor.lo wviiinv.lo libGctp_la_OBJECTS = $(am_libGctp_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libGctp_la_SOURCES) DIST_SOURCES = $(libGctp_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FC = @FC@ FCFLAGS = @FCFLAGS@ FFLAGS = @FFLAGS@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ ac_ct_FC = @ac_ct_FC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ LIBHDFEOS5 = $(top_builddir)/src/libhe5_hdfeos.la LIBGCTP = $(top_builddir)/gctp/src/libGctp.la # Boilerplate definitions # Library to build lib_LTLIBRARIES = libGctp.la DEFAULT_INCLUDES = -I. -I$(srcdir) # Include the libGCTP include directory AM_CPPFLAGS = -I$(srcdir)/../include/ # Library source files libGctp_la_SOURCES = gctp.c alberfor.c alberinv.c alconfor.c alconinv.c \ azimfor.c aziminv.c bceafor.c bceainv.c br_gctp.c ceafor.c \ ceainv.c cproj.c eqconfor.c eqconinv.c equifor.c equiinv.c \ for_init.c gnomfor.c gnominv.c goodfor.c goodinv.c gvnspfor.c \ gvnspinv.c hamfor.c haminv.c imolwfor.c imolwinv.c inv_init.c \ isinusfor.c isinusinv.c lamazfor.c lamazinv.c lamccfor.c \ lamccinv.c merfor.c merinv.c millfor.c millinv.c molwfor.c \ molwinv.c obleqfor.c obleqinv.c omerfor.c omerinv.c orthfor.c \ orthinv.c paksz.c polyfor.c polyinv.c psfor.c psinv.c report.c \ robfor.c robinv.c sinfor.c sininv.c sphdz.c somfor.c sominv.c \ sterfor.c sterinv.c stplnfor.c stplninv.c tmfor.c tminv.c untfz.c \ utmfor.c utminv.c vandgfor.c vandginv.c wivfor.c wivinv.c \ wviifor.c wviiinv.c all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/include.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign gctp/src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign gctp/src/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/config/include.am: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libGctp.la: $(libGctp_la_OBJECTS) $(libGctp_la_DEPENDENCIES) $(EXTRA_libGctp_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) -rpath $(libdir) $(libGctp_la_OBJECTS) $(libGctp_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alberfor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alberinv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alconfor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alconinv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/azimfor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aziminv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bceafor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bceainv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/br_gctp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ceafor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ceainv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cproj.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eqconfor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eqconinv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/equifor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/equiinv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/for_init.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gctp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnomfor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnominv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/goodfor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/goodinv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gvnspfor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gvnspinv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hamfor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/haminv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imolwfor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imolwinv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inv_init.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isinusfor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isinusinv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lamazfor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lamazinv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lamccfor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lamccinv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/merfor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/merinv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/millfor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/millinv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/molwfor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/molwinv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/obleqfor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/obleqinv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/omerfor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/omerinv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orthfor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orthinv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/paksz.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/polyfor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/polyinv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/psfor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/psinv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/report.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/robfor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/robinv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sinfor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sininv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/somfor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sominv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sphdz.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sterfor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sterinv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stplnfor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stplninv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tmfor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tminv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/untfz.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utmfor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utminv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vandgfor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vandginv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wivfor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wivinv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wviifor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wviiinv.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(libdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-libLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-libLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-libLTLIBRARIES install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-libLTLIBRARIES # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: hdf-eos5-2.0/gctp/src/alberfor.c000077500000000000000000000077301507520047200164650ustar00rootroot00000000000000/******************************************************************************* NAME ALBERS CONICAL EQUAL AREA PURPOSE: Transforms input longitude and latitude to Easting and Northing for the Albers Conical Equal Area projection. The longitude and latitude must be in radians. The Easting and Northing values will be returned in meters. PROGRAMMER DATE ---------- ---- T. Mittan, Feb, 1992 ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double r_major; /* major axis */ static double r_minor; /* minor axis */ static double c; /* constant c */ static double e3; /* eccentricity */ static double rh; /* heigth above elipsoid */ static double ns0; /* ratio between meridians */ static double lon_center; /* center longitude */ static double false_easting; /* x offset in meters */ static double false_northing; /* y offset in meters */ /* Initialize the Albers projection -------------------------------*/ int alberforint( double r_maj, /* major axis */ double r_min, /* minor axis */ double lat1, /* first standard parallel */ double lat2, /* second standard parallel */ double lon0, /* center longitude */ double lat0, /* center lattitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { double sin_po,cos_po; /* sin and cos values */ double con; /* temporary variable */ double es,temp; /* eccentricity squared and temp var */ double ms1; /* small m 1 */ double ms2; /* small m 2 */ double qs0; /* small q 0 */ double qs1; /* small q 1 */ double qs2; /* small q 2 */ false_easting = false_east; false_northing = false_north; lon_center = lon0; if (fabs(lat1 + lat2) < EPSLN) { p_error("Equal latitudes for St. Parallels on opposite sides of equator", "alber-forinit"); return(31); } r_major = r_maj; r_minor = r_min; temp = r_minor / r_major; es = 1.0 - SQUARE(temp); e3 = sqrt(es); tsincos(lat1, &sin_po, &cos_po); con = sin_po; ms1 = msfnz(e3,sin_po,cos_po); qs1 = qsfnz(e3,sin_po,cos_po); tsincos(lat2,&sin_po,&cos_po); ms2 = msfnz(e3,sin_po,cos_po); qs2 = qsfnz(e3,sin_po,cos_po); tsincos(lat0,&sin_po,&cos_po); qs0 = qsfnz(e3,sin_po,cos_po); if (fabs(lat1 - lat2) > EPSLN) ns0 = (ms1 * ms1 - ms2 *ms2)/ (qs2 - qs1); else ns0 = con; c = ms1 * ms1 + ns0 * qs1; rh = r_major * sqrt(c - ns0 * qs0)/ns0; /* Report parameters to the user -----------------------------*/ ptitle("ALBERS CONICAL EQUAL-AREA"); radius2(r_major, r_minor); stanparl(lat1,lat2); cenlonmer(lon_center); origin(lat0); offsetp(false_easting,false_northing); return(OK); } /* Albers Conical Equal Area forward equations--mapping lat,long to x,y -------------------------------------------------------------------*/ int alberfor( double lon, /* (I) Longitude */ double lat, /* (I) Latitude */ double *x, /* (O) X projection coordinate */ double *y) /* (O) Y projection coordinate */ { double sin_phi,cos_phi; /* sine and cos values */ double qs; /* small q */ double theta; /* angle */ double rh1; /* height above ellipsoid */ tsincos(lat,&sin_phi,&cos_phi); qs = qsfnz(e3,sin_phi,cos_phi); rh1 = r_major * sqrt(c - ns0 * qs)/ns0; theta = ns0 * adjust_lon(lon - lon_center); *x = rh1 * sin(theta) + false_easting; *y = rh - rh1 * cos(theta) + false_northing; return(OK); } hdf-eos5-2.0/gctp/src/alberinv.c000077500000000000000000000125141507520047200164670ustar00rootroot00000000000000/******************************************************************************* NAME ALBERS CONICAL EQUAL-AREA PURPOSE: Transforms input Easting and Northing to longitude and latitude for the Albers Conical Equal Area projection. The Easting and Northing must be in meters. The longitude and latitude values will be returned in radians. PROGRAMMER DATE ---------- ---- T. Mittan, Feb, 1992 S. Nelson Feb, 1996 Made a modification to the assignment to "con" enclosing the section 1.0 - e3 in parenthesis. ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double r_major; /* major axis */ static double r_minor; /* minor axis */ static double c; /* constant c */ static double e3; /* eccentricity */ static double es; /* eccentricity squared */ static double rh; /* heigth above elipsoid */ static double ns0; /* ratio between meridians */ static double lon_center; /* center longitude */ static double false_easting; /* x offset in meters */ static double false_northing; /* y offset in meters */ /* Initialize the Albers projection -------------------------------*/ int alberinvint( double r_maj, /* major axis */ double r_min, /* minor axis */ double lat1, /* first standard parallel */ double lat2, /* second standard parallel */ double lon0, /* center longitude */ double lat0, /* center lattitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { double sin_po,cos_po; /* sine and cos values */ double con; /* temporary variable */ double temp; /* temporary variable */ double ms1; /* small m 1 */ double ms2; /* small m 2 */ double qs0; /* small q 0 */ double qs1; /* small q 1 */ double qs2; /* small q 2 */ false_easting = false_east; false_northing = false_north; lon_center = lon0; if (fabs(lat1 + lat2) < EPSLN) { p_error("Equal latitudes for Standard Parallels on opposite sides of equator" ,"alber-invinit"); return(31); } r_major = r_maj; r_minor = r_min; temp = r_minor / r_major; es = 1.0 - SQUARE(temp); e3 = sqrt(es); tsincos(lat1, &sin_po, &cos_po); con = sin_po; ms1 = msfnz(e3,sin_po,cos_po); qs1 = qsfnz(e3,sin_po,cos_po); tsincos(lat2,&sin_po,&cos_po); ms2 = msfnz(e3,sin_po,cos_po); qs2 = qsfnz(e3,sin_po,cos_po); tsincos(lat0,&sin_po,&cos_po); qs0 = qsfnz(e3,sin_po,cos_po); if (fabs(lat1 - lat2) > EPSLN) ns0 = (ms1 * ms1 - ms2 *ms2)/ (qs2 - qs1); else ns0 = con; c = ms1 * ms1 + ns0 * qs1; rh = r_major * sqrt(c - ns0 * qs0)/ns0; /* Report parameters to the user -----------------------------*/ ptitle("ALBERS CONICAL EQUAL-AREA"); radius2(r_major, r_minor); stanparl(lat1,lat2); cenlonmer(lon_center); origin(lat0); offsetp(false_easting,false_northing); return(OK); } /* Albers Conical Equal Area inverse equations--mapping x,y to lat/long -------------------------------------------------------------------*/ int alberinv( double x, /* (O) X projection coordinate */ double y, /* (O) Y projection coordinate */ double *lon, /* (I) Longitude */ double *lat) /* (I) Latitude */ { double rh1; /* height above ellipsoid */ double qs; /* function q */ double con; /* temporary sign value */ double theta; /* angle */ long flag; /* error flag; */ flag = 0; x -= false_easting; y = rh - y + false_northing;; if (ns0 >= 0) { rh1 = sqrt(x * x + y * y); con = 1.0; } else { rh1 = -sqrt(x * x + y * y); con = -1.0; } theta = 0.0; if (rh1 != 0.0) theta = atan2(con * x, con * y); con = rh1 * ns0 / r_major; qs = (c - con * con) / ns0; if (e3 >= 1e-10) { con = 1 - .5 * (1.0 - es) * log((1.0 - e3) / (1.0 + e3))/e3; if (fabs(fabs(con) - fabs(qs)) > .0000000001 ) { *lat = phi1z(e3,qs,&flag); if (flag != 0) return(flag); } else { if (qs >= 0) *lat = .5 * PI; else *lat = -.5 * PI; } } else { *lat = phi1z(e3,qs,&flag); if (flag != 0) return(flag); } *lon = adjust_lon(theta/ns0 + lon_center); return(OK); } hdf-eos5-2.0/gctp/src/alconfor.c000077500000000000000000000117021507520047200164660ustar00rootroot00000000000000/******************************************************************************* NAME ALASKA CONFORMAL PURPOSE: Transforms input longitude and latitude to Easting and Northing for the Alaska Conformal projection. The longitude and latitude must be in radians. The Easting and Northing values will be returned in meters. PROGRAMMER DATE ---------- ---- T. Mittan March, 1993 This function was adapted from the Alaska Conformal projection code (FORTRAN) in the General Cartographic Transformation Package software which is available from the U.S. Geological Survey National Mapping Division. ALGORITHM REFERENCES 1. "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder, The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355. 2. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 3. "Software Documentation for GCTP General Cartographic Transformation Package", U.S. Geological Survey National Mapping Division, May 1982. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double r_major; /* major axis */ static double r_minor; /* minor axis */ static double lon_center; /* Center longitude (projection center) */ static double lat_center; /* center latitude */ static double false_easting; /* x offset in meters */ static double false_northing; /* y offset in meters */ static double acoef[7]; static double bcoef[7]; static double sin_p26; static double cos_p26; static double e; static long n; /* Initialize the ALASKA CONFORMAL projection -----------------------------------------*/ int alconforint( double r_maj, /* Major axis */ double r_min, /* Minor axis */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { double es; double chi; double esphi; /* Place parameters in static storage for common use -------------------------------------------------*/ r_major = r_maj; r_minor = r_min; false_easting = false_east; false_northing = false_north; lon_center = -152.0 * D2R; lat_center = 64.0 * D2R; n = 6; es = .006768657997291094; e = sqrt(es); acoef[1]= 0.9945303; acoef[2]= 0.0052083; acoef[3]= 0.0072721; acoef[4]= -0.0151089; acoef[5]= 0.0642675; acoef[6]= 0.3582802; bcoef[1]= 0.0; bcoef[2]= -.0027404; bcoef[3]= 0.0048181; bcoef[4]= -0.1932526; bcoef[5]= -0.1381226; bcoef[6]= -0.2884586; esphi = e * sin(lat_center); chi = 2.0 * atan(tan((HALF_PI + lat_center)/2.0) * pow(((1.0 - esphi)/(1.0 + esphi)),(e/2.0))) - HALF_PI; tsincos(chi,&sin_p26,&cos_p26); /* Report parameters to the user -----------------------------*/ ptitle("ALASKA CONFORMAL"); radius2(r_major,r_minor); cenlon(lon_center); cenlat(lat_center); offsetp(false_easting,false_northing); return(OK); } /* ALASKA CONFORMAL forward equations--mapping lat,long to x,y ----------------------------------------------------------*/ int alconfor( double lon, /* (I) Longitude */ double lat, /* (I) Latitude */ double *x, /* (O) X projection coordinate */ double *y) /* (O) Y projection coordinate */ { double dlon; double sinlon,coslon; double sinphi,cosphi; double esphi; double g; double s; double xp; double yp; double ar; double ai; double br; double bi; double arn; double ain; double chi; double r; long j; /* Forward equations -----------------*/ dlon = adjust_lon( lon - lon_center); /* caluclate x' and y' for Oblique Stereographic Proj for LAT/LONG ----------------------------------------------------------------*/ tsincos(dlon,&sinlon,&coslon); esphi = e * sin(lat); chi = 2.0 * atan(tan((HALF_PI + lat) / 2.0) * pow(((1.0 - esphi) / (1.0 + esphi)),(e/2.0))) - HALF_PI; tsincos(chi,&sinphi,&cosphi); g = sin_p26 * sinphi + cos_p26 * cosphi * coslon; s = 2.0 / (1.0 + g); xp = s * cosphi * sinlon; yp = s * (cos_p26 * sinphi - sin_p26 * cosphi * coslon); /* Use Knuth algorithm for summing complex terms, to convert Oblique Stereographic to Modified-Stereographic coord ----------------------------------------------------------*/ r = xp + xp; s = xp*xp + yp*yp; ar = acoef[n]; ai = bcoef[n]; br = acoef[n -1]; bi = bcoef[n -1]; for (j =2; j <= n; j++) { arn = br + r * ar; ain = bi + r * ai; if (j < n) { br = acoef[n - j] - s * ar; bi = bcoef[n - j] - s * ai; ar = arn; ai = ain; } } br = -s * ar; bi = -s * ai; ar = arn; ai = ain; *x = (xp * ar - yp * ai + br) * r_major + false_easting; *y = (yp * ar + xp * ai + bi) * r_major + false_northing; return(OK); } hdf-eos5-2.0/gctp/src/alconinv.c000077500000000000000000000143451507520047200165020ustar00rootroot00000000000000/******************************************************************************* NAME ALASKA CONFORMAL PURPOSE: Transforms input Easting and Northing to longitude and latitude for the Alaska Conformal projection. The Easting and Northing must be in meters. The longitude and latitude values will be returned in radians. PROGRAMMER DATE ---------- ---- T. Mittan March, 1993 This function was adapted from the Alaska Conformal projection code (FORTRAN) in the General Cartographic Transformation Package software which is available from the U.S. Geological Survey National Mapping Division. ALGORITHM REFERENCES 1. "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder, The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355. 2. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 3. "Software Documentation for GCTP General Cartographic Transformation Package", U.S. Geological Survey National Mapping Division, May 1982. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double r_major; /* major axis */ static double r_minor; /* minor axis */ static double lon_center; /* Center longitude (projection center) */ static double lat_center; /* center latitude */ static double false_easting; /* x offset in meters */ static double false_northing; /* y offset in meters */ static double acoef[7]; static double bcoef[7]; static double sin_p26; static double cos_p26; static double e; static long n; /* Initialize the ALASKA CONFORMAL projection -----------------------------------------*/ int alconinvint( double r_maj, /* Major axis */ double r_min, /* Minor axis */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { double es; double chi; double esphi; /* Place parameters in static storage for common use -------------------------------------------------*/ r_major = r_maj; r_minor = r_min; false_easting = false_east; false_northing = false_north; lon_center = -152.0 * D2R; lat_center = 64.0 * D2R; n = 6; es = .006768657997291094; e = sqrt(es); acoef[1]= 0.9945303; acoef[2]= 0.0052083; acoef[3]= 0.0072721; acoef[4]= -0.0151089; acoef[5]= 0.0642675; acoef[6]= 0.3582802; bcoef[1]= 0.0; bcoef[2]= -.0027404; bcoef[3]= 0.0048181; bcoef[4]= -0.1932526; bcoef[5]= -0.1381226; bcoef[6]= -0.2884586; esphi = e * sin(lat_center); chi = 2.0 * atan(tan((HALF_PI + lat_center)/2.0) * pow(((1.0 - esphi)/(1.0 + esphi)),(e/2.0))) - HALF_PI; tsincos(chi,&sin_p26,&cos_p26); /* Report parameters to the user -----------------------------*/ ptitle("ALASKA CONFORMAL"); radius2(r_major,r_minor); cenlon(lon_center); cenlat(lat_center); offsetp(false_easting,false_northing); return(OK); } /* ALASKA CONFORMAL inverse equations--mapping x,y to lat/long ----------------------------------------------------------*/ int alconinv( double x, /* (O) X projection coordinate */ double y, /* (O) Y projection coordinate */ double *lon, /* (I) Longitude */ double *lat) /* (I) Latitude */ { double esphi; double r; double s; double br; double bi; double ai; double ar; double ci; double cr; double di; double dr; double arn; double ain; double crn; double cin; double fxyr; double fxyi; double fpxyr; double fpxyi; double xp,yp; double den; double dxp; double dyp; double ds; double z; double cosz; double sinz; double rh; double chi; double dphi; double phi; long j; long nn; /* Inverse equations -----------------*/ x = (x - false_easting) / r_major; y = (y - false_northing) / r_major; xp = x; yp = y; nn = 0; /* Use Knuth algorithm for summing complex terms, to convert Modified- Stereographic conformal to Oblique Stereographic coordinates. --------------------------------------------------------------------*/ do { r = xp + xp; s = xp * xp + yp * yp; ar = acoef[n]; ai = bcoef[n]; br = acoef[n -1]; bi = bcoef[n - 1]; cr = (double) (n) * ar; ci = (double) (n) * ai; dr = (double) (n -1) * br; di = (double) (n -1) * bi; for (j = 2; j <= n; j++) { arn = br + r * ar; ain = bi + r * ai; if (j < n) { br = acoef[n -j] - s * ar; bi = bcoef[n - j] - s * ai; ar = arn; ai = ain; crn = dr + r * cr; cin = di + r * ci; dr = (double) (n - j) * acoef[n -j] - s * cr; di = (double) (n - j) * bcoef[n -j] - s * ci; cr = crn; ci = cin; } } br = -s * ar; bi = -s * ai; ar = arn; ai = ain; fxyr = xp * ar - yp * ai + br - x; fxyi = yp * ar + xp * ai + bi - y; fpxyr = xp * cr - yp * ci + dr; fpxyi = yp * cr + xp * ci + ci; den = fpxyr * fpxyr + fpxyi * fpxyi; dxp = -(fxyr * fpxyr + fxyi * fpxyi) / den; dyp = -(fxyi * fpxyr - fxyr * fpxyi) / den; xp = xp + dxp; yp = yp + dyp; ds = fabs(dxp) + fabs(dyp); nn++; if (nn > 20) { p_error("Too many iterations in inverse","alcon-inv"); return(235); } } while (ds > EPSLN); /* convert Oblique Stereographic coordinates to LAT/LONG ------------------------------------------------------*/ rh = sqrt(xp * xp + yp * yp); z = 2.0 * atan(rh / 2.0); tsincos(z,&sinz,&cosz); *lon = lon_center; if (fabs(rh) <= EPSLN) { *lat = lat_center; return(OK); } chi = asinz(cosz * sin_p26 + (yp * sinz * cos_p26) / rh); nn = 0; phi = chi; do { esphi = e * sin(phi); dphi = 2.0 * atan(tan((HALF_PI + chi) / 2.0) * pow(((1.0 + esphi) / (1.0 - esphi)),(e / 2.0))) - HALF_PI - phi; phi += dphi; nn++; if (nn > 20) { p_error("Too many iterations in inverse","alcon-inv"); return(236); } } while(fabs(dphi) > EPSLN); *lat = phi; *lon = adjust_lon (lon_center + atan2((xp * sinz), (rh * cos_p26 * cosz - yp * sin_p26 * sinz))); return(OK); } hdf-eos5-2.0/gctp/src/azimfor.c000077500000000000000000000067211507520047200163370ustar00rootroot00000000000000/******************************************************************************* NAME AZIMUTHAL EQUIDISTANT PURPOSE: Transforms input longitude and latitude to Easting and Northing for the Azimuthal Equidistant projection. The longitude and latitude must be in radians. The Easting and Northing values will be returned in meters. PROGRAMMER DATE ---------- ---- T. Mittan Mar, 1993 ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double r_major; /* major axis */ static double lon_center; /* Center longitude (projection center) */ static double lat_origin; /* center latitude */ static double false_northing; /* y offset in meters */ static double false_easting; /* x offset in meters */ static double sin_p12; /* sin of center latitude */ static double cos_p12; /* cos of center latitude */ /* Initialize the Azimuthal projection ----------------------------------*/ int azimforint( double r_maj, /* major axis */ double center_lon, /* center longitude */ double center_lat, /* center latitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { /* Place parameters in static storage for common use -------------------------------------------------*/ r_major = r_maj; lon_center = center_lon; lat_origin = center_lat; false_northing = false_north; false_easting = false_east; tsincos(center_lat,&sin_p12,&cos_p12); /* Report parameters to the user -----------------------------*/ ptitle("AZIMUTHAL EQUIDISTANT"); radius(r_major); cenlonmer(lon_center); origin(lat_origin); offsetp(false_easting,false_northing); return(OK); } /* Azimuthal forward equations--mapping lat,long to x,y ---------------------------------------------------*/ int azimfor( double lon, /* (I) Longitude */ double lat, /* (I) Latitude */ double *x, /* (O) X projection coordinate */ double *y) /* (O) Y projection coordinate */ { double sinphi, cosphi; /* sin and cos value */ double dlon; /* delta longitude value */ double coslon; /* cos of longitude */ double ksp; /* scale factor */ double g; double con; /* radius of circle */ double z; /* angle */ char mess[80]; /* error message buffer */ /* Forward equations -----------------*/ dlon = adjust_lon(lon - lon_center); tsincos(lat,&sinphi,&cosphi); coslon = cos(dlon); g = sin_p12 * sinphi + cos_p12 * cosphi * coslon; if (fabs(fabs(g) - 1.0) < EPSLN) { ksp = 1.0; if (g < 0.0) { con = 2.0 * HALF_PI * r_major; sprintf(mess,"Point projects into a circle of radius = %12.2lf",con); p_error(mess,"azim-for"); return(123); } } else { z = acos(g); ksp = z/ sin(z); } *x = false_easting + r_major * ksp * cosphi * sin(dlon); *y = false_northing + r_major * ksp * (cos_p12 * sinphi - sin_p12 * cosphi * coslon); return(OK); } hdf-eos5-2.0/gctp/src/aziminv.c000077500000000000000000000070041507520047200163400ustar00rootroot00000000000000/******************************************************************************* NAME AZIMUTHAL EQUIDISTANT PURPOSE: Transforms input Easting and Northing to longitude and latitude for the Azimuthal Equidistant projection. The Easting and Northing must be in meters. The longitude and latitude values will be returned in radians. PROGRAMMER DATE ---------- ---- T. Mittan Mar, 1993 ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double r_major; /* major axis */ static double lon_center; /* Center longitude (projection center) */ static double lat_origin; /* center latitude */ static double false_northing; /* y offset in meters */ static double false_easting; /* x offset in meters */ static double sin_p12; /* sin of center latitude */ static double cos_p12; /* cos of center latitude */ /* Initialize the Azimuthal projection ----------------------------------*/ int aziminvint( double r_maj, /* major axis */ double center_lon, /* center longitude */ double center_lat, /* center latitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { /* Place parameters in static storage for common use -------------------------------------------------*/ r_major = r_maj; lon_center = center_lon; lat_origin = center_lat; false_northing = false_north; false_easting = false_east; tsincos(center_lat,&sin_p12,&cos_p12); /* Report parameters to the user -----------------------------*/ ptitle("AZIMUTHAL EQUIDISTANT"); radius(r_major); cenlonmer(lon_center); origin(lat_origin); offsetp(false_easting,false_northing); return(OK); } /* Azimuthal inverse equations--mapping x,y to lat/long ---------------------------------------------------*/ int aziminv( double x, /* (O) X projection coordinate */ double y, /* (O) Y projection coordinate */ double *lon, /* (I) Longitude */ double *lat) /* (I) Latitude */ { double rh; /* height above ellipsoid */ double z; /* angle */ double sinz,cosz; /* sin of z and cos of z */ double con; /* Inverse equations -----------------*/ x -= false_easting; y -= false_northing; rh = sqrt(x * x + y * y); if (rh > (2.0 * HALF_PI * r_major)) { p_error("Input data error","azim-inv"); return(125); } z = rh / r_major; tsincos(z,&sinz,&cosz); *lon = lon_center; if (fabs(rh) <= EPSLN) { *lat = lat_origin; return(OK); } *lat = asinz(cosz * sin_p12 + (y * sinz * cos_p12) / rh); con = fabs(lat_origin) - HALF_PI; if (fabs(con) <= EPSLN) { if (lat_origin >= 0.0) { *lon = adjust_lon(lon_center + atan2(x , -y)); return(OK); } else { *lon = adjust_lon(lon_center - atan2(-x , y)); return(OK); } } con = cosz - sin_p12 * sin(*lat); if ((fabs(con) < EPSLN) && (fabs(x) < EPSLN)) return(OK); *lon = adjust_lon(lon_center + atan2((x * sinz * cos_p12), (con * rh))); return(OK); } hdf-eos5-2.0/gctp/src/bceafor.c000077500000000000000000000105231507520047200162640ustar00rootroot00000000000000/******************************************************************************* NAME Cylinderical Equal Area PURPOSE: Transforms input longitude and latitude to Easting and Northing for the Cylinderical Equal Area projection. The longitude and latitude must be in radians. The Easting and Northing values will be returned in meters. PROGRAMMER DATE ---------- ---- D. Steinwand, EROS Nov, 1991 T. Mittan Mar, 1993 Abe Taaheri/Emergent Info. Tech., Inc. June, 2000 Abe Taaheri/L3 Comm. Analyrics Corp. Oct. 2002 Modified to support both spherical and ellipsoid models of earth for Cylinderical Equal Area projection. ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double r_major; /* major axis */ static double r_minor; /* minor axis */ static double e; /* eccentricity */ static double es; /* eccentricity squared */ static double lon_center; /* Center longitude (projection center) */ static double lat_truesc; /* Latitude of true scale */ static double false_northing; /* y offset in meters */ static double false_easting; /* x offset in meters */ static double cosphi1; /* cos of latitude of true scale */ static double sinphi1; /* sin of latitude of true scale */ static double kz; /* K_0 for Cylinderical Equal Area proj.*/ static long ind; /* spherical flag */ /* Initialize the Cylinderical Equal Area projection -------------------------------------------------*/ int bceaforint( double r_maj, /* major axis */ double r_min, /* minor axis */ double center_lon, /* center longitude */ double center_lat, /* center latitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { double temp; /* temporary variable */ /* Place parameters in static storage for common use -------------------------------------------------*/ r_major = r_maj; r_minor = r_min; lon_center = center_lon; lat_truesc = center_lat; false_northing = false_north; false_easting = false_east; temp = r_minor / r_major; es = 1.0 - SQUARE(temp); e = sqrt(es); if(es < 0.00001) { ind = 1; } else { ind = 0; } cosphi1 = cos(lat_truesc); sinphi1 = sin(lat_truesc); kz = cosphi1/(sqrt(1.0 - (es*sinphi1*sinphi1))); /* Report parameters to the user -----------------------------*/ ptitle("Cylinderical Equal Area"); radius2(r_major, r_minor); cenlonmer(lon_center); true_scale(lat_truesc); offsetp(false_easting,false_northing); return(OK); } /* Cylinderical Equal Area forward equations--mapping lat,long to x,y --------------------------------------------------*/ int bceafor( double lon, /* (I) Longitude */ double lat, /* (I) Latitude */ double *x, /* (O) X projection coordinate */ double *y) /* (O) Y projection coordinate */ { double dlon; /* delta longitude value */ double sinphi; /* sin value */ double q; /* Forward equations -----------------*/ dlon = adjust_lon(lon - lon_center); sinphi = sin(lat); if( ind != 0) /* sphere */ { *x = false_easting + r_major * dlon * cosphi1; *y = false_northing + r_major * sinphi / cosphi1; } else /* ellipsoid */ { q = (1.0 - es) * ((sinphi / (1.0 - es * sinphi * sinphi)) - (1.0 / (2.0 * e)) * log((1.0 - e * sinphi)/(1.0 + e * sinphi))); *x = false_easting + (r_major * kz * dlon); *y = false_northing + (r_major * q) / (2.0 * kz); } return(OK); } hdf-eos5-2.0/gctp/src/bceainv.c000077500000000000000000000113341507520047200162730ustar00rootroot00000000000000/******************************************************************************* NAME Cylinderical Equal Area PURPOSE: Transforms input Easting and Northing to longitude and latitude for the Cylinderical Equal Area projection. The Easting and Northing must be in meters. The longitude and latitude values will be returned in radians. PROGRAMMER DATE ---------- ---- D. Steinwand, EROS Nov, 1991 T. Mittan Mar, 1993 Abe Taaheri/Emergent Info Tech, Inc. June, 2000 Abe Taaheri/L3 Comm. Analyrics Corp. Oct. 2002 Modified to support both spherical and ellipsoid models of earth for Cylinderical Equal Area projection. ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double r_major; /* major axis */ static double r_minor; /* minor axis */ static double e; /* eccentricity */ static double es; /* eccentricity squared */ static double e_p4; /* eccentricity's 4th power */ static double e_p6; /* eccentricity's 6th power */ static double lon_center; /* Center longitude (projection center) */ static double lat_truesc; /* latitude of true scale */ static double false_northing; /* y offset in meters */ static double false_easting; /* x offset in meters */ static double cosphi1; /* cos of latitude of true scale */ static double sinphi1; /* sin of latitude of true scale */ static double kz; /* K_0 for Cylinderical Equal Area proj.*/ static double qp; /* qp for Cylinderical Equal Area proj.*/ static long ind; /* spherical flag */ /* Initialize the Cylinderical Equal Area projection -----------------------------------*/ int bceainvint( double r_maj, /* major axis */ double r_min, /* minor axis */ double center_lon, /* center longitude */ double center_lat, /* center latitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { double temp; /* temporary variable */ /* Place parameters in static storage for common use -------------------------------------------------*/ r_major = r_maj; r_minor = r_min; lon_center = center_lon; lat_truesc = center_lat; false_northing = false_north; false_easting = false_east; temp = r_minor / r_major; es = 1.0 - SQUARE(temp); e = sqrt(es); e_p4 = es * es; e_p6 = e_p4 *es; if(e < 0.00001) { ind = 1; qp = 2.0; } else { ind = 0; qp = (1.0 - es)*((1.0/(1.0 - es))-(1.0/(2.0*e))*log((1.0 - e)/(1.0 + e))); } cosphi1 = cos(lat_truesc); sinphi1 = sin(lat_truesc); kz = cosphi1/(sqrt(1.0 - (es*sinphi1*sinphi1))); /* Report parameters to the user -----------------------------*/ ptitle("Cylinderical Equal Area"); radius2(r_major, r_minor); cenlonmer(lon_center); true_scale(lat_truesc); offsetp(false_easting,false_northing); return(OK); } /* Cylinderical Equal Area inverse equations--mapping x,y to lat/long --------------------------------------------------*/ int bceainv( double x, /* (O) X projection coordinate */ double y, /* (O) Y projection coordinate */ double *lon, /* (I) Longitude */ double *lat) /* (I) Latitude */ { double beta; /* Inverse equations -----------------*/ x -= false_easting; y -= false_northing; if( ind != 0) /* sphere */ { *lat = asin( y * cosphi1 / r_major); /* we may need to use asinz dfined in cproj.c instead of asin */ *lon = adjust_lon(lon_center + x/(r_major * cosphi1)); } else /* ellipsoid */ { beta = asin(2.0 * y * kz/(r_major * qp)); *lat = beta +(((es / 3.0) + ((31.0/180.0) * e_p4)+ ((517.0/5040.0) * e_p6)) * sin(2.0*beta))+ ((((23.0/360.0) * e_p4)+ ((251.0/3780.0) * e_p6)) * sin(4.0*beta))+ (((761.0/45360.0) * e_p6) * sin(6.0*beta)); *lon = adjust_lon(lon_center + x/(r_major * kz)); } return(OK); } hdf-eos5-2.0/gctp/src/br_gctp.c000077500000000000000000000012751507520047200163070ustar00rootroot00000000000000 #ifdef unix /* Fortran bridge routine for the UNIX */ void gctp_(incoor,insys,inzone,inparm,inunit,indatum,ipr,efile,jpr,pfile, outcoor, outsys,outzone,outparm,outunit,fn27,fn83,iflg) double *incoor; long *insys; long *inzone; double *inparm; long *inunit; long *indatum; long *ipr; /* printout flag for error messages. 0=yes, 1=no*/ char *efile; long *jpr; /* printout flag for projection parameters 0=yes, 1=no*/ char *pfile; double *outcoor; long *outsys; long *outzone; double *outparm; long *outunit; long *iflg; { gctp(incoor,insys,inzone,inparm,inunit,indatum,ipr,efile,jpr,pfile,outcoor, outsys,outzone,outparm,outunit,fn27,fn83,iflg); return; } #endif hdf-eos5-2.0/gctp/src/ceafor.c000077500000000000000000000115731507520047200161300ustar00rootroot00000000000000/******************************************************************************* NAME Cylinderical Equal Area PURPOSE: Transforms input longitude and latitude to Easting and Northing for the Cylinderical Equal Area projection. The longitude and latitude must be in radians. The Easting and Northing values will be returned in meters. PROGRAMMER DATE REASON ---------- ---- ------ Abe Taaheri/Emergent Info. Tech., Inc. 6/15/00 Initial version. Abe Taaheri/L3 Comm. Analyrics Corp. 1/15/03 Modified to support both spherical and ellipsoidal models of earth for Cylinderical Equal Area projection to support EASE-Grid and to support EASE-Grid2. ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. 3. "EASE-Grid 2.0: Incremental but Significant Improvements for Earth-Gridded Data Sets", Mary J. Brodzik ?, Brendan Billingsley, Terry Haran , Bruce Raup and Matthew H.Savoie, National Snow & Ice Data Center, Cooperative Institute of Environmental Sciences, University of Colorado, 449 UCB, Boulder, CO 80309, USA; E-Mails: brendan.billingsley@nsidc.org (B.B.); tharan@nsidc.org (T.H.); braup@nsidc.org (B.R.); savoie@nsidc.org (M.H.S.) *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double r_major; /* major axis */ static double r_minor; /* minor axis */ static double e; /* eccentricity */ static double es; /* eccentricity squared */ static double lon_center; /* Center longitude (projection center) */ static double lat_truesc; /* Latitude of true scale */ static double false_northing; /* y offset in meters */ static double false_easting; /* x offset in meters */ static double cosphi1; /* cos of latitude of true scale */ static double sinphi1; /* sin of latitude of true scale */ static double kz; /* K_0 for Cylinderical Equal Area proj.*/ static long ind; /* spherical flag */ /* Initialize the Cylinderical Equal Area projection -------------------------------------------------*/ int ceaforint( double r_maj, /* major axis */ double r_min, /* minor axis */ double center_lon, /* center longitude */ double center_lat, /* center latitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { double temp; /* temporary variable */ /* Place parameters in static storage for common use -------------------------------------------------*/ r_major = r_maj; r_minor = r_min; lon_center = center_lon; lat_truesc = center_lat; false_northing = false_north; false_easting = false_east; temp = r_minor / r_major; es = 1.0 - SQUARE(temp); e = sqrt(es); if(es < 0.00001) { ind = 1; } else { ind = 0; } cosphi1 = cos(lat_truesc); sinphi1 = sin(lat_truesc); kz = cosphi1/(sqrt(1.0 - (es*sinphi1*sinphi1))); /* Report parameters to the user -----------------------------*/ ptitle("Cylinderical Equal Area"); radius2(r_major, r_minor); cenlonmer(lon_center); true_scale(lat_truesc); offsetp(false_easting,false_northing); return(OK); } /* Cylinderical Equal Area forward equations--mapping lat,long to x,y --------------------------------------------------*/ int ceafor( double lon, /* (I) Longitude */ double lat, /* (I) Latitude */ double *x, /* (O) X projection coordinate */ double *y) /* (O) Y projection coordinate */ { double dlon; /* delta longitude value */ double sinphi; /* sin value */ double q; /* Forward equations -----------------*/ dlon = adjust_lon(lon - lon_center); sinphi = sin(lat); if( ind != 0) /* sphere */ { *x = false_easting + r_major * dlon * cosphi1; *y = false_northing + r_major * sinphi / cosphi1; } else /* ellipsoid */ { q = (1.0 - es) * ((sinphi / (1.0 - es * sinphi * sinphi)) - (1.0 / (2.0 * e)) * log((1.0 - e * sinphi)/(1.0 + e * sinphi))); *x = false_easting + (r_major * kz * dlon); *y = false_northing + (r_major * q) / (2.0 * kz); } return(OK); } hdf-eos5-2.0/gctp/src/ceainv.c000077500000000000000000000123571507520047200161370ustar00rootroot00000000000000/******************************************************************************* NAME Cylinderical Equal Area PURPOSE: Transforms input Easting and Northing to longitude and latitude for the Cylinderical Equal Area projection. The Easting and Northing must be in meters. The longitude and latitude values will be returned in radians. PROGRAMMER DATE REASON ---------- ---- ------ Abe Taaheri/Emergent Info. Tech., Inc. 6/15/00 Initial version. Abe Taaheri/L3 Comm. Analyrics Corp. 1/15/03 Modified to support both spherical and ellipsoidal models of earth for Cylinderical Equal Area projection to support EASE-Grid and to support EASE-Grid2. ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. 3. "EASE-Grid 2.0: Incremental but Significant Improvements for Earth-Gridded Data Sets", Mary J. Brodzik ?, Brendan Billingsley, Terry Haran , Bruce Raup and Matthew H.Savoie, National Snow & Ice Data Center, Cooperative Institute of Environmental Sciences, University of Colorado, 449 UCB, Boulder, CO 80309, USA; E-Mails: brendan.billingsley@nsidc.org (B.B.); tharan@nsidc.org (T.H.); braup@nsidc.org (B.R.); savoie@nsidc.org (M.H.S.) *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double r_major; /* major axis */ static double r_minor; /* minor axis */ static double e; /* eccentricity */ static double es; /* eccentricity squared */ static double e_p4; /* eccentricity's 4th power */ static double e_p6; /* eccentricity's 6th power */ static double lon_center; /* Center longitude (projection center) */ static double lat_truesc; /* latitude of true scale */ static double false_northing; /* y offset in meters */ static double false_easting; /* x offset in meters */ static double cosphi1; /* cos of latitude of true scale */ static double sinphi1; /* sin of latitude of true scale */ static double kz; /* K_0 for Cylinderical Equal Area proj.*/ static double qp; /* qp for Cylinderical Equal Area proj.*/ static long ind; /* spherical flag */ /* Initialize the Cylinderical Equal Area projection -----------------------------------*/ int ceainvint( double r_maj, /* major axis */ double r_min, /* minor axis */ double center_lon, /* center longitude */ double center_lat, /* center latitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { double temp; /* temporary variable */ /* Place parameters in static storage for common use -------------------------------------------------*/ r_major = r_maj; r_minor = r_min; lon_center = center_lon; lat_truesc = center_lat; false_northing = false_north; false_easting = false_east; temp = r_minor / r_major; es = 1.0 - SQUARE(temp); e = sqrt(es); e_p4 = es * es; e_p6 = e_p4 *es; if(e < 0.00001) { ind = 1; qp = 2.0; } else { ind = 0; qp = (1.0 - es)*((1.0/(1.0 - es))-(1.0/(2.0*e))*log((1.0 - e)/(1.0 + e))); } cosphi1 = cos(lat_truesc); sinphi1 = sin(lat_truesc); kz = cosphi1/(sqrt(1.0 - (es*sinphi1*sinphi1))); /* Report parameters to the user -----------------------------*/ ptitle("Cylinderical Equal Area"); radius2(r_major, r_minor); cenlonmer(lon_center); true_scale(lat_truesc); offsetp(false_easting,false_northing); return(OK); } /* Cylinderical Equal Area inverse equations--mapping x,y to lat/long --------------------------------------------------*/ int ceainv( double x, /* (O) X projection coordinate */ double y, /* (O) Y projection coordinate */ double *lon, /* (I) Longitude */ double *lat) /* (I) Latitude */ { double beta; /* Inverse equations -----------------*/ x -= false_easting; y -= false_northing; if( ind != 0) /* sphere */ { *lat = asinz( y * cosphi1 / r_major); /*we may need to use asinz dfined in cproj.c instead of asin */ *lon = adjust_lon(lon_center + x/(r_major * cosphi1)); } else /* ellipsoid */ { beta = asinz(2.0 * y * kz/(r_major * qp)); *lat = beta +(((es / 3.0) + ((31.0/180.0) * e_p4)+ ((517.0/5040.0) * e_p6)) * sin(2.0*beta))+ ((((23.0/360.0) * e_p4)+ ((251.0/3780.0) * e_p6)) * sin(4.0*beta))+ (((761.0/45360.0) * e_p6) * sin(6.0*beta)); *lon = adjust_lon(lon_center + x/(r_major * kz)); } return(OK); } hdf-eos5-2.0/gctp/src/cproj.c000077500000000000000000000270201507520047200160000ustar00rootroot00000000000000/******************************************************************************* NAME Projection support routines listed below. PURPOSE: The following functions are included in CPROJ.C. SINCOS: Calculates the sine and cosine. ASINZ: Eliminates roundoff errors. MSFNZ: Computes the constant small m for Oblique Equal Area. QSFNZ: Computes the constant small q for Oblique Equal Area. PHI1Z: Computes phi1 for Albers Conical Equal-Area. PHI2Z: Computes the latitude angle, phi2, for Lambert Conformal Conic and Polar Stereographic. PHI3Z: Computes the latitude, phi3, for Equidistant Conic. PHI4Z: Computes the latitude, phi4, for Polyconic. PAKCZ: Converts a 2 digit alternate packed DMS format to standard packed DMS format. PAKR2DM: Converts radians to 3 digit packed DMS format. TSFNZ: Computes the small t for Lambert Conformal Conic and Polar Stereographic. SIGN: Returns the sign of an argument. ADJUST_LON: Adjusts a longitude angle to range -180 to 180. E0FN, E1FN, E2FN, E3FN: Computes the constants e0,e1,e2,and e3 for calculating the distance along a meridian. E4FN: Computes e4 used for Polar Stereographic. MLFN: Computes M, the distance along a meridian. CALC_UTM_ZONE: Calculates the UTM zone number. PROGRAMMER DATE REASON ---------- ---- ------ D. Steinwand, EROS July, 1991 Initial development T. Mittan, EROS May, 1993 Modified from Fortran GCTP for C GCTP S. Nelson, EROS June, 1993 Added inline comments S. Nelson, EROS Nov, 1993 Added loop counter in ADJUST_LON *******************************************************************************/ #include #include "cproj.h" #define MAX_VAL 4 #define MAXLONG 2147483647. #define DBLLONG 4.61168601e18 /* Function to calculate the sine and cosine in one call. Some computer systems have implemented this function, resulting in a faster implementation than calling each function separately. It is provided here for those computer systems which don`t implement this function ----------------------------------------------------*/ /*#ifndef sun */ void tsincos(double val, double *sin_val, double *cos_val) { *sin_val = sin(val); *cos_val = cos(val); return; } /* #endif */ /* Function to eliminate roundoff errors in asin ----------------------------------------------*/ double asinz (double con) { if (fabs(con) > 1.0) { if (con > 1.0) con = 1.0; else con = -1.0; } return(asin(con)); } /* Function to compute the constant small m which is the radius of a parallel of latitude, phi, divided by the semimajor axis. ---------------------------------------------------------------*/ double msfnz ( double eccent, double sinphi, double cosphi) { double con; con = eccent * sinphi; return((cosphi / (sqrt (1.0 - con * con)))); } /* Function to compute constant small q which is the radius of a parallel of latitude, phi, divided by the semimajor axis. ------------------------------------------------------------*/ double qsfnz ( double eccent, double sinphi, double cosphi) { double con; if (eccent > 1.0e-7) { con = eccent * sinphi; return (( 1.0- eccent * eccent) * (sinphi /(1.0 - con * con) - (.5/eccent)* log((1.0 - con)/(1.0 + con)))); } else return(2.0 * sinphi); } /* Function to compute phi1, the latitude for the inverse of the Albers Conical Equal-Area projection. -------------------------------------------*/ double phi1z ( double eccent, /* Eccentricity angle in radians */ double qs, /* Angle in radians */ long *flag) /* Error flag number */ { double eccnts; double dphi; double con; double com; double sinpi; double cospi; double phi; long i; phi = asinz(.5 * qs); if (eccent < EPSLN) return(phi); eccnts = eccent * eccent; for (i = 1; i <= 25; i++) { tsincos(phi,&sinpi,&cospi); con = eccent * sinpi; com = 1.0 - con * con; dphi = .5 * com * com / cospi * (qs / (1.0 - eccnts) - sinpi / com + .5 / eccent * log ((1.0 - con) / (1.0 + con))); phi = phi + dphi; if (fabs(dphi) <= 1e-7) return(phi); } p_error ("Convergence error","phi1z-conv"); *flag = 001; return(ERROR); } /* Function to compute the latitude angle, phi2, for the inverse of the Lambert Conformal Conic and Polar Stereographic projections. ----------------------------------------------------------------*/ double phi2z( double eccent, /* Spheroid eccentricity */ double ts, /* Constant value t */ long *flag) /* Error flag number */ { double eccnth; double phi; double con; double dphi; double sinpi; long i; *flag = 0; eccnth = .5 * eccent; phi = HALF_PI - 2 * atan(ts); for (i = 0; i <= 15; i++) { sinpi = sin(phi); con = eccent * sinpi; dphi = HALF_PI - 2 * atan(ts *(pow(((1.0 - con)/(1.0 + con)),eccnth))) - phi; phi += dphi; if (fabs(dphi) <= .0000000001) return(phi); } p_error ("Convergence error","phi2z-conv"); *flag = 002; return(002); } /* Function to compute latitude, phi3, for the inverse of the Equidistant Conic projection. -----------------------------------------------------------------*/ double phi3z( double ml, /* Constant */ double e0, /* Constant */ double e1, /* Constant */ double e2, /* Constant */ double e3, /* Constant */ long *flag) /* Error flag number */ { double phi; double dphi; long i; phi = ml; for (i = 0; i < 15; i++) { dphi = (ml + e1 * sin(2.0 * phi) - e2 * sin(4.0 * phi) + e3 * sin(6.0 * phi)) / e0 - phi; phi += dphi; if (fabs(dphi) <= .0000000001) { *flag = 0; return(phi); } } p_error("Latitude failed to converge after 15 iterations","PHI3Z-CONV"); *flag = 3; return(3); } /* Function to compute, phi4, the latitude for the inverse of the Polyconic projection. ------------------------------------------------------------*/ double phi4z ( double eccent, /* Spheroid eccentricity squared */ double e0, double e1, double e2, double e3, double a, double b, double *c, double *phi) { double sinphi; double sin2ph; double tanphi; double ml; double mlp; double con1; double con2; double con3; double dphi; long i; *phi = a; for (i = 1; i <= 15; i++) { sinphi = sin(*phi); tanphi = tan(*phi); *c = tanphi * sqrt (1.0 - eccent * sinphi * sinphi); sin2ph = sin (2.0 * *phi); /* ml = e0 * *phi - e1 * sin2ph + e2 * sin (4.0 * *phi); mlp = e0 - 2.0 * e1 * cos (2.0 * *phi) + 4.0 * e2 * cos (4.0 * *phi); */ ml = e0 * *phi - e1 * sin2ph + e2 * sin (4.0 * *phi) - e3 * sin (6.0 * *phi); mlp = e0 - 2.0 * e1 * cos (2.0 * *phi) + 4.0 * e2 * cos (4.0 * *phi) - 6.0 * e3 * cos (6.0 * *phi); con1 = 2.0 * ml + *c * (ml * ml + b) - 2.0 * a * (*c * ml + 1.0); con2 = eccent * sin2ph * (ml * ml + b - 2.0 * a * ml) / (2.0 * *c); con3 = 2.0 * (a - ml) * (*c * mlp - 2.0 / sin2ph) - 2.0 * mlp; dphi = con1 / (con2 + con3); *phi += dphi; if (fabs(dphi) <= .0000000001 ) return(OK); } p_error("Lattitude failed to converge","phi4z-conv"); return(004); } /* Function to convert 2 digit alternate packed DMS format (+/-)DDDMMSS.SSS to 3 digit standard packed DMS format (+/-)DDDMMMSSS.SSS. -----------------------------------------------------------------*/ double pakcz( double pak) /* Angle in alternate packed DMS format */ { double con; double secs; long degs,mins; char sgna; sgna = ' '; if (pak < 0.0) sgna = '-'; con = fabs (pak); degs = (long) ((con / 10000.0) + .001); con = con - degs * 10000; mins = (long) ((con / 100.0) + .001); secs = con - mins * 100; con = (double) (degs) * 1000000.0 + (double) (mins) * 1000.0 + secs; if (sgna == '-') con = - con; return(con); } /* Function to convert radians to 3 digit packed DMS format (+/-)DDDMMMSSS.SSS ----------------------------------------------------------------------------*/ double pakr2dm( double pak) /* Angle in radians */ { double con; double secs; long degs,mins; char sgna; sgna = ' '; pak *= R2D; if (pak < 0.0) sgna = '-'; con = fabs (pak); degs = (long) (con); con = (con - degs) * 60; mins = (long) con; secs = (con - mins) * 60; con = (double) (degs) * 1000000.0 + (double) (mins) * 1000.0 + secs; if (sgna == '-') con = - con; return(con); } /* Function to compute the constant small t for use in the forward computations in the Lambert Conformal Conic and the Polar Stereographic projections. --------------------------------------------------------------*/ double tsfnz( double eccent, /* Eccentricity of the spheroid */ double phi, /* Latitude phi */ double sinphi) /* Sine of the latitude */ { double con; double com; con = eccent * sinphi; com = .5 * eccent; con = pow(((1.0 - con) / (1.0 + con)),com); return (tan(.5 * (HALF_PI - phi))/con); } /* Function to return the sign of an argument ------------------------------------------*/ int sign(double x) { if (x < 0.0) return(-1); else return(1);} /* Function to adjust a longitude angle to range from -180 to 180 radians added if statments -----------------------------------------------------------------------*/ double adjust_lon( double x) /* Angle in radians */ { long count = 0; for(;;) { if (fabs(x)<=PI) break; else if (((long) fabs(x / PI)) < 2) x = x-(sign(x) *TWO_PI); else if (((long) fabs(x / TWO_PI)) < MAXLONG) { x = x-(((long)(x / TWO_PI))*TWO_PI); } else if (((long) fabs(x / (MAXLONG * TWO_PI))) < MAXLONG) { x = x-(((long)(x / (MAXLONG * TWO_PI))) * (TWO_PI * MAXLONG)); } else if (((long) fabs(x / (DBLLONG * TWO_PI))) < MAXLONG) { x = x-(((long)(x / (DBLLONG * TWO_PI))) * (TWO_PI * DBLLONG)); } else x = x-(sign(x) *TWO_PI); count++; if (count > MAX_VAL) break; } return(x); } /* Functions to compute the constants e0, e1, e2, and e3 which are used in a series for calculating the distance along a meridian. The input x represents the eccentricity squared. ----------------------------------------------------------------*/ double e0fn(double x){return(1.0-0.25*x*(1.0+x/16.0*(3.0+1.25*x)));} double e1fn(double x){return(0.375*x*(1.0+0.25*x*(1.0+0.46875*x)));} double e2fn(double x){return(0.05859375*x*x*(1.0+0.75*x));} double e3fn(double x){return(x*x*x*(35.0/3072.0));} /* Function to compute the constant e4 from the input of the eccentricity of the spheroid, x. This constant is used in the Polar Stereographic projection. --------------------------------------------------------------------*/ double e4fn(double x) { double con; double com; con = 1.0 + x; com = 1.0 - x; return (sqrt((pow(con,con))*(pow(com,com)))); } /* Function computes the value of M which is the distance along a meridian from the Equator to latitude phi. ------------------------------------------------*/ double mlfn(double e0, double e1, double e2, double e3, double phi){ return(e0*phi-e1*sin(2.0*phi)+e2*sin(4.0*phi)-e3*sin(6.0*phi));} /* Function to calculate UTM zone number--NOTE Longitude entered in DEGREES!!! ---------------------------------------------------------------------------*/ long calc_utm_zone(double lon) { return((long)(((lon + 180.0) / 6.0) + 1.0)); } hdf-eos5-2.0/gctp/src/eqconfor.c000077500000000000000000000102211507520047200164720ustar00rootroot00000000000000/******************************************************************************* NAME EQUIDISTANT CONIC PURPOSE: Transforms input longitude and latitude to Easting and Northing for the Equidistant Conic projection. The longitude and latitude must be in radians. The Easting and Northing values will be returned in meters. PROGRAMMER DATE ---------- ---- T. Mittan Mar, 1993 ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double r_major; /* major axis */ static double r_minor; /* minor axis */ static double lon_center; /* Center longitude (projection center) */ static double e0,e1,e2,e3; /* eccentricity constants */ static double e,es; /* eccentricity constants */ static double ml0; /* small value m */ static double false_northing; /* y offset in meters */ static double false_easting; /* x offset in meters */ static double ns; static double g; static double rh; /* Initialize the Equidistant Conic projection ------------------------------------------*/ int eqconforint( double r_maj, /* major axis */ double r_min, /* minor axis */ double lat1, /* latitude of standard parallel*/ double lat2, /* latitude of standard parallel*/ double center_lon, /* center longitude */ double center_lat, /* center latitude */ double false_east, /* x offset in meters */ double false_north, /* y offset in meters */ long mode) /* which format is present A B */ { double temp; /* temporary variable */ double sinphi,cosphi; /* sin and cos values */ double ms1,ms2; double ml1,ml2; /* Place parameters in static storage for common use -------------------------------------------------*/ r_major = r_maj; r_minor = r_min; lon_center = center_lon; false_northing = false_north; false_easting = false_east; temp = r_minor / r_major; es = 1.0 - SQUARE(temp); e = sqrt(es); e0 = e0fn(es); e1 = e1fn(es); e2 = e2fn(es); e3 = e3fn(es); tsincos(lat1,&sinphi,&cosphi); ms1 = msfnz(e,sinphi,cosphi); ml1 = mlfn(e0, e1, e2, e3, lat1); /* format B ---------*/ if (mode != 0) { if (fabs(lat1 + lat2) < EPSLN) { p_error("Standard Parallels on opposite sides of equator","eqcon_for"); return(81); } tsincos(lat2,&sinphi,&cosphi); ms2 = msfnz(e,sinphi,cosphi); ml2 = mlfn(e0, e1, e2, e3, lat2); if (fabs(lat1 - lat2) >= EPSLN) ns = (ms1 - ms2) / (ml2 - ml1); else ns = sinphi; } else ns = sinphi; g = ml1 + ms1/ns; ml0 = mlfn(e0, e1, e2, e3, center_lat); rh = r_major * (g - ml0); /* Report parameters to the user -----------------------------*/ if (mode != 0) { ptitle("EQUIDISTANT CONIC"); radius2(r_major, r_minor); stanparl(lat1,lat2); cenlonmer(lon_center); origin(center_lat); offsetp(false_easting,false_northing); } else { ptitle("EQUIDISTANT CONIC"); radius2(r_major, r_minor); stparl1(lat1); cenlonmer(lon_center); origin(center_lat); offsetp(false_easting,false_northing); } return(OK); } /* Equidistant Conic forward equations--mapping lat,long to x,y -----------------------------------------------------------*/ int eqconfor( double lon, /* (I) Longitude */ double lat, /* (I) Latitude */ double *x, /* (O) X projection coordinate */ double *y) /* (O) Y projection coordinate */ { double ml; double theta; double rh1; /* Forward equations -----------------*/ ml = mlfn(e0, e1, e2, e3, lat); rh1 = r_major * (g - ml); theta = ns * adjust_lon(lon - lon_center); *x = false_easting + rh1 * sin(theta); *y = false_northing + rh - rh1 * cos(theta); return(OK); } hdf-eos5-2.0/gctp/src/eqconinv.c000077500000000000000000000106011507520047200165020ustar00rootroot00000000000000/******************************************************************************* NAME EQUIDISTANT CONIC PURPOSE: Transforms input Easting and Northing to longitude and latitude for the Equidistant Conic projection. The Easting and Northing must be in meters. The longitude and latitude values will be returned in radians. PROGRAMMER DATE ---------- ---- T. Mittan Mar, 1993 ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double r_major; /* major axis */ static double r_minor; /* minor axis */ static double lon_center; /* Center longitude (projection center) */ static double e0,e1,e2,e3; /* eccentricity constants */ static double e,es; /* eccentricity constants */ static double ml0; /* small value m */ static double false_northing; /* y offset in meters */ static double false_easting; /* x offset in meters */ static double ns; static double g; static double rh; /* Initialize the Equidistant Conic projection ------------------------------------------*/ int eqconinvint( double r_maj, /* major axis */ double r_min, /* minor axis */ double lat1, /* latitude of standard parallel*/ double lat2, /* latitude of standard parallel*/ double center_lon, /* center longitude */ double center_lat, /* center latitude */ double false_east, /* x offset in meters */ double false_north, /* y offset in meters */ long mode) /* which format is present A B */ { double temp; /* temporary variable */ double sinphi,cosphi; /* sin and cos values */ double ms1,ms2; double ml1,ml2; /* Place parameters in static storage for common use -------------------------------------------------*/ r_major = r_maj; r_minor = r_min; lon_center = center_lon; false_northing = false_north; false_easting = false_east; temp = r_minor / r_major; es = 1.0 - SQUARE(temp); e = sqrt(es); e0 = e0fn(es); e1 = e1fn(es); e2 = e2fn(es); e3 = e3fn(es); tsincos(lat1,&sinphi,&cosphi); ms1 = msfnz(e,sinphi,cosphi); ml1 = mlfn(e0, e1, e2, e3, lat1); /* format B ---------*/ if (mode != 0) { if (fabs(lat1 + lat2) < EPSLN) { p_error("Standard Parallels on opposite sides of equator","eqcon-for"); return(81); } tsincos(lat2,&sinphi,&cosphi); ms2 = msfnz(e,sinphi,cosphi); ml2 = mlfn(e0, e1, e2, e3, lat2); if (fabs(lat1 - lat2) >= EPSLN) ns = (ms1 - ms2) / (ml2 - ml1); else ns = sinphi; } else ns = sinphi; g = ml1 + ms1/ns; ml0 = mlfn(e0, e1, e2, e3, center_lat); rh = r_major * (g - ml0); /* Report parameters to the user -----------------------------*/ if (mode != 0) { ptitle("EQUIDISTANT CONIC"); radius2(r_major, r_minor); stanparl(lat1,lat2); cenlonmer(lon_center); origin(center_lat); offsetp(false_easting,false_northing); } else { ptitle("EQUIDISTANT CONIC"); radius2(r_major, r_minor); stparl1(lat1); cenlonmer(lon_center); origin(center_lat); offsetp(false_easting,false_northing); } return(OK); } /* Equidistant Conic inverse equations--mapping x,y to lat/long -----------------------------------------------------------*/ int eqconinv( double x, /* (O) X projection coordinate */ double y, /* (O) Y projection coordinate */ double *lon, /* (I) Longitude */ double *lat) /* (I) Latitude */ { double rh1; double ml; double con; double theta; long flag; /* Inverse equations -----------------*/ flag = 0; x -= false_easting; y = rh - y + false_northing; if (ns >= 0) { rh1 = sqrt(x * x + y * y); con = 1.0; } else { rh1 = -sqrt(x * x + y * y); con = -1.0; } theta = 0.0; if (rh1 != 0.0) theta = atan2(con * x, con * y); ml = g - rh1 / r_major; *lat = phi3z(ml,e0,e1,e2,e3,&flag); *lon = adjust_lon(lon_center + theta / ns); if (flag != 0) return(flag); else return(OK); } hdf-eos5-2.0/gctp/src/equifor.c000077500000000000000000000051671507520047200163450ustar00rootroot00000000000000/******************************************************************************* NAME EQUIRECTANGULAR PURPOSE: Transforms input longitude and latitude to Easting and Northing for the Equirectangular projection. The longitude and latitude must be in radians. The Easting and Northing values will be returned in meters. PROGRAMMER DATE ---------- ---- T. Mittan Mar, 1993 ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double r_major; /* major axis */ static double lon_center; /* Center longitude (projection center) */ static double lat_origin; /* center latitude */ static double false_northing; /* y offset in meters */ static double false_easting; /* x offset in meters */ /* Initialize the Equirectangular projection ----------------------------------------*/ int equiforint( double r_maj, /* major axis */ double center_lon, /* center longitude */ double lat1, /* latitude of true scale */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { /* Place parameters in static storage for common use -------------------------------------------------*/ r_major = r_maj; lon_center = center_lon; lat_origin = lat1; false_northing = false_north; false_easting = false_east; /* Report parameters to the user -----------------------------*/ ptitle("EQUIRECTANGULAR"); radius(r_major); cenlonmer(lon_center); origin(lat_origin); offsetp(false_easting,false_northing); return(OK); } /* Equirectangular forward equations--mapping lat,long to x,y ---------------------------------------------------------*/ int equifor( double lon, /* (I) Longitude */ double lat, /* (I) Latitude */ double *x, /* (O) X projection coordinate */ double *y) /* (O) Y projection coordinate */ { double dlon; /* delta longitude value */ /* Forward equations -----------------*/ dlon = adjust_lon(lon - lon_center); *x = false_easting + r_major * dlon * cos(lat_origin); *y = false_northing + r_major * lat; return(OK); } hdf-eos5-2.0/gctp/src/equiinv.c000077500000000000000000000052471507520047200163520ustar00rootroot00000000000000/******************************************************************************* NAME EQUIRECTANGULAR PURPOSE: Transforms input Easting and Northing to longitude and latitude for the Equirectangular projection. The Easting and Northing must be in meters. The longitude and latitude values will be returned in radians. PROGRAMMER DATE ---------- ---- T. Mittan Mar, 1993 ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double r_major; /* major axis */ static double lon_center; /* Center longitude (projection center) */ static double lat_origin; /* center latitude */ static double false_northing; /* y offset in meters */ static double false_easting; /* x offset in meters */ /* Initialize the Equirectangular projection ----------------------------------------*/ int equiinvint( double r_maj, /* major axis */ double center_lon, /* center longitude */ double lat1, /* latitude of true scale */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { /* Place parameters in static storage for common use -------------------------------------------------*/ r_major = r_maj; lon_center = center_lon; lat_origin = lat1; false_northing = false_north; false_easting = false_east; /* Report parameters to the user -----------------------------*/ ptitle("EQUIRECTANGULAR"); radius(r_major); cenlonmer(lon_center); origin(lat_origin); offsetp(false_easting,false_northing); return(OK); } /* Equirectangular inverse equations--mapping x,y to lat/long ---------------------------------------------------------*/ int equiinv( double x, /* (O) X projection coordinate */ double y, /* (O) Y projection coordinate */ double *lon, /* (I) Longitude */ double *lat) /* (I) Latitude */ { /* Inverse equations -----------------*/ x -= false_easting; y -= false_northing; *lat = y / r_major; if (fabs(*lat) > HALF_PI) { p_error("Input data error","equi-inv"); return(174); } *lon = adjust_lon(lon_center + x / (r_major * cos(lat_origin))); return(OK); } hdf-eos5-2.0/gctp/src/for_init.c000077500000000000000000000622211507520047200164760ustar00rootroot00000000000000/******************************************************************************* NAME FOR_INIT PURPOSE: Initializes forward projection transformation parameters PROGRAMMER DATE REASON ---------- ---- ------ T. Mittan 3-09-93 Initial Development S. Nelson 11-94 Added Clarke spheroid default to UTM Raj Gejjagaraguppe(ARC) 8-30-96 Landsat Ratio is removed as hard coded value. Now this ratio can be an input from the user through the projection parameter array element number 9. Raj Gejjagaraguppe(ARC) 1-07-97 Added a new projection type called Integerized Sinusoidal Grid to support MODIS level 3 datasets. D. Wynne(ARC) 3-24-97 Added Support for Power Challenge (R10000 Processor Chip Revision: 2.5) Long is 8 bytes, on all other currently supported platforms Long is 4 bytes. Abe Taaheri 06-27-00 Added a new projection type called Behrmann Cylinderical Equal Area to support EASE grid. Abe Taaheri 10-23-00 Updated for ISINUS projection, so that both codes 31 and 99 (i.e. ISINUS and ISINUS1) can be used for this projection. Abe Taaheri 1-15-03 Modified to support both spherical and ellipsoid models of earth for Normal Cylinderical Equal Area projection. Abe Taaheri 8-15-03 Added CEA projection. This is used by generalized EASE grid, when the EASE grid corners are specified in meters (Note that BCEA is similar projection and used when EASE grid corners are set in packed DMS degrees. Abe Taaheri 11-15-03 Modified the call for LA projection to support ellipsoid earth for this projection ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. *******************************************************************************/ #include #include "cproj.h" #include "proj.h" int for_init( int outsys, /* output system code */ int outzone, /* output zone number */ double *outparm, /* output array of projection parameters */ int outdatum, /* output datum */ char *fn27, /* NAD 1927 parameter file */ char *fn83, /* NAD 1983 parameter file */ int *iflg, /* status flag */ int (*for_trans[])(double, double, double *, double *)) /* forward function pointer */ { long zone; /* zone number */ double azimuth; /* azimuth */ double alf; /* SOM angle */ double angle; /* rotation anlge */ double lon1; /* longitude point in utm scene */ double lon2; /* 2nd longitude */ double lat1; /* 1st standard parallel */ double lat2; /* 2nd standard parallel */ double center_long; /* center longitude */ double center_lat; /* center latitude */ double h; /* height above sphere */ double lon_origin; /* longitude at origin */ double lat_origin; /* latitude at origin */ double r_major; /* major axis in meters */ double r_minor; /* minor axis in meters */ double scale_factor; /* scale factor */ double false_easting; /* false easting in meters */ double false_northing; /* false northing in meters */ double shape_m; /* constant used for Oblated Equal Area */ double shape_n; /* constant used for Oblated Equal Area */ long start; /* where SOM starts beginning or end */ double time; /* SOM time */ double radius; /* radius of sphere */ long tmpdatum; /* temporary datum for UTM */ long path; /* SOM path number */ long satnum; /* SOM satellite number */ long mode; /* which initialization method to use A or B */ double sat_ratio; /* satellite ratio which specify the start point*/ double dzone; /* number of longitudinal zones in ISG */ double djustify; /* justify flag in ISG projection */ long thing; /* used to initialize 8 byte pointer, added */ /* for Power Challenge */ long *iflg64; /* 8 byte status flag, for Power Challenge */ thing = 0; /* These lines are to initialize the */ iflg64 = &thing; /* the 8-byte pointer address */ /* Initialize forward transformations -----------------------------------*/ /* find the correct major and minor axis --------------------------------------*/ if(outsys == CEA) { if(outparm[0] > 0.0 || outparm[0] < 0.0 || outparm[1] > 0.0 || outparm[1] < 0.0) { outdatum = -20; } sphdz(outdatum,outparm,&r_major,&r_minor,&radius); } else if(outsys == BCEA) { if(outparm[0] > 0.0 || outparm[0] < 0.0 || outparm[1] > 0.0 || outparm[1] < 0.0) { outdatum = -20; } else /* for BCEA use 6371228.0 m as default for r_maj and r_min, i.e. use spherical earth model with radius 6371228.0 m instead of Clarke 1866 spheroid */ { outdatum = 20; } sphdz(outdatum,outparm,&r_major,&r_minor,&radius); } else { sphdz(outdatum,outparm,&r_major,&r_minor,&radius); } false_easting = outparm[6]; false_northing = outparm[7]; if (outsys == CEA)/* Cylindrical Equal-Area, used for EASE grid wghen grid corners are specified in meters */ { /* this is the call to initialize CEA ----------------------------------------*/ center_long = paksz(outparm[4],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; lat1 = paksz(outparm[5],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR;; *iflg64 = ceaforint(r_major,r_minor,center_long,lat1,false_easting, false_northing); *iflg = (int)*iflg64; for_trans[outsys] = ceafor; } else if (outsys == BCEA)/* Cylindrical Equal-Area, used for EASE grid wghen grid corners are specified in DMS degrees */ { /* this is the call to initialize BCEA ----------------------------------------*/ center_long = paksz(outparm[4],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; lat1 = paksz(outparm[5],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR;; *iflg64 = bceaforint(r_major,r_minor,center_long,lat1,false_easting, false_northing); *iflg = (int)*iflg64; for_trans[outsys] = bceafor; } else if (outsys == UTM) { /* this is the call to initialize U T M -------------------------------------*/ /* set Clarke 1866 spheroid if negative datum code ----------------------------------------------*/ if (outdatum < 0) { tmpdatum = 0; sphdz(tmpdatum,outparm,&r_major,&r_minor,&radius); } zone = outzone; if (zone == 0) { lon1 = paksz(outparm[0],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; lat1 = paksz(outparm[1],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; zone = calc_utm_zone(lon1 * R2D); if (lat1 < 0) zone = -zone; } scale_factor = .9996; *iflg64 = utmforint(r_major,r_minor,scale_factor,zone); *iflg = (int)*iflg64; for_trans[outsys] = utmfor; } else if (outsys == SPCS) { /* this is the call to initialize STATE PLANE -------------------------------------------*/ *iflg64 = stplnforint(outzone,outdatum,fn27,fn83); *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; for_trans[outsys] = stplnfor; } else if (outsys == ALBERS) { /* this is the call to initialize ALBERS CONICAL EQUAL AREA ----------------------------------------------------------*/ lat1 = paksz(outparm[2],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; lat2 = paksz(outparm[3],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; lat_origin = paksz(outparm[5],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; center_long = paksz(outparm[4],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = alberforint(r_major,r_minor,lat1,lat2,center_long,lat_origin, false_easting, false_northing); *iflg = (int)*iflg64; for_trans[outsys] = alberfor; } else if (outsys == LAMCC) { /* this is the call to initialize LAMBERT CONFORMAL CONIC --------------------------------------------------------*/ lat1 = paksz(outparm[2],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; lat2 = paksz(outparm[3],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; center_long = paksz(outparm[4],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; lat_origin = paksz(outparm[5],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = lamccforint(r_major,r_minor,lat1,lat2,center_long,lat_origin, false_easting, false_northing); *iflg = (int)*iflg64; for_trans[outsys] = lamccfor; } else if (outsys == MERCAT) { /* this is the call to initialize MERCATOR ----------------------------------------*/ center_long = paksz(outparm[4],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; lat1 = paksz(outparm[5],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = merforint(r_major,r_minor,center_long,lat1,false_easting, false_northing); *iflg = (int)*iflg64; for_trans[outsys] = merfor; } else if (outsys == PS) { /* this is the call to initialize POLAR STEREOGRAPHIC ----------------------------------------------------*/ center_long = paksz(outparm[4],iflg64)* 3600 * S2R; *iflg = (int) *iflg64; if ((int)*iflg64 != 0) return ERROR; lat1 = paksz(outparm[5],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = psforint(r_major,r_minor,center_long,lat1,false_easting, false_northing); *iflg = (int)*iflg64; for_trans[outsys] = psfor; } else if (outsys == POLYC) { /* this is the call to initialize POLYCONIC -----------------------------------------*/ center_long = paksz(outparm[4],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; lat_origin = paksz(outparm[5],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = polyforint(r_major,r_minor,center_long,lat_origin,false_easting, false_northing); *iflg = (int)*iflg64; for_trans[outsys] = polyfor; } else if (outsys == EQUIDC) { /* this is the call to initialize EQUIDISTANT CONIC -------------------------------------------------*/ lat1 = paksz(outparm[2],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; lat2 = paksz(outparm[3],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; center_long = paksz(outparm[4],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; lat_origin = paksz(outparm[5],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; if (outparm[8] == 0) mode = 0; else mode = 1; *iflg64 = eqconforint(r_major,r_minor,lat1,lat2,center_long,lat_origin, false_easting,false_northing,mode); *iflg = (int)*iflg64; for_trans[outsys] = eqconfor; } else if (outsys == TM) { /* this is the call to initialize TRANSVERSE MECTAR -------------------------------------------------*/ scale_factor = outparm[2]; center_long = paksz(outparm[4],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; lat_origin = paksz(outparm[5],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = tmforint(r_major,r_minor,scale_factor,center_long,lat_origin, false_easting,false_northing); *iflg = (int)*iflg64; for_trans[outsys] = tmfor; } else if (outsys == STEREO) { /* this is the call to initialize STEREOGRAPHIC ---------------------------------------------*/ center_long = paksz(outparm[4],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; center_lat = paksz(outparm[5],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = sterforint(radius,center_long,center_lat,false_easting, false_northing); *iflg = (int)*iflg64; for_trans[outsys] = sterfor; } else if (outsys == LAMAZ) { /* this is the call to initialize LAMBERT AZIMUTHAL -------------------------------------------------*/ center_long = paksz(outparm[4],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; center_lat = paksz(outparm[5],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = lamazforint(r_major, r_minor, center_long, center_lat,false_easting, false_northing); *iflg = (int)*iflg64; for_trans[outsys] = lamazfor; } else if (outsys == AZMEQD) { /* this is the call to initialize AZIMUTHAL EQUIDISTANT -----------------------------------------------------*/ center_long = paksz(outparm[4],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; center_lat = paksz(outparm[5],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = azimforint(radius,center_long,center_lat,false_easting, false_northing); *iflg = (int)*iflg64; for_trans[outsys] = azimfor; } else if (outsys == GNOMON) { /* this is the call to initialize GNOMONIC ----------------------------------------*/ center_long = paksz(outparm[4],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; center_lat = paksz(outparm[5],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = gnomforint(radius,center_long,center_lat,false_easting, false_northing); *iflg = (int)*iflg64; for_trans[outsys] = gnomfor; } else if (outsys == ORTHO) { /* this is the call to initalize ORTHOGRAPHIC -------------------------------------------*/ center_long = paksz(outparm[4],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; center_lat = paksz(outparm[5],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = orthforint(radius,center_long,center_lat,false_easting, false_northing); *iflg = (int)*iflg64; for_trans[outsys] = orthfor; } else if (outsys == GVNSP) { /* this is the call to initalize GENERAL VERTICAL NEAR-SIDE PERSPECTIVE ----------------------------------------------------------------------*/ center_long = paksz(outparm[4],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; center_lat = paksz(outparm[5],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; h = outparm[2]; *iflg64 = gvnspforint(radius,h,center_long,center_lat,false_easting, false_northing); *iflg = (int)*iflg64; for_trans[outsys] = gvnspfor; } else if (outsys == SNSOID) { /* this is the call to initialize SINUSOIDAL -------------------------------------------*/ center_long = paksz(outparm[4],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = sinforint(r_major,r_minor, center_long,false_easting,false_northing); *iflg = (int)*iflg64; for_trans[outsys] = sinfor; } else if (outsys == EQRECT) { /* this is the call to initialize EQUIRECTANGULAR -----------------------------------------------*/ center_long = paksz(outparm[4],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; lat1 = paksz(outparm[5],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = equiforint(radius,center_long,lat1,false_easting,false_northing); *iflg = (int)*iflg64; for_trans[outsys] = equifor; } else if (outsys == MILLER) { /* this is the call to initialize MILLER CYLINDRICAL --------------------------------------------------*/ center_long = paksz(outparm[4],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = millforint(radius, center_long,false_easting,false_northing); *iflg = (int)*iflg64; for_trans[outsys] = millfor; } else if (outsys == VGRINT) { /* this is the call to initialize VAN DER GRINTEN -----------------------------------------------*/ center_long = paksz(outparm[4],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = vandgforint(radius, center_long,false_easting,false_northing); *iflg = (int)*iflg64; for_trans[outsys] = vandgfor; } else if (outsys == HOM) { /* this is the call to initialize HOTLINE OBLIQUE MERCATOR ---------------------------------------------------------*/ scale_factor = outparm[2]; lat_origin = paksz(outparm[5],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; if (outparm[12] != 0) { mode = 1; azimuth = paksz(outparm[3],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; lon_origin = paksz(outparm[4],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; } else { mode = 0; lon1 = paksz(outparm[8],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; lat1 = paksz(outparm[9],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; lon2 = paksz(outparm[10],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; lat2 = paksz(outparm[11],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; } *iflg64 = omerforint(r_major,r_minor,scale_factor,azimuth,lon_origin, lat_origin,false_easting, false_northing,lon1,lat1, lon2,lat2,mode); *iflg = (int)*iflg64; for_trans[outsys] = omerfor; } else if (outsys == SOM) { /* this is the call to initialize SOM -----------------------------------*/ path = (long) outparm[3]; satnum = (long) outparm[2]; if (outparm[12] == 0) { mode = 1; alf = paksz(outparm[3],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; lon1 = paksz(outparm[4],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; time = outparm[8]; sat_ratio = outparm[9]; start = (long) outparm[10]; } else mode = 0; /* *iflg64 = somforint(r_major,r_minor,satnum,path,false_easting,false_northing); *iflg = (int)*iflg64; */ *iflg64 = somforint(r_major,r_minor,satnum,path,alf,lon1,false_easting, false_northing,time,start,mode,sat_ratio); *iflg = (int)*iflg64; for_trans[outsys] = somfor; } else if (outsys == HAMMER) { /* this is the call to initialize HAMMER --------------------------------------*/ center_long = paksz(outparm[4],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = hamforint(radius,center_long,false_easting,false_northing); *iflg = (int)*iflg64; for_trans[outsys] = hamfor; } else if (outsys == ROBIN) { /* this is the call to initialize ROBINSON ----------------------------------------*/ center_long = paksz(outparm[4],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = robforint(radius,center_long,false_easting,false_northing); *iflg = (int)*iflg64; for_trans[outsys] = robfor; } else if (outsys == GOODE) { /* this is the call to initialize GOODE'S HOMOLOSINE ---------------------------------------------------*/ *iflg64 = goodforint(radius); *iflg = (int)*iflg64; for_trans[outsys] = goodfor; } else if (outsys == MOLL) { /* this is the call to initialize MOLLWEIDE ------------------------------------------*/ center_long = paksz(outparm[4],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = molwforint(radius, center_long,false_easting,false_northing); *iflg = (int)*iflg64; for_trans[outsys] = molwfor; } else if (outsys == IMOLL) { /* this is the call to initialize INTERRUPTED MOLLWEIDE -----------------------------------------------------*/ *iflg64 = imolwforint(radius); *iflg = (int)*iflg64; for_trans[outsys] = imolwfor; } else if (outsys == ALASKA) { /* this is the call to initialize ALASKA CONFORMAL ------------------------------------------------*/ *iflg64 = alconforint(r_major,r_minor,false_easting,false_northing); *iflg = (int)*iflg64; for_trans[outsys] = alconfor; } else if (outsys == WAGIV) { /* this is the call to initialize WAGNER IV -----------------------------------------*/ center_long = paksz(outparm[4],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = wivforint(radius, center_long,false_easting,false_northing); *iflg = (int)*iflg64; for_trans[outsys] = wivfor; } else if (outsys == WAGVII) { /* this is the call to initialize WAGNER VII ------------------------------------------*/ center_long = paksz(outparm[4],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = wviiforint(radius, center_long,false_easting,false_northing); *iflg = (int)*iflg64; for_trans[outsys] = wviifor; } else if (outsys == OBEQA) { /* this is the call to initialize OBLATED EQUAL AREA ---------------------------------------------------*/ center_long = paksz(outparm[4],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; center_lat = paksz(outparm[5],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; shape_m = outparm[2]; shape_n = outparm[3]; angle = paksz(outparm[8],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = obleqforint(radius,center_long,center_lat,shape_m, shape_n, angle,false_easting,false_northing); *iflg = (int)*iflg64; for_trans[outsys] = obleqfor; } else if ((outsys == ISINUS) || (outsys == ISINUS1)) { /* this is the call to initialize INTEGERIZED SINUSOIDAL GRID ------------------------------------------------------------*/ center_long = paksz(outparm[4],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; dzone = outparm[8]; djustify = outparm[10]; *iflg64 = isinusforinit(radius, center_long, false_easting, false_northing, dzone, djustify); *iflg = (int)*iflg64; for_trans[outsys] = isinusfor; } return OK; } hdf-eos5-2.0/gctp/src/gctp.c000077500000000000000000000257301507520047200156260ustar00rootroot00000000000000/******************************************************************************* NAME GCTP VERSION PROGRAMMER DATE ------- ---------- ---- T. Mittan 2-26-93 Conversion from FORTRAN to C S. Nelson 12-14-93 Added assignments to inunit and outunit for State Plane purposes. c.1.0 S. Nelson 9-15-94 Added outdatum parameter call. c.1.1 S. Nelson 11-94 Modified code so that UTM can accept any spheroid code. Changed State Plane legislated distance units, for NAD83, to be consistant with FORTRAN version of GCTP. Unit codes are specified by state laws as of 2/1/92. DaW 22-10-97 Changed all "return;" to "return(0);". The SGI 64-bit platform complained about no return values. ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. *******************************************************************************/ #include #include #include "cproj.h" #include "proj.h" /* Function prototypes */ int init(long, long, char*, char*); long untfz(long, long, double*); void close_file(); int for_init(int, int, double*, int, char*, char*, int*, long (*f[])(double, double, double*, double*)); int inv_init(int, int, double*, int, char*, char*, int*, long (*i[])(double, double, double*, double*)); #define TRUE 1 #define FALSE 0 static long iter = 0; /* First time flag */ static long inpj[MAXPROJ + 1]; /* input projection array */ static long indat[MAXPROJ + 1]; /* input dataum array */ static long inzn[MAXPROJ + 1]; /* input zone array */ static double pdin[MAXPROJ + 1][15]; /* input projection parm array */ static long outpj[MAXPROJ + 1]; /* output projection array */ static long outdat[MAXPROJ + 1]; /* output dataum array */ static long outzn[MAXPROJ + 1]; /* output zone array */ static double pdout[MAXPROJ + 1][15]; /* output projection parm array */ static long (*for_trans[MAXPROJ + 1])();/* forward function pointer array*/ static long (*inv_trans[MAXPROJ + 1])();/* inverse function pointer array*/ /* Table of unit codes as specified by state laws as of 2/1/92 for NAD 1983 State Plane projection, 1 = U.S. Survey Feet, 2 = Meters, 5 = International Feet */ static long NADUT[134] = {1, 5, 1, 1, 5, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 2, 2, 1, 1, 5, 2, 1, 2, 5, 1, 2, 2, 2, 1, 1, 1, 5, 2, 1, 5, 2, 2, 5, 2, 1, 1, 5, 2, 2, 1, 2, 1, 2, 2, 1, 2, 2, 2}; /* static long NAD83[134] = {101,102,5010,5300,201,202,203,301,302,401,402,403, 404,405,406,0000,501,502,503,600,700,901,902,903,1001,1002, 5101,5102,5103,5104,5105,1101,1102,1103,1201,1202,1301,1302, 1401,1402,1501,1502,1601,1602,1701,1702,1703,1801,1802,1900, 2001,2002,2101,2102,2103,2111,2112,2113,2201,2202,2203,2301, 2302,2401,2402,2403,2500,0000,0000,2600,0000,2701,2702,2703, 2800,2900,3001,3002,3003,3101,3102,3103,3104,3200,3301,3302, 3401,3402,3501,3502,3601,3602,3701,3702,3800,3900,0000,4001, 4002,4100,4201,4202,4203,4204,4205,4301,4302,4303,4400,4501, 4502,4601,4602,4701,4702,4801,4802,4803,4901,4902,4903,4904, 5001,5002,5003,5004,5005,5006,5007,5008,5009,5200,0000,5400}; */ int gctp(incoor,insys,inzone,inparm,inunit,indatum,ipr,efile,jpr,pfile,outcoor, outsys,outzone,outparm,outunit,outdatum,fn27,fn83,iflg) double *incoor; /* input coordinates */ long *insys; /* input projection code */ long *inzone; /* input zone number */ double *inparm; /* input projection parameter array */ long *inunit; /* input units */ long *indatum; /* input datum */ long *ipr; /* printout flag for error messages. 0=screen, 1=file, 2=both*/ char *efile; /* error file name */ long *jpr; /* printout flag for projection parameters 0=screen, 1=file, 2 = both*/ char *pfile; /* error file name */ double *outcoor; /* output coordinates */ long *outdatum; /* output datum */ long *outsys; /* output projection code */ long *outzone; /* output zone */ double *outparm; /* output projection array */ long *outunit; /* output units */ char fn27[]; /* file name of NAD 1927 parameter file */ char fn83[]; /* file name of NAD 1983 parameter file */ long *iflg; /* error flag */ { double x; /* x coordinate */ double y; /* y coordinate */ double factor; /* conversion factor */ double lon; /* longitude */ double lat; /* latitude */ /*double temp; */ /* dummy variable */ double pakr2dm(); long i,j; /* loop counters */ long ininit_flag; /* input initilization flag */ long outinit_flag; /* output initilization flag */ /*long ind;*/ /* temporary var used to find state plane zone */ long unit; /* temporary unit variable */ double dummy[15]; /* temporary projection array */ int iflgval=0; /* setup initilization flags and output message flags ---------------------------------------------------*/ ininit_flag = FALSE; outinit_flag = FALSE; *iflg = 0; *iflg = init(*ipr,*jpr,efile,pfile); if ((int)*iflg != 0) return(0); /* check to see if initilization is required only the first 13 projection parameters are currently used. If more are added the loop should be increased. ---------------------------------------------------------*/ if (iter == 0) { for (i = 0; i < MAXPROJ + 1; i++) { inpj[i] = 0; indat[i] = 0; inzn[i] = 0; outpj[i] = 0; outdat[i] = 0; outzn[i] = 0; for (j = 0; j < 15; j++) { pdin[i][j] = 0.0; pdout[i][j] = 0.0; } } ininit_flag = TRUE; outinit_flag = TRUE; iter = 1; } else { if ((int)*insys != GEO) { if ((inzn[(int)*insys] != *inzone) || (indat[(int)*insys] != *indatum) || (inpj[(int)*insys] != (int)*insys) || ((int)*insys == 2)) { ininit_flag = TRUE; } else for (i = 0; i < 13; i++) if (pdin[(int)*insys][i] != inparm[i]) { ininit_flag = TRUE; break; } } if ((int)*outsys != GEO) { if ((outzn[(int)*outsys] != *outzone) || (outdat[(int)*outsys] != *outdatum) || (outpj[(int)*outsys] != *outsys) || ((int)*outsys == 2)) { outinit_flag = TRUE; } else for (i = 0; i < 13; i++) if (pdout[(int)*outsys][i] != outparm[i]) { outinit_flag = TRUE; break; } } } /* Check input and output projection numbers ------------------------------------------*/ if (((int)*insys < 0) || ((int)*insys > MAXPROJ)) { p_error("Insys is illegal","GCTP-INPUT"); *iflg = 1; return(0); } if (((int)*outsys < 0) || ((int)*outsys > MAXPROJ)) { p_error("Outsys is illegal","GCTP-OUTPUT"); *iflg = 2; return(0); } /* find the correct conversion factor for units ---------------------------------------------*/ unit = *inunit; /* use legislated unit table for State Plane -------------------------------------------*/ if (((int)*indatum == 0) && ((int)*insys == 2) && ((int)*inunit == 6)) unit = 1; if (((int)*indatum == 8) && ((int)*insys == 2) && ((int)*inunit == 6)) unit = NADUT[(*inzone)/100]; /* find the factor unit conversions --------------------------------*/ if ((int)*insys == GEO) *iflg = untfz(unit,0,&factor); else *iflg = untfz(unit,2,&factor); if ((int)*insys == SPCS) *inunit = unit; if ((int)*iflg != 0) { close_file(); return(0); } x = incoor[0] * factor; y = incoor[1] * factor; /* Initialize inverse transformation ----------------------------------*/ if ((int)ininit_flag) { inpj[(int)*insys] = *insys; indat[(int)*insys] = *indatum; inzn[(int)*insys] = *inzone; for (i = 0;i < 15; i++) pdin[(int)*insys][i] = inparm[i]; if ((int)*insys == 1) { for( i = 2; i < 15; i++) dummy[i] = inparm[i]; dummy[0] = 0; dummy[1] = 0; if (((int)*inzone != 0) || (inparm[0] == 0.0)) { dummy[0] = 1.0e6 * (double)(6 * (int)*inzone -183); if ( (int)*inzone >= 0) dummy[1] = 4.0e7; else dummy[1] = -4.0e7; } else { dummy[0] = inparm[0]; dummy[1] = inparm[1]; } inv_init((int)*insys,(int)*inzone,dummy,(int)*indatum,fn27,fn83,&iflgval,inv_trans); } else inv_init((int)*insys,(int)*inzone,inparm,(int)*indatum,fn27,fn83,&iflgval,inv_trans); *iflg=(long)iflgval; if ((int)*iflg != 0) { close_file(); return(0); } } /* Do actual transformations --------------------------*/ /* Inverse transformations ------------------------*/ if ((int)*insys == GEO) { lon = x; lat = y; } else if ((*iflg = inv_trans[(int)*insys](x, y, &lon, &lat)) != 0) { close_file(); return(0); } /* DATUM conversion should go here --------------------------------*/ /* The datum conversion facilities should go here */ /* Initialize forward transformation ----------------------------------*/ if ((int)outinit_flag) { outpj[(int)*outsys] = *outsys; outdat[(int)*outsys] = *outdatum; outzn[(int)*outsys] = *outzone; for (i = 0;i < 15; i++) pdout[(int)*outsys][i] = outparm[i]; if ((int)*outsys == 1) { for (i = 2; i < 15; i++) dummy[i] = outparm[i]; dummy[0] = 0; dummy[1] = 0; if (outparm[0] == 0.0) { dummy[0] = pakr2dm(lon); dummy[1] = pakr2dm(lat); } else { dummy[0] = outparm[0]; dummy[1] = outparm[1]; } for_init((int)*outsys,(int)*outzone,dummy,(int)*outdatum,fn27,fn83,&iflgval,for_trans); } else for_init((int)*outsys,(int)*outzone,outparm,(int)*outdatum,fn27,fn83,&iflgval,for_trans); *iflg=(long)iflgval; if ((int)*iflg != 0) { close_file(); return(0); } } /* Forward transformations ------------------------*/ if ((int)*outsys == GEO) { outcoor[0] = lon; outcoor[1] = lat; } else if ((*iflg = for_trans[(int)*outsys](lon, lat, &outcoor[0], &outcoor[1])) != 0) { close_file(); return(0); } /* find the correct conversion factor for units ---------------------------------------------*/ unit = *outunit; /* use legislated unit table ----------------------------*/ if (((int)*outdatum == 0) && ((int)*outsys == 2) && ((int)*outunit == 6)) unit = 1; if (((int)*outdatum == 8) && ((int)*outsys == 2) && ((int)*outunit == 6)) unit = NADUT[(*outzone)/100]; if ((int)*outsys == GEO) *iflg = untfz(0,unit,&factor); else *iflg = untfz(2,unit,&factor); if ((int)*outsys == SPCS) *outunit = unit; outcoor[0] *= factor; outcoor[1] *= factor; close_file(); return(0); } hdf-eos5-2.0/gctp/src/gnomfor.c000077500000000000000000000064411507520047200163360ustar00rootroot00000000000000/******************************************************************************* NAME GNOMONIC PURPOSE: Transforms input longitude and latitude to Easting and Northing for the Gnomonic projection. The longitude and latitude must be in radians. The Easting and Northing values will be returned in meters. PROGRAMMER DATE ---------- ---- T. Mittan Mar, 1993 This function was adapted from the Gnomonic projection code (FORTRAN) in the General Cartographic Transformation Package software which is available from the U.S. Geological Survey National Mapping Division. ALGORITHM REFERENCES 1. "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder, The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355. 2. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 3. "Software Documentation for GCTP General Cartographic Transformation Package", U.S. Geological Survey National Mapping Division, May 1982. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double lon_center; /* Center longitude (projection center) */ static double R; /* Radius of the earth (sphere) */ static double sin_p13; /* Sine of the center latitude */ static double cos_p13; /* Cosine of the center latitude */ static double false_easting; /* x offset in meters */ static double false_northing; /* y offset in meters */ /* Initialize the Gnomonic projection ---------------------------------*/ int gnomforint( double r, /* (I) Radius of the earth (sphere) */ double center_long, /* (I) Center longitude */ double center_lat, /* (I) Center latitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { /* Place parameters in static storage for common use -------------------------------------------------*/ R = r; lon_center = center_long; false_easting = false_east; false_northing = false_north; tsincos(center_lat, &sin_p13, &cos_p13); /* Report parameters to the user -----------------------------*/ ptitle("GNOMONIC"); radius(r); cenlon(center_long); cenlat(center_lat); offsetp(false_easting,false_northing); return(OK); } /* Gnomonic forward equations--mapping lat,long to x,y --------------------------------------------------*/ int gnomfor( double lon, /* (I) Longitude */ double lat, /* (I) Latitude */ double *x, /* (O) X projection coordinate */ double *y) /* (O) Y projection coordinate */ { double dlon; double sinphi,cosphi; double coslon; double g; double ksp; /* Forward equations -----------------*/ dlon = adjust_lon(lon - lon_center); tsincos(lat,&sinphi,&cosphi); coslon = cos(dlon); g = sin_p13 * sinphi + cos_p13 * cosphi * coslon; if (g <= 0.0) { p_error("Point projects into infinity","gnomfor-conv"); return(133); } ksp = 1.0 / g; *x = false_easting + R * ksp * cosphi * sin(dlon); *y = false_northing + R * ksp * (cos_p13 * sinphi - sin_p13 * cosphi * coslon); return(OK); } hdf-eos5-2.0/gctp/src/gnominv.c000077500000000000000000000072311507520047200163420ustar00rootroot00000000000000/******************************************************************************* NAME GNOMONIC PURPOSE: Transforms input Easting and Northing to longitude and latitude for the Gnomonic projection. The Easting and Northing must be in meters. The longitude and latitude values will be returned in radians. PROGRAMMER DATE ---------- ---- T. Mittan Mar, 1993 This function was adapted from the Gnomonic projection code (FORTRAN) in the General Cartographic Transformation Package software which is available from the U.S. Geological Survey National Mapping Division. ALGORITHM REFERENCES 1. "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder, The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355. 2. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 3. "Software Documentation for GCTP General Cartographic Transformation Package", U.S. Geological Survey National Mapping Division, May 1982. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double lon_center; /* Center longitude (projection center) */ static double lat_center; /* Center latitude (projection center) */ static double R; /* Radius of the earth (sphere) */ static double sin_p13; /* Sine of the center latitude */ static double cos_p13; /* Cosine of the center latitude */ static double false_easting; /* x offset in meters */ static double false_northing; /* y offset in meters */ /* Initialize the Gnomonic projection ---------------------------------*/ int gnominvint( double r, /* (I) Radius of the earth (sphere) */ double center_long, /* (I) Center longitude */ double center_lat, /* (I) Center latitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { /* Place parameters in static storage for common use -------------------------------------------------*/ R = r; lon_center = center_long; lat_center = center_lat; false_easting = false_east; false_northing = false_north; tsincos(center_lat, &sin_p13, &cos_p13); /* Report parameters to the user -----------------------------*/ ptitle("GNOMONIC"); radius(r); cenlon(center_long); cenlat(center_lat); offsetp(false_easting,false_northing); return(OK); } /* Gnomonic inverse equations--mapping x,y to lat/long --------------------------------------------------*/ int gnominv( double x, /* (O) X projection coordinate */ double y, /* (O) Y projection coordinate */ double *lon, /* (I) Longitude */ double *lat) /* (I) Latitude */ { double rh; double z,sinz,cosz; double con; /* Inverse equations -----------------*/ x -= false_easting; y -= false_northing; rh = sqrt(x * x + y * y); z = atan(rh / R); tsincos(z,&sinz,&cosz); *lon = lon_center; if (fabs(rh) <= EPSLN) { *lat = lat_center; return(OK); } *lat = asinz(cosz * sin_p13 + (y * sinz * cos_p13) / rh); con = fabs(lat_center) - HALF_PI; if (fabs(con) <= EPSLN) { if (lat_center >= 0.0) { *lon = adjust_lon(lon_center + atan2(x, -y)); return(OK); } else { *lon = adjust_lon(lon_center - atan2(-x, y)); return(OK); } } con = cosz - sin_p13 * sin(*lat); if ((fabs(con) < EPSLN) && (fabs(x) < EPSLN)) return(OK); *lon = adjust_lon(lon_center + atan2((x * sinz * cos_p13), (con * rh))); return(OK); } hdf-eos5-2.0/gctp/src/goodfor.c000077500000000000000000000136001507520047200163210ustar00rootroot00000000000000/******************************************************************************* NAME GOODE'S HOMOLOSINE PURPOSE: Transforms input longitude and latitude to Easting and Northing for the Goode's Homolosine projection. The longitude and latitude must be in radians. The Easting and Northing values will be returned in meters. PROGRAMMER DATE ---------- ---- D. Steinwand, EROS May, 1991; Updated Sept, 1992; Updated Feb 1993 S. Nelson, EDC Jun, 1993 Make changes in precision and number of iterations. ALGORITHM REFERENCES 1. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. 2. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 3. Goode, J.P., 1925, The Homolosine projection: a new device for portraying the Earth's surface entire: Assoc. Am. Geographers, Annals, v. 15, p. 119-125 *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double R; /* Radius of the earth (sphere) */ static double lon_center[12]; /* Central meridians, one for each region */ static double feast[12]; /* False easting, one for each region */ /* Initialize the Goode`s Homolosine projection --------------------------------------------*/ int goodforint( double r) /* (I) Radius of the earth (sphere) */ { /* Place parameters in static storage for common use -------------------------------------------------*/ R = r; /* Initialize central meridians for each of the 12 regions -------------------------------------------------------*/ lon_center[0] = -1.74532925199; /* -100.0 degrees */ lon_center[1] = -1.74532925199; /* -100.0 degrees */ lon_center[2] = 0.523598775598; /* 30.0 degrees */ lon_center[3] = 0.523598775598; /* 30.0 degrees */ lon_center[4] = -2.79252680319; /* -160.0 degrees */ lon_center[5] = -1.0471975512; /* -60.0 degrees */ lon_center[6] = -2.79252680319; /* -160.0 degrees */ lon_center[7] = -1.0471975512; /* -60.0 degrees */ lon_center[8] = 0.349065850399; /* 20.0 degrees */ lon_center[9] = 2.44346095279; /* 140.0 degrees */ lon_center[10] = 0.349065850399; /* 20.0 degrees */ lon_center[11] = 2.44346095279; /* 140.0 degrees */ /* Initialize false eastings for each of the 12 regions ----------------------------------------------------*/ feast[0] = R * -1.74532925199; feast[1] = R * -1.74532925199; feast[2] = R * 0.523598775598; feast[3] = R * 0.523598775598; feast[4] = R * -2.79252680319; feast[5] = R * -1.0471975512; feast[6] = R * -2.79252680319; feast[7] = R * -1.0471975512; feast[8] = R * 0.349065850399; feast[9] = R * 2.44346095279; feast[10] = R * 0.349065850399; feast[11] = R * 2.44346095279; /* Report parameters to the user -----------------------------*/ ptitle("GOODE'S HOMOLOSINE EQUAL-AREA"); radius(r); return(OK); } /* Goode`s Homolosine forward equations--mapping lat,long to x,y -------------------------------------------------------------*/ int goodfor( double lon, /* (I) Longitude */ double lat, /* (I) Latitude */ double *x, /* (O) X projection coordinate */ double *y) /* (O) Y projection coordinate */ { double delta_lon; /* Delta longitude (Given longitude - center */ double theta; double delta_theta; double constant; long i; long region; /* Forward equations -----------------*/ if (lat >= 0.710987989993) /* if on or above 40 44' 11.8" */ { if (lon <= -0.698131700798) region = 0; /* If to the left of -40 */ else region = 2; } else if (lat >= 0.0) /* Between 0.0 and 40 44' 11.8" */ { if (lon <= -0.698131700798) region = 1; /* If to the left of -40 */ else region = 3; } else if (lat >= -0.710987989993) /* Between 0.0 & -40 44' 11.8" */ { if (lon <= -1.74532925199) region = 4; /* If between -180 and -100 */ else if (lon <= -0.349065850399) region = 5; /* If between -100 and -20 */ else if (lon <= 1.3962634016) region = 8; /* If between -20 and 80 */ else region = 9; /* If between 80 and 180 */ } else /* Below -40 44' */ { if (lon <= -1.74532925199) region = 6; /* If between -180 and -100 */ else if (lon <= -0.349065850399) region = 7; /* If between -100 and -20 */ else if (lon <= 1.3962634016) region = 10; /* If between -20 and 80 */ else region = 11; /* If between 80 and 180 */ } if (region==1||region==3||region==4||region==5||region==8||region==9) { delta_lon = adjust_lon(lon - lon_center[region]); *x = feast[region] + R * delta_lon * cos(lat); *y = R * lat; } else { delta_lon = adjust_lon(lon - lon_center[region]); theta = lat; constant = PI * sin(lat); /* Iterate using the Newton-Raphson method to find theta -----------------------------------------------------*/ for (i=0;;i++) { delta_theta = -(theta + sin(theta) - constant) / (1.0 + cos(theta)); theta += delta_theta; if (fabs(delta_theta) < EPSLN) break; if (i >= 50) { p_error("Iteration failed to converge","goode-forward"); return(251); } } theta /= 2.0; /* If the latitude is 90 deg, force the x coordinate to be "0 + false easting" this is done here because of precision problems with "cos(theta)" ------------------------------------------------------------------*/ if (PI / 2 - fabs(lat) < EPSLN) delta_lon = 0; *x = feast[region] + 0.900316316158 * R * delta_lon * cos(theta); *y = R * (1.4142135623731 * sin(theta) - 0.0528035274542 * sign(lat)); } return(OK); } hdf-eos5-2.0/gctp/src/goodinv.c000077500000000000000000000157261507520047200163420ustar00rootroot00000000000000/******************************************************************************* NAME GOODE'S HOMOLOSINE PURPOSE: Transforms input Easting and Northing to longitude and latitude for the Goode's Homolosine projection. The Easting and Northing must be in meters. The longitude and latitude values will be returned in radians. PROGRAMMER DATE ---------- ---- D. Steinwand, EROS May, 1991; Updated Sept, 1992; Updated Feb 1993 S. Nelson, EDC Jun, 1993 Made changes in precision. ALGORITHM REFERENCES 1. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. 2. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 3. Goode, J.P., 1925, The Homolosine projection: a new device for portraying the Earth's surface entire: Assoc. Am. Geographers, Annals, v. 15, p. 119-125 *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double R; /* Radius of the earth (sphere) */ static double lon_center[12]; /* Central meridians, one for each region */ static double feast[12]; /* False easting, one for each region */ /* Initialize the Goode`s Homolosine projection --------------------------------------------*/ int goodinvint( double r) /* (I) Radius of the earth (sphere) */ { /* Place parameters in static storage for common use -------------------------------------------------*/ R = r; /* Initialize central meridians for each of the 12 regions -------------------------------------------------------*/ lon_center[0] = -1.74532925199; /* -100.0 degrees */ lon_center[1] = -1.74532925199; /* -100.0 degrees */ lon_center[2] = 0.523598775598; /* 30.0 degrees */ lon_center[3] = 0.523598775598; /* 30.0 degrees */ lon_center[4] = -2.79252680319; /* -160.0 degrees */ lon_center[5] = -1.0471975512; /* -60.0 degrees */ lon_center[6] = -2.79252680319; /* -160.0 degrees */ lon_center[7] = -1.0471975512; /* -60.0 degrees */ lon_center[8] = 0.349065850399; /* 20.0 degrees */ lon_center[9] = 2.44346095279; /* 140.0 degrees */ lon_center[10] = 0.349065850399; /* 20.0 degrees */ lon_center[11] = 2.44346095279; /* 140.0 degrees */ /* Initialize false eastings for each of the 12 regions ----------------------------------------------------*/ feast[0] = R * -1.74532925199; feast[1] = R * -1.74532925199; feast[2] = R * 0.523598775598; feast[3] = R * 0.523598775598; feast[4] = R * -2.79252680319; feast[5] = R * -1.0471975512; feast[6] = R * -2.79252680319; feast[7] = R * -1.0471975512; feast[8] = R * 0.349065850399; feast[9] = R * 2.44346095279; feast[10] = R * 0.349065850399; feast[11] = R * 2.44346095279; /* Report parameters to the user -----------------------------*/ ptitle("GOODE'S HOMOLOSINE EQUAL-AREA"); radius(r); return(OK); } /* Goode`s Homolosine inverse equations--mapping x,y to lat,long -------------------------------------------------------------*/ int goodinv( double x, /* (I) X projection coordinate */ double y, /* (I) Y projection coordinate */ double *lon, /* (O) Longitude */ double *lat) /* (O) Latitude */ { double arg; double theta; double temp; long region; /* Inverse equations -----------------*/ if (y >= R * 0.710987989993) /* if on or above 40 44' 11.8" */ { if (x <= R * -0.698131700798) region = 0; /* If to the left of -40 */ else region = 2; } else if (y >= 0.0) /* Between 0.0 and 40 44' 11.8" */ { if (x <= R * -0.698131700798) region = 1; /* If to the left of -40 */ else region = 3; } else if (y >= R * -0.710987989993) /* Between 0.0 & -40 44' 11.8" */ { if (x <= R * -1.74532925199) region = 4; /* If between -180 and -100 */ else if (x <= R * -0.349065850399) region = 5; /* If between -100 and -20 */ else if (x <= R * 1.3962634016) region = 8; /* If between -20 and 80 */ else region = 9; /* If between 80 and 180 */ } else /* Below -40 44' 11.8" */ { if (x <= R * -1.74532925199) region = 6; /* If between -180 and -100 */ else if (x <= R * -0.349065850399) region = 7; /* If between -100 and -20 */ else if (x <= R * 1.3962634016) region = 10; /* If between -20 and 80 */ else region = 11; /* If between 80 and 180 */ } x = x - feast[region]; if (region==1||region==3||region==4||region==5||region==8||region==9) { *lat = y / R; if (fabs(*lat) > HALF_PI) { p_error("Input data error","goode-inverse"); return(252); } temp = fabs(*lat) - HALF_PI; if (fabs(temp) > EPSLN) { temp = lon_center[region] + x / (R * cos(*lat)); *lon = adjust_lon(temp); } else *lon = lon_center[region]; } else { arg = (y + 0.0528035274542 * R * sign(y)) / (1.4142135623731 * R); if (fabs(arg) > 1.0) return(IN_BREAK); theta = asin(arg); *lon = lon_center[region]+(x/(0.900316316158 * R * cos(theta))); if(*lon < -(PI + EPSLN)) return(IN_BREAK); arg = (2.0 * theta + sin(2.0 * theta)) / PI; if (fabs(arg) > 1.0) return(IN_BREAK); *lat = asin(arg); } /* because of precision problems, long values of 180 deg and -180 deg may be mixed. ----------------------------------------------------------------*/ if (((x < 0) && (PI - *lon < EPSLN)) || ((x > 0) && (PI + *lon < EPSLN))) *lon = -(*lon); /* Are we in a interrupted area? If so, return status code of IN_BREAK. ---------------------------------------------------------------------*/ if (region == 0 && (*lon < -(PI + EPSLN) || *lon > -0.698131700798)) return(IN_BREAK); if (region == 1 && (*lon < -(PI + EPSLN) || *lon > -0.698131700798)) return(IN_BREAK); if (region == 2 && (*lon < -0.698131700798 || *lon > PI + EPSLN)) return(IN_BREAK); if (region == 3 && (*lon < -0.698131700798 || *lon > PI + EPSLN)) return(IN_BREAK); if (region == 4 && (*lon < -(PI + EPSLN) || *lon > -1.74532925199)) return(IN_BREAK); if (region == 5 && (*lon < -1.74532925199 || *lon > -0.349065850399)) return(IN_BREAK); if (region == 6 && (*lon < -(PI + EPSLN) || *lon > -1.74532925199)) return(IN_BREAK); if (region == 7 && (*lon < -1.74532925199 || *lon > -0.349065850399)) return(IN_BREAK); if (region == 8 && (*lon < -0.349065850399 || *lon > 1.3962634016)) return(IN_BREAK); if (region == 9 && (*lon < 1.3962634016|| *lon > PI + EPSLN)) return(IN_BREAK); if (region ==10 && (*lon < -0.349065850399 || *lon > 1.3962634016)) return(IN_BREAK); if (region ==11 && (*lon < 1.3962634016 || *lon > PI + EPSLN)) return(IN_BREAK); return(OK); } hdf-eos5-2.0/gctp/src/gvnspfor.c000077500000000000000000000072421507520047200165330ustar00rootroot00000000000000/******************************************************************************* NAME GENERAL VERTICAL NEAR-SIDE PERSPECTIVE PURPOSE: Transforms input longitude and latitude to Easting and Northing for the General Vertical Near-Side Perspective projection. The longitude and latitude must be in radians. The Easting and Northing values will be returned in meters. PROGRAMMER DATE ---------- ---- T. Mittan Mar, 1993 This function was adapted from the General Vertical Near-Side Perspective projection code (FORTRAN) in the General Cartographic Transformation Package software which is available from the U.S. Geological Survey National Mapping Division. ALGORITHM REFERENCES 1. "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder, The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355. 2. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 3. "Software Documentation for GCTP General Cartographic Transformation Package", U.S. Geological Survey National Mapping Division, May 1982. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double lon_center; /* Center longitude (projection center) */ static double R; /* Radius of the earth (sphere) */ static double p; /* Height above sphere */ static double sin_p15; /* Sine of the center latitude */ static double cos_p15; /* Cosine of the center latitude */ static double false_easting; /* x offset in meters */ static double false_northing; /* y offset in meters */ /* Initialize the General Vertical Near-Side Perspective projection ---------------------------------------------------------------*/ int gvnspforint( double r, /* (I) Radius of the earth (sphere) */ double h, /* height above sphere */ double center_long, /* (I) Center longitude */ double center_lat, /* (I) Center latitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { /* Place parameters in static storage for common use -------------------------------------------------*/ R = r; p = 1.0 + h / R; lon_center = center_long; false_easting = false_east; false_northing = false_north; tsincos(center_lat, &sin_p15, &cos_p15); /* Report parameters to the user -----------------------------*/ ptitle("GENERAL VERTICAL NEAR-SIDE PERSPECTIVE"); radius(r); genrpt(h,"Height of Point Above Surface of Sphere: "); cenlon(center_long); cenlat(center_lat); offsetp(false_easting,false_northing); return(OK); } /* General Vertical Near-Side Perspective forward equations--mapping lat,long to x,y ----------------------------------------------------------------*/ int gvnspfor( double lon, /* (I) Longitude */ double lat, /* (I) Latitude */ double *x, /* (O) X projection coordinate */ double *y) /* (O) Y projection coordinate */ { double dlon; double sinphi,cosphi; double coslon; double g; double ksp; /* Forward equations -----------------*/ dlon = adjust_lon(lon - lon_center); tsincos(lat,&sinphi,&cosphi); coslon = cos(dlon); g = sin_p15 * sinphi + cos_p15 * cosphi * coslon; if (g < (1.0/ p)) { p_error("Point cannot be projected","gvnsp-for"); return(153); } ksp = (p - 1.0)/(p - g); *x = false_easting + R * ksp * cosphi * sin(dlon); *y = false_northing + R * ksp * (cos_p15 * sinphi - sin_p15 * cosphi * coslon); return(OK); } hdf-eos5-2.0/gctp/src/gvnspinv.c000077500000000000000000000103511507520047200165340ustar00rootroot00000000000000/******************************************************************************* NAME GENERAL VERTICAL NEAR-SIDE PERSPECTIVE PURPOSE: Transforms input Easting and Northing to longitude and latitude for the General Vertical Near-Side Perspective projection. The Easting and Northing must be in meters. The longitude and latitude values will be returned in radians. PROGRAMMER DATE ---------- ---- T. Mittan Mar, 1993 This function was adapted from the General Vertical Near-side projection code (FORTRAN) in the General Cartographic Transformation Package software which is available from the U.S. Geological Survey National Mapping Division. ALGORITHM REFERENCES 1. "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder, The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355. 2. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 3. "Software Documentation for GCTP General Cartographic Transformation Package", U.S. Geological Survey National Mapping Division, May 1982. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double lon_center; /* Center longitude (projection center) */ static double lat_center; /* Center latitude (projection center) */ static double R; /* Radius of the earth (sphere) */ static double p; /* Height above sphere */ static double sin_p15; /* Sine of the center latitude */ static double cos_p15; /* Cosine of the center latitude */ static double false_easting; /* x offset in meters */ static double false_northing; /* y offset in meters */ /* Initialize the General Vertical Near-Side Perspective projection ---------------------------------------------------------------*/ int gvnspinvint( double r, /* (I) Radius of the earth (sphere) */ double h, /* height above sphere */ double center_long, /* (I) Center longitude */ double center_lat, /* (I) Center latitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { /* Place parameters in static storage for common use -------------------------------------------------*/ R = r; p = 1.0 + h / R; lon_center = center_long; lat_center = center_lat; false_easting = false_east; false_northing = false_north; tsincos(center_lat, &sin_p15, &cos_p15); /* Report parameters to the user -----------------------------*/ ptitle("GENERAL VERTICAL NEAR-SIDE PERSPECTIVE"); radius(r); genrpt(h,"Height of Point Above Surface of Sphere: "); cenlon(center_long); cenlat(center_lat); offsetp(false_easting,false_northing); return(OK); } /* General Vertical Near-Side Perspective inverse equations--mapping x,y to lat/long ----------------------------------------------------------------*/ int gvnspinv( double x, /* (O) X projection coordinate */ double y, /* (O) Y projection coordinate */ double *lon, /* (I) Longitude */ double *lat) /* (I) Latitude */ { double rh; double r; double con; double com; double z,sinz,cosz; /* Inverse equations -----------------*/ x -= false_easting; y -= false_northing; rh = sqrt(x * x + y * y); r = rh / R; con = p - 1.0; com = p + 1.0; if (r > sqrt(con/com)) { p_error("Input data error","gvnsp-for"); return(155); } sinz = (p - sqrt(1.0 - (r * r * com) / con)) / (con / r + r/con); z = asinz(sinz); tsincos(z,&sinz,&cosz); *lon = lon_center; if (fabs(rh) <= EPSLN) { *lat = lat_center; return(OK); } *lat = asinz(cosz * sin_p15 + ( y * sinz * cos_p15)/rh); con = fabs(lat_center) - HALF_PI; if (fabs(con) <= EPSLN) { if (lat_center >= 0.0) { *lon = adjust_lon(lon_center + atan2(x, -y)); return(OK); } else { *lon = adjust_lon(lon_center - atan2(-x, y)); return(OK); } } con = cosz - sin_p15 * sin(*lat); if ((fabs(con) < EPSLN) && (fabs(x) < EPSLN)) return(OK); *lon = adjust_lon(lon_center + atan2((x * sinz * cos_p15), (con * rh))); return(OK); } hdf-eos5-2.0/gctp/src/hamfor.c000077500000000000000000000055501507520047200161430ustar00rootroot00000000000000/******************************************************************************* NAME HAMMER PURPOSE: Transforms input longitude and latitude to Easting and Northing for the Hammer projection. The longitude and latitude must be in radians. The Easting and Northing values will be returned in meters. PROGRAMMER DATE ---------- ---- T. Mittan March, 1993 This function was adapted from the Lambert Azimuthal Equal Area projection code (FORTRAN) in the General Cartographic Transformation Package software which is available from the U.S. Geological Survey National Mapping Division. ALGORITHM REFERENCES 1. "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder, The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355. 2. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 3. "Software Documentation for GCTP General Cartographic Transformation Package", U.S. Geological Survey National Mapping Division, May 1982. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double lon_center; /* Center longitude (projection center) */ static double R; /* Radius of the earth (sphere) */ static double false_easting; /* x offset in meters */ static double false_northing; /* y offset in meters */ /* Initialize the HAMMER projection -------------------------------*/ int hamforint( double r, /* (I) Radius of the earth (sphere) */ double center_long, /* (I) Center longitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { /* Place parameters in static storage for common use -------------------------------------------------*/ R = r; lon_center = center_long; false_easting = false_east; false_northing = false_north; /* Report parameters to the user -----------------------------*/ ptitle("HAMMER"); radius(r); cenlon(center_long); offsetp(false_easting,false_northing); return(OK); } /* HAMMER forward equations--mapping lat,long to x,y ------------------------------------------------------------*/ int hamfor( double lon, /* (I) Longitude */ double lat, /* (I) Latitude */ double *x, /* (O) X projection coordinate */ double *y) /* (O) Y projection coordinate */ { double dlon; double fac; /* Forward equations -----------------*/ dlon = adjust_lon(lon - lon_center); fac = R * 1.414213562 / sqrt(1.0 + cos(lat) * cos(dlon / 2.0)); *x = false_easting + fac * 2.0 * cos(lat) * sin(dlon / 2.0); *y = false_northing + fac * sin(lat); return(OK); } hdf-eos5-2.0/gctp/src/haminv.c000077500000000000000000000055261507520047200161540ustar00rootroot00000000000000/******************************************************************************* NAME HAMMER PURPOSE: Transforms input Easting and Northing to longitude and latitude for the Hammer projection. The Easting and Northing must be in meters. The longitude and latitude values will be returned in radians. PROGRAMMER DATE ---------- ---- T. Mittan March, 1993 This function was adapted from the Hammer projection code (FORTRAN) in the General Cartographic Transformation Package software which is available from the U.S. Geological Survey National Mapping Division. ALGORITHM REFERENCES 1. "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder, The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355. 2. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 3. "Software Documentation for GCTP General Cartographic Transformation Package", U.S. Geological Survey National Mapping Division, May 1982. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double lon_center; /* Center longitude (projection center) */ static double R; /* Radius of the earth (sphere) */ static double false_easting; /* x offset in meters */ static double false_northing; /* y offset in meters */ /* Initialize the HAMMER projection -------------------------------*/ int haminvint( double r, /* (I) Radius of the earth (sphere) */ double center_long, /* (I) Center longitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { /* Place parameters in static storage for common use -------------------------------------------------*/ R = r; lon_center = center_long; false_easting = false_east; false_northing = false_north; /* Report parameters to the user -----------------------------*/ ptitle("HAMMER"); radius(r); cenlon(center_long); offsetp(false_easting,false_northing); return(OK); } /* HAMMER inverse equations--mapping x,y to lat/long ------------------------------------------------*/ int haminv( double x, /* (O) X projection coordinate */ double y, /* (O) Y projection coordinate */ double *lon, /* (I) Longitude */ double *lat) /* (I) Latitude */ { double fac; /* Inverse equations -----------------*/ x -= false_easting; y -= false_northing; fac = sqrt(4.0 * R * R - (x * x)/ 4.0 - y * y) / 2.0; *lon = adjust_lon(lon_center + 2.0 * atan2((x * fac), (2.0 * R * R - x * x/4 - y * y))); *lat = asinz(y * fac / R / R); return(OK); } hdf-eos5-2.0/gctp/src/imolwfor.c000077500000000000000000000113231507520047200165200ustar00rootroot00000000000000/******************************************************************************* NAME INTERRUPTED MOLLWEIDE PURPOSE: Transforms input longitude and latitude to Easting and Northing for the Interrupted Mollweide projection. The longitude and latitude must be in radians. The Easting and Northing values will be returned in meters. PROGRAMMER DATE REASON ---------- ---- ------ D. Steinwand, EROS June, 1991 Initial development T. Mittan, EDC Feb, 1993 Adapted format to be used by the "C" version of GCTP. S. Nelson, EDC June, 1993 Changed precisian of radians in assigning the region, and in the conversion algorithm. S. Nelson, EDC Feb, 1994 changed perror to p_error. ALGORITHM REFERENCES 1. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. 2. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double R; /* Radius of the earth (sphere) */ static double lon_center[6]; /* Central meridians, one for each region */ static double feast[6]; /* False easting, one for each region */ /* Initialize the Interrupted Mollweide projection --------------------------------------------*/ int imolwforint( double r) /* (I) Radius of the earth (sphere) */ { /* Place parameters in static storage for common use -------------------------------------------------*/ R = r; /* Initialize central meridians for each of the 6 regions ------------------------------------------------------*/ lon_center[0] = 1.0471975512; /* 60.0 degrees */ lon_center[1] = -2.96705972839; /* -170.0 degrees */ lon_center[2] = -0.523598776; /* -30.0 degrees */ lon_center[3] = 1.57079632679; /* 90.0 degrees */ lon_center[4] = -2.44346095279; /* -140.0 degrees */ lon_center[5] = -0.34906585; /* -20.0 degrees */ /* Initialize false eastings for each of the 6 regions ---------------------------------------------------*/ feast[0] = R * -2.19988776387; feast[1] = R * -0.15713484; feast[2] = R * 2.04275292359; feast[3] = R * -1.72848324304; feast[4] = R * 0.31426968; feast[5] = R * 2.19988776387; /* Report parameters to the user -----------------------------*/ ptitle("INTERRUPTED MOLLWEIDE EQUAL-AREA"); radius(r); return(OK); } /* Interrupted Mollweide forward equations--mapping lat,long to x,y -------------------------------------------------------------*/ int imolwfor( double lon, /* (I) Longitude */ double lat, /* (I) Latitude */ double *x, /* (O) X projection coordinate */ double *y) /* (O) Y projection coordinate */ { double delta_lon; /* Delta longitude (Given longitude - center */ double theta; double delta_theta; double con; long i; long region; /* Forward equations -----------------*/ /* Note: PI has been adjusted so that the correct region will be assigned when lon = 180 deg. ----------------------------------------------------------------------*/ if (lat >= 0.0) { if (lon >= 0.34906585 && lon < 1.91986217719) region = 0; else if ((lon >= 1.919862177 && lon <= (PI + 1.0E-14)) || (lon >= (-PI - 1.0E-14) && lon < -1.745329252)) region=1; else region = 2; } else { if (lon >= 0.34906585 && lon < 2.44346095279) region = 3; else if ((lon >= 2.44346095279 && lon <= (PI +1.0E-14)) || (lon >= (-PI - 1.0E-14) && lon<-1.2217304764)) region=4; else region = 5; } delta_lon = adjust_lon(lon - lon_center[region]); theta = lat; con = PI * sin(lat); /* Iterate using the Newton-Raphson method to find theta -----------------------------------------------------*/ for (i=0;;i++) { delta_theta = -(theta + sin(theta) - con) / (1.0 + cos(theta)); theta += delta_theta; if (fabs(delta_theta) < EPSLN) break; if (i >= 50) p_error("Iteration failed to converge","IntMoll-forward"); } theta /= 2.0; /* If the latitude is 90 deg, force the x coordinate to be "0 + false easting" this is done here because of percision problems with "cos(theta)" --------------------------------------------------------------------------*/ if (PI / 2 - fabs(lat) < EPSLN) delta_lon = 0; *x = feast[region] + 0.900316316158 * R * delta_lon * cos(theta); *y = R * 1.4142135623731 * sin(theta); return(OK); } hdf-eos5-2.0/gctp/src/imolwinv.c000077500000000000000000000101541507520047200165270ustar00rootroot00000000000000/******************************************************************************* NAME INTERRUPTED MOLLWEIDE PURPOSE: Transforms input Easting and Northing to longitude and latitude for the Interrupted Mollweide projection. The Easting and Northing must be in meters. The longitude and latitude values will be returned in radians. PROGRAMMER DATE REASON ---------- ---- ------ D. Steinwand, EROS June, 1991 Initial Development S. Nelson, EDC June, 1993 Changed precision for values to determine regions and if coordinates are in the break, and for the values in the conversion algorithm. ALGORITHM REFERENCES 1. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. 2. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double R; /* Radius of the earth (sphere) */ static double lon_center[6]; /* Central meridians, one for each region */ static double feast[6]; /* False easting, one for each region */ /* Initialize the Interrupted Mollweide projection --------------------------------------------*/ int imolwinvint( double r) /* (I) Radius of the earth (sphere) */ { /* Place parameters in static storage for common use -------------------------------------------------*/ R = r; /* Initialize central meridians for each of the 6 regions ------------------------------------------------------*/ lon_center[0] = 1.0471975512; /* 60.0 degrees */ lon_center[1] = -2.96705972839; /* -170.0 degrees */ lon_center[2] = -0.523598776; /* -30.0 degrees */ lon_center[3] = 1.57079632679; /* 90.0 degrees */ lon_center[4] = -2.44346095279; /* -140.0 degrees */ lon_center[5] = -0.34906585; /* -20.0 degrees */ /* Initialize false eastings for each of the 6 regions ---------------------------------------------------*/ feast[0] = R * -2.19988776387; feast[1] = R * -0.15713484; feast[2] = R * 2.04275292359; feast[3] = R * -1.72848324304; feast[4] = R * 0.31426968; feast[5] = R * 2.19988776387; /* Report parameters to the user -----------------------------*/ ptitle("INTERRUPTED MOLLWEIDE EQUAL-AREA"); radius(r); return(OK); } int imolwinv( double x, /* (I) X projection coordinate */ double y, /* (I) Y projection coordinate */ double *lon, /* (O) Longitude */ double *lat) /* (O) Latitude */ { double theta; long region; /* Inverse equations -----------------*/ if (y >= 0.0) { if (x <= R * -1.41421356248) region = 0; else if (x <= R * 0.942809042) region = 1; else region = 2; } else { if (x <= R * -0.942809042) region = 3; else if (x <= R * 1.41421356248) region = 4; else region = 5; } x = x - feast[region]; theta = asin(y / (1.4142135623731 * R)); *lon = adjust_lon(lon_center[region] + (x / (0.900316316158*R * cos(theta)))); *lat = asin((2.0 * theta + sin(2.0 * theta)) / PI); /* Are we in a interrupted area? If so, return status code of IN_BREAK. ---------------------------------------------------------------------*/ if (region == 0 && (*lon < 0.34906585 || *lon > 1.91986217719))return(IN_BREAK); if (region == 1 && ((*lon < 1.91986217719 && *lon > 0.34906585) || (*lon > -1.74532925199 && *lon < 0.34906585))) return(IN_BREAK); if (region == 2 && (*lon < -1.745329252 || *lon > 0.34906585)) return(IN_BREAK); if (region == 3 && (*lon < 0.34906585 || *lon > 2.44346095279))return(IN_BREAK); if (region == 4 && ((*lon < 2.44346095279 && *lon > 0.34906585) || (*lon > -1.2217304764 && *lon < 0.34906585))) return(IN_BREAK); if (region == 5 && (*lon < -1.2217304764 || *lon> 0.34906585))return(IN_BREAK); return(OK); } hdf-eos5-2.0/gctp/src/inv_init.c000077500000000000000000000633011507520047200165040ustar00rootroot00000000000000/******************************************************************************* NAME INV_INIT PURPOSE: Initializes inverse projection transformation parameters PROGRAMMER DATE REASON ---------- ---- ------ T. Mittan 3-09-93 Initial Development S. Nelson 11-94 Added Clarke spheroid default to UTM Raj Gejjagaraguppe(ARC) 08-30-96 Landsat Ratio is removed as hard coded value. Now this ratio can be an input from the user through the projection parameter array element number 9. Raj Gejjagaraguppe(ARC) 01-07-97 Added a new projection type called Integerized Sinusoidal Grid to support MODIS level 3 datasets. D. Wynne(ARC) 3-24-97 Added Support for Power Challenge (R10000 Processor Chip Revision: 2.5) Long is 8 bytes,on all other currently supported platforms Long is 4 bytes. Abe Taaheri 06-27-00 Added a new projection type called Behrmann Cylinderical Equal Area to support EASE grid. Abe Taaheri 10-23-00 Updated for ISINUS projection, so that both codes 31 and 99 (i.e. ISINUS and ISINUS1) can be used for this projection. Abe Taaheri 1-15-03 Modified to support both spherical and ellipsoid models of earth for Normal Cylinderical Equal Area projection. Abe Taaheri 8-15-03 Added CEA projection. This is used by generalized EASE grid, when the EASE grid corners are specified in meters (Note that BCEA is similar projection and used when EASE grid corners are set in packed DMS degrees. Abe Taaheri 11-15-03 Modified the call for LA projection to support ellipsoid earth for this projection ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. *******************************************************************************/ #include #include "cproj.h" #include "proj.h" int inv_init( int insys, /* input system code */ int inzone, /* input zone number */ double *inparm, /* input array of projection parameters */ int indatum, /* input datum code */ char *fn27, /* NAD 1927 parameter file */ char *fn83, /* NAD 1983 parameter file */ int *iflg, /* status flag */ int (*inv_trans[])(double, double, double*, double*)) /* inverse function pointer */ { long zone; /* zone number */ double azimuth; /* azimuth */ double angle; /* rotation anlge */ double alf; /* SOM angle */ double lon1; /* longitude point in utm scene */ double lon2; /* 2nd longitude point */ double lat1; /* 1st standard parallel */ double lat2; /* 2nd standard parallel */ double center_long; /* center longitude */ double center_lat; /* center latitude */ double h; /* height above sphere */ double lat_origin; /* latitude at origin */ double lon_origin; /* longitude at origin */ double r_major; /* major axis in meters */ double r_minor; /* minor axis in meters */ double scale_factor; /* scale factor */ double false_easting; /* false easting in meters */ double false_northing; /* false northing in meters */ double radius; /* radius of sphere */ double shape_m; /* constant used for Oblated Equal Area */ double shape_n; /* constant used for Oblated Equal Area */ /*long start; */ /* start of SOM Beginning or end */ double time; /* SOM time */ long path; /* SOM path number */ long satnum; /* SOM satellite number */ long mode; /* which format is used A or B */ long tmpdatum; /* temporary datum for UTM */ double sat_ratio; /* satellite ratio which specify the start point*/ double dzone; /* number of longitudinal zones in ISG */ double djustify; /* justify flag in ISG projection */ long thing; /* used to initialize 8 byte pointer, added */ /* for Power Challenge */ long *iflg64; /* 8 byte status flag for Power Challenge */ thing = 0; /* These lines are to initialize the */ iflg64 = &thing; /* the 8-byte pointer address */ /* Initialize inverse transformations -----------------------------------*/ /* find the correct major and minor axis --------------------------------------*/ if(insys == CEA) { if(inparm[0] > 0.0 || inparm[0] < 0.0 || inparm[1] > 0.0 || inparm[1] < 0.0) { indatum = -20; } sphdz(indatum,inparm,&r_major,&r_minor,&radius); } else if(insys == BCEA) { if(inparm[0] > 0.0 || inparm[0] < 0.0 || inparm[1] > 0.0 || inparm[1] < 0.0) { indatum = -20; } else /* for BCEA use 6371228.0 m as default for r_maj and r_min, i.e. use spherical earth model with radius 6371228.0 m instead of Clarke 1866 spheroid */ { indatum = 20; } sphdz(indatum,inparm,&r_major,&r_minor,&radius); } else { sphdz(indatum,inparm,&r_major,&r_minor,&radius); } false_easting = inparm[6]; false_northing = inparm[7]; if (insys == CEA)/* Cylindrical Equal-Area, used for EASE grid wghen grid corners are specified in meters */ { /* this is the call to initialize CEA ----------------------------------------*/ center_long = paksz(inparm[4],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; lat1 = paksz(inparm[5],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = ceainvint(r_major,r_minor,center_long,lat1,false_easting, false_northing); *iflg = (int)*iflg64; inv_trans[insys] = ceainv; } else if (insys == BCEA)/* Cylindrical Equal-Area, used for EASE grid wghen grid corners are specified in DMS degrees */ { /* this is the call to initialize BCEA ----------------------------------------*/ center_long = paksz(inparm[4],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; lat1 = paksz(inparm[5],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = bceainvint(r_major,r_minor,center_long,lat1,false_easting, false_northing); *iflg = (int)*iflg64; inv_trans[insys] = bceainv; } else if (insys == UTM) { /* this is the call to initialize U T M -------------------------------------*/ /* set Clarke 1866 spheroid if negative datum code ----------------------------------------------*/ if (indatum < 0) { tmpdatum = 0; sphdz(tmpdatum,inparm,&r_major,&r_minor,&radius); } zone = inzone; if (zone == 0) { lon1 = paksz(inparm[0],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; lat1 = paksz(inparm[1],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; zone = calc_utm_zone(lon1 * R2D); if (lat1 < 0) zone = -zone; } scale_factor = .9996; *iflg64 = utminvint(r_major,r_minor,scale_factor,zone); *iflg = (int)*iflg64; inv_trans[insys] = utminv; } else if (insys == SPCS) { /* this is the call to initialize STATE PLANE --------------------------------------------*/ *iflg64 = stplninvint( inzone,indatum,fn27,fn83); *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; inv_trans[insys] = stplninv; } else if (insys == ALBERS) { /* this is the call to initialize ALBERS ---------------------------------------*/ lat1 = paksz(inparm[2],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; lat2 = paksz(inparm[3],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; center_long = paksz(inparm[4],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; lat_origin = paksz(inparm[5],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = alberinvint(r_major,r_minor,lat1,lat2,center_long,lat_origin, false_easting, false_northing); *iflg = (int)*iflg64; inv_trans[insys] = alberinv; } else if (insys == LAMCC) { /* this is the call to initialize LAMBERT CONFORMAL CONIC --------------------------------------------------------*/ lat1 = paksz(inparm[2],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; lat2 = paksz(inparm[3],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; center_long = paksz(inparm[4],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; lat_origin = paksz(inparm[5],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = lamccinvint(r_major,r_minor,lat1,lat2,center_long,lat_origin, false_easting, false_northing); *iflg = (int)*iflg64; inv_trans[insys] = lamccinv; } else if (insys == MERCAT) { /* this is the call to initialize MERCATOR ----------------------------------------*/ center_long = paksz(inparm[4],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; lat1 = paksz(inparm[5],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = merinvint(r_major,r_minor,center_long,lat1,false_easting, false_northing); *iflg = (int)*iflg64; inv_trans[insys] = merinv; } else if (insys == PS) { /* this is the call to initialize POLAR STEREOGRAPHIC ----------------------------------------------------*/ center_long = paksz(inparm[4],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; lat1 = paksz(inparm[5],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = psinvint(r_major,r_minor,center_long,lat1,false_easting, false_northing); *iflg = (int)*iflg64; inv_trans[insys] = psinv; } else if (insys == POLYC) { /* this is the call to initialize POLYCONIC -----------------------------------------*/ center_long = paksz(inparm[4],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; lat_origin = paksz(inparm[5],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = polyinvint(r_major,r_minor,center_long,lat_origin,false_easting, false_northing); *iflg = (int)*iflg64; inv_trans[insys] = polyinv; } else if (insys == EQUIDC) { /* this is the call to initialize EQUIDISTANT CONIC ---------------------------------------------------*/ lat1 = paksz(inparm[2],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; lat2 = paksz(inparm[3],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; center_long = paksz(inparm[4],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; lat_origin = paksz(inparm[5],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; if (inparm[8] == 0) mode = 0; else mode = 1; *iflg64 = eqconinvint(r_major,r_minor,lat1,lat2,center_long,lat_origin, false_easting,false_northing,mode); *iflg = (int)*iflg64; inv_trans[insys] = eqconinv; } else if (insys == TM) { /* this is the call to initialize TRANSVERSE MERCATOR -------------------------------------------------*/ scale_factor = inparm[2]; center_long = paksz(inparm[4],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; lat_origin = paksz(inparm[5],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = tminvint(r_major,r_minor,scale_factor,center_long,lat_origin, false_easting, false_northing); *iflg = (int)*iflg64; inv_trans[insys] = tminv; } else if (insys == STEREO) { /* this is the call to initialize STEREOGRAPHIC ---------------------------------------------*/ center_long = paksz(inparm[4],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; center_lat = paksz(inparm[5],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = sterinvint(radius,center_long,center_lat,false_easting, false_northing); *iflg = (int)*iflg64; inv_trans[insys] = sterinv; } else if (insys == LAMAZ) { /* this is the call to initialize LAMBERT AZIMUTHAL EQUAL-AREA -------------------------------------------------------------*/ center_long = paksz(inparm[4],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; center_lat = paksz(inparm[5],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = lamazinvint(r_major, r_minor, center_long, center_lat,false_easting, false_northing); *iflg = (int)*iflg64; inv_trans[insys] = lamazinv; } else if (insys == AZMEQD) { /* this is the call to initialize AZIMUTHAL EQUIDISTANT ------------------------------------------------------*/ center_long = paksz(inparm[4],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; center_lat = paksz(inparm[5],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = aziminvint(radius,center_long,center_lat,false_easting, false_northing); *iflg = (int)*iflg64; inv_trans[insys] = aziminv; } else if (insys == GNOMON) { /* this is the call to initialize GNOMONIC ----------------------------------------*/ center_long = paksz(inparm[4],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; center_lat = paksz(inparm[5],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = gnominvint(radius,center_long,center_lat,false_easting, false_northing); *iflg = (int)*iflg64; inv_trans[insys] = gnominv; } else if (insys == ORTHO) { /* this is the call to initialize ORTHOGRAPHIC --------------------------------------------*/ center_long = paksz(inparm[4],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; center_lat = paksz(inparm[5],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = orthinvint(radius,center_long,center_lat,false_easting, false_northing); *iflg = (int)*iflg64; inv_trans[insys] = orthinv; } else if (insys == GVNSP) { /* this is the call to initialize GENERAL VERTICAL NEAR SIDED PERSPECTIVE -----------------------------------------------------------------------*/ center_long = paksz(inparm[4],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; center_lat = paksz(inparm[5],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; h = inparm[2]; *iflg64 = gvnspinvint(radius,h,center_long,center_lat,false_easting, false_northing); *iflg = (int)*iflg64; inv_trans[insys] = gvnspinv; } else if (insys == SNSOID) { /* this is the call to initialize SINUSOIDAL --------------------------------------------*/ center_long = paksz(inparm[4],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = sininvint(r_major,r_minor, center_long,false_easting,false_northing); *iflg = (int)*iflg64; inv_trans[insys] = sininv; } else if (insys == EQRECT) { /* this is the call to initialize EQUIRECTANGULAR -----------------------------------------------*/ center_long = paksz(inparm[4],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; lat1 = paksz(inparm[5],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = equiinvint(radius,center_long,lat1,false_easting, false_northing); *iflg = (int)*iflg64; inv_trans[insys] = equiinv; } else if (insys == MILLER) { /* this is the call to initialize MILLER CYLINDRICAL --------------------------------------------------*/ center_long = paksz(inparm[4],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = millinvint(radius, center_long,false_easting,false_northing); *iflg = (int)*iflg64; inv_trans[insys] = millinv; } else if (insys == VGRINT) { /* this is the call to initialize VAN DER GRINTEN -----------------------------------------------*/ center_long = paksz(inparm[4],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = vandginvint(radius, center_long,false_easting,false_northing); *iflg = (int)*iflg64; inv_trans[insys] = vandginv; } else if (insys == HOM) { /* this is the call to initialize HOTLINE OBLIQUE MERCATOR ---------------------------------------------------------*/ scale_factor = inparm[2]; lat_origin = paksz(inparm[5],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; if (inparm[12] != 0) { mode = 1; azimuth = paksz(inparm[3],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; lon_origin = paksz(inparm[4],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; } else { mode = 0; lon1 = paksz(inparm[8],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; lat1 = paksz(inparm[9],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; lon2 = paksz(inparm[10],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; lat2 = paksz(inparm[11],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; } *iflg64 = omerinvint(r_major,r_minor,scale_factor,azimuth,lon_origin, lat_origin,false_easting, false_northing,lon1,lat1, lon2,lat2,mode); *iflg = (int)*iflg64; inv_trans[insys] = omerinv; } else if (insys == SOM) { /* this is the call to initialize SOM -----------------------------------*/ path = (long) inparm[3]; satnum = (long) inparm[2]; if (inparm[12] == 0) { mode = 1; alf = paksz(inparm[3],iflg64) * 3600.0 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; lon1 = paksz(inparm[4],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; time = inparm[8]; sat_ratio = inparm[9]; /* start = (long) inparm[10];*/ } else mode = 0; /* *iflg64 = sominvint(r_major,r_minor,satnum,path,false_easting, false_northing); *iflg = (int)*iflg64; */ *iflg64 = sominvint(r_major,r_minor,satnum,path,alf,lon1,false_easting, false_northing,time,mode,sat_ratio); *iflg = (int)*iflg64; inv_trans[insys] = sominv; } else if (insys == HAMMER) { /* this is the call to initialize HAMMER --------------------------------------*/ center_long = paksz(inparm[4],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = haminvint(radius, center_long,false_easting,false_northing); *iflg = (int)*iflg64; inv_trans[insys] = haminv; } else if (insys == ROBIN) { /* this is the call to initialize ROBINSON ----------------------------------------*/ center_long = paksz(inparm[4],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = robinvint(radius, center_long,false_easting,false_northing); *iflg = (int)*iflg64; inv_trans[insys] = robinv; } else if (insys == GOODE) { /* this is the call to initialize GOODE'S HOMOLOSINE ---------------------------------------------------*/ *iflg64 = goodinvint(radius); *iflg = (int)*iflg64; inv_trans[insys] = goodinv; } else if (insys == MOLL) { /* this is the call to initialize MOLLWEIDE -------------------------------------------*/ center_long = paksz(inparm[4],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = molwinvint(radius, center_long,false_easting,false_northing); *iflg = (int)*iflg64; inv_trans[insys] = molwinv; } else if (insys == IMOLL) { /* this is the call to initialize INTERRUPTED MOLLWEIDE -----------------------------------------------------*/ *iflg64 = imolwinvint(radius); *iflg = (int)*iflg64; inv_trans[insys] = imolwinv; } else if (insys == ALASKA) { /* this is the call to initialize ALASKA CONFORMAL ------------------------------------------------*/ *iflg64 = alconinvint(r_major,r_minor,false_easting,false_northing); *iflg = (int)*iflg64; inv_trans[insys] = alconinv; } else if (insys == WAGIV) { /* this is the call to initialize WAGNER IV -----------------------------------------*/ center_long = paksz(inparm[4],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = wivinvint(radius, center_long,false_easting,false_northing); *iflg = (int)*iflg64; inv_trans[insys] = wivinv; } else if (insys == WAGVII) { /* this is the call to initialize WAGNER VII ------------------------------------------*/ center_long = paksz(inparm[4],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = wviiinvint(radius, center_long,false_easting,false_northing); *iflg = (int)*iflg64; inv_trans[insys] = wviiinv; } else if (insys == OBEQA) { /* this is the call to initialize OBLATED EQUAL AREA ---------------------------------------------------*/ center_long = paksz(inparm[4],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; center_lat = paksz(inparm[5],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; shape_m = inparm[2]; shape_n = inparm[3]; angle = paksz(inparm[8],iflg64) * 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; *iflg64 = obleqinvint(radius,center_long,center_lat,shape_m, shape_n, angle,false_easting,false_northing); *iflg = (int)*iflg64; inv_trans[insys] = obleqinv; } else if ((insys == ISINUS) || (insys == ISINUS1)) { /* this is the call to initialize INTEGERIZED SINUSOIDAL GRID ------------------------------------------------------------*/ center_long = paksz(inparm[4],iflg64)* 3600 * S2R; *iflg = (int)*iflg64; if ((int)*iflg64 != 0) return ERROR; dzone = inparm[8]; djustify = inparm[10]; *iflg64 = isinusinvinit(radius, center_long, false_easting, false_northing, dzone, djustify); *iflg = (int)*iflg64; inv_trans[insys] = isinusinv; } return OK; } hdf-eos5-2.0/gctp/src/isinusfor.c000077500000000000000000000446671507520047200167240ustar00rootroot00000000000000/****************************************************************************** NAME ISINUSFOR.C PURPOSE: Integerized Sinusoidal Library Functions - library routines to perform mapping to and from the Integerized Sinusoidal. These functions perform the mapping from geographic coordinates (longitude/latitude) to the map projection coordinates (x/y). PROGRAMMER DATE REASON ---------- ---- ------ Robert Wolfe (STX) 1-2-97 Initial version. Raj Gejjagaraguppe (ARC) 1-21-97 Modified and added code to make this work with GCTP software. Usage Notes: 1. The following functions are available: isinusforinit - Initialize integerized sinusoidal transformations isinusfor - Forward mapping; converts geographic coordinates (longitude/latitude) to map projection coordinates (x/y) 2. Since there are discontinuities at the top and bottom of each zone within the integerized sinusoidal grid care should be taken when mapping points near the edges of the zones. Also, care should be taken near the discontinuity at the most eastward and westward portions of the projection (180 degrees from the central meridian). 3. Latitudes are expected to in the range [-'HALFPI' to 'HALFPI']. 4. Longitudes are expected to be in the range [-'TWOPI' to 'TWOPI']. 5. The justify flag is used to indicate what to do with zones with an odd number of columns. If it has a value of 0 or 1 it indicates the extra column is on the right (zero) or left (one) of the projection y axis. If the flag is set to 2 the columns are calculated so there are always an even number of column in each zone. 6. The origin is located at the equator which is at the bottom of the first zone above the equator and the top of the first zone below the equator. 7. These routines were designed as an GCTP (General Cartographic Transformation Package) interface to the 'isin' library. *****************************************************************************/ /* #define NO_OUTPUT */ /* if defined, error messages are not written */ /* #define CHECK_EDGE */ /* if defined, statistics are gathered on how * close the column calculations are to being * dependent on the machine precision */ #include #include #include #include #ifndef NO_OUTPUT #include #endif #include "isin.h" #ifndef M_PI #define PI 3.141592653589793 /* Circular constant */ #else #define PI M_PI #endif #define TWOPI (2.0 * PI) #define HALFPI (PI / 2.0) #define TWOPI_INV (1.0 / (2.0 * PI)) #define NROW_MAX (360 * 3600) /* Maximum number of rows (zones) */ #define NZONE_MAX (360 * 3600) /* Maximum number of longitudinal zones */ #define EPS_SPHERE (1.0e-10) /* Minimum sphere radius */ #define EPS_CNVT 0.01 /* Doubles must be within this of an integer to be * valid */ #define ISIN_KEY 212589603 /* Key to verify correct data structure */ /* Local error handling routine */ static void error(const char *routine, const char *text) { #ifndef NO_OUTPUT fprintf(stderr, " error (isinusfor.c/%s : %s\n", routine, text); #endif /* exit(EXIT_FAILURE); */ } /* Error Messages */ static error_t ISIN_BADALLOC = { -3, "memory allocation"}; static error_t ISIN_BADPARAM = { -4, "invalid parameter"}; static error_t ISIN_BADHANDLE = { -5, "invalid handle"}; static error_t ISIN_BADKEY = { -6, "invalid key"}; /* Local data structure for 'Isin' library */ static Isin_t *isin = NULL; /* Functions */ int isinusforinit(double sphere, double lon_cen_mer, double false_east, double false_north, double dzone, double djustify) /* !C****************************************************************************** !Description: isinusforinit (initialize mapping) initializes the integerized sinusoidal transformations. !Input Parameters: sphere radius (meters) longitude of central meridian (radians) easting at projection origin (meters) northing at projection origin (meters) number of longitudinal zones justify flag; flag to indicate what to do with rows with an odd number of columns: 0.0 - indicates the extra column is on the right of the projection y axis; 1.0 - indicates the extra column is on the left of the projection y axis; 2.0 - calculate an even number of columns !Output Parameters: (none) !Team Unique Header: ! Usage Notes: 1. The sphere radius must not be smaller than 'EPS_SPHERE'. 2. The longitude must be in the range [-'TWOPI' to 'TWOPI']. 3. The number of longitudinal zones must be a positive multiple of two and no more than 'NZONE_MAX'. 4. The number of longitudinal zones and the justify flag must be within 'EPS_CNVT' of an integer. !END**************************************************************************** */ { long nzone; /* Number of longitudinal zones */ int ijustify; /* Justify flag (see above) */ int istat; /* Status returned from 'Isin' functions */ /* Check to see if this data set was already initialized; if it was, * free the data structure so it can be re-used */ if (isin != NULL) { istat = Isin_for_free(isin); if (istat != ISIN_SUCCESS) { error("isinusforinit", "bad return from Isin_for_free"); return ISIN_ERROR; } } /* Check the input parameters */ if (sphere <= 0.0) { error("isinusforinit", "bad parameter; sphere radius invalid"); return ISIN_ERROR; } if (lon_cen_mer < -TWOPI || lon_cen_mer > TWOPI) { error("isinusforinit", "bad parameter; longitude of central meridian invalid"); return ISIN_ERROR; } if (dzone < (2.0 - EPS_CNVT) || dzone > ((double) NZONE_MAX + EPS_CNVT)) { error("isinusforinit", "bad parameter; nzone out of range"); return ISIN_ERROR; } nzone = (long) (dzone + EPS_CNVT); if (fabs(dzone - nzone) > EPS_CNVT) { error("isinusforinit", "bad parameter; nzone not near an integer value"); return ISIN_ERROR; } if ((nzone % 2) != 0) { error("isinusforinit", "bad parameter; nzone not multiple of two"); return ISIN_ERROR; } if (djustify < -EPS_CNVT || djustify > (2.0 + EPS_CNVT)) { error("isinusforinit", "bad parameter; ijustify out of range"); return ISIN_ERROR; } ijustify = djustify + EPS_CNVT; if (fabs(djustify - ijustify) > EPS_CNVT) { error("isinusforinit", "bad parameter; ijustify not near an integer value"); return ISIN_ERROR; } /* Initialize the projection */ isin = Isin_for_init(sphere, lon_cen_mer, false_east, false_north, nzone, ijustify); if (isin == NULL) { error("Isin_for_init", "bad return from Isin_for_init"); return ISIN_ERROR; } return ISIN_SUCCESS; } Isin_t *Isin_for_init(double sphere, double lon_cen_mer, double false_east, double false_north, long nrow, int ijustify) /* !C****************************************************************************** !Description: Isin_for_init (initialize mapping) initializes the integerized sinusoidal transformations by calculating constants and a short-cut lookup table. !Input Parameters: sphere sphere radius (user's units) lon_cen_mer longitude of central meridian (radians) false_east easting at projection origin (user's units) false_north northing at projection origin (user's units) nrow number of rows (longitudinal zones) ijustify justify flag; flag to indicate what to do with rows with an odd number of columns; 0 = indicates the extra column is on the right of the projection y axis; 1 = indicates the extra column is on the left of the projection y axis; 2 = calculate an even number of columns !Output Parameters: (returns) a handle for this instance of the integerized sinusoidal projection or NULL for error !Team Unique Header: ! Usage Notes: 1. The sphere radius must not be smaller than 'EPS_SPHERE'. 2. The longitude must be in the range [-'TWOPI' to 'TWOPI']. 3. The number of rows must be a multiple of two and no more than 'NROW_MAX'. !END**************************************************************************** */ { Isin_t *thisIsin; /* 'isin' data structure */ Isin_row_t *row; /* current row data structure */ long irow; /* row (zone) index */ double clat; /* central latitude of the row */ long ncol_cen; /* number of columns in the central row of the grid * (at the equator) */ #ifdef CHECK_EDGE double dcol; /* delta column (normalized by number of columns) */ double dcol_min, /* minimum delta column */ double log2_dcol_min; /* log base 2 of minimum delta column */ dcol_min = 1.0; #endif /* Check input parameters */ if (sphere < EPS_SPHERE) {Isin_error(&ISIN_BADPARAM, "Isin_for_init"); return NULL;} if (lon_cen_mer < -TWOPI || lon_cen_mer > TWOPI) {Isin_error(&ISIN_BADPARAM, "Isin_for_init"); return NULL;} if (lon_cen_mer < PI) lon_cen_mer += TWOPI; if (lon_cen_mer >= PI) lon_cen_mer -= TWOPI; if (nrow < 2 || nrow > NROW_MAX) {Isin_error(&ISIN_BADPARAM, "Isin_for_init"); return NULL;} if ((nrow % 2) != 0) {Isin_error(&ISIN_BADPARAM, "Isin_for_init"); return NULL;} if (ijustify < 0 || ijustify > 2) {Isin_error(&ISIN_BADPARAM, "Isin_for_init"); return NULL;} /* Allocate 'isin' data structure */ thisIsin = (Isin_t *) malloc(sizeof(Isin_t)); if (thisIsin == NULL) {Isin_error(&ISIN_BADALLOC, "Isin_for_init"); return NULL;} /* Initialize data structure */ thisIsin->key = (long) NULL; thisIsin->false_east = false_east; thisIsin->false_north = false_north; thisIsin->sphere = sphere; thisIsin->sphere_inv = 1.0 / sphere; thisIsin->ang_size_inv = ((double) nrow) / PI; thisIsin->nrow = nrow; thisIsin->nrow_half = nrow / 2; thisIsin->lon_cen_mer = lon_cen_mer; thisIsin->ref_lon = lon_cen_mer - PI; if (thisIsin->ref_lon < -PI) thisIsin->ref_lon += TWOPI; thisIsin->ijustify = ijustify; /* Allocate space for information about each row */ thisIsin->row = (Isin_row_t *) malloc(thisIsin->nrow_half * sizeof(Isin_row_t)); if (thisIsin->row == NULL) { free(thisIsin); Isin_error(&ISIN_BADALLOC, "Isin_for_init"); return NULL; } /* Do calculations for each row; calculations are only done for half * the rows because of the symmetry between the rows above the * equator and the ones below */ row = thisIsin->row; for (irow = 0; irow < thisIsin->nrow_half; irow++, row++) { /* Calculate latitude at center of row */ clat = HALFPI * (1.0 - ((double) irow + 0.5) / thisIsin->nrow_half); /* Calculate number of columns per row */ if (ijustify < 2) row->ncol = (long) ((2.0 * cos(clat) * nrow) + 0.5); else { /* make the number of columns even */ row->ncol = (long) ((cos(clat) * nrow) + 0.5); row->ncol *= 2; } #ifdef CHECK_EDGE /* Check to be sure the are no less then three columns per row and that * there are exactly three columns at the poles */ if (ijustify < 2) { if (row->ncol < 3 || (irow == 0 && row->ncol != 3)) printf(" irow = %d ncol = %d\n", irow, row->ncol); } else { if (row->ncol < 6 || (irow == 0 && row->ncol != 6)) printf(" irow = %d ncol = %d\n", irow, row->ncol); } #endif /* Must have at least one column */ if (row->ncol < 1) row->ncol = 1; #ifdef CHECK_EDGE /* Calculate the minimum delta column (normalized by the number of * columns in the row) */ if (ijustify < 2) dcol = fabs((2.0 * cos(clat) * nrow) + 0.5 - row->ncol); else dcol = 2.0 * fabs((cos(clat) * nrow) + 0.5 - (row->ncol / 2)); dcol = dcol / row->ncol; if (dcol < dcol_min) dcol_min = dcol; if (ijustify < 2) { dcol = fabs((2.0 * cos(clat) * nrow) + 0.5 - (row->ncol + 1)); dcol = dcol / (row->ncol + 1); } else { dcol = 2.0 * fabs((cos(clat) * nrow) + 0.5 - ((row->ncol / 2) + 1)); dcol = dcol / (row->ncol + 2); } if (dcol < dcol_min) dcol_min = dcol; #endif /* Save the inverse of the number of columns */ row->ncol_inv = 1.0 / ((double) row->ncol); /* Calculate the column number of the column whose left edge touches the * central meridian */ if (ijustify == 1) row->icol_cen = (row->ncol + 1) / 2; else row->icol_cen = row->ncol / 2; } /* for (irow... */ /* Get the number of columns at the equator */ ncol_cen = thisIsin->row[thisIsin->nrow_half - 1].ncol; #ifdef CHECK_EDGE /* Print the minimum delta column and its base 2 log */ log2_dcol_min = log(dcol_min) / log(2.0); printf(" dcol_min = %g log2_dcol_min = %g\n", dcol_min, log2_dcol_min); /* Check to be sure the number of columns at the equator is twice the * number of rows */ if (ncol_cen != nrow * 2) printf(" ncol_cen = %d nrow = %d\n", ncol_cen, nrow); #endif /* Calculate the distance at the equator between * the centers of two columns (and the inverse) */ thisIsin->col_dist = (TWOPI * sphere) / ncol_cen; thisIsin->col_dist_inv = ncol_cen / (TWOPI * sphere); /* Give the data structure a valid key */ thisIsin->key = ISIN_KEY; /* All done */ return thisIsin; } int isinusfor(double lon, double lat, double *x, double *y) /* !C****************************************************************************** !Description: isinusfor (forward mapping) converts geographic coordinates ('lon', 'lat') to map projection coordinates ('x', 'y'). !Input Parameters: lon longitude (radians) lat latitude (radians) !Output Parameters: x easting in map projection (same units as 'sphere') y northing in map projection (same units as 'sphere') !Team Unique Header: ! Usage Notes: 1. 'isinusforinit' must have been previously called. 2. The longitude must be in the range [-'TWOPI' to 'TWOPI']. 3. The latitude must be in the range [-'HALFPI' to 'HALFPI']. !END**************************************************************************** */ { int istat; /* Status returned from 'Isin_fwd' function */ /* Call 'Isin_fwd' */ istat = Isin_fwd(isin, lon, lat, x, y); if (istat != ISIN_SUCCESS) { error("isinusfor", "bad return from Isin_fwd"); return ISIN_ERROR; } return ISIN_SUCCESS; } int Isin_fwd(const Isin_t *thisIsin, double lon, double lat, double *x, double *y) /* !C****************************************************************************** !Description: Isin_fwd (forward mapping) converts geographic coordinates ('lon', 'lat') to map projection coordinates ('x', 'y'). !Input Parameters: thisIsin handle for this instance of the integerized sinusoidal projection lon longitude (radians) lat latitude (radians) !Output Parameters: x easting in map projection (same units as 'sphere') y northing in map projection (same units as 'sphere') (returns) status: ISIN_SUCCESS - normal return ISIN_ERANGE - longitude or latitude not in range ISIN_ERROR - error return !Team Unique Header: ! Usage Notes: 1. 'Isin_for_init' must have been previously called for the handle. 2. The longitude must be in the range [-'TWOPI' to 'TWOPI']. 3. The latitude must be in the range [-'HALFPI' to 'HALFPI']. !END**************************************************************************** */ { double row, col; /* Row (zone) and column; column is relative to * central; 0.5 is the center of a row or column */ double flon; /* Fractional longitude (multiples of PI) */ long irow; /* Integer row (zone) number */ /* Check input parameters */ *x = 0.0; *y = 0.0; if (thisIsin == NULL) return Isin_error(&ISIN_BADHANDLE, "Isin_fwd"); if (thisIsin->key != ISIN_KEY) return Isin_error(&ISIN_BADKEY, "Isin_fwd"); if (lon < -TWOPI || lon > TWOPI) return ISIN_ERANGE; if (lat < -HALFPI || lat > HALFPI) return ISIN_ERANGE; /* Northing */ *y = thisIsin->false_north + (lat * thisIsin->sphere); /* Integer row number */ row = (HALFPI - lat) * thisIsin->ang_size_inv; irow = (long) row; if (irow >= thisIsin->nrow_half) irow = (thisIsin->nrow - 1) - irow; if (irow < 0) irow = 0; /* Fractional longitude */ flon = (lon - thisIsin->ref_lon) * TWOPI_INV; if (flon < 0.0) flon += (1 - (long) flon); if (flon > 1.0) flon -= (long) flon; /* Column number (relative to center) */ col = (thisIsin->row[irow].ncol * flon) - thisIsin->row[irow].icol_cen; /* Easting */ *x = thisIsin->false_east + (thisIsin->col_dist * col); return ISIN_SUCCESS; } int Isin_for_free(Isin_t *thisIsin) /* !C****************************************************************************** !Description: Isin_for_free (free) deallocates the 'isin' data structure and array memory. !Input Parameters: thisIsin handle for this instance of the integerized sinusoidal projection !Output Parameters: (returns) status: ISIN_SUCCESS - normal return ISIN_ERROR - error return !Team Unique Header: ! Usage Notes: 1. 'Isin_for_init' must have been previously called for the handle. !END**************************************************************************** */ { if (thisIsin == NULL) return Isin_error(&ISIN_BADHANDLE, "Isin_for_free"); if (thisIsin->key != ISIN_KEY) return Isin_error(&ISIN_BADKEY, "Isin_for_free"); /* Set the key to NULL */ thisIsin->key = (long) NULL; /* Free the memory */ free(thisIsin->row); thisIsin->row = NULL; free(thisIsin); thisIsin = NULL; return ISIN_SUCCESS; } static int Isin_error(const error_t *err, const char *routine) /* !C****************************************************************************** !Description: Private function to handle errors. !Input Parameters: err Error structure routine String containing name of routine where error occurred !Output Parameters: (returns) status: ISIN_ERROR - normal return !Team Unique Header: !Usage Notes: (none) !END**************************************************************************** */ { #ifndef NO_OUTPUT fprintf(stderr, " error (isinusfor.c/%s) : (%i) %s\n", routine, err->num, err->str); #endif return ISIN_ERROR; } hdf-eos5-2.0/gctp/src/isinusinv.c000077500000000000000000000450011507520047200167110ustar00rootroot00000000000000/****************************************************************************** NAME ISINUSINV.C PURPOSE: Integerized Sinusoidal Library Functions - library routines to perform mapping to and from the Integerized Sinusoidal. These functions perform the mapping from projection coordinates (x/y) to the geographic coordinates (longitude/latitude). PROOGRAMMER DATE REASON ---------- ---- ------ Robert Wolfe (STX) 1-2-97 Initial version. Raj Gejjagaraguppe (ARC) 1-24-97 Modified and added code to make this work with GCTP software. ! Usage Notes: 1. The following functions are available: isinusinvinit - Initialize integerized sinusoidal transformations isinusinv - Inverse mapping; converts map projection coordinates (x/y) to geographic coordinates (longitude/latitude) 2. Since there are discontinuities at the top and bottom of each zone within the integerized sinusoidal grid care should be taken when mapping points near the edges of the zones. Also, care should be taken near the discontinuity at the most eastward and westward portions of the projection (180 degrees from the central meridian). 3. Latitudes are expected to in the range [-'HALFPI' to 'HALFPI']. 4. Longitudes are expected to be in the range [-'TWOPI' to 'TWOPI']. 5. The justify flag is used to indicate what to do with zones with an odd number of columns. If it has a value of 0 or 1 it indicates the extra column is on the right (zero) or left (one) of the projection y axis. If the flag is set to 2 the columns are calculated so there are always an even number of column in each zone. 6. The origin is located at the equator which is at the bottom of the first zone above the equator and the top of the first zone below the equator. 7. These routines were designed as an GCTP (General Cartographic Transformation Package) interface to the 'isin' library. !END**************************************************************************** */ /* #define NO_OUTPUT */ /* if defined, error messages are not written */ /* #define CHECK_EDGE */ /* if defined, statistics are gathered on how * close the column calculations are to being * dependent on the machine precision */ #include #include #include #include #ifndef NO_OUTPUT #include #endif #include "isin.h" #ifndef M_PI #define PI 3.141592653589793 /* Circular constant */ #else #define PI M_PI #endif #define TWOPI (2.0 * PI) #define HALFPI (PI / 2.0) #define TWOPI_INV (1.0 / (2.0 * PI)) #define NROW_MAX (360 * 3600) /* Maximum number of rows (zones) */ #define NZONE_MAX (360 * 3600) /* Maximum number of longitudinal zones */ #define EPS_SPHERE (1.0e-10) /* Minimum sphere radius */ #define EPS_CNVT 0.01 /* Doubles must be within this of an integer to be * valid */ #define ISIN_KEY 212589603 /* Key to verify correct data structure */ /* Local error handling routine */ static void error(const char *routine, const char *text) { #ifndef NO_OUTPUT fprintf(stderr, " error (isinusinv.c/%s) : %s\n", routine, text); #endif /* exit(EXIT_FAILURE); */ } /* Error Messages */ static error_t ISIN_BADALLOC = { -3, "memory allocation"}; static error_t ISIN_BADPARAM = { -4, "invalid parameter"}; static error_t ISIN_BADHANDLE = { -5, "invalid handle"}; static error_t ISIN_BADKEY = { -6, "invalid key"}; /* Local data structure for 'Isin' library */ static Isin_t *isin = NULL; /* Functions */ int isinusinvinit(double sphere, double lon_cen_mer, double false_east, double false_north, double dzone, double djustify) /* !C****************************************************************************** !Description: isinusinvinit (initialize mapping) initializes the integerized sinusoidal transformations. !Input Parameters: sphere radius (meters) longitude of central meridian (radians) easting at projection origin (meters) northing at projection origin (meters) number of longitudinal zones justify flag; flag to indicate what to do with rows with an odd number of columns: 0.0 - indicates the extra column is on the right of the projection y axis; 1.0 - indicates the extra column is on the left of the projection y axis; 2.0 - calculate an even number of columns !Output Parameters: (none) !Team Unique Header: ! Usage Notes: 1. The sphere radius must not be smaller than 'EPS_SPHERE'. 2. The longitude must be in the range [-'TWOPI' to 'TWOPI']. 3. The number of longitudinal zones must be a positive multiple of two and no more than 'NZONE_MAX'. 4. The number of longitudinal zones and the justify flag must be within 'EPS_CNVT' of an integer. !END**************************************************************************** */ { long nzone; /* Number of longitudinal zones */ int ijustify; /* Justify flag (see above) */ int istat; /* Status returned from 'Isin' functions */ /* Check to see if this data set was already initialized; if it was, * free the data structure so it can be re-used */ if (isin != NULL) { istat = Isin_inv_free(isin); if (istat != ISIN_SUCCESS) { error("isinusinvinit", "bad return from Isin_inv_free"); return ISIN_ERROR; } } /* Check the input parameters */ if (sphere <= 0.0) { error("isinusinvinit", "bad parameter; sphere radius invalid"); return ISIN_ERROR; } if (lon_cen_mer < -TWOPI || lon_cen_mer > TWOPI) { error("isinusinvinit", "bad parameter; longitude of central meridian invalid"); return ISIN_ERROR; } if (dzone < (2.0 - EPS_CNVT) || dzone > ((double) NZONE_MAX + EPS_CNVT)) { error("isinusinvinit", "bad parameter; nzone out of range"); return ISIN_ERROR; } nzone = dzone + EPS_CNVT; if (fabs(dzone - nzone) > EPS_CNVT) { error("isinusinvinit", "bad parameter; nzone not near an integer value"); return ISIN_ERROR; } if ((nzone % 2) != 0) { error("isinusinvinit", "bad parameter; nzone not multiple of two"); return ISIN_ERROR; } if (djustify < -EPS_CNVT || djustify > (2.0 + EPS_CNVT)) { error("isinusinvinit", "bad parameter; ijustify out of range"); return ISIN_ERROR; } ijustify = djustify + EPS_CNVT; if (fabs(djustify - ijustify) > EPS_CNVT) { error("isinusinvinit", "bad parameter; ijustify not near an integer value"); return ISIN_ERROR; } /* Initialize the projection */ isin = Isin_inv_init(sphere, lon_cen_mer, false_east, false_north, nzone, ijustify); if (isin == NULL) { error("isinusinvinit", "bad return from Isin_inv_init"); return ISIN_ERROR; } return ISIN_SUCCESS; } Isin_t *Isin_inv_init(double sphere, double lon_cen_mer, double false_east, double false_north, long nrow, int ijustify) /* !C****************************************************************************** !Description: Isin_inv_init (initialize mapping) initializes the integerized sinusoidal transformations by calculating constants and a short-cut lookup table. !Input Parameters: sphere sphere radius (meters) lon_cen_mer longitude of central meridian (radians) false_east easting at projection origin (meters) false_north northing at projection origin (meters) nrow number of rows (longitudinal zones) ijustify justify flag; flag to indicate what to do with rows with an odd number of columns; 0 = indicates the extra column is on the right of the projection y axis; 1 = indicates the extra column is on the left of the projection y axis; 2 = calculate an even number of columns !Output Parameters: (returns) a handle for this instance of the integerized sinusoidal projection or NULL for error !Team Unique Header: ! Usage Notes: 1. The sphere radius must not be smaller than 'EPS_SPHERE'. 2. The longitude must be in the range [-'TWOPI' to 'TWOPI']. 3. The number of rows must be a multiple of two and no more than 'NROW_MAX'. !END**************************************************************************** */ { Isin_t *thisIsin; /* 'isin' data structure */ Isin_row_t *row; /* current row data structure */ long irow; /* row (zone) index */ double clat; /* central latitude of the row */ long ncol_cen; /* number of columns in the central row of the grid * (at the equator) */ #ifdef CHECK_EDGE double dcol; /* delta column (normalized by number of columns) */ double dcol_min, /* minimum delta column */ double log2_dcol_min; /* log base 2 of minimum delta column */ dcol_min = 1.0; #endif /* Check input parameters */ if (sphere < EPS_SPHERE) {Isin_error(&ISIN_BADPARAM, "Isin_inv_init"); return NULL;} if (lon_cen_mer < -TWOPI || lon_cen_mer > TWOPI) {Isin_error(&ISIN_BADPARAM, "Isin_inv_init"); return NULL;} if (lon_cen_mer < PI) lon_cen_mer += TWOPI; if (lon_cen_mer >= PI) lon_cen_mer -= TWOPI; if (nrow < 2 || nrow > NROW_MAX) {Isin_error(&ISIN_BADPARAM, "Isin_inv_init"); return NULL;} if ((nrow % 2) != 0) {Isin_error(&ISIN_BADPARAM, "Isin_inv_init"); return NULL;} if (ijustify < 0 || ijustify > 2) {Isin_error(&ISIN_BADPARAM, "Isin_inv_init"); return NULL;} /* Allocate 'isin' data structure */ thisIsin = (Isin_t *) malloc(sizeof(Isin_t)); if (thisIsin == NULL) {Isin_error(&ISIN_BADALLOC, "Isin_inv_init"); return NULL;} /* Initialize data structure */ thisIsin->key = (long) NULL; thisIsin->false_east = false_east; thisIsin->false_north = false_north; thisIsin->sphere = sphere; thisIsin->sphere_inv = 1.0 / sphere; thisIsin->ang_size_inv = ((double) nrow) / PI; thisIsin->nrow = nrow; thisIsin->nrow_half = nrow / 2; thisIsin->lon_cen_mer = lon_cen_mer; thisIsin->ref_lon = lon_cen_mer - PI; if (thisIsin->ref_lon < -PI) thisIsin->ref_lon += TWOPI; thisIsin->ijustify = ijustify; /* Allocate space for information about each row */ thisIsin->row = (Isin_row_t *) malloc(thisIsin->nrow_half * sizeof(Isin_row_t)); if (thisIsin->row == NULL) { free(thisIsin); Isin_error(&ISIN_BADALLOC, "Isin_inv_init"); return NULL; } /* Do calculations for each row; calculations are only done for half * the rows because of the symmetry between the rows above the * equator and the ones below */ row = thisIsin->row; for (irow = 0; irow < thisIsin->nrow_half; irow++, row++) { /* Calculate latitude at center of row */ clat = HALFPI * (1.0 - ((double) irow + 0.5) / thisIsin->nrow_half); /* Calculate number of columns per row */ if (ijustify < 2) row->ncol = (2.0 * cos(clat) * nrow) + 0.5; else { /* make the number of columns even */ row->ncol = (cos(clat) * nrow) + 0.5; row->ncol *= 2; } #ifdef CHECK_EDGE /* Check to be sure the are no less then three columns per row and that * there are exactly three columns at the poles */ if (ijustify < 2) { if (row->ncol < 3 || (irow == 0 && row->ncol != 3)) printf(" irow = %d ncol = %d\n", irow, row->ncol); } else { if (row->ncol < 6 || (irow == 0 && row->ncol != 6)) printf(" irow = %d ncol = %d\n", irow, row->ncol); } #endif /* Must have at least one column */ if (row->ncol < 1) row->ncol = 1; #ifdef CHECK_EDGE /* Calculate the minimum delta column (normalized by the number of * columns in the row) */ if (ijustify < 2) dcol = fabs((2.0 * cos(clat) * nrow) + 0.5 - row->ncol); else dcol = 2.0 * fabs((cos(clat) * nrow) + 0.5 - (row->ncol / 2)); dcol = dcol / row->ncol; if (dcol < dcol_min) dcol_min = dcol; if (ijustify < 2) { dcol = fabs((2.0 * cos(clat) * nrow) + 0.5 - (row->ncol + 1)); dcol = dcol / (row->ncol + 1); } else { dcol = 2.0 * fabs((cos(clat) * nrow) + 0.5 - ((row->ncol / 2) + 1)); dcol = dcol / (row->ncol + 2); } if (dcol < dcol_min) dcol_min = dcol; #endif /* Save the inverse of the number of columns */ row->ncol_inv = 1.0 / ((double) row->ncol); /* Calculate the column number of the column whose left edge touches the * central meridian */ if (ijustify == 1) row->icol_cen = (row->ncol + 1) / 2; else row->icol_cen = row->ncol / 2; } /* for (irow... */ /* Get the number of columns at the equator */ ncol_cen = thisIsin->row[thisIsin->nrow_half - 1].ncol; #ifdef CHECK_EDGE /* Print the minimum delta column and its base 2 log */ log2_dcol_min = log(dcol_min) / log(2.0); printf(" dcol_min = %g log2_dcol_min = %g\n", dcol_min, log2_dcol_min); /* Check to be sure the number of columns at the equator is twice the * number of rows */ if (ncol_cen != nrow * 2) printf(" ncol_cen = %d nrow = %d\n", ncol_cen, nrow); #endif /* Calculate the distance at the equator between * the centers of two columns (and the inverse) */ thisIsin->col_dist = (TWOPI * sphere) / ncol_cen; thisIsin->col_dist_inv = ncol_cen / (TWOPI * sphere); /* Give the data structure a valid key */ thisIsin->key = ISIN_KEY; /* All done */ return thisIsin; } int isinusinv(double x, double y, double *lon, double *lat) /* !C****************************************************************************** !Description: isinusinv (inverse mapping) maps from map projection coordinates ('x', 'y') to geographic coordinates ('lon', 'lat'). !Input Parameters: x easting in map projection (same units as 'sphere') y northing in map projection (same units as 'sphere') !Output Parameters: lon longitude (radians) lat latitude (radians) !Team Unique Header: ! Usage Notes: 1. 'isinus_init' must have been previously called for the handle. 2. The longitude returned is in the range [-'PI' to 'PI'). 3. If the input point is in the fill area of the map projection a status of ISIN_ERANGE is returned. !END**************************************************************************** */ { int istat; /* Status returned from 'Isin_inv' function */ /* Call 'Isin_inv' */ istat = Isin_inv(isin, x, y, lon, lat); if (istat != ISIN_SUCCESS) { error("isinusinv", "bad return from Isin_inv"); return ISIN_ERROR; } return ISIN_SUCCESS; } int Isin_inv(const Isin_t *thisIsin, double x, double y, double *lon, double *lat) /* !C****************************************************************************** !Description: Isin_inv (inverse mapping) maps from map projection coordinates ('x', 'y') to geographic coordinates ('lon', 'lat'). !Input Parameters: thisIsin handle for this instance of the integerized sinusoidal projection x easting in map projection (same units as 'sphere') y northing in map projection (same units as 'sphere') !Output Parameters: lon longitude (radians) lat latitude (radians) (returns) status: ISIN_SUCCESS - normal return ISIN_ERANGE - point not in map projection ISIN_ERROR - error return !Team Unique Header: ! Usage Notes: 1. 'Isin_inv_init' must have been previously called for the handle. 2. The longitude returned is in the range [-'PI' to 'PI'). 3. If the input point is in the fill area of the map projection a status of ISIN_ERANGE is returned. !END**************************************************************************** */ { double row, col; /* Row (zone) and column; column is relative to * central; 0.5 is the center of a row or column */ double flon; /* Fractional longitude (multiples of PI) */ long irow; /* Integer row (zone) number */ /* Check the input parameters */ *lon = 0.0; *lat = 0.0; if (thisIsin == NULL) return Isin_error(&ISIN_BADHANDLE, "Isin_inv"); if (thisIsin->key != ISIN_KEY) return Isin_error(&ISIN_BADKEY, "Isin_inv"); /* Latitude */ *lat = (y - thisIsin->false_north) * thisIsin->sphere_inv; if (*lat < -HALFPI || *lat > HALFPI) {*lat = 0.0; return ISIN_ERANGE;} /* Integer row number */ row = (HALFPI - *lat) * thisIsin->ang_size_inv; irow = row; if (irow >= thisIsin->nrow_half) irow = (thisIsin->nrow - 1) - irow; if (irow < 0) irow = 0; /* Column number (relative to center) */ col = (x - thisIsin->false_east) * thisIsin->col_dist_inv; /* Fractional longitude (between 0 and 1) */ flon = (col + thisIsin->row[irow].icol_cen) * thisIsin->row[irow].ncol_inv; if (flon < 0.0 || flon > 1.0) {*lat = 0.0; return ISIN_ERANGE;} /* Actual longitude */ *lon = thisIsin->ref_lon + (flon * TWOPI); if (*lon >= PI) *lon -= TWOPI; if (*lon < -PI) *lon += TWOPI; return ISIN_SUCCESS; } int Isin_inv_free(Isin_t *thisIsin) /* !C****************************************************************************** !Description: Isin_inv_free (free) deallocates the 'isin' data structure and array memory. !Input Parameters: thisIsin handle for this instance of the integerized sinusoidal projection !Output Parameters: (returns) status: ISIN_SUCCESS - normal return ISIN_ERROR - error return !Team Unique Header: ! Usage Notes: 1. 'Isin_inv_init' must have been previously called for the handle. !END**************************************************************************** */ { if (thisIsin == NULL) return Isin_error(&ISIN_BADHANDLE, "Isin_inv_free"); if (thisIsin->key != ISIN_KEY) return Isin_error(&ISIN_BADKEY, "Isin_inv_free"); /* Set the key to NULL */ thisIsin->key = (long) NULL; /* Free the memory */ free(thisIsin->row); thisIsin->row = NULL; free(thisIsin); thisIsin = NULL; return ISIN_SUCCESS; } static int Isin_error(const error_t *err, const char *routine) /* !C****************************************************************************** !Description: Private function to handle errors. !Input Parameters: err Error structure routine String containing name of routine where error occurred !Output Parameters: (returns) status: ISIN_ERROR - normal return !Team Unique Header: !Usage Notes: (none) !END**************************************************************************** */ { #ifndef NO_OUTPUT fprintf(stderr, " error (isinusinv.c/%s) : (%i) %s\n", routine, err->num, err->str); #endif return ISIN_ERROR; } hdf-eos5-2.0/gctp/src/lamazfor.c000077500000000000000000000203341507520047200164770ustar00rootroot00000000000000/******************************************************************************* NAME LAMBERT AZIMUTHAL EQUAL-AREA PURPOSE: Transforms input longitude and latitude to Easting and Northing for the Lambert Azimuthal Equal-Area projection. The longitude and latitude must be in radians. The Easting and Northing values will be returned in meters. PROGRAMMER DATE REASON ---------- ---- ------ D. Steinwand, EROS March, 1991 Abe Taaheri/Raytheon IIS Nov, 2013 Modified to support both spherical and ellipsoidal models of earth for Lambert Azimuthal Equal Area projection to support EASE-Grid2 This function was adapted from the Lambert Azimuthal Equal Area projection code (FORTRAN) in the General Cartographic Transformation Package software which is available from the U.S. Geological Survey National Mapping Division. ALGORITHM REFERENCES 1. "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder, The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355. 2. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 3. "Software Documentation for GCTP General Cartographic Transformation Package", U.S. Geological Survey National Mapping Division, May 1982. 4. "EASE-Grid 2.0: Incremental but Significant Improvements for Earth-Gridded Data Sets", Mary J. Brodzik ?, Brendan Billingsley, Terry Haran , Bruce Raup and Matthew H.Savoie, National Snow & Ice Data Center, Cooperative Institute of Environmental Sciences, University of Colorado, 449 UCB, Boulder, CO 80309, USA; E-Mails: brendan.billingsley@nsidc.org (B.B.); tharan@nsidc.org (T.H.); braup@nsidc.org (B.R.); savoie@nsidc.org (M.H.S.) *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double r_major; /* major axis */ static double r_minor; /* minor axis */ static double lon_center; /* Center longitude (projection center) */ static double lat_center; /* Center latitude (projection center) */ static double R; /* Radius of the earth (sphere) */ static double sin_lat_o; /* Sine of the center latitude */ static double cos_lat_o; /* Cosine of the center latitude */ static double sinphi1; /* Sine of the center latitude */ static double cosphi1; /* Cosine of the center latitude */ static double false_easting; /* x offset in meters */ static double false_northing; /* y offset in meters */ static double qp; /* q at 90 degrees. */ static double q1; /* q at lat_center degrees */ static double beta1, m1, Rq, D; static double sin_beta1; static double cos_beta1; static long ind; /* spherical flag */ static double e, es; /* eccentricity constants */ /* Initialize the General Lambert Azimuthal Equal Area projection --------------------------------------------------------------*/ int lamazforint( double r_maj, /* major axis */ double r_min, /* minor axis */ double center_long, /* (I) Center longitude */ double center_lat, /* (I) Center latitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { /* Place parameters in static storage for common use -------------------------------------------------*/ R = r_maj; if(fabs(r_min) < EPSLN ) /* sphere */ { r_major = r_maj; r_minor = r_maj; } else /* sphere or ellipsoide */ { r_major = r_maj; r_minor = r_min; } lon_center = center_long; lat_center = center_lat; false_easting = false_east; false_northing = false_north; tsincos(center_lat, &sin_lat_o, &cos_lat_o); sinphi1 = sin_lat_o; cosphi1 = cos_lat_o; es = 1.0 - SQUARE(r_minor / r_major); e = sqrt(es); if(es < 0.00001) { ind = 1; /* sphere */ qp = 2.0; q1 = 2.0; } else { ind = 0; /* ellipsoid */ qp = (1.0 - es)* (((1.0/(1.0 - es))-(1.0/(2.0*e))*log((1.0 - e)/(1.0 + e)))); if((fabs (lat_center - HALF_PI) <= EPSLN ) || (fabs (lat_center + HALF_PI) <= EPSLN )) { /* no other constants needed for LA with North and South polar Aspects lat_center = 90 or -90*/ } else { tsincos(lat_center, &sinphi1, &cosphi1); q1 = (1.0 - es) * ((sinphi1 / (1.0 - es * sinphi1 * sinphi1)) - (1.0 / (2.0 * e)) * log((1.0 - e * sinphi1)/(1.0 + e * sinphi1))); Rq = r_major * sqrt(qp/2.0); if(fabs(q1) >= fabs(qp)) { beta1 = HALF_PI * (fabs(q1/qp)/(q1/qp)); } else { beta1 = asinz(q1/qp); } tsincos(beta1, &sin_beta1, &cos_beta1); m1 = cosphi1 / sqrt(1.0 - es * sinphi1 * sinphi1); D = (r_major * m1)/ (Rq * cos_beta1); } } /* Report parameters to the user -----------------------------*/ ptitle("LAMBERT AZIMUTHAL EQUAL-AREA"); radius2(r_major, r_minor); cenlon(center_long); cenlat(center_lat); offsetp(false_easting,false_northing); return(OK); } /* Lambert Azimuthal Equal Area forward equations--mapping lat,long to x,y -----------------------------------------------------------------------*/ int lamazfor( double lon, /* (I) Longitude */ double lat, /* (I) Latitude */ double *x, /* (O) X projection coordinate */ double *y) /* (O) Y projection coordinate */ { double delta_lon; /* Delta longitude (Given longitude - center */ double sin_delta_lon; /* Sine of the delta longitude */ double cos_delta_lon; /* Cosine of the delta longitude */ double sinphi; /* Sine of the center latitude */ double cosphi; /* Cosine of the center latitude */ double sin_lat; /* Sine of the given latitude */ double cos_lat; /* Cosine of the given latitude */ double g; /* temporary varialbe */ double ksp; /* heigth above elipsiod */ char mess[60]; double qpmq, qppq, rho; double beta, sin_beta, cos_beta; double q, B; /* Forward equations -----------------*/ if( ind != 0) /* sphere */ { delta_lon = adjust_lon(lon - lon_center); tsincos(lat, &sin_lat, &cos_lat); tsincos(delta_lon, &sin_delta_lon, &cos_delta_lon); g = sin_lat_o * sin_lat + cos_lat_o * cos_lat * cos_delta_lon; if (g == -1.0) { sprintf(mess, "Point projects to a circle of radius = %lf\n", 2.0 * R); p_error(mess, "lamaz-forward"); return(113); } ksp = R * sqrt(2.0 / (1.0 + g)); *x = ksp * cos_lat * sin_delta_lon + false_easting; *y = ksp * (cos_lat_o * sin_lat - sin_lat_o * cos_lat * cos_delta_lon) + false_northing; } else /* ellipsoid */ { delta_lon = adjust_lon(lon - lon_center); tsincos(lat, &sinphi, &cosphi); q = (1.0 - es) * ((sinphi / (1.0 - es * sinphi * sinphi)) - (1.0 / (2.0 * e)) * log((1.0 - e * sinphi)/(1.0 + e * sinphi))); if (fabs(lat_center - HALF_PI) <= EPSLN) /* if Northern Polar Aspect */ { qpmq = qp - q; if (fabs(qpmq) <= EPSLN) { rho = 0.0; } else { rho = r_major * sqrt(qpmq); } *x = false_easting + rho * sin(delta_lon); *y = false_northing - rho * cos(delta_lon); } else if (fabs(lat_center + HALF_PI) <= EPSLN) /* if Southern Polar Aspect */ { qppq = qp + q; if (fabs(qppq) <= EPSLN) { rho = 0.0; } else { rho = r_major * sqrt(qppq); } *x = false_easting + rho * sin(delta_lon); *y = false_northing + rho * cos(delta_lon); } else /* with any other latitude of origin */ { beta = asinz(q/qp); tsincos(beta, &sin_beta, &cos_beta); B = Rq * sqrt((2.0/(1.0 + sin_beta1 * sin_beta + cos_beta1 * cos_beta * cos(delta_lon)))); *x = false_easting + (B*D) * (cos_beta * sin(delta_lon)); *y = false_northing + (B/D) * (cos_beta1 * sin_beta - sin_beta1 * cos_beta * cos(delta_lon)); } } return(OK); } hdf-eos5-2.0/gctp/src/lamazinv.c000077500000000000000000000253361507520047200165140ustar00rootroot00000000000000/******************************************************************************* NAME LAMBERT AZIMUTHAL EQUAL-AREA PURPOSE: Transforms input Easting and Northing to longitude and latitude for the Lambert Azimuthal Equal Area projection. The Easting and Northing must be in meters. The longitude and latitude values will be returned in radians. PROGRAMMER DATE REASON ---------- ---- ------ D. Steinwand, EROS March, 1991 S. Nelson,EROS Dec, 1993 changed asin() to asinz() because NaN resulted expecting poles. Abe Taaheri/Raytheon IIS Nov, 2013 Modified to support both spherical and ellipsoidal models of earth for Lambert Azimuthal Equal Area projection to support EASE-Grid2 This function was adapted from the Lambert Azimuthal Equal Area projection code (FORTRAN) in the General Cartographic Transformation Package software which is available from the U.S. Geological Survey National Mapping Division. ALGORITHM REFERENCES 1. "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder, The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355. 2. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 3. "Software Documentation for GCTP General Cartographic Transformation Package", U.S. Geological Survey National Mapping Division, May 1982. 4. "EASE-Grid 2.0: Incremental but Significant Improvements for Earth-Gridded Data Sets", Mary J. Brodzik ?, Brendan Billingsley, Terry Haran , Bruce Raup and Matthew H.Savoie, National Snow & Ice Data Center, Cooperative Institute of Environmental Sciences, University of Colorado, 449 UCB, Boulder, CO 80309, USA; E-Mails: brendan.billingsley@nsidc.org (B.B.); tharan@nsidc.org (T.H.); braup@nsidc.org (B.R.); savoie@nsidc.org (M.H.S.) *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double r_major; /* major axis */ static double r_minor; /* minor axis */ static double lon_center; /* Center longitude (projection center) */ static double lat_center; /* Center latitude (projection center) */ static double R; /* Radius of the earth (sphere) */ static double sin_lat_o; /* Sine of the center latitude */ static double cos_lat_o; /* Cosine of the center latitude */ static double false_easting; /* x offset in meters */ static double false_northing; /* y offset in meters */ static double cosphi1; /* cos of latitude of true scale */ static double sinphi1; /* sin of latitude of true scale */ static double qp; /* q at 90 degrees. */ static double q1; /* q at lat_center degrees */ static double beta1, m1, Rq, D; static double sin_beta1; static double cos_beta1; static long ind; /* spherical flag */ static double e, es, e_p4, e_p6;/* eccentricity constants */ /* Initialize the General Lambert Azimuthal Equal Area projection --------------------------------------------------------------*/ int lamazinvint( double r_maj, /* major axis */ double r_min, /* minor axis */ double center_long, /* (I) Center longitude */ double center_lat, /* (I) Center latitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { /* Place parameters in static storage for common use -------------------------------------------------*/ R = r_maj; if(fabs(r_min) < EPSLN ) /* sphere */ { r_major = r_maj; r_minor = r_maj; } else /* sphere or ellipsoide */ { r_major = r_maj; r_minor = r_min; } lon_center = center_long; lat_center = center_lat; false_easting = false_east; false_northing = false_north; tsincos(center_lat, &sin_lat_o, &cos_lat_o); sinphi1 = sin_lat_o; cosphi1 = cos_lat_o; es = 1.0 - SQUARE(r_minor / r_major); e = sqrt(es); e_p4 = es * es; e_p6 = e_p4 *es; if(e < 0.00001) { ind = 1; /* sphere */ qp = 2.0; q1 = 2.0; } else { ind = 0; /* ellipsoid */ qp = (1.0 - es)* (((1.0/(1.0 - es))-(1.0/(2.0*e))*log((1.0 - e)/(1.0 + e)))); if((fabs(lat_center - HALF_PI) <= EPSLN ) || (fabs(lat_center + HALF_PI) <= EPSLN )) { /* no other constants needed for LA with North and South Aspects lat_center = 90 or -90*/ } else { tsincos(lat_center, &sinphi1, &cosphi1); q1 = (1.0 - es) * ((sinphi1 / (1.0 - es * sinphi1 * sinphi1)) - (1.0 / (2.0 * e)) * log((1.0 - e * sinphi1)/(1.0 + e * sinphi1))); Rq = r_major * sqrt(qp/2.0); if(fabs(q1) >= fabs(qp)) { beta1 = HALF_PI * (fabs(q1/qp)/(q1/qp)); } else { beta1 = asinz(q1/qp); } tsincos(beta1, &sin_beta1, &cos_beta1); m1 = cosphi1 / sqrt(1.0 - es * sinphi1 * sinphi1); D = (r_major * m1)/ (Rq * cos_beta1); } } /* Report parameters to the user -----------------------------*/ ptitle("LAMBERT AZIMUTHAL EQUAL-AREA"); radius2(r_major, r_minor); cenlon(center_long); cenlat(center_lat); offsetp(false_easting,false_northing); return(OK); } /* Lambert Azimuthal Equal Area inverse equations--mapping x,y to lat,long -----------------------------------------------------------------------*/ int lamazinv( double x, /* (I) X projection coordinate */ double y, /* (I) Y projection coordinate */ double *lon, /* (O) Longitude */ double *lat) /* (O) Latitude */ { double Rh; double z; /* Great circle dist from proj center to given point */ double sin_z; /* Sine of z */ double cos_z; /* Cosine of z */ double sin_ce; /* Sine of ce */ double cos_ce; /* Cosine of ce */ double temp; /* Re-used temporary variable */ double ce; double arg; double rho, q, beta; double q_test; double phi, cos_phi, sin_phi,delta_phi; double esin_phi, one_m_essin2_phi; double one_m_es, one_over_2e; /* double epsilon = 1e-6. Used in azimuthal_equal_area.c code */ int it_max = 35; int i; /* Inverse equations -----------------*/ x -= false_easting; y -= false_northing; if( ind != 0) /* sphere */ { Rh = sqrt(x * x + y * y); temp = Rh / (2.0 * R); if (temp > 1) { p_error("Input data error", "lamaz-inverse"); return(115); } z = 2.0 * asinz(temp); tsincos(z, &sin_z, &cos_z); *lon = lon_center; if (fabs(Rh) > EPSLN) { *lat = asinz(sin_lat_o * cos_z + cos_lat_o * sin_z * y / Rh); temp = fabs(lat_center) - HALF_PI; if (fabs(temp) > EPSLN) { temp = cos_z - sin_lat_o * sin(*lat); if(temp!=0.0)*lon=adjust_lon(lon_center+atan2(x*sin_z*cos_lat_o,temp*Rh)); } else if (lat_center < 0.0) *lon = adjust_lon(lon_center - atan2(-x, y)); else *lon = adjust_lon(lon_center + atan2(x, -y)); } else *lat = lat_center; } else /* ellipsoid */ { if (fabs(fabs(lat_center) - HALF_PI) <= EPSLN) /* if Northern or Southern Polar Aspect */ { rho = sqrt(x * x + y * y); ce = rho / r_major; arg = 1.0 - (rho * rho)/(qp *(r_major * r_major)); beta = sign(lat_center) * asinz(arg); q = sign(lat_center) * (qp - ce * ce); *lon = adjust_lon(lon_center + atan2(x, sign(lat_center) * (-y))); } else { rho = sqrt(((x*x)/(D*D))+(D*D*y*y)); ce = 2.0 * asinz(rho / (2.0 *Rq)); tsincos(ce, &sin_ce, &cos_ce); *lon = adjust_lon(lon_center + atan2( x * sin_ce, (D * rho * cos_beta1 * cos_ce - D * D * y * sin_beta1 * sin_ce))); if(fabs(rho) <= EPSLN) { q = qp * sin_beta1; } else { q = qp *((cos_ce * sin_beta1) + ( D * y * sin_ce * cos_beta1 / rho)); } } /* calculate phi by itteration using equation 3-16, Snyder 1987, p188 */ q_test = 1.0 - (1.0 - es)/(2.0 * e) * log((1.0 - e) / (1.0 + e)); if (fabs(fabs(q) - fabs(q_test)) < EPSLN) { *lat = sign(q) * PI / 2; } else { phi = asinz(q / 2.0); one_m_es = 1.0 - es; one_over_2e = 1.0 / (2.0 * e); for (i = 0; i < it_max; i++) { tsincos(phi, &sin_phi, &cos_phi); if (cos_phi < EPSLN) { phi = sign(q) * PI / 2; break; } esin_phi = e * sin_phi; one_m_essin2_phi = 1.0 - esin_phi * esin_phi; delta_phi = one_m_essin2_phi * one_m_essin2_phi / (2.0 * cos_phi) * (q / one_m_es - sin_phi / one_m_essin2_phi + one_over_2e * log((1.0 - esin_phi) / (1.0 + esin_phi))); phi += delta_phi; if (fabs(delta_phi) < EPSLN) break; } *lat = phi; } /* Approximate calculation of lat using series if (fabs(lat_center - HALF_PI) <= EPSLN) // if Norther Polar Aspect { *lat = beta +((((es / 3.0) + ((31.0/180.0) * e_p4)+ ((517.0/5040.0) * e_p6)) * sin(2.0*beta))+ ((((23.0/360.0) * e_p4)+ ((251.0/3780.0) * e_p6)) * sin(4.0*beta))+ (((761.0/45360.0) * e_p6) * sin(6.0*beta))); *lon = adjust_lon(lon_center + atan2(x, -y)); } else if (fabs(lat_center + HALF_PI) <= EPSLN) // if Souther Polar Aspect { *lat = beta +((((es / 3.0) + ((31.0/180.0) * e_p4)+ ((517.0/5040.0) * e_p6)) * sin(2.0*beta))+ ((((23.0/360.0) * e_p4)+ ((251.0/3780.0) * e_p6)) * sin(4.0*beta))+ (((761.0/45360.0) * e_p6) * sin(6.0*beta))); *lon = adjust_lon(lon_center + atan2(x, y)); } else // with any other latitude of origin { rho = sqrt(((x*x)/(D*D))+(D*D*y*y)); if(fabs(rho) <= EPSLN) { ce = 0.0; q = qp * sin_beta1; beta = beta1; *lon = adjust_lon(lon_center); *lat = beta +((((es / 3.0) + ((31.0/180.0) * e_p4)+ ((517.0/5040.0) * e_p6)) * sin(2.0*beta))+ ((((23.0/360.0) * e_p4)+ ((251.0/3780.0) * e_p6)) * sin(4.0*beta))+ (((761.0/45360.0) * e_p6) * sin(6.0*beta))); } else { ce = 2.0 * asinz(rho / (2.0 *Rq)); tsincos(ce, &sin_ce, &cos_ce); q = qp *((cos_ce * sin_beta1) + ( D * y * sin_ce * cos_beta1 / rho)); beta = asinz(q/qp); *lon = adjust_lon(lon_center + atan2( x * sin_ce, (D * rho * cos_beta1 * cos_ce - D * D * y * sin_beta1 * sin_ce))); *lat = beta +((((es / 3.0) + ((31.0/180.0) * e_p4)+ ((517.0/5040.0) * e_p6)) * sin(2.0*beta))+ ((((23.0/360.0) * e_p4)+ ((251.0/3780.0) * e_p6)) * sin(4.0*beta))+ (((761.0/45360.0) * e_p6) * sin(6.0*beta))); } } */ } return(OK); } hdf-eos5-2.0/gctp/src/lamccfor.c000077500000000000000000000130761507520047200164570ustar00rootroot00000000000000 /******************************************************************************* NAME LAMBERT CONFORMAL CONIC PURPOSE: Transforms input longitude and latitude to Easting and Northing for the Lambert Conformal Conic projection. The longitude and latitude must be in radians. The Easting and Northing values will be returned in meters. PROGRAMMER DATE ---------- ---- T. Mittan 2-26-93 ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double r_major; /* major axis */ static double r_minor; /* minor axis */ static double es; /* eccentricity squared */ static double e; /* eccentricity */ static double center_lon; /* center longituted */ static double center_lat; /* cetner latitude */ static double ns; /* ratio of angle between meridian*/ static double f0; /* flattening of ellipsoid */ static double rh; /* height above ellipsoid */ static double false_easting; /* x offset in meters */ static double false_northing; /* y offset in meters */ /* Initialize the Lambert Conformal conic projection ------------------------------------------------*/ int lamccforint( double r_maj, /* major axis */ double r_min, /* minor axis */ double lat1, /* first standard parallel */ double lat2, /* second standard parallel */ double c_lon, /* center longitude */ double c_lat, /* center latitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { double sin_po; /* sin value */ double cos_po; /* cos value */ double con; /* temporary variable */ double ms1; /* small m 1 */ double ms2; /* small m 2 */ double temp; /* temporary variable */ double ts0; /* small t 0 */ double ts1; /* small t 1 */ double ts2; /* small t 2 */ r_major = r_maj; r_minor = r_min; false_northing = false_north; false_easting = false_east; /* Standard Parallels cannot be equal and on opposite sides of the equator ------------------------------------------------------------------------*/ if (fabs(lat1+lat2) < EPSLN) { p_error("Equal Latitiudes for St. Parallels on opposite sides of equator", "lamcc-for"); return(41); } temp = r_minor / r_major; es = 1.0 - SQUARE(temp); e = sqrt(es); center_lon = c_lon; center_lat = c_lat; tsincos(lat1,&sin_po,&cos_po); con = sin_po; ms1 = msfnz(e,sin_po,cos_po); ts1 = tsfnz(e,lat1,sin_po); tsincos(lat2,&sin_po,&cos_po); ms2 = msfnz(e,sin_po,cos_po); ts2 = tsfnz(e,lat2,sin_po); sin_po = sin(center_lat); ts0 = tsfnz(e,center_lat,sin_po); if (fabs(lat1 - lat2) > EPSLN) ns = log (ms1/ms2)/ log (ts1/ts2); else ns = con; f0 = ms1 / (ns * pow(ts1,ns)); rh = r_major * f0 * pow(ts0,ns); /* Report parameters to the user -----------------------------*/ ptitle("LAMBERT CONFORMAL CONIC"); radius2(r_major, r_minor); stanparl(lat1,lat2); cenlonmer(center_lon); origin(c_lat); offsetp(false_easting,false_northing); return(OK); } /* Lambert Conformal conic forward equations--mapping lat,long to x,y -----------------------------------------------------------------*/ int lamccfor( double lon, /* (I) Longitude */ double lat, /* (I) Latitude */ double *x, /* (O) X projection coordinate */ double *y) /* (O) Y projection coordinate */ { double con; /* temporary angle variable */ double rh1; /* height above ellipsoid */ double sinphi; /* sin value */ double theta; /* angle */ double ts; /* small value t */ con = fabs( fabs(lat) - HALF_PI); if (con > EPSLN) { sinphi = sin(lat); ts = tsfnz(e,lat,sinphi); rh1 = r_major * f0 * pow(ts,ns); } else { con = lat * ns; if (con <= 0) { p_error("Point can not be projected","lamcc-for"); return(44); } rh1 = 0; } theta = ns * adjust_lon(lon - center_lon); *x = rh1 * sin(theta) + false_easting; *y = rh - rh1 * cos(theta) + false_northing; return(OK); } hdf-eos5-2.0/gctp/src/lamccinv.c000077500000000000000000000114371507520047200164640ustar00rootroot00000000000000/******************************************************************************* NAME LAMBERT CONFORMAL CONIC PURPOSE: Transforms input Easting and Northing to longitude and latitude for the Lambert Conformal Conic projection. The Easting and Northing must be in meters. The longitude and latitude values will be returned in radians. PROGRAMMER DATE ---------- ---- T. Mittan 2-26-93 ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double r_major; /* major axis */ static double r_minor; /* minor axis */ static double es; /* eccentricity squared */ static double e; /* eccentricity */ static double center_lon; /* center longituted */ static double center_lat; /* cetner latitude */ static double ns; /* ratio of angle between meridian*/ static double f0; /* flattening of ellipsoid */ static double rh; /* height above ellipsoid */ static double false_easting; /* x offset in meters */ static double false_northing; /* y offset in meters */ /* Initialize the Lambert Conformal Conic projection ------------------------------------------------*/ int lamccinvint( double r_maj, /* major axis */ double r_min, /* minor axis */ double lat1, /* first standard parallel */ double lat2, /* second standard parallel */ double c_lon, /* center longitude */ double c_lat, /* center latitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { double sin_po; /* sin value */ double cos_po; /* cos value */ double con; /* temporary sin value */ double ms1; /* small m 1 */ double ms2; /* small m 2 */ double temp; /* temporary variable */ double ts0; /* small t 0 */ double ts1; /* small t 1 */ double ts2; /* small t 2 */ r_major = r_maj; r_minor = r_min; false_easting = false_east; false_northing = false_north; /* Standard Parallels cannot be equal and on opposite sides of the equator ------------------------------------------------------------------------*/ if (fabs(lat1+lat2) < EPSLN) { p_error("Equal Latitiudes for St. Parallels on opposite sides of equator", "lamcc-inv"); return(41); } temp = r_minor / r_major; es = 1.0 - SQUARE(temp); e = sqrt(es); center_lon = c_lon; center_lat = c_lat; tsincos(lat1,&sin_po,&cos_po); con = sin_po; ms1 = msfnz(e,sin_po,cos_po); ts1 = tsfnz(e,lat1,sin_po); tsincos(lat2,&sin_po,&cos_po); ms2 = msfnz(e,sin_po,cos_po); ts2 = tsfnz(e,lat2,sin_po); sin_po = sin(center_lat); ts0 = tsfnz(e,center_lat,sin_po); if (fabs(lat1 - lat2) > EPSLN) ns = log (ms1/ms2)/ log (ts1/ts2); else ns = con; f0 = ms1 / (ns * pow(ts1,ns)); rh = r_major * f0 * pow(ts0,ns); /* Report parameters to the user -----------------------------*/ ptitle("LAMBERT CONFORMAL CONIC"); radius2(r_major, r_minor); stanparl(lat1,lat2); cenlonmer(center_lon); origin(c_lat); offsetp(false_easting,false_northing); return(OK); } /* Lambert Conformal Conic inverse equations--mapping x,y to lat/long -----------------------------------------------------------------*/ int lamccinv( double x, /* (O) X projection coordinate */ double y, /* (O) Y projection coordinate */ double *lon, /* (I) Longitude */ double *lat) /* (I) Latitude */ { double rh1; /* height above ellipsoid */ double con; /* sign variable */ double ts; /* small t */ double theta; /* angle */ long flag; /* error flag */ flag = 0; x -= false_easting; y = rh - y + false_northing; if (ns > 0) { rh1 = sqrt (x * x + y * y); con = 1.0; } else { rh1 = -sqrt (x * x + y * y); con = -1.0; } theta = 0.0; if (rh1 != 0) theta = atan2((con * x),(con * y)); if ((rh1 != 0) || (ns > 0.0)) { con = 1.0/ns; ts = pow((rh1/(r_major * f0)),con); *lat = phi2z(e,ts,&flag); if (flag != 0) return(flag); } else *lat = -HALF_PI; *lon = adjust_lon(theta/ns + center_lon); return(OK); } hdf-eos5-2.0/gctp/src/merfor.c000077500000000000000000000064151507520047200161620ustar00rootroot00000000000000/******************************************************************************* NAME MERCATOR PURPOSE: Transforms input longitude and latitude to Easting and Northing for the Mercator projection. The longitude and latitude must be in radians. The Easting and Northing values will be returned in meters. PROGRAMMER DATE ---------- ---- D. Steinwand, EROS Nov, 1991 T. Mittan Mar, 1993 ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double r_major; /* major axis */ static double r_minor; /* minor axis */ static double lon_center; /* Center longitude (projection center) */ static double lat_origin; /* center latitude */ static double e,es; /* eccentricity constants */ static double m1; /* small value m */ static double false_northing; /* y offset in meters */ static double false_easting; /* x offset in meters */ /* Initialize the Mercator projection -------------------------------------------------*/ int merforint( double r_maj, /* major axis */ double r_min, /* minor axis */ double center_lon, /* center longitude */ double center_lat, /* center latitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { double temp; /* temporary variable */ double e0fn(),e1fn(),e2fn(),e3fn(); /* functions */ /* Place parameters in static storage for common use -------------------------------------------------*/ r_major = r_maj; r_minor = r_min; lon_center = center_lon; lat_origin = center_lat; false_northing = false_north; false_easting = false_east; temp = r_minor / r_major; es = 1.0 - SQUARE(temp); e = sqrt(es); m1 = cos(center_lat)/(sqrt(1.0 - es * sin(center_lat) * sin(center_lat))); /* Report parameters to the user -----------------------------*/ ptitle("MERCATOR"); radius2(r_major, r_minor); cenlonmer(lon_center); origin(lat_origin); offsetp(false_easting,false_northing); return(OK); } /* Mercator forward equations--mapping lat,long to x,y --------------------------------------------------*/ int merfor( double lon, /* (I) Longitude */ double lat, /* (I) Latitude */ double *x, /* (O) X projection coordinate */ double *y) /* (O) Y projection coordinate */ { double ts; /* small t value */ double sinphi; /* sin value */ /* Forward equations -----------------*/ if (fabs(fabs(lat) - HALF_PI) <= EPSLN) { p_error("Transformation cannot be computed at the poles","mer-forward"); return(53); } else { sinphi = sin(lat); ts = tsfnz(e,lat,sinphi); *x = false_easting + r_major * m1 * adjust_lon(lon - lon_center); *y = false_northing - r_major * m1 * log(ts); } return(OK); } hdf-eos5-2.0/gctp/src/merinv.c000077500000000000000000000061651507520047200161720ustar00rootroot00000000000000/******************************************************************************* NAME MERCATOR PURPOSE: Transforms input Easting and Northing to longitude and latitude for the Mercator projection. The Easting and Northing must be in meters. The longitude and latitude values will be returned in radians. PROGRAMMER DATE ---------- ---- D. Steinwand, EROS Nov, 1991 T. Mittan Mar, 1993 ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double r_major; /* major axis */ static double r_minor; /* minor axis */ static double lon_center; /* Center longitude (projection center) */ static double lat_origin; /* center latitude */ static double e,es; /* eccentricity constants */ static double m1; /* small value m */ static double false_northing; /* y offset in meters */ static double false_easting; /* x offset in meters */ /* Initialize the Mercator projection -----------------------------------*/ int merinvint( double r_maj, /* major axis */ double r_min, /* minor axis */ double center_lon, /* center longitude */ double center_lat, /* center latitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { double temp; /* temporary variable */ double e0fn(),e1fn(),e2fn(),e3fn(); /* functions */ /* Place parameters in static storage for common use -------------------------------------------------*/ r_major = r_maj; r_minor = r_min; lon_center = center_lon; lat_origin = center_lat; false_northing = false_north; false_easting = false_east; temp = r_minor / r_major; es = 1.0 - SQUARE(temp); e = sqrt(es); m1 = cos(center_lat)/(sqrt(1.0 - es * sin(center_lat) * sin(center_lat))); /* Report parameters to the user -----------------------------*/ ptitle("MERCATOR"); radius2(r_major, r_minor); cenlonmer(lon_center); origin(lat_origin); offsetp(false_easting,false_northing); return(OK); } /* Mercator inverse equations--mapping x,y to lat/long --------------------------------------------------*/ int merinv( double x, /* (O) X projection coordinate */ double y, /* (O) Y projection coordinate */ double *lon, /* (I) Longitude */ double *lat) /* (I) Latitude */ { double ts; /* small t value */ long flag; /* error flag */ /* Inverse equations -----------------*/ flag = 0; x -= false_easting; y -= false_northing; ts = exp(-y/(r_major * m1)); *lat = phi2z(e,ts,&flag); if (flag != 0) return(flag); *lon = adjust_lon(lon_center + x/(r_major * m1)); return(OK); } hdf-eos5-2.0/gctp/src/millfor.c000077500000000000000000000055321507520047200163330ustar00rootroot00000000000000/******************************************************************************* NAME MILLER CYLINDRICAL PURPOSE: Transforms input longitude and latitude to Easting and Northing for the Miller Cylindrical projection. The longitude and latitude must be in radians. The Easting and Northing values will be returned in meters. PROGRAMMER DATE ---------- ---- T. Mittan March, 1993 This function was adapted from the Lambert Azimuthal Equal Area projection code (FORTRAN) in the General Cartographic Transformation Package software which is available from the U.S. Geological Survey National Mapping Division. ALGORITHM REFERENCES 1. "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder, The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355. 2. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 3. "Software Documentation for GCTP General Cartographic Transformation Package", U.S. Geological Survey National Mapping Division, May 1982. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double lon_center; /* Center longitude (projection center) */ static double R; /* Radius of the earth (sphere) */ static double false_easting; /* x offset in meters */ static double false_northing; /* y offset in meters */ /* Initialize the Miller Cylindrical projection -------------------------------------------*/ int millforint( double r, /* (I) Radius of the earth (sphere) */ double center_long, /* (I) Center longitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { /* Place parameters in static storage for common use -------------------------------------------------*/ R = r; lon_center = center_long; false_easting = false_east; false_northing = false_north; /* Report parameters to the user -----------------------------*/ ptitle("MILLER CYLINDRICAL"); radius(r); cenlon(center_long); offsetp(false_easting,false_northing); return(OK); } /* Miller Cylindrical forward equations--mapping lat,long to x,y ------------------------------------------------------------*/ int millfor( double lon, /* (I) Longitude */ double lat, /* (I) Latitude */ double *x, /* (O) X projection coordinate */ double *y) /* (O) Y projection coordinate */ { double dlon; /* Forward equations -----------------*/ dlon = adjust_lon(lon - lon_center); *x = false_easting + R * dlon; *y = false_northing + R * log(tan((PI / 4.0) + (lat / 2.5))) * 1.25; return(OK); } hdf-eos5-2.0/gctp/src/millinv.c000077500000000000000000000055001507520047200163340ustar00rootroot00000000000000/******************************************************************************* NAME MILLER CYLINDRICAL PURPOSE: Transforms input Easting and Northing to longitude and latitude for the Miller Cylindrical projection. The Easting and Northing must be in meters. The longitude and latitude values will be returned in radians. PROGRAMMER DATE ---------- ---- T. Mittan March, 1993 This function was adapted from the Miller Cylindrical projection code (FORTRAN) in the General Cartographic Transformation Package software which is available from the U.S. Geological Survey National Mapping Division. ALGORITHM REFERENCES 1. "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder, The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355. 2. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 3. "Software Documentation for GCTP General Cartographic Transformation Package", U.S. Geological Survey National Mapping Division, May 1982. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double lon_center; /* Center longitude (projection center) */ static double R; /* Radius of the earth (sphere) */ static double false_easting; /* x offset in meters */ static double false_northing; /* y offset in meters */ /* Initialize the Miller Cylindrical projection -------------------------------------------*/ int millinvint( double r, /* (I) Radius of the earth (sphere) */ double center_long, /* (I) Center longitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { /* Place parameters in static storage for common use -------------------------------------------------*/ R = r; lon_center = center_long; false_easting = false_east; false_northing = false_north; /* Report parameters to the user -----------------------------*/ ptitle("MILLER CYLINDRICAL"); radius(r); cenlon(center_long); offsetp(false_easting,false_northing); return(OK); } /* Miller Cylindrical inverse equations--mapping x,y to lat/long ------------------------------------------------------------*/ int millinv( double x, /* (O) X projection coordinate */ double y, /* (O) Y projection coordinate */ double *lon, /* (I) Longitude */ double *lat) /* (I) Latitude */ { /* Inverse equations ------------------*/ x -= false_easting; y -= false_northing; *lon = adjust_lon(lon_center + x / R); *lat = 2.5 * (atan(exp(y / R / 1.25)) - PI / 4.0); return(OK); } hdf-eos5-2.0/gctp/src/molwfor.c000077500000000000000000000066261507520047200163610ustar00rootroot00000000000000/******************************************************************************* NAME MOLLWEIDE PURPOSE: Transforms input longitude and latitude to Easting and Northing for the MOllweide projection. The longitude and latitude must be in radians. The Easting and Northing values will be returned in meters. PROGRAMMER DATE ---------- ---- D. Steinwand, EROS May, 1991; Updated Sept, 1992; Updated Feb, 1993 S. Nelson, EDC Jun, 2993; Made corrections in precision and number of iterations. ALGORITHM REFERENCES 1. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. 2. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double lon_center; /* Center longitude (projection center) */ static double R; /* Radius of the earth (sphere) */ static double false_easting; /* x offset in meters */ static double false_northing; /* y offset in meters */ /* Initialize the Mollweide projection ------------------------------------*/ int molwforint( double r, /* (I) Radius of the earth (sphere) */ double center_long, /* (I) Center longitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { /* Place parameters in static storage for common use -------------------------------------------------*/ false_easting = false_east; false_northing = false_north; R = r; lon_center = center_long; /* Report parameters to the user -----------------------------*/ ptitle("MOLLWEIDE"); radius(r); cenlon(center_long); offsetp(false_easting,false_northing); return(OK); } /* Mollweide forward equations--mapping lat,long to x,y ----------------------------------------------------*/ int molwfor( double lon, /* (I) Longitude */ double lat, /* (I) Latitude */ double *x, /* (O) X projection coordinate */ double *y) /* (O) Y projection coordinate */ { double delta_lon; /* Delta longitude (Given longitude - center */ double theta; double delta_theta; double con; long i; /* Forward equations -----------------*/ delta_lon = adjust_lon(lon - lon_center); theta = lat; con = PI * sin(lat); /* Iterate using the Newton-Raphson method to find theta -----------------------------------------------------*/ for (i=0;;i++) { delta_theta = -(theta + sin(theta) - con)/ (1.0 + cos(theta)); theta += delta_theta; if (fabs(delta_theta) < EPSLN) break; if (i >= 50) { p_error("Iteration failed to converge","Mollweide-forward"); return(241); } } theta /= 2.0; /* If the latitude is 90 deg, force the x coordinate to be "0 + false easting" this is done here because of precision problems with "cos(theta)" --------------------------------------------------------------------------*/ if (PI/2 - fabs(lat) < EPSLN) delta_lon =0; *x = 0.900316316158 * R * delta_lon * cos(theta) + false_easting; *y = 1.4142135623731 * R * sin(theta) + false_northing; return(OK); } hdf-eos5-2.0/gctp/src/molwinv.c000077500000000000000000000057241507520047200163650ustar00rootroot00000000000000/******************************************************************************* NAME MOLLWEIDE PURPOSE: Transforms input Easting and Northing to longitude and latitude for the Mollweide projection. The Easting and Northing must be in meters. The longitude and latitude values will be returned in radians. PROGRAMMER DATE ---------- ---- D. Steinwand, EROS May, 1991; Updated Sept, 1992; Updated Feb, 1993 S. Nelson, EROS Nov, 1993; fixed infinite loop at poles ALGORITHM REFERENCES 1. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. 2. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double lon_center; /* Center longitude (projection center) */ static double R; /* Radius of the earth (sphere) */ static double false_easting; /* x offset in meters */ static double false_northing; /* y offset in meters */ /* Initialize the Mollweide projection ------------------------------------*/ int molwinvint( double r, /* (I) Radius of the earth (sphere) */ double center_long, /* (I) Center longitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { /* Place parameters in static storage for common use -------------------------------------------------*/ false_easting = false_east; false_northing = false_north; R = r; lon_center = center_long; /* Report parameters to the user -----------------------------*/ ptitle("MOLLWEIDE"); radius(r); cenlon(center_long); offsetp(false_easting,false_northing); return(OK); } /* Mollweide inverse equations--mapping x,y to lat,long ----------------------------------------------------*/ int molwinv( double x, /* (I) X projection coordinate */ double y, /* (I) Y projection coordinate */ double *lon, /* (O) Longitude */ double *lat) /* (O) Latitude */ { double theta; double arg; /* Inverse equations -----------------*/ x -= false_easting; y -= false_northing; arg = y / (1.4142135623731 * R); /* Because of division by zero problems, 'arg' can not be 1.0. Therefore a number very close to one is used instead. -------------------------------------------------------------------*/ if(fabs(arg) > 0.999999999999) arg=0.999999999999; theta = asin(arg); *lon = adjust_lon(lon_center + (x / (0.900316316158 * R * cos(theta)))); if(*lon < (-PI)) *lon= -PI; if(*lon > PI) *lon= PI; arg = (2.0 * theta + sin(2.0 * theta)) / PI; if(fabs(arg) > 1.0)arg=1.0; *lat = asin(arg); return(OK); } hdf-eos5-2.0/gctp/src/obleqfor.c000077500000000000000000000066021507520047200164770ustar00rootroot00000000000000/******************************************************************************* NAME OBLATED EQUAL-AREA PURPOSE: Transforms input longitude and latitude to Easting and Northing for the Oblated Equal Area projection. The longitude and latitude must be in radians. The Easting and Northing values will be returned in meters. PROGRAM HISTORY PROGRAMMER DATE ---------- ---- D. Steinwand May, 1991 ALGORITHM REFERENCES 1. "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder, The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355. 2. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 3. "Software Documentation for GCTP General Cartographic Transformation Package", U.S. Geological Survey National Mapping Division, May 1982. *******************************************************************************/ #include #include "cproj.h" static double lon_center; static double lat_o; static double theta; static double m; static double n; static double R; static double sin_lat_o; static double cos_lat_o; static double false_easting; static double false_northing; int obleqforint( double r, double center_long, double center_lat, double shape_m, double shape_n, double angle, double false_east, double false_north) { /* Place parameters in static storage for common use -------------------------------------------------*/ R = r; lon_center = center_long; lat_o = center_lat; m = shape_m; n = shape_n; theta = angle; false_easting = false_east; false_northing = false_north; /* Report parameters to the user (to device set up prior to this call) -------------------------------------------------------------------*/ ptitle("OBLATED EQUAL-AREA"); radius(R); cenlon(lon_center); cenlat(lat_o); genrpt(m,"Parameter m: "); genrpt(n,"Parameter n: "); genrpt(theta,"Theta: "); offsetp(false_easting,false_northing); /* Calculate the sine and cosine of the latitude of the center of the map and store in static storage for common use. -------------------------------------------*/ tsincos(lat_o, &sin_lat_o, &cos_lat_o); return(OK); } int obleqfor( double lon, /* (I) Longitude */ double lat, /* (I) Latitude */ double *x, /* (O) X projection coordinate */ double *y) /* (O) Y projection coordinate */ { double delta_lon; double sin_delta_lon; double cos_delta_lon; double sin_lat; double cos_lat; double z; double Az; double sin_Az; double cos_Az; double temp; /* Re-used temporary variable */ double x_prime; double y_prime; double M; double N; /* Forward equations -----------------*/ delta_lon = lon - lon_center; tsincos(lat, &sin_lat, &cos_lat); tsincos(delta_lon, &sin_delta_lon, &cos_delta_lon); z = acos(sin_lat_o * sin_lat + cos_lat_o * cos_lat * cos_delta_lon); Az = atan2(cos_lat * sin_delta_lon , cos_lat_o * sin_lat - sin_lat_o * cos_lat * cos_delta_lon) + theta; tsincos(Az, &sin_Az, &cos_Az); temp = 2.0 * sin(z / 2.0); x_prime = temp * sin_Az; y_prime = temp * cos_Az; M = asin(x_prime / 2.0); temp = y_prime / 2.0 * cos(M) / cos(2.0 * M / m); N = asin(temp); *y = n * R * sin(2.0 * N / n) + false_easting; *x = m * R * sin(2.0 * M / m) * cos(N) / cos(2.0 * N / n) + false_northing; return(OK); } hdf-eos5-2.0/gctp/src/obleqinv.c000077500000000000000000000067421507520047200165120ustar00rootroot00000000000000/******************************************************************************* NAME OBLATED EQUAL-AREA PURPOSE: Transforms input Easting and Northing to longitude and latitude for the Oblated Equal Area projection. The Easting and Northing must be in meters. The longitude and latitude values will be returned in radians. PROGRAM HISTORY PROGRAMMER DATE REASON ---------- ---- ------ D. Steinwand May, 1991 S. Nelson Nov, 1993 Added "double adjust_lon()" function declaration statement. ALGORITHM REFERENCES 1. "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder, The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355. 2. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 3. "Software Documentation for GCTP General Cartographic Transformation Package", U.S. Geological Survey National Mapping Division, May 1982. *******************************************************************************/ #include #include "cproj.h" static double lon_center; static double lat_o; static double theta; static double m; static double n; static double R; static double sin_lat_o; static double cos_lat_o; static double false_easting; static double false_northing; int obleqinvint( double r, double center_long, double center_lat, double shape_m, double shape_n, double angle, double false_east, double false_north) { /* Place parameters in static storage for common use -------------------------------------------------*/ R = r; lon_center = center_long; lat_o = center_lat; m = shape_m; n = shape_n; theta = angle; false_easting = false_east; false_northing = false_north; /* Report parameters to the user (to device set up prior to this call) -------------------------------------------------------------------*/ ptitle("OBLATED EQUAL-AREA"); radius(R); cenlon(lon_center); cenlat(lat_o); genrpt(m,"Parameter m: "); genrpt(n,"Parameter n: "); genrpt(theta,"Theta: "); offsetp(false_easting,false_northing); /* Calculate the sine and cosine of the latitude of the center of the map and store in static storage for common use. -------------------------------------------*/ tsincos(lat_o, &sin_lat_o, &cos_lat_o); return(OK); } int obleqinv( double x, /* (I) X projection coordinate */ double y, /* (I) Y projection coordinate */ double *lon, /* (O) Longitude */ double *lat) /* (O) Latitude */ { double z; double sin_z; double cos_z; double Az; double temp; /* Re-used temporary variable */ double x_prime; double y_prime; double M; double N; double diff_angle; double sin_diff_angle; double cos_diff_angle; /* Inverse equations -----------------*/ x -= false_easting; y -= false_northing; N = (n / 2.0) * asin(y / (n * R)); temp = x / (m * R) * cos(2.0 * N / n) / cos(N); M = (m / 2.0) * asin(temp); x_prime = 2.0 * sin(M); y_prime = 2.0 * sin(N) * cos(2.0 * M / m) / cos(M); temp = sqrt(x_prime * x_prime + y_prime * y_prime) / 2.0; z = 2.0 * asin(temp); Az = atan2(x_prime, y_prime); diff_angle = Az - theta; tsincos(diff_angle, &sin_diff_angle, &cos_diff_angle); tsincos(z, &sin_z, &cos_z); *lat = asin(sin_lat_o * cos_z + cos_lat_o * sin_z * cos_diff_angle); *lon = adjust_lon(lon_center + atan2((sin_z * sin_diff_angle), (cos_lat_o * cos_z - sin_lat_o * sin_z * cos_diff_angle))); return(OK); } hdf-eos5-2.0/gctp/src/omerfor.c000077500000000000000000000165311507520047200163410ustar00rootroot00000000000000/******************************************************************************* NAME OBLIQUE MERCATOR (HOTINE) PURPOSE: Transforms input longitude and latitude to Easting and Northing for the Oblique Mercator projection. The longitude and latitude must be in radians. The Easting and Northing values will be returned in meters. PROGRAMMER DATE ---------- ---- T. Mittan Mar, 1993 ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double r_major; /* major axis */ static double r_minor; /* minor axis */ static double scale_factor; /* scale factor */ static double lon_origin; /* center longitude */ static double lat_origin; /* center latitude */ static double e,es; /* eccentricity constants */ static double false_northing; /* y offset in meters */ static double false_easting; /* x offset in meters */ static double sin_p20,cos_p20; /* sin and cos values */ static double bl; static double al; static double d; static double el,u; static double singam,cosgam; static double sinaz,cosaz; /* Initialize the Oblique Mercator projection ------------------------------------------*/ int omerforint( double r_maj, /* major axis */ double r_min, /* minor axis */ double scale_fact, /* scale factor */ double azimuth, /* azimuth east of north */ double lon_orig, /* longitude of origin */ double lat_orig, /* center latitude */ double false_east, /* x offset in meters */ double false_north, /* y offset in meters */ double lon1, /* fist point to define central line */ double lat1, /* fist point to define central line */ double lon2, /* second point to define central line */ double lat2, /* second point to define central line */ long mode) /* which format type A or B */ { double temp; /* temporary variable */ double con,com; double ts; double ts1,ts2; double h,l; double j,p,dlon; double f,g,gama; double sinphi; /* Place parameters in static storage for common use -------------------------------------------------*/ r_major = r_maj; r_minor = r_min; scale_factor = scale_fact; lat_origin = lat_orig; false_northing = false_north; false_easting = false_east; temp = r_minor / r_major; es = 1.0 - SQUARE(temp); e = sqrt(es); tsincos(lat_origin,&sin_p20,&cos_p20); con = 1.0 - es * sin_p20 * sin_p20; com = sqrt(1.0 - es); bl = sqrt(1.0 + es * pow(cos_p20,4.0)/(1.0 - es)); al = r_major * bl * scale_factor * com / con; if (fabs(lat_origin) < EPSLN) { ts = 1.0; d = 1.0; el = 1.0; } else { ts = tsfnz(e,lat_origin,sin_p20); con = sqrt(con); d = bl * com / (cos_p20 * con); if ((d * d - 1.0) > 0.0) { if (lat_origin >= 0.0) f = d + sqrt(d * d - 1.0); else f = d - sqrt(d * d - 1.0); } else f = d; el = f * pow(ts,bl); } /* Report parameters to the user that are the same for both formats ---------------------------------------------------------------*/ ptitle("OBLIQUE MERCATOR (HOTINE)"); radius2(r_major, r_minor); genrpt(scale_factor,"Scale Factor at C. Meridian: "); offsetp(false_easting,false_northing); if (mode != 0) { g = .5 * (f - 1.0/f); gama = asinz(sin(azimuth) / d); lon_origin = lon_orig - asinz(g * tan(gama))/bl; /* Report parameters common to format B -------------------------------------*/ genrpt(azimuth * R2D,"Azimuth of Central Line: "); cenlon(lon_origin); cenlat(lat_origin); con = fabs(lat_origin); if ((con > EPSLN) && (fabs(con - HALF_PI) > EPSLN)) { tsincos(gama,&singam,&cosgam); tsincos(azimuth,&sinaz,&cosaz); if (lat_origin >= 0) u = (al / bl) * atan(sqrt(d*d - 1.0)/cosaz); else u = -(al / bl) * atan(sqrt(d*d - 1.0)/cosaz); } else { p_error("Input data error","omer-init"); return(201); } } else { sinphi = sin(lat1); ts1 = tsfnz(e,lat1,sinphi); sinphi = sin(lat2); ts2 = tsfnz(e,lat2,sinphi); h = pow(ts1,bl); l = pow(ts2,bl); f = el/h; g = .5 * (f - 1.0/f); j = (el * el - l * h)/(el * el + l * h); p = (l - h) / (l + h); dlon = lon1 - lon2; if (dlon < -PI) lon2 = lon2 - 2.0 * PI; if (dlon > PI) lon2 = lon2 + 2.0 * PI; dlon = lon1 - lon2; lon_origin = .5 * (lon1 + lon2) - atan(j * tan(.5 * bl * dlon)/p)/bl; dlon = adjust_lon(lon1 - lon_origin); gama = atan(sin(bl * dlon)/g); azimuth = asinz(d * sin(gama)); /* Report parameters common to format A -------------------------------------*/ genrpt(lon1 * R2D,"Longitude of First Point: "); genrpt(lat1 * R2D,"Latitude of First Point: "); genrpt(lon2 * R2D,"Longitude of Second Point: "); genrpt(lat2 * R2D,"Latitude of Second Point: "); if (fabs(lat1 - lat2) <= EPSLN) { p_error("Input data error","omer-init"); return(202); } else con = fabs(lat1); if ((con <= EPSLN) || (fabs(con - HALF_PI) <= EPSLN)) { p_error("Input data error","omer-init"); return(202); } else if (fabs(fabs(lat_origin) - HALF_PI) <= EPSLN) { p_error("Input data error","omer-init"); return(202); } tsincos(gama,&singam,&cosgam); tsincos(azimuth,&sinaz,&cosaz); if (lat_origin >= 0) u = (al/bl) * atan(sqrt(d * d - 1.0)/cosaz); else u = -(al/bl) * atan(sqrt(d * d - 1.0)/cosaz); } return(OK); } /* Oblique Mercator forward equations--mapping lat,long to x,y ----------------------------------------------------------*/ int omerfor( double lon, /* (I) Longitude */ double lat, /* (I) Latitude */ double *x, /* (O) X projection coordinate */ double *y) /* (O) Y projection coordinate */ { double sin_phi; /* sin */ double t; /* temporary values */ double con; /* cone constant, small m */ double q,us,vl; double ul,vs; double s; double dlon; double ts1; /* Forward equations -----------------*/ sin_phi = sin(lat); dlon = adjust_lon(lon - lon_origin); vl = sin(bl * dlon); if (fabs(fabs(lat) - HALF_PI) > EPSLN) { ts1 = tsfnz(e,lat,sin_phi); q = el / (pow(ts1,bl)); s = .5 * (q - 1.0 / q); t = .5 * (q + 1.0/ q); ul = (s * singam - vl * cosgam) / t; con = cos(bl * dlon); if (fabs(con) < .0000001) { us = al * bl * dlon; } else { us = al * atan((s * cosgam + vl * singam) / con)/bl; if (con < 0) us = us + PI * al / bl; } } else { if (lat >= 0) ul = singam; else ul = -singam; us = al * lat / bl; } if (fabs(fabs(ul) - 1.0) <= EPSLN) { p_error("Point projects into infinity","omer-for"); return(205); } vs = .5 * al * log((1.0 - ul)/(1.0 + ul)) / bl; us = us - u; *x = false_easting + vs * cosaz + us * sinaz; *y = false_northing + us * cosaz - vs * sinaz; return(OK); } hdf-eos5-2.0/gctp/src/omerinv.c000077500000000000000000000161421507520047200163450ustar00rootroot00000000000000/******************************************************************************* NAME OBLIQUE MERCATOR (HOTINE) PURPOSE: Transforms input Easting and Northing to longitude and latitude for the Oblique Mercator projection. The Easting and Northing must be in meters. The longitude and latitude values will be returned in radians. PROGRAMMER DATE ---------- ---- T. Mittan Mar, 1993 ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double r_major; /* major axis */ static double r_minor; /* minor axis */ static double scale_factor; /* scale factor */ static double lon_origin; /* center longitude */ static double lat_origin; /* center latitude */ static double e,es; /* eccentricity constants */ static double false_northing; /* y offset in meters */ static double false_easting; /* x offset in meters */ static double sin_p20,cos_p20; /* sin and cos values */ static double bl; static double al; static double ts; static double d; static double el,u; static double singam,cosgam; static double sinaz,cosaz; /* Initialize the Oblique Mercator projection ------------------------------------------*/ int omerinvint( double r_maj, /* major axis */ double r_min, /* minor axis */ double scale_fact, /* scale factor */ double azimuth, /* azimuth east of north */ double lon_orig, /* longitude of origin */ double lat_orig, /* center latitude */ double false_east, /* x offset in meters */ double false_north, /* y offset in meters */ double lon1, /* fist point to define central line */ double lat1, /* fist point to define central line */ double lon2, /* second point to define central line */ double lat2, /* second point to define central line */ long mode) /* which format type A or B */ { double temp; /* temporary variable */ double con,com; double h,l,ts1,ts2; double j,p,dlon; double f,g,gama; double sinphi; /* Place parameters in static storage for common use -------------------------------------------------*/ r_major = r_maj; r_minor = r_min; scale_factor = scale_fact; lat_origin = lat_orig; false_northing = false_north; false_easting = false_east; temp = r_minor / r_major; es = 1.0 - SQUARE(temp); e = sqrt(es); tsincos(lat_origin,&sin_p20,&cos_p20); con = 1.0 - es * sin_p20 * sin_p20; com = sqrt(1.0 - es); bl = sqrt(1.0 + es * pow(cos_p20,4.0)/(1.0 - es)); al = r_major * bl * scale_factor * com / con; if (fabs(lat_origin) < EPSLN) { ts = 1.0; d = 1.0; el = 1.0; } else { ts = tsfnz(e,lat_origin,sin_p20); con = sqrt(con); d = bl * com / (cos_p20 * con); if ((d * d - 1.0) > 0.0) { if (lat_origin >= 0.0) f = d + sqrt(d * d - 1.0); else f = d - sqrt(d * d - 1.0); } else f = d; el = f * pow(ts,bl); } /* Report parameters to the user that are the same for both formats ---------------------------------------------------------------*/ ptitle("OBLIQUE MERCATOR (HOTINE)"); radius2(r_major, r_minor); genrpt(scale_factor,"Scale Factor at C. Meridian: "); offsetp(false_easting,false_northing); if (mode != 0) { g = .5 * (f - 1.0/f); gama = asinz(sin(azimuth) / d); lon_origin = lon_orig - asinz(g * tan(gama))/bl; /* Report parameters common to format B -------------------------------------*/ genrpt(azimuth * R2D,"Azimuth of Central Line: "); cenlon(lon_origin); cenlat(lat_origin); con = fabs(lat_origin); if ((con > EPSLN) && (fabs(con - HALF_PI) > EPSLN)) { tsincos(gama,&singam,&cosgam); tsincos(azimuth,&sinaz,&cosaz); if (lat_origin >= 0) u = (al / bl) * atan(sqrt(d*d - 1.0)/cosaz); else u = -(al / bl) * atan(sqrt(d*d - 1.0)/cosaz); } else { p_error("Input data error","omer-init"); return(201); } } else { sinphi = sin(lat1); ts1 = tsfnz(e,lat1,sinphi); sinphi = sin(lat2); ts2 = tsfnz(e,lat2,sinphi); h = pow(ts1,bl); l = pow(ts2,bl); f = el/h; g = .5 * (f - 1.0/f); j = (el * el - l * h)/(el * el + l * h); p = (l - h) / (l + h); dlon = lon1 - lon2; if (dlon < -PI) lon2 = lon2 - 2.0 * PI; if (dlon > PI) lon2 = lon2 + 2.0 * PI; dlon = lon1 - lon2; lon_origin = .5 * (lon1 + lon2) - atan(j * tan(.5 * bl * dlon)/p)/bl; dlon = adjust_lon(lon1 - lon_origin); gama = atan(sin(bl * dlon)/g); azimuth = asinz(d * sin(gama)); /* Report parameters common to format A -------------------------------------*/ genrpt(lon1 * R2D,"Longitude of First Point: "); genrpt(lat1 * R2D,"Latitude of First Point: "); genrpt(lon2 * R2D,"Longitude of Second Point: "); genrpt(lat2 * R2D,"Latitude of Second Point: "); if (fabs(lat1 - lat2) <= EPSLN) { p_error("Input data error","omer-init"); return(202); } else con = fabs(lat1); if ((con <= EPSLN) || (fabs(con - HALF_PI) <= EPSLN)) { p_error("Input data error","omer-init"); return(202); } else if (fabs(fabs(lat_origin) - HALF_PI) <= EPSLN) { p_error("Input data error","omer-init"); return(202); } tsincos(gama,&singam,&cosgam); tsincos(azimuth,&sinaz,&cosaz); if (lat_origin >= 0) u = (al/bl) * atan(sqrt(d * d - 1.0)/cosaz); else u = -(al/bl) * atan(sqrt(d * d - 1.0)/cosaz); } return(OK); } /* Oblique Mercator inverse equations--mapping x,y to lat/long ----------------------------------------------------------*/ int omerinv( double x, /* (O) X projection coordinate */ double y, /* (O) Y projection coordinate */ double *lon, /* (I) Longitude */ double *lat) /* (I) Latitude */ { double theta; /* angle */ double t; /* temporary values */ double con; /* cone constant, small m */ double vs,us,q,s,ts1; double vl,ul; long flag; /* Inverse equations -----------------*/ x -= false_easting; y -= false_northing; flag = 0; vs = x * cosaz - y * sinaz; us = y * cosaz + x * sinaz; us = us + u; q = exp(-bl * vs / al); s = .5 * (q - 1.0/q); t = .5 * (q + 1.0/q); vl = sin(bl * us / al); ul = (vl * cosgam + s * singam)/t; if (fabs(fabs(ul) - 1.0) <= EPSLN) { *lon = lon_origin; if (ul >= 0.0) *lat = HALF_PI; else *lat = -HALF_PI; } else { con = 1.0 / bl; ts1 = pow((el / sqrt((1.0 + ul) / (1.0 - ul))),con); *lat = phi2z(e,ts1,&flag); if (flag != 0) return(flag); con = cos(bl * us /al); theta = lon_origin - atan2((s * cosgam - vl * singam) , con)/bl; *lon = adjust_lon(theta); } return(OK); } hdf-eos5-2.0/gctp/src/orthfor.c000077500000000000000000000062531507520047200163530ustar00rootroot00000000000000/******************************************************************************* NAME ORTHOGRAPHIC PURPOSE: Transforms input longitude and latitude to Easting and Northing for the Orthographic projection. The longitude and latitude must be in radians. The Easting and Northing values will be returned in meters. PROGRAMMER DATE ---------- ---- T. Mittan Mar, 1993 ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double r_major; /* major axis */ static double lon_center; /* Center longitude (projection center) */ static double lat_origin; /* center latitude */ static double false_northing; /* y offset in meters */ static double false_easting; /* x offset in meters */ static double sin_p14; /* sin of center latitude */ static double cos_p14; /* cos of center latitude */ /* Initialize the Orthographic projection -------------------------------------*/ int orthforint( double r_maj, /* major axis */ double center_lon, /* center longitude */ double center_lat, /* center latitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { /* Place parameters in static storage for common use -------------------------------------------------*/ r_major = r_maj; lon_center = center_lon; lat_origin = center_lat; false_northing = false_north; false_easting = false_east; tsincos(center_lat,&sin_p14,&cos_p14); /* Report parameters to the user -----------------------------*/ ptitle("ORTHOGRAPHIC"); radius(r_major); cenlonmer(lon_center); origin(lat_origin); offsetp(false_easting,false_northing); return(OK); } /* Orthographic forward equations--mapping lat,long to x,y ---------------------------------------------------*/ int orthfor( double lon, /* (I) Longitude */ double lat, /* (I) Latitude */ double *x, /* (O) X projection coordinate */ double *y) /* (O) Y projection coordinate */ { double sinphi, cosphi; /* sin and cos value */ double dlon; /* delta longitude value */ double coslon; /* cos of longitude */ double ksp; /* scale factor */ double g; /* Forward equations -----------------*/ dlon = adjust_lon(lon - lon_center); tsincos(lat,&sinphi,&cosphi); coslon = cos(dlon); g = sin_p14 * sinphi + cos_p14 * cosphi * coslon; ksp = 1.0; if ((g > 0) || (fabs(g) <= EPSLN)) { *x = false_easting + r_major * ksp * cosphi * sin(dlon); *y = false_northing + r_major * ksp * (cos_p14 * sinphi - sin_p14 * cosphi * coslon); } else { p_error("Point can not be projected","orth-for"); return(143); } return(OK); } hdf-eos5-2.0/gctp/src/orthinv.c000077500000000000000000000067461507520047200163700ustar00rootroot00000000000000/******************************************************************************* NAME ORTHOGRAPHIC PURPOSE: Transforms input Easting and Northing to longitude and latitude for the Orthographic projection. The Easting and Northing must be in meters. The longitude and latitude values will be returned in radians. PROGRAMMER DATE ---------- ---- T. Mittan Mar, 1993 ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double r_major; /* major axis */ static double lon_center; /* Center longitude (projection center) */ static double lat_origin; /* center latitude */ static double false_northing; /* y offset in meters */ static double false_easting; /* x offset in meters */ static double sin_p14; /* sin of center latitude */ static double cos_p14; /* cos of center latitude */ /* Initialize the Orthographic projection -------------------------------------*/ int orthinvint( double r_maj, /* major axis */ double center_lon, /* center longitude */ double center_lat, /* center latitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { /* Place parameters in static storage for common use -------------------------------------------------*/ r_major = r_maj; lon_center = center_lon; lat_origin = center_lat; false_northing = false_north; false_easting = false_east; tsincos(center_lat,&sin_p14,&cos_p14); /* Report parameters to the user -----------------------------*/ ptitle("ORTHOGRAPHIC"); radius(r_major); cenlonmer(lon_center); origin(lat_origin); offsetp(false_easting,false_northing); return(OK); } /* Orthographic inverse equations--mapping x,y to lat/long ------------------------------------------------------*/ int orthinv( double x, /* (O) X projection coordinate */ double y, /* (O) Y projection coordinate */ double *lon, /* (I) Longitude */ double *lat) /* (I) Latitude */ { double rh; /* height above ellipsoid */ double z; /* angle */ double sinz,cosz; /* sin of z and cos of z */ double con; /* Inverse equations -----------------*/ x -= false_easting; y -= false_northing; rh = sqrt(x * x + y * y); if (rh > r_major + .0000001) { p_error("Input data error","orth-inv"); return(145); } z = asinz(rh / r_major); tsincos(z,&sinz,&cosz); *lon = lon_center; if (fabs(rh) <= EPSLN) { *lat = lat_origin; return(OK); } *lat = asinz(cosz * sin_p14 + (y * sinz * cos_p14)/rh); con = fabs(lat_origin) - HALF_PI; if (fabs(con) <= EPSLN) { if (lat_origin >= 0) { *lon = adjust_lon(lon_center + atan2(x, -y)); return(OK); } else { *lon = adjust_lon(lon_center - atan2(-x, y)); return(OK); } } con = cosz - sin_p14 * sin(*lat); if ((fabs(con) >= EPSLN) || (fabs(x) >= EPSLN)) *lon = adjust_lon(lon_center + atan2((x * sinz * cos_p14), (con * rh))); return(OK); } hdf-eos5-2.0/gctp/src/paksz.c000077500000000000000000000052121507520047200160120ustar00rootroot00000000000000/******************************************************************************* NAME PAKSZ PURPOSE: This function converts a packed DMS angle to seconds. The standard packed DMS format is: degrees * 1000000 + minutes * 1000 + seconds Example: ang = 120025045.25 yields deg = 120 min = 25 sec = 45.25 The algorithm used for the conversion is as follows: 1. The absolute value of the angle is used. 2. The degrees are separated out: deg = ang/1000000 (fractional portion truncated) 3. The minutes are separated out: min = (ang - deg * 1000000) / 1000 (fractional portion truncated) 4. The seconds are then computed: sec = ang - deg * 1000000 - min * 1000 5. The total angle in seconds is computed: sec = deg * 3600.0 + min * 60.0 + sec 6. The sign of sec is set to that of the input angle. PROGRAMMER DATE ---------- ---- T. Mittan MARCH, 1993 ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Proffesional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. *******************************************************************************/ #include #include #include "cproj.h" /* Convert DMS packed angle into deg ----------------------------------*/ double paksz( double ang, /* angle which in DMS */ long *iflg) /* error flag number */ { double fac; /* sign flag */ double deg; /* degree variable */ double min; /* minute variable */ double sec; /* seconds variable */ double tmp; /* temporary variable */ long i; /* temporary variable */ *iflg = (long)0; if (ang < 0.0) fac = -1; else fac = 1; /* find degrees -------------*/ sec = fabs(ang); tmp = 1000000.0; i = (long) (sec/tmp); if ((int)i > 360) { p_error("Illegal DMS field","paksz-deg"); *iflg = (long)1116; return(ERROR); } else deg = i; /* find minutes -------------*/ sec = sec - deg * tmp; tmp = 1000; i = (long) (sec / tmp); if ((int)i > 60) { p_error("Illegal DMS field","paksz-min"); *iflg = (long)1116; return(ERROR); } else min = i; /* find seconds -------------*/ sec = sec - min * tmp; if (sec > 60) { p_error("Illegal DMS field","paksz-sec"); *iflg = (long)1116; return(ERROR); } else sec = fac * (deg * 3600.0 + min * 60.0 + sec); deg = sec / 3600.0; return(deg); } hdf-eos5-2.0/gctp/src/polyfor.c000077500000000000000000000066311507520047200163620ustar00rootroot00000000000000/******************************************************************************* NAME POLYCONIC PURPOSE: Transforms input longitude and latitude to Easting and Northing for the Polyconic projection. The longitude and latitude must be in radians. The Easting and Northing values will be returned in meters. PROGRAMMER DATE ---------- ---- T. Mittan Mar, 1993 ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double r_major; /* major axis */ static double r_minor; /* minor axis */ static double lon_center; /* Center longitude (projection center) */ static double lat_origin; /* center latitude */ static double e0,e1,e2,e3; /* eccentricity constants */ static double e,es; /* eccentricity constants */ static double ml0; /* small value m */ static double false_northing; /* y offset in meters */ static double false_easting; /* x offset in meters */ /* Initialize the POLYCONIC projection ----------------------------------*/ int polyforint( double r_maj, /* major axis */ double r_min, /* minor axis */ double center_lon, /* center longitude */ double center_lat, /* center latitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { double temp; /* temporary variable */ /* Place parameters in static storage for common use -------------------------------------------------*/ r_major = r_maj; r_minor = r_min; lon_center = center_lon; lat_origin = center_lat; false_northing = false_north; false_easting = false_east; temp = r_minor / r_major; es = 1.0 - SQUARE(temp); e = sqrt(es); e0 = e0fn(es); e1 = e1fn(es); e2 = e2fn(es); e3 = e3fn(es); ml0 = mlfn(e0, e1, e2, e3, lat_origin); /* Report parameters to the user -----------------------------*/ ptitle("POLYCONIC"); radius2(r_major, r_minor); cenlonmer(lon_center); origin(lat_origin); offsetp(false_easting,false_northing); return(OK); } /* Polyconic forward equations--mapping lat,long to x,y ---------------------------------------------------*/ int polyfor( double lon, /* (I) Longitude */ double lat, /* (I) Latitude */ double *x, /* (O) X projection coordinate */ double *y) /* (O) Y projection coordinate */ { double sinphi, cosphi; /* sin and cos value */ double con, ml; /* cone constant, small m */ double ms; /* small m */ /* Forward equations -----------------*/ con = adjust_lon(lon - lon_center); if (fabs(lat) <= .0000001) { *x = false_easting + r_major * con; *y = false_northing - r_major * ml0; } else { tsincos(lat,&sinphi,&cosphi); ml = mlfn(e0, e1, e2, e3, lat); ms = msfnz(e,sinphi,cosphi); con *= sinphi; *x = false_easting + r_major * ms * sin(con)/sinphi; *y = false_northing + r_major * (ml - ml0 + ms * (1.0 - cos(con))/sinphi); } return(OK); } hdf-eos5-2.0/gctp/src/polyinv.c000077500000000000000000000065601507520047200163710ustar00rootroot00000000000000/******************************************************************************* NAME POLYCONIC PURPOSE: Transforms input Easting and Northing to longitude and latitude for the Polyconic projection. The Easting and Northing must be in meters. The longitude and latitude values will be returned in radians. PROGRAMMER DATE ---------- ---- T. Mittan Mar, 1993 ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double r_major; /* major axis */ static double r_minor; /* minor axis */ static double lon_center; /* Center longitude (projection center) */ static double lat_origin; /* center latitude */ static double e0,e1,e2,e3; /* eccentricity constants */ static double es; /* eccentricity constants */ static double ml0; /* small value m */ static double false_northing; /* y offset in meters */ static double false_easting; /* x offset in meters */ /* Initialize the POLYCONIC projection ----------------------------------*/ int polyinvint( double r_maj, /* major axis */ double r_min, /* minor axis */ double center_lon, /* center longitude */ double center_lat, /* center latitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { double temp; /* temporary variable */ /* Place parameters in static storage for common use -------------------------------------------------*/ r_major = r_maj; r_minor = r_min; lon_center = center_lon; lat_origin = center_lat; false_northing = false_north; false_easting = false_east; temp = r_minor / r_major; es = 1.0 - SQUARE(temp); e0 = e0fn(es); e1 = e1fn(es); e2 = e2fn(es); e3 = e3fn(es); ml0 = mlfn(e0, e1, e2, e3, lat_origin); /* Report parameters to the user -----------------------------*/ ptitle("POLYCONIC"); radius2(r_major, r_minor); cenlonmer(lon_center); origin(lat_origin); offsetp(false_easting,false_northing); return(OK); } /* Polyconic inverse equations--mapping x,y to lat/long ---------------------------------------------------*/ int polyinv( double x, /* (O) X projection coordinate */ double y, /* (O) Y projection coordinate */ double *lon, /* (I) Longitude */ double *lat) /* (I) Latitude */ { double al; /* temporary values */ double b; /* temporary values */ double c; /* temporary values */ long iflg; /* error flag */ /* Inverse equations -----------------*/ x -= false_easting; y -= false_northing; al = ml0 + y/r_major; iflg = 0; if (fabs(al) <= .0000001) { *lon = x/r_major + lon_center; *lat = 0.0; } else { b = al * al + (x/r_major) * (x/r_major); iflg = (long) phi4z(es,e0,e1,e2,e3,al,b,&c,lat); if (iflg != 0) return(74); *lon = adjust_lon((asinz(x * c / r_major) / sin(*lat)) + lon_center); } return(OK); } hdf-eos5-2.0/gctp/src/psfor.c000077500000000000000000000072051507520047200160170ustar00rootroot00000000000000/******************************************************************************* NAME POLAR STEREOGRAPHIC PURPOSE: Transforms input longitude and latitude to Easting and Northing for the Polar Stereographic projection. The longitude and latitude must be in radians. The Easting and Northing values will be returned in meters. PROGRAMMER DATE ---------- ---- T. Mittan 2-26-93 ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double r_major; /* major axis */ static double r_minor; /* minor axis */ static double es; /* eccentricity squared */ static double e; /* eccentricity */ static double e4; /* e4 calculated from eccentricity*/ static double center_lon; /* center longitude */ static double center_lat; /* center latitude */ static double fac; /* sign variable */ static double ind; /* flag variable */ static double mcs; /* small m */ static double tcs; /* small t */ static double false_northing; /* y offset in meters */ static double false_easting; /* x offset in meters */ /* Initialize the Polar Stereographic projection --------------------------------------------*/ int psforint( double r_maj, /* major axis */ double r_min, /* minor axis */ double c_lon, /* center longitude */ double c_lat, /* center latitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { double temp; /* temporary variable */ double con1; /* temporary angle */ double sinphi; /* sin value */ double cosphi; /* cos value */ r_major = r_maj; r_minor = r_min; false_northing = false_north; false_easting = false_east; temp = r_minor / r_major; es = 1.0 - SQUARE(temp); e = sqrt(es); e4 = e4fn(e); center_lon = c_lon; center_lat = c_lat; if (c_lat < 0) fac = -1.0; else fac = 1.0; ind = 0; if (fabs(fabs(c_lat) - HALF_PI) > EPSLN) { ind = 1; con1 = fac * center_lat; tsincos(con1,&sinphi,&cosphi); mcs = msfnz(e,sinphi,cosphi); tcs = tsfnz(e,con1,sinphi); } /* Report parameters to the user -----------------------------*/ ptitle("POLAR STEREOGRAPHIC"); radius2(r_major, r_minor); cenlon(center_lon); offsetp(false_east,false_north); return(OK); } /* Polar Stereographic forward equations--mapping lat,long to x,y --------------------------------------------------------------*/ int psfor( double lon, /* (I) Longitude */ double lat, /* (I) Latitude */ double *x, /* (O) X projection coordinate */ double *y) /* (O) Y projection coordinate */ { double con1; /* adjusted longitude */ double con2; /* adjusted latitude */ double rh; /* height above ellipsoid */ double sinphi; /* sin value */ double ts; /* value of small t */ con1 = fac * adjust_lon(lon - center_lon); con2 = fac * lat; sinphi = sin(con2); ts = tsfnz(e,con2,sinphi); if (ind != 0) rh = r_major * mcs * ts / tcs; else rh = 2.0 * r_major * ts / e4; *x = fac * rh * sin(con1) + false_easting; *y = -fac * rh * cos(con1) + false_northing;; return(OK); } hdf-eos5-2.0/gctp/src/psinv.c000077500000000000000000000076471507520047200160370ustar00rootroot00000000000000/******************************************************************************* NAME POLAR STEREOGRAPHIC PURPOSE: Transforms input Easting and Northing to longitude and latitude for the Polar Stereographic projection. The Easting and Northing must be in meters. The longitude and latitude values will be returned in radians. PROGRAMMER DATE ---------- ---- T. Mittan 2-26-93 ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double r_major; /* major axis */ static double r_minor; /* minor axis */ static double e; /* eccentricity */ static double e4; /* e4 calculated from eccentricity*/ static double center_lon; /* center longitude */ static double center_lat; /* center latitude */ static double fac; /* sign variable */ static double ind; /* flag variable */ static double mcs; /* small value m */ static double tcs; /* small value t */ static double false_northing; /* y offset in meters */ static double false_easting; /* x offset in meters */ /* Initialize the Polar Stereographic projection --------------------------------------------*/ int psinvint( double r_maj, /* major axis */ double r_min, /* minor axis */ double c_lon, /* center longitude */ double c_lat, /* center latitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { double temp; /* temporary variable */ double con1; /* temporary angle */ double sinphi; /* sin value */ double cosphi; /* cos value */ double es; /* eccentricity squared */ r_major = r_maj; r_minor = r_min; false_easting = false_east; false_northing = false_north; temp = r_minor / r_major; es = 1.0 - SQUARE(temp); e = sqrt(es); e4 = e4fn(e); center_lon = c_lon; center_lat = c_lat; if (c_lat < 0) fac = -1.0; else fac = 1.0; ind = 0; if (fabs(fabs(c_lat) - HALF_PI) > EPSLN) { ind = 1; con1 = fac * center_lat; tsincos(con1,&sinphi,&cosphi); mcs = msfnz(e,sinphi,cosphi); tcs = tsfnz(e,con1,sinphi); } /* Report parameters to the user -----------------------------*/ ptitle("POLAR STEREOGRAPHIC"); radius2(r_major, r_minor); cenlon(center_lon); offsetp(false_east,false_north); return(OK); } /* Polar Stereographic inverse equations--mapping x,y to lat/long --------------------------------------------------------------*/ int psinv( double x, /* (O) X projection coordinate */ double y, /* (O) Y projection coordinate */ double *lon, /* (I) Longitude */ double *lat) /* (I) Latitude */ { double rh; /* height above ellipsiod */ double ts; /* small value t */ double temp; /* temporary variable */ long flag; /* error flag */ flag = 0; x = (x - false_easting) * fac; y = (y - false_northing) *fac; rh = sqrt(x * x + y * y); if (ind != 0) ts = rh * tcs/(r_major * mcs); else ts = rh * e4 / (r_major * 2.0); *lat = fac * phi2z(e,ts,&flag); if (flag != 0) return(flag); if (rh == 0) *lon = fac * center_lon; else { temp = atan2(x, -y); *lon = adjust_lon(fac *temp + center_lon); } return(OK); } hdf-eos5-2.0/gctp/src/report.c000077500000000000000000000223441507520047200162020ustar00rootroot00000000000000/******************************************************************************* NAME Projection support routines listed below PURPOSE: The following functions are included in REPORT.C INIT: Initializes the output device for error messages and report headings. P_ERROR: Reports errors to the terminal, a specified file, or both. PTITLE, RADIUS, RADIUS2, CENLON, CENLONMER, CENLAT, ORIGIN, STANPARL, STPARL1, OFFSET, GENRPT, GENRPT_LONG, PBLANK: Reports projection parameters to the terminal, specified file, or both. PROGRAMMER DATE REASON ---------- ---- ------ D. Steinwand, EROS July, 1991 Initial development. T. Mittan Mar, 1993 Adapted code to new "C" version of GCTP library. S. Nelson Jun, 1993 Added inline code. Added error messages if no filename was specified. Carol S. W. Tsai Sep, 1997 Added code for p_errort, a function to report error, to generate the status meassages that is relative to the message file created for PGS GCT tools if it is PGS_TOOLKIT_COMPILE *******************************************************************************/ #ifdef PGS_TOOLKIT_COMPILE /* only TOOLKIT compilation */ #include #include #endif /* only TOOLKIT compilation */ #include #include #include "cproj.h" #define TRUE 1 #ifndef FALSE #define FALSE 0 #endif static long terminal_p; /* flag for printing parameters to terminal */ static long terminal_e; /* flag for printing errors to terminal */ static long file_e; /* flag for printing errors to terminal */ static long file_p; /* flag for printing parameters to file */ static FILE *fptr_p=NULL; static FILE *fptr_e=NULL; static char parm_file[256]; static char err_file[256]; /* Function to report errors -------------------------*/ void p_error( char *what, char *where) { #ifdef PGS_TOOLKIT_COMPILE PGSt_SMF_status returnStatus = PGSGCT_E_GCTP_ERROR; if(strcmp(what, "Too many iterations in inverse") == 0) returnStatus = PGSGCT_E_ITER_EXCEEDED; else if(strncmp(what, "Point projects into a circle of radius", strlen("Point projects into a circle of radius")) == 0) returnStatus = PGSGCT_E_POINT_PROJECT; else if(strcmp(what, "Input data error") == 0) returnStatus = PGSGCT_E_INPUT_DATA_ERROR; else if(strcmp(what, "Point projects into infinity") == 0) returnStatus = PGSGCT_E_INFINITE; else if(strcmp(what, "Iteration failed to converge") == 0) returnStatus = PGSGCT_E_ITER_FAILED; else if(strcmp(what, "Point can not be projected") == 0) returnStatus = PGSGCT_E_PROJECT_FAILED; else if(strcmp(what, "Point cannot be projected") == 0) returnStatus = PGSGCT_E_PROJECT_FAILED; else if(strcmp(what, "Transformation cannot be computed at the poles") == 0) returnStatus = PGSGCT_E_POINTS_ON_POLES; else if(strcmp(what, "50 iterations without conv") == 0) returnStatus = PGSGCT_E_ITER_SOM; else if(strcmp(what, "50 iterations without convergence") == 0) returnStatus = PGSGCT_E_ITER_SOM; PGS_SMF_SetDynamicMsg(returnStatus,what,where); #else if (terminal_e) printf("[%s] %s\n",where,what); if (file_e) { fptr_e = (FILE *)fopen(err_file,"a"); fprintf(fptr_e,"[%s] %s\n",where,what); fclose(fptr_e); fptr_e = NULL; } #endif } /* initialize output device -------------------------*/ int init( long ipr, /* flag for printing errors (0,1,or 2) */ long jpr, /* flag for printing parameters (0,1,or 2) */ char *efile, /* name of error file */ char *pfile) /* name of parameter file */ { if (ipr == 0) { terminal_e = TRUE; file_e = FALSE; } else if (ipr == 1) { terminal_e = FALSE; if (strlen(efile) == 0) { return(6); } file_e = TRUE; strcpy(err_file,efile); } else if (ipr == 2) { terminal_e = TRUE; if (strlen(efile) == 0) { file_e = FALSE; p_error("Output file name not specified","report-file"); return(6); } file_e = TRUE; strcpy(err_file,efile); } else { terminal_e = FALSE; file_e = FALSE; } if (jpr == 0) { terminal_p = TRUE; file_p = FALSE; } else if (jpr == 1) { terminal_p = FALSE; if (strlen(pfile) == 0) { return(6); } file_p = TRUE; strcpy(parm_file,pfile); } else if (jpr == 2) { terminal_p = TRUE; if (strlen(pfile) == 0) { file_p = FALSE; p_error("Output file name not specified","report-file"); return(6); } file_p = TRUE; strcpy(parm_file,pfile); } else { terminal_p = FALSE; file_p = FALSE; } return(0); } void close_file() { if (fptr_e != NULL) { fclose(fptr_e); fptr_e = NULL; } if (fptr_p != NULL) { fclose(fptr_p); fptr_p = NULL; } } /* Functions to report projection parameters -----------------------------------------*/ void ptitle(char *A) { if (terminal_p) printf("\n%s PROJECTION PARAMETERS:\n\n",A); if (file_p) { fptr_p = (FILE *)fopen(parm_file,"a"); fprintf(fptr_p,"\n%s PROJECTION PARAMETERS:\n\n",A); fclose(fptr_p); } } void radius(double A) { if (terminal_p) printf(" Radius of Sphere: %lf meters\n",A); if (file_p) { fptr_p = (FILE *)fopen(parm_file,"a"); fprintf(fptr_p," Radius of Sphere: %lf meters\n",A); fclose(fptr_p); } } void radius2(double A, double B) { if (terminal_p) { printf(" Semi-Major Axis of Ellipsoid: %lf meters\n",A); printf(" Semi-Minor Axis of Ellipsoid: %lf meters\n",B); } if (file_p) { fptr_p = (FILE *)fopen(parm_file,"a"); fprintf(fptr_p," Semi-Major Axis of Ellipsoid: %lf meters\n",A); fprintf(fptr_p," Semi-Minor Axis of Ellipsoid: %lf meters\n",B); fclose(fptr_p); } } void cenlon(double A) { if (terminal_p) printf(" Longitude of Center: %lf degrees\n",A*R2D); if (file_p) { fptr_p = (FILE *)fopen(parm_file,"a"); fprintf(fptr_p," Longitude of Center: %lf degrees\n",A*R2D); fclose(fptr_p); } } void cenlonmer(double A) { if (terminal_p) printf(" Longitude of Central Meridian: %lf degrees\n",A*R2D); if (file_p) { fptr_p = (FILE *)fopen(parm_file,"a"); fprintf(fptr_p," Longitude of Central Meridian: %lf degrees\n",A*R2D); fclose(fptr_p); } } void cenlat(double A) { if (terminal_p) printf(" Latitude of Center: %lf degrees\n",A*R2D); if (file_p) { fptr_p = (FILE *)fopen(parm_file,"a"); fprintf(fptr_p," Latitude of Center: %lf degrees\n",A*R2D); fclose(fptr_p); } } void origin(double A) { if (terminal_p) printf(" Latitude of Origin: %lf degrees\n",A*R2D); if (file_p) { fptr_p = (FILE *)fopen(parm_file,"a"); fprintf(fptr_p," Latitude of Origin: %lf degrees\n",A*R2D); fclose(fptr_p); } } void true_scale(double A) { if (terminal_p) printf(" Latitude of True Scale: %lf degrees\n",A*R2D); if (file_p) { fptr_p = (FILE *)fopen(parm_file,"a"); fprintf(fptr_p," Latitude of True Scale: %lf degrees\n",A*R2D); fclose(fptr_p); } return; } void stanparl(double A, double B) { if (terminal_p) { printf(" 1st Standard Parallel: %lf degrees\n",A*R2D); printf(" 2nd Standard Parallel: %lf degrees\n",B*R2D); } if (file_p) { fptr_p = (FILE *)fopen(parm_file,"a"); fprintf(fptr_p," 1st Standard Parallel: %lf degrees\n",A*R2D); fprintf(fptr_p," 2nd Standard Parallel: %lf degrees\n",B*R2D); fclose(fptr_p); } } void stparl1(double A) { if (terminal_p) { printf(" Standard Parallel: %lf degrees\n",A*R2D); } if (file_p) { fptr_p = (FILE *)fopen(parm_file,"a"); fprintf(fptr_p," Standard Parallel: %lf degrees\n",A*R2D); fclose(fptr_p); } } void offsetp(double A, double B) { if (terminal_p) { printf(" False Easting: %lf meters \n",A); printf(" False Northing: %lf meters \n",B); } if (file_p) { fptr_p = (FILE *)fopen(parm_file,"a"); fprintf(fptr_p," False Easting: %lf meters \n",A); fprintf(fptr_p," False Northing: %lf meters \n",B); fclose(fptr_p); } } void genrpt(double A, char *S) { if (terminal_p) printf(" %s %lf\n", S, A); if (file_p) { fptr_p = (FILE *)fopen(parm_file,"a"); fprintf(fptr_p," %s %lf\n", S, A); fclose(fptr_p); } } void genrpt_long(long A, char *S) { if (terminal_p) printf(" %s %ld\n", S, A); if (file_p) { fptr_p = (FILE *)fopen(parm_file,"a"); fprintf(fptr_p," %s %ld\n", S, A); fclose(fptr_p); } } void pblank() { if (terminal_p) printf("\n"); if (file_p) { fptr_p = (FILE *)fopen(parm_file,"a"); fprintf(fptr_p,"\n"); fclose(fptr_p); } } hdf-eos5-2.0/gctp/src/robfor.c000077500000000000000000000110351507520047200161530ustar00rootroot00000000000000/******************************************************************************* NAME ROBINSON PURPOSE: Transforms input longitude and latitude to Easting and Northing for the Robinson projection. The longitude and latitude must be in radians. The Easting and Northing values will be returned in meters. PROGRAMMER DATE ---------- ---- T. Mittan March, 1993 This function was adapted from the Lambert Azimuthal Equal Area projection code (FORTRAN) in the General Cartographic Transformation Package software which is available from the U.S. Geological Survey National Mapping Division. ALGORITHM REFERENCES 1. "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder, The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355. 2. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 3. "Software Documentation for GCTP General Cartographic Transformation Package", U.S. Geological Survey National Mapping Division, May 1982. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double lon_center; /* Center longitude (projection center) */ static double R; /* Radius of the earth (sphere) */ static double false_easting; /* x offset in meters */ static double false_northing; /* y offset in meters */ static double pr[21]; static double xlr[21]; /* Initialize the ROBINSON projection ---------------------------------*/ int robforint( double r, /* (I) Radius of the earth (sphere) */ double center_long, /* (I) Center longitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { long i; /* Place parameters in static storage for common use -------------------------------------------------*/ R = r; lon_center = center_long; false_easting = false_east; false_northing = false_north; pr[1]= -0.062; xlr[1]=0.9986; pr[2]=0.0; xlr[2]=1.0; pr[3]=0.062; xlr[3]=0.9986; pr[4]=0.124; xlr[4]=0.9954; pr[5]=0.186; xlr[5]=0.99; pr[6]=0.248; xlr[6]=0.9822; pr[7]=0.31; xlr[7]=0.973; pr[8]=0.372; xlr[8]=0.96; pr[9]=0.434; xlr[9]=0.9427; pr[10]=0.4958; xlr[10]=0.9216; pr[11]=0.5571; xlr[11]=0.8962; pr[12]=0.6176; xlr[12]=0.8679; pr[13]=0.6769; xlr[13]=0.835; pr[14]=0.7346; xlr[14]=0.7986; pr[15]=0.7903; xlr[15]=0.7597; pr[16]=0.8435; xlr[16]=0.7186; pr[17]=0.8936; xlr[17]=0.6732; pr[18]=0.9394; xlr[18]=0.6213; pr[19]=0.9761; xlr[19]=0.5722; pr[20]=1.0; xlr[20]=0.5322; for (i = 0; i < 21; i++) xlr[i] *= 0.9858; /* Report parameters to the user -----------------------------*/ ptitle("ROBINSON"); radius(r); cenlon(center_long); offsetp(false_easting,false_northing); return(OK); } /* Robinson forward equations--mapping lat,long to x,y ------------------------------------------------------------*/ int robfor( double lon, /* (I) Longitude */ double lat, /* (I) Latitude */ double *x, /* (O) X projection coordinate */ double *y) /* (O) Y projection coordinate */ { double dlon; double p2; long ip1; /* Forward equations -----------------*/ dlon = adjust_lon(lon - lon_center); p2 = fabs(lat / 5.0 / .01745329252); ip1 = (long) (p2 - EPSLN); /* Stirling's interpolation formula (using 2nd Diff.) ---------------------------------------------------*/ p2 -= (double) ip1; *x = R * (xlr[ip1 + 2] + p2 * (xlr[ip1 + 3] - xlr[ip1 + 1]) / 2.0 + p2 * p2 * (xlr[ip1 + 3] - 2.0 * xlr[ip1 + 2] + xlr[ip1 + 1])/2.0) * dlon + false_easting; if (lat >= 0) *y = R * (pr[ip1 + 2] + p2 * (pr[ip1 + 3] - pr[ip1 +1]) / 2.0 + p2 * p2 * (pr[ip1 + 3] - 2.0 * pr[ip1 + 2] + pr[ip1 + 1]) / 2.0) * PI / 2.0 + false_northing; else *y = -R * (pr[ip1 + 2] + p2 * (pr[ip1 + 3] - pr[ip1 +1]) / 2.0 + p2 * p2 * (pr[ip1 + 3] - 2.0 * pr[ip1 + 2] + pr[ip1 + 1]) / 2.0) * PI / 2.0 + false_northing; return(OK); } hdf-eos5-2.0/gctp/src/robinv.c000077500000000000000000000142741507520047200161710ustar00rootroot00000000000000/******************************************************************************* NAME ROBINSON PURPOSE: Transforms input Easting and Northing to longitude and latitude for the Robinson projection. The Easting and Northing must be in meters. The longitude and latitude values will be returned in radians. PROGRAMMER DATE REASON ---------- ---- ------ T. Mittan March, 1993 Converted from FORTRAN to C. S. Nelson Nov, 1993 Changed number of iterations from 20 to 75. This seemed to give a valid Latitude with less fatal errors. This function was adapted from the Robinson projection code (FORTRAN) in the General Cartographic Transformation Package software which is available from the U.S. Geological Survey National Mapping Division. ALGORITHM REFERENCES 1. "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder, The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355. 2. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 3. "Software Documentation for GCTP General Cartographic Transformation Package", U.S. Geological Survey National Mapping Division, May 1982. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double lon_center; /* Center longitude (projection center) */ static double R; /* Radius of the earth (sphere) */ static double false_easting; /* x offset in meters */ static double false_northing; /* y offset in meters */ static double pr[21]; static double xlr[21]; /* Initialize the ROBINSON projection ---------------------------------*/ int robinvint( double r, /* (I) Radius of the earth (sphere) */ double center_long, /* (I) Center longitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { long i; /* Place parameters in static storage for common use -------------------------------------------------*/ R = r; lon_center = center_long; false_easting = false_east; false_northing = false_north; pr[1]= -0.062; xlr[1]=0.9986; pr[2]=0.0; xlr[2]=1.0; pr[3]=0.062; xlr[3]=0.9986; pr[4]=0.124; xlr[4]=0.9954; pr[5]=0.186; xlr[5]=0.99; pr[6]=0.248; xlr[6]=0.9822; pr[7]=0.31; xlr[7]=0.973; pr[8]=0.372; xlr[8]=0.96; pr[9]=0.434; xlr[9]=0.9427; pr[10]=0.4958; xlr[10]=0.9216; pr[11]=0.5571; xlr[11]=0.8962; pr[12]=0.6176; xlr[12]=0.8679; pr[13]=0.6769; xlr[13]=0.835; pr[14]=0.7346; xlr[14]=0.7986; pr[15]=0.7903; xlr[15]=0.7597; pr[16]=0.8435; xlr[16]=0.7186; pr[17]=0.8936; xlr[17]=0.6732; pr[18]=0.9394; xlr[18]=0.6213; pr[19]=0.9761; xlr[19]=0.5722; pr[20]=1.0; xlr[20]=0.5322; for (i = 0; i < 21; i++) xlr[i] *= 0.9858; /* Report parameters to the user -----------------------------*/ ptitle("ROBINSON"); radius(r); cenlon(center_long); offsetp(false_easting,false_northing); return(OK); } /* Robinson inverse equations--mapping x,y to lat/long ------------------------------------------------------------*/ int robinv( double x, /* (O) X projection coordinate */ double y, /* (O) Y projection coordinate */ double *lon, /* (I) Longitude */ double *lat) /* (I) Latitude */ { double yy; double p2; double u,v,t,c; double phid; double y1; long ip1; long i; /* Inverse equations -----------------*/ x -= false_easting; y -= false_northing; yy = 2.0 * y / PI / R; phid = yy * 90.0; p2 = fabs(phid / 5.0); ip1 = (long) (p2 - EPSLN); if (ip1 == 0) ip1 = 1; /* Stirling's interpolation formula as used in forward transformation is reversed for first estimation of LAT. from rectangular coordinates. LAT. is then adjusted by iteration until use of forward series provides correct value of Y within tolerance. ---------------------------------------------------------------------------*/ for (i = 0;;) { u = pr[ip1 + 3] - pr[ip1 + 1]; v = pr[ip1 + 3] - 2.0 * pr[ip1 + 2] + pr[ip1 + 1]; t = 2.0 * (fabs(yy) - pr[ip1 + 2]) / u; c = v / u; p2 = t * (1.0 - c * t * (1.0 - 2.0 * c * t)); if ((p2 >= 0.0) || (ip1 == 1)) { if (y >= 0) phid = (p2 + (double) ip1 ) * 5.0; else phid = -(p2 + (double) ip1 ) * 5.0; do { p2 = fabs(phid / 5.0); ip1 = (long) (p2 - EPSLN); p2 -= (double) ip1; if (y >= 0) y1 = R * (pr[ip1 +2] + p2 *(pr[ip1 + 3] - pr[ip1 +1]) / 2.0 + p2 * p2 * (pr[ip1 + 3] - 2.0 * pr[ip1 + 2] + pr[ip1 + 1])/2.0) * PI / 2.0; else y1 = -R * (pr[ip1 +2] + p2 *(pr[ip1 + 3] - pr[ip1 +1]) / 2.0 + p2 * p2 * (pr[ip1 + 3] - 2.0 * pr[ip1 + 2] + pr[ip1 + 1])/2.0) * PI / 2.0; phid += -180.0 * (y1 - y) / PI / R; i++; if (i > 75) { p_error("Too many iterations in inverse","robinv-conv"); return(234); } } while (fabs(y1 - y) > .00001); break; } else { ip1 -= 1; if (ip1 < 0) { p_error("Too many iterations in inverse","robinv-conv"); return(234); } } } *lat = phid * .01745329252; /* calculate LONG. using final LAT. with transposed forward Stirling's interpolation formula. ---------------------------------------------------------------------*/ *lon = lon_center + x / R / (xlr[ip1 + 2] + p2 * (xlr[ip1 + 3] - xlr[ip1 + 1]) / 2.0 + p2 * p2 * (xlr[ip1 + 3] - 2.0 * xlr[ip1 + 2] + xlr[ip1 + 1]) / 2.0); *lon = adjust_lon(*lon); return(OK); } hdf-eos5-2.0/gctp/src/sinfor.c000077500000000000000000000102511507520047200161610ustar00rootroot00000000000000/******************************************************************************* NAME SINUSOIDAL PURPOSE: Transforms input longitude and latitude to Easting and Northing for the Sinusoidal projection. The longitude and latitude must be in radians. The Easting and Northing values will be returned in meters. PROGRAMMER DATE REASON ---------- ---- ------ D. Steinwand, EROS May, 1991 Abe Taaheri/Raytheon IIS March, 2017 Modified to support both spherical and ellipsoidal models of earth for r Sinusoidal projection This function was adapted from the Sinusoidal projection code (FORTRAN) in the General Cartographic Transformation Package software which is available from the U.S. Geological Survey National Mapping Division. ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. "Software Documentation for GCTP General Cartographic Transformation Package", U.S. Geological Survey National Mapping Division, May 1982. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double r_major; /* major axis */ static double r_minor; /* minor axis */ static double lon_center; /* Center longitude (projection center) */ static double R; /* Radius of the earth (sphere) */ static double false_easting; /* x offset in meters */ static double false_northing; /* y offset in meters */ static long ind; /* spherical flag */ static double e, es; /* eccentricity constants */ static double e0,e1,e2,e3; /* eccentricity constants */ /* Initialize the Sinusoidal projection ------------------------------------*/ int sinforint( double r_maj, /* major axis */ double r_min, /* minor axis */ double center_long, /* (I) Center longitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { /* Place parameters in static storage for common use -------------------------------------------------*/ R = r_maj; if(fabs(r_min) < EPSLN ) /* sphere */ { r_major = r_maj; r_minor = r_maj; } else /* sphere or ellipsoide */ { r_major = r_maj; r_minor = r_min; } lon_center = center_long; false_easting = false_east; false_northing = false_north; es = 1.0 - SQUARE(r_minor / r_major); e = sqrt(es); e0 = e0fn(es); e1 = e1fn(es); e2 = e2fn(es); e3 = e3fn(es); if(es < 0.00001) { ind = 1; /* sphere */ } else { ind = 0; /* ellipsoid */ } /* Report parameters to the user -----------------------------*/ ptitle("SINUSOIDAL"); radius2(r_major, r_minor); cenlon(center_long); offsetp(false_easting,false_northing); return(OK); } /* Sinusoidal forward equations--mapping lat,long to x,y -----------------------------------------------------*/ int sinfor( double lon, /* (I) Longitude */ double lat, /* (I) Latitude */ double *x, /* (O) X projection coordinate */ double *y) /* (O) Y projection coordinate */ { double delta_lon; /* Delta longitude (Given longitude - center */ double sin_phi, cos_phi;/* sin and cos value */ double con, ml; /* cone constant, small m */ /* Forward equations -----------------*/ if (ind != 0) /* Spherical */ { delta_lon = adjust_lon(lon - lon_center); *x = R * delta_lon * cos(lat) + false_easting; *y = R * lat + false_northing; return(OK); } else /* Ellipsoidal */ { delta_lon = adjust_lon(lon - lon_center); tsincos(lat, &sin_phi, &cos_phi); con = 1.0 - es * SQUARE(sin_phi); ml = r_major * mlfn(e0, e1, e2, e3, lat); *x = r_major * delta_lon * cos_phi / sqrt(con) + false_easting; *y = ml + false_northing; return(OK); } } hdf-eos5-2.0/gctp/src/sininv.c000077500000000000000000000115441507520047200161750ustar00rootroot00000000000000/******************************************************************************* NAME SINUSOIDAL PURPOSE: Transforms input Easting and Northing to longitude and latitude for the Sinusoidal projection. The Easting and Northing must be in meters. The longitude and latitude values will be returned in radians. PROGRAMMER DATE REASON ---------- ---- ------ D. Steinwand, EROS May, 1991 Abe Taaheri/Raytheon IIS March, 2017 Modified to support both spherical and ellipsoidal models of earth for Sinusoidal projection This function was adapted from the Sinusoidal projection code (FORTRAN) in the General Cartographic Transformation Package software which is available from the U.S. Geological Survey National Mapping Division. ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. "Software Documentation for GCTP General Cartographic Transformation Package", U.S. Geological Survey National Mapping Division, May 1982. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double r_major, r_minor; /* major axis */ static double lon_center; /* Center longitude (projection center) */ static double R; /* Radius of the earth (sphere) */ static double false_easting; /* x offset in meters */ static double false_northing; /* y offset in meters */ static long ind; /* spherical flag */ static double e, es, imu; /* eccentricity constants */ static double e1, e2, e3, e4, e5; /* Initialize the Sinusoidal projection ------------------------------------*/ int sininvint( double r_maj, /* major axis */ double r_min, /* minor axis */ double center_long, /* (I) Center longitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { /* Place parameters in static storage for common use -------------------------------------------------*/ R = r_maj; if(fabs(r_min) < EPSLN ) /* sphere */ { r_major = r_maj; r_minor = r_maj; } else /* sphere or ellipsoide */ { r_major = r_maj; r_minor = r_min; } lon_center = center_long; false_easting = false_east; false_northing = false_north; es = 1.0 - SQUARE(r_minor / r_major); e = sqrt(es); if(e < 0.00001) { ind = 1; /* sphere */ } else { double e12, e13, e14; ind = 0; /* ellipsoid */ e1 = (1.0 - sqrt(1.0 - es))/(1.0 + sqrt(1.0 - es)); e12 = e1 * e1; e13 = e12 * e1; e14 = e13 * e1; imu = (1.0 - (es/4.0) - (3.0 * es * es / 64.0) - (5.0 * es * es * es /256.0)); e2 = ((3.0 * e1 /2.0) - (27.0 * e13 / 32.0)); e3 = ((21.0 * e12 / 16.0) - (55.0 * e14 / 32.0)); e4 = (151.0 * e13 / 96.0); e5 = (1097.0 * e14 / 512.0); } /* Report parameters to the user -----------------------------*/ ptitle("SINUSOIDAL"); radius2(r_major, r_minor); cenlon(center_long); offsetp(false_easting,false_northing); return(OK); } /* Sinusoidal inverse equations--mapping x,y to lat,long -----------------------------------------------------*/ int sininv( double x, /* (I) X projection coordinate */ double y, /* (I) Y projection coordinate */ double *lon, /* (O) Longitude */ double *lat) /* (O) Latitude */ { double temp; /* Re-used temporary variable */ double mu, ml; double sin_phi, cos_phi; /* Inverse equations -----------------*/ x -= false_easting; y -= false_northing; if (ind != 0) /* Spherical */ { *lat = y / R; if (fabs(*lat) > HALF_PI) { p_error("Input data error","sinusoidal-inverse"); return(164); } temp = fabs(*lat) - HALF_PI; if (fabs(temp) > EPSLN) { temp = lon_center + x / (R * cos(*lat)); *lon = adjust_lon(temp); } else *lon = lon_center; return(OK); } else /* Ellipsoidal */ { ml = y; mu = ml / (r_major * imu); *lat = mu + (e2 * sin(2.0 * mu)) + (e3 * sin(4.0 * mu)) + (e4 * sin(6.0 * mu)) + (e5 * sin(8.0 * mu)); if (fabs(*lat) > HALF_PI) { p_error("Input data error","sinusoidal-inverse"); return(164); } temp = fabs(*lat) - HALF_PI; if (fabs(temp) > EPSLN) { sin_phi = sin(*lat); cos_phi = cos(*lat); temp = lon_center + x * sqrt(1.0 - es * SQUARE(sin_phi)) / (r_major * cos_phi); *lon = adjust_lon(temp); } else *lon = lon_center; return(OK); } } hdf-eos5-2.0/gctp/src/somfor.c000077500000000000000000000175431507520047200162010ustar00rootroot00000000000000/******************************************************************************* NAME SPACE OBLIQUE MERCATOR (SOM) PURPOSE: The first method of Transforming input longitude and latitude to Easting and Northing for the SOM projection. The longitude and latitude must be in radians. The Easting and Northing values will be returned in meters. PROGRAM HISTORY PROGRAMMER DATE REASON ---------- ---- ------ D. Steinwand July, 1992 T. Mittan Mar, 1993 S. Nelson Nov, 1993 Changed error message Raj Gejjagaraguppe(ARC) Aug, 1996 Landsat Ratio is removed as hard coded value. Now this ratio can be an input from the user through the projection parameter array element number 9. ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. "Software Documentation for GCTP General Cartographic Transformation Package", U.S. Geological Survey National Mapping Division, May 1982. *******************************************************************************/ #include #include "cproj.h" static double lon_center,a,b,a2,a4,c1,c3,q,t,w,xj,p21,sa,ca,es,s,start; static double false_easting; static double false_northing; static void som_series(double *fb, double *fa2, double *fa4, double *fc1, double *fc3, double *dlam); double gsat_ratio; int somforint( double r_major, /* major axis */ double r_minor, /* minor axis */ long satnum, /* Landsat satellite number (1,2,3,4,5) */ long path, /* Landsat path number */ double alf_in, double lon, double false_east, /* x offset in meters */ double false_north, /* y offset in meters */ double time, long start1, long flag, double sat_ratio) /* satellite ratio which specify the start point of x,y reading within an orbit */ { long i; double alf,e2c,e2s,one_es; double dlam,fb,fa2,fa4,fc1,fc3,suma2,suma4,sumc1,sumc3,sumb; double adjust_lon(); /* Assign satellite ratio to a global variable ------------------------------------------- */ gsat_ratio = sat_ratio; /* Place parameters in static storage for common use -------------------------------------------------*/ false_easting = false_east; false_northing = false_north; a = r_major; b = r_minor; es = 1.0 - SQUARE(r_minor/r_major); if (flag != 0) { alf = alf_in; p21 = time / 1440.0; lon_center = lon; start = start1; } else { if (satnum < 4) { alf = 99.092 * D2R; p21=103.2669323/1440.0; lon_center = (128.87 - (360.0/251.0 * path)) * D2R; gsat_ratio = 0.5201613; } else { alf = 98.2 * D2R; p21=98.8841202/1440.0; lon_center = (129.30 - (360.0/233.0 * path)) * D2R; gsat_ratio = 0.5201613; /* lon_center = (-129.30557714 - (360.0/233.0 * path)) * D2R; */ } start=0.0; } /* Report parameters to the user (to device set up prior to this call) -------------------------------------------------------------------*/ ptitle("SPACE OBLIQUE MERCATOR"); radius2(a,b); if (flag == 0) { genrpt_long(path, "Path Number: "); genrpt_long(satnum, "Satellite Number: "); } genrpt(alf*R2D, "Inclination of Orbit: "); genrpt(lon_center*R2D,"Longitude of Ascending Orbit: "); offsetp(false_easting,false_northing); genrpt(gsat_ratio, "Landsat Ratio: "); ca=cos(alf); if (fabs(ca)<1.e-9) ca=1.e-9; sa=sin(alf); e2c=es*ca*ca; e2s=es*sa*sa; w=(1.0-e2c)/(1.0-es); w=w*w-1.0; one_es=1.0-es; q = e2s / one_es; t = (e2s*(2.0-es)) / (one_es*one_es); xj = one_es*one_es*one_es; dlam=0.0; som_series(&fb,&fa2,&fa4,&fc1,&fc3,&dlam); suma2=fa2; suma4=fa4; sumb=fb; sumc1=fc1; sumc3=fc3; for(i=9;i<=81;i+=18) { dlam=i; som_series(&fb,&fa2,&fa4,&fc1,&fc3,&dlam); suma2=suma2+4.0*fa2; suma4=suma4+4.0*fa4; sumb=sumb+4.0*fb; sumc1=sumc1+4.0*fc1; sumc3=sumc3+4.0*fc3; } for(i=18; i<=72; i+=18) { dlam=i; som_series(&fb,&fa2,&fa4,&fc1,&fc3,&dlam); suma2=suma2+2.0*fa2; suma4=suma4+2.0*fa4; sumb=sumb+2.0*fb; sumc1=sumc1+2.0*fc1; sumc3=sumc3+2.0*fc3; } dlam=90.0; som_series(&fb,&fa2,&fa4,&fc1,&fc3,&dlam); suma2=suma2+fa2; suma4=suma4+fa4; sumb=sumb+fb; sumc1=sumc1+fc1; sumc3=sumc3+fc3; a2=suma2/30.0; a4=suma4/60.0; b=sumb/30.0; c1=sumc1/15.0; c3=sumc3/45.0; return(OK); } int somfor( double lon, /* (I) Longitude */ double lat, /* (I) Latitude */ double *y, /* (O) X projection coordinate */ double *x) /* (O) Y projection coordinate */ { long n,l; double delta_lon; double rlm,tabs,tlam,xlam,c,xlamt,ab2,ab1,xlamp,sav; double d,sdsq,sd,tanlg,xtan,tphi,dp,rlm2; double scl,tlamp,conv,delta_lat,radlt,radln; double temp; char errorbuf[80]; /* Forward equations -----------------*/ conv=1.e-7; delta_lat=lat; delta_lon= lon-lon_center; /* Test for latitude and longitude approaching 90 degrees ----------------------------------------------------*/ if (delta_lat>1.570796) delta_lat=1.570796; if (delta_lat<-1.570796) delta_lat= -1.570796; radlt=delta_lat; radln=delta_lon; if(delta_lat>=0.0)tlamp=PI/2.0; if(start!= 0.0)tlamp=2.5*PI; if(delta_lat<0.0) tlamp=1.5*PI; n=0; L230: sav=tlamp; l=0; xlamp=radln+p21*tlamp; ab1=cos(xlamp); if(fabs(ab1)=0.0) scl=1.0; if(ab1<0.0) scl= -1.0; ab2=tlamp-(scl)*sin(tlamp)*HALF_PI; L240: xlamt=radln+p21*sav; c=cos(xlamt); if (fabs(c)<1.e-7) xlamt=xlamt-1.e-7; xlam=(((1.0-es)*tan(radlt)*sa)+sin(xlamt)*ca)/c; tlam=atan(xlam); tlam=tlam+ab2; tabs=fabs(sav)-fabs(tlam); if(fabs(tabs) 50) goto L260; sav=tlam; goto L240; /* Adjust for confusion at beginning and end of landsat orbits -----------------------------------------------------------*/ L250: rlm=PI * gsat_ratio; rlm2=rlm+2.0*PI; n++; if(n>=3) goto L300; if(tlam>rlm&&tlam=rlm2) tlamp=HALF_PI; goto L230; L260: sprintf(errorbuf,"50 iterations without conv\n"); p_error(errorbuf,"som-forward"); return(214); /* tlam computed - now compute tphi --------------------------------*/ L300: dp=sin(radlt); tphi=asin(((1.0-es)*ca*dp-sa*cos(radlt)*sin(xlamt))/sqrt(1.0-es*dp*dp)); /* compute x and y ---------------*/ xtan = (PI/4.0) + (tphi/2.0); tanlg = log(tan(xtan)); sd=sin(tlam); sdsq=sd*sd; s=p21*sa*cos(tlam)*sqrt((1.0+t*sdsq)/((1.0+w*sdsq)*(1.0+q*sdsq))); d=sqrt(xj*xj+s*s); *x=b*tlam+a2*sin(2.0*tlam)+a4*sin(4.0*tlam)-tanlg*s/d; *x = a* *x; *y=c1*sd+c3*sin(3.0*tlam)+tanlg*xj/d; *y = a* *y; /* Negate x & swap x,y -------------------*/ temp= *x; *x= *y + false_easting; *y=temp + false_northing;; return(OK); } /* Series to calculate a,b,c coefficients to convert from transform latitude,longitude to Space Oblique Mercator (SOM) rectangular coordinates Mathematical analysis by John Snyder 6/82 --------------------------------------------------------------------------*/ static void som_series( double *fb, double *fa2, double *fa4, double *fc1, double *fc3, double *dlam) { double sd,sdsq,h,sq,fc; *dlam= *dlam*0.0174532925; /* Convert dlam to radians */ sd=sin(*dlam); sdsq=sd*sd; s=p21*sa*cos(*dlam)*sqrt((1.0+t*sdsq)/((1.0+w*sdsq)*(1.0+q*sdsq))); h=sqrt((1.0+q*sdsq)/(1.0+w*sdsq))*(((1.0+w*sdsq)/((1.0+q*sdsq)*(1.0+ q*sdsq)))-p21*ca); sq=sqrt(xj*xj+s*s); *fb=(h*xj-s*s)/sq; *fa2= *fb*cos(2.0* *dlam); *fa4= *fb*cos(4.0* *dlam); fc=s*(h+xj)/sq; *fc1=fc*cos(*dlam); *fc3=fc*cos(3.0* *dlam); } hdf-eos5-2.0/gctp/src/sominv.c000077500000000000000000000154571507520047200162110ustar00rootroot00000000000000/******************************************************************************* NAME SPACE OBLIQUE MERCATOR (SOM) PURPOSE: The first method to Transform input Easting and Northing to longitude and latitude for the SOM projection. The Easting and Northing must be in meters. The longitude and latitude values will be returned in radians. PROGRAM HISTORY PROGRAMMER DATE ---------- ---- D. Steinwand July, 1992 T. Mittan Mar, 1993 Raj Gejjagaraguppe(ARC) Aug, 1996 Landsat Ratio is removed as hard coded value. Now this ratio can be an input from the user through the projection parameter array element number 9. ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. "Software Documentation for GCTP General Cartographic Transformation Package", U.S. Geological Survey National Mapping Division, May 1982. *******************************************************************************/ #include #include "cproj.h" static double lon_center,a,b,a2,a4,c1,c3,q,t,u,w,xj,p21,sa,ca,es,s; static double som_series(double *fb, double *fa2, double *fa4, double *fc1, double *fc3, double *dlam); static double false_easting; static double false_northing; int sominvint( double r_major, /* major axis */ double r_minor, /* minor axis */ long satnum, /* Landsat satellite number (1,2,3,4,5) */ long path, /* Landsat path number */ double alf_in, double lon, double false_east, /* x offset in meters */ double false_north, /* y offset in meters */ double time, long flag, double sat_ratio) { long i; double alf,e2c,e2s,one_es; double dlam,fb,fa2,fa4,fc1,fc3,suma2,suma4,sumc1,sumc3,sumb; /* Place parameters in static storage for common use -------------------------------------------------*/ false_easting = false_east; false_northing = false_north; a = r_major; b = r_minor; es = 1.0 - SQUARE(r_minor/r_major); if (flag != 0) { alf = alf_in; lon_center = lon; p21 = time/1440.0; } else { if (satnum < 4) { alf = 99.092 * D2R; p21=103.2669323/1440.0; lon_center = (128.87 - (360.0/251.0 * path)) * D2R; } else { alf = 98.2 * D2R; p21=98.8841202/1440.0; lon_center = (129.30 - (360.0/233.0 * path)) * D2R; /* lon_center = (129.30557714 - (360.0/233.0 * path)) * D2R; */ } } /* Report parameters to the user (to device set up prior to this call) -------------------------------------------------------------------*/ ptitle("SPACE OBLIQUE MERCATOR"); radius2(a,b); genrpt_long(path, "Path Number: "); genrpt_long(satnum, "Satellite Number: "); genrpt(alf*R2D, "Inclination of Orbit: "); genrpt(lon_center*R2D, "Longitude of Ascending Orbit: "); offsetp(false_easting,false_northing); genrpt(sat_ratio, "Landsat Ratio: "); ca=cos(alf); if (fabs(ca)<1.e-9) ca=1.e-9; sa=sin(alf); e2c=es*ca*ca; e2s=es*sa*sa; w=(1.0-e2c)/(1.0-es); w=w*w-1.0; one_es=1.0-es; q = e2s / one_es; t = (e2s*(2.0-es)) / (one_es*one_es); u= e2c / one_es; xj = one_es*one_es*one_es; dlam=0.0; som_series(&fb,&fa2,&fa4,&fc1,&fc3,&dlam); suma2=fa2; suma4=fa4; sumb=fb; sumc1=fc1; sumc3=fc3; for(i=9;i<=81;i+=18) { dlam=i; som_series(&fb,&fa2,&fa4,&fc1,&fc3,&dlam); suma2=suma2+4.0*fa2; suma4=suma4+4.0*fa4; sumb=sumb+4.0*fb; sumc1=sumc1+4.0*fc1; sumc3=sumc3+4.0*fc3; } for(i=18; i<=72; i+=18) { dlam=i; som_series(&fb,&fa2,&fa4,&fc1,&fc3,&dlam); suma2=suma2+2.0*fa2; suma4=suma4+2.0*fa4; sumb=sumb+2.0*fb; sumc1=sumc1+2.0*fc1; sumc3=sumc3+2.0*fc3; } dlam=90.0; som_series(&fb,&fa2,&fa4,&fc1,&fc3,&dlam); suma2=suma2+fa2; suma4=suma4+fa4; sumb=sumb+fb; sumc1=sumc1+fc1; sumc3=sumc3+fc3; a2=suma2/30.0; a4=suma4/60.0; b=sumb/30.0; c1=sumc1/15.0; c3=sumc3/45.0; return(OK); } int sominv( double y, /* (I) Y projection coordinate */ double x, /* (I) X projection coordinate */ double *lon, /* (O) Longitude */ double *lat) /* (O) Latitude */ { double tlon,conv,sav,sd,sdsq,blon,dif,st,defac,actan,tlat,dd,bigk,bigk2,xlamt; double sl,scl,dlat,dlon,temp; long inumb; /* Inverse equations. Begin inverse computation with approximation for tlon. Solve for transformed long. ---------------------------*/ temp=y; y=x - false_easting; x= temp - false_northing; tlon= x/(a*b); conv=1.e-9; for(inumb=0;inumb<50;inumb++) { sav=tlon; sd=sin(tlon); sdsq=sd*sd; s=p21*sa*cos(tlon)*sqrt((1.0+t*sdsq)/((1.0+w*sdsq)*(1.0+q*sdsq))); blon=(x/a)+(y/a)*s/xj-a2*sin(2.0*tlon)-a4*sin(4.0*tlon)-(s/xj)*(c1* sin(tlon)+c3*sin(3.0*tlon)); tlon=blon/b; dif=tlon-sav; if(fabs(dif)=50) { p_error("50 iterations without convergence","som-inverse"); return(214); } /* Compute transformed lat. ------------------------*/ st=sin(tlon); defac=exp(sqrt(1.0+s*s/xj/xj)*(y/a-c1*st-c3*sin(3.0*tlon))); actan=atan(defac); tlat=2.0*(actan-(PI/4.0)); /* Compute geodetic longitude --------------------------*/ dd=st*st; if(fabs(cos(tlon))<1.e-7) tlon=tlon-1.e-7; bigk=sin(tlat); bigk2=bigk*bigk; xlamt=atan(((1.0-bigk2/(1.0-es))*tan(tlon)*ca-bigk*sa*sqrt((1.0+q*dd) *(1.0-bigk2)-bigk2*u)/cos(tlon))/(1.0-bigk2*(1.0+u))); /* Correct inverse quadrant ------------------------*/ if(xlamt>=0.0) sl=1.0; if(xlamt<0.0) sl= -1.0; if(cos(tlon)>=0.0) scl=1.0; if(cos(tlon)<0.0) scl= -1.0; xlamt=xlamt-((PI/2.0)*(1.0-scl)*sl); dlon=xlamt-p21*tlon; /* Compute geodetic latitude -------------------------*/ if(fabs(sa)<1.e-7)dlat=asin(bigk/sqrt((1.0-es)*(1.0-es)+es*bigk2)); if(fabs(sa)>=1.e-7)dlat=atan((tan(tlon)*cos(xlamt)-ca*sin(xlamt))/((1.0-es)*sa)); *lon = adjust_lon(dlon+lon_center); *lat = dlat; return(OK); } /* Series to calculate a,b,c coefficients to convert from transform latitude,longitude to Space Oblique Mercator (SOM) rectangular coordinates Mathematical analysis by John Snyder 6/82 --------------------------------------------------------------------------*/ static double som_series( double *fb, double *fa2, double *fa4, double *fc1, double *fc3, double *dlam) { double sd,sdsq,h,sq,fc; *dlam= *dlam*0.0174532925; /* Convert dlam to radians */ sd=sin(*dlam); sdsq=sd*sd; s=p21*sa*cos(*dlam)*sqrt((1.0+t*sdsq)/((1.0+w*sdsq)*(1.0+q*sdsq))); h=sqrt((1.0+q*sdsq)/(1.0+w*sdsq))*(((1.0+w*sdsq)/((1.0+q*sdsq)*(1.0+ q*sdsq)))-p21*ca); sq=sqrt(xj*xj+s*s); *fb=(h*xj-s*s)/sq; *fa2= *fb*cos(2.0* *dlam); *fa4= *fb*cos(4.0* *dlam); fc=s*(h+xj)/sq; *fc1=fc*cos(*dlam); *fc3=fc*cos(3.0* *dlam); return(0); } hdf-eos5-2.0/gctp/src/sphdz.c000077500000000000000000000162761507520047200160260ustar00rootroot00000000000000/******************************************************************************* NAME SPHDZ PURPOSE: This function assigns values to the semimajor axis, semiminor axis, and radius of sphere. If the datum code is negative, the first two values in the parameter array (parm) are used to define the values as follows: --If parm[0] is a non-zero value and parm[1] is greater than one, the semimajor axis and radius are set to parm[0] and the semiminor axis is set to parm[1]. --If parm[0] is nonzero and parm[1] is greater than zero but less than or equal to one, the semimajor axis and radius are set to parm[0] and the semiminor axis is computed from the eccentricity squared value parm[1]. This algorithm is given below. --If parm[0] is nonzero and parm[1] is equal to zero, the semimajor axis, radius, and semiminor axis are set to parm[0]. --If parm[0] equals zero and parm[1] is greater than zero, the default Clarke 1866 is used to assign values to the semimajor axis, radius and semiminor axis. --If parm[0] and parm[1] equals zero, the semimajor axis and radius are set to 6370997.0 (This value is represented as the next to last value in the datum code array) and the semiminor axis is set to zero. For datum (-20), used for BCEA and/or CEA projections, the corresponding values will be 6371228.0 m. if a datum code is zero or greater, the semimajor and semiminor axis are defined by the datum code as found in Table A and the radius is set to 6370997.0 (except for datum code of 20, where it will be 6371228.0). If the datum code is greater than DATMCT+1 the default datum, Clarke 1866, is used to define the semimajor and semiminor axis and radius is set to 6370997.0 (except for datum code of 20, where it will be 6371228.0). The algorithm to define the semiminor axis using the eccentricity squared value is as follows: semiminor = sqrt(1.0 - ES) * semimajor where ES = eccentricity squared Table A: SUPPORTED DATUMS 0: Clarke 1866 (default) 1: Clarke 1880 2: Bessel 3: International 1967 4: International 1909 5: WGS 72 6: Everest 7: WGS 66 8: GRS 1980/WGS 84 9: Airy 10: Modified Everest 11: Modified Airy 12: Walbeck 13: Southeast Asia 14: Australian National 15: Krassovsky 16: Hough 17: Mercury 1960 18: Modified Mercury 1968 19: Sphere of Radius 6370997 meters 20: Sphere of Radius 21: Sphere of Radius 6371228 meters 6371007.181 meters 22: Hughes 1980 Note: Datum code of 20 is added by Abe Taaheri for 25 km global EASE grid that assumes an earth radius of 6371228 meters. Note: Datum code of 21 is added by Sharon Ni for MODIS Sinusoidal data that assumes an earth radius of 6371007.181 meters. Note: Datum code of 22 is added by Abe Taaheri for Hughes 1980 datum used in AMSR_E Sea Ice products (Semi Major Axis 6378273.0 meters, Semi Minor Axis 6356889.4485 meters) PROGRAMMER DATE ---------- ---- T. Mittan MARCH, 1993 ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. *******************************************************************************/ #include #include #include "cproj.h" #include "proj.h" static double major[23] = {6378206.4, 6378249.145, 6377397.155, 6378157.5, 6378388.0, 6378135.0, 6377276.3452, 6378145.0, 6378137.0, 6377563.396, 6377304.063, 6377340.189, 6378137.0, 6378155.0, 6378160.0, 6378245.0, 6378270.0, 6378166.0, 6378150.0, 6370997.0, 6371228.0, 6371007.181, 6378273.0}; static double minor[23] = {6356583.8, 6356514.86955, 6356078.96284, 6356772.2, 6356911.94613, 6356750.519915, 6356075.4133, 6356759.769356, 6356752.31414, 6356256.91, 6356103.039, 6356034.448, 6356752.314245, 6356773.3205, 6356774.719, 6356863.0188, 6356794.343479, 6356784.283666, 6356768.337303, 6370997.0, 6371228.0, 6371007.181, 6356889.4485}; /* Finds the correct ellipsoid axis ---------------------------------*/ int sphdz( long isph, /* spheroid code number also known as datum */ double *parm, /* projection parameters */ double *r_major, /* major axis */ double *r_minor, /* minor axis */ double *radius) /* radius */ { double t_major; /* temporary major axis */ double t_minor; /* temporary minor axis */ long jsph; /* spheroid code number */ if (isph < 0) { t_major = fabs(parm[0]); t_minor = fabs(parm[1]); if (t_major > 0.0) { if (t_minor > 1.0) { *r_major = t_major; *r_minor = t_minor; *radius = t_major; } else if (t_minor > 0.0) { *r_major = t_major; *radius = t_major; *r_minor = (sqrt(1.0 - t_minor)) * t_major; } else { *r_major = t_major; *radius = t_major; *r_minor = t_major; } } else /* t_major <= 0 */ if (t_minor > 0.0) { *r_major = major[0]; *radius = major[0]; *r_minor = minor[0]; } else /* t_minor <= 0 */ if(isph == -22 ) /*Hughes 1980 */ { *r_major = major[DATMCT+ 2]; *radius = major[DATMCT+ 2]; *r_minor = minor[DATMCT+ 2]; } else if(isph == -21 ) /* MODIS Sphere*/ { *r_major = major[DATMCT + 1]; *radius = major[DATMCT + 1]; *r_minor = 6371007.181; } else if(isph == -20 ) /*BCEA or CEA */ { *r_major = major[DATMCT]; *radius = major[DATMCT]; *r_minor = 6371228.0; } else { *r_major = major[DATMCT - 1]; *radius = major[DATMCT - 1]; *r_minor = 6370997.0; } } else /* isph >= 0 */ { jsph = labs(isph); if (jsph > 22) { p_error("Invalid spheroid selection","INFORMATIONAL"); p_error("Reset to 0","INFORMATIONAL"); isph = 1; jsph = 0; } else if (jsph == 22) /* check for Hughes 1980*/ { *r_major = major[jsph]; *r_minor = minor[jsph]; *radius = major[DATMCT - 1]; /* standard sphere */ } else if (jsph == 21) /* check for the Modis sphere*/ { *r_major = major[jsph]; *r_minor = minor[jsph]; *radius = major[jsph]; } else if (jsph == 20) /* BCEA defaults to spherical earth with radius 6371228.0 */ { *r_major = major[jsph]; *r_minor = minor[jsph]; *radius = major[DATMCT]; } else { *r_major = major[jsph]; *r_minor = minor[jsph]; *radius = major[DATMCT - 1]; /* standard sphere */ } } return(OK); } hdf-eos5-2.0/gctp/src/sterfor.c000077500000000000000000000063011507520047200163460ustar00rootroot00000000000000/******************************************************************************* NAME STEREOGRAPHIC PURPOSE: Transforms input longitude and latitude to Easting and Northing for the Stereographic projection. The longitude and latitude must be in radians. The Easting and Northing values will be returned in meters. PROGRAMMER DATE ---------- ---- T. Mittan Mar, 1993 ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double r_major; /* major axis */ static double lon_center; /* Center longitude (projection center) */ static double lat_origin; /* center latitude */ static double false_northing; /* y offset in meters */ static double false_easting; /* x offset in meters */ static double sin_p10; /* sin of center latitude */ static double cos_p10; /* cos of center latitude */ /* Initialize the Stereographic projection --------------------------------------*/ int sterforint( double r_maj, /* major axis */ double center_lon, /* center longitude */ double center_lat, /* center latitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { /* Place parameters in static storage for common use -------------------------------------------------*/ r_major = r_maj; lon_center = center_lon; lat_origin = center_lat; false_northing = false_north; false_easting = false_east; tsincos(center_lat,&sin_p10,&cos_p10); /* Report parameters to the user -----------------------------*/ ptitle("STEREOGRAPHIC"); radius(r_major); cenlonmer(lon_center); origin(lat_origin); offsetp(false_easting,false_northing); return(OK); } /* Stereographic forward equations--mapping lat,long to x,y ---------------------------------------------------*/ int sterfor( double lon, /* (I) Longitude */ double lat, /* (I) Latitude */ double *x, /* (O) X projection coordinate */ double *y) /* (O) Y projection coordinate */ { double sinphi, cosphi; /* sin and cos value */ double dlon; /* delta longitude value */ double coslon; /* cos of longitude */ double ksp; /* scale factor */ double g; /* Forward equations -----------------*/ dlon = adjust_lon(lon - lon_center); tsincos(lat,&sinphi,&cosphi); coslon = cos(dlon); g = sin_p10 * sinphi + cos_p10 * cosphi * coslon; if (fabs(g + 1.0) <= EPSLN) { p_error("Point projects into infinity","ster-for"); return(103); } else { ksp = 2.0 / (1.0 + g); *x = false_easting + r_major * ksp * cosphi * sin(dlon); *y = false_northing + r_major * ksp * (cos_p10 * sinphi - sin_p10 * cosphi * coslon); } return(OK); } hdf-eos5-2.0/gctp/src/sterinv.c000077500000000000000000000070031507520047200163540ustar00rootroot00000000000000/******************************************************************************* NAME STEREOGRAPHIC PURPOSE: Transforms input Easting and Northing to longitude and latitude for the Stereographic projection. The Easting and Northing must be in meters. The longitude and latitude values will be returned in radians. PROGRAMMER DATE ---------- ---- T. Mittan Mar, 1993 ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double r_major; /* major axis */ static double lon_center; /* Center longitude (projection center) */ static double lat_origin; /* center latitude */ static double false_northing; /* y offset in meters */ static double false_easting; /* x offset in meters */ static double sin_p10; /* sin of center latitude */ static double cos_p10; /* cos of center latitude */ /* Initialize the Stereographic projection --------------------------------------*/ int sterinvint( double r_maj, /* major axis */ double center_lon, /* center longitude */ double center_lat, /* center latitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { /* Place parameters in static storage for common use -------------------------------------------------*/ r_major = r_maj; lon_center = center_lon; lat_origin = center_lat; false_northing = false_north; false_easting = false_east; tsincos(center_lat,&sin_p10,&cos_p10); /* Report parameters to the user -----------------------------*/ ptitle("STEREOGRAPHIC"); radius(r_major); cenlonmer(lon_center); origin(lat_origin); offsetp(false_easting,false_northing); return(OK); } /* Stereographic inverse equations--mapping x,y to lat/long -------------------------------------------------------*/ int sterinv( double x, /* (O) X projection coordinate */ double y, /* (O) Y projection coordinate */ double *lon, /* (I) Longitude */ double *lat) /* (I) Latitude */ { double rh; /* height above ellipsoid */ double z; /* angle */ double sinz,cosz; /* sin of z and cos of z */ double con; /* Inverse equations -----------------*/ x -= false_easting; y -= false_northing; rh = sqrt(x * x + y * y); z = 2.0 * atan(rh / (2.0 * r_major)); tsincos(z,&sinz,&cosz); *lon = lon_center; if (fabs(rh) <= EPSLN) { *lat = lat_origin; return(OK); } else { *lat = asin(cosz * sin_p10 + (y * sinz * cos_p10) / rh); con = fabs(lat_origin) - HALF_PI; if (fabs(con) <= EPSLN) { if (lat_origin >= 0.0) { *lon = adjust_lon(lon_center + atan2(x, -y)); return(OK); } else { *lon = adjust_lon(lon_center - atan2(-x, y)); return(OK); } } else { con = cosz - sin_p10 * sin(*lat); if ((fabs(con) < EPSLN) && (fabs(x) < EPSLN)) return(OK); else *lon = adjust_lon(lon_center + atan2((x * sinz * cos_p10), (con * rh))); } } return(OK); } hdf-eos5-2.0/gctp/src/stplnfor.c000077500000000000000000000164411507520047200165370ustar00rootroot00000000000000/******************************************************************************* NAME STATE PLANE PURPOSE: Transforms input longitude and latitude to Easting and Northing for the State Plane projection. The longitude and latitude must be in radians. The Easting and Northing values will be returned in meters. PROGRAMMER DATE ---------- ---- T. Mittan Apr, 1993 ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. HISTORY 15-Nov-2005 TR NCR 44092 - Added defined(CYGWIN) *******************************************************************************/ #include #include "cproj.h" static int id; static long inzone = 0; static long NAD27[134] = {101,102,5010,5300,201,202,203,301,302,401,402,403,404, 405,406,407,501,502,503,600,700,901,902,903,1001,1002,5101, 5102,5103,5104,5105,1101,1102,1103,1201,1202,1301,1302,1401, 1402,1501,1502,1601,1602,1701,1702,1703,1801,1802,1900,2001, 2002,2101,2102,2103,2111,2112,2113,2201,2202,2203,2301,2302, 2401,2402,2403,2501,2502,2503,2601,2602,2701,2702,2703,2800, 2900,3001,3002,3003,3101,3102,3103,3104,3200,3301,3302,3401, 3402,3501,3502,3601,3602,3701,3702,3800,3901,3902,4001,4002, 4100,4201,4202,4203,4204,4205,4301,4302,4303,4400,4501,4502, 4601,4602,4701,4702,4801,4802,4803,4901,4902,4903,4904,5001, 5002,5003,5004,5005,5006,5007,5008,5009,5201,5202,5400}; static long NAD83[134] = {101,102,5010,5300,201,202,203,301,302,401,402,403, 404,405,406,0000,501,502,503,600,700,901,902,903,1001,1002, 5101,5102,5103,5104,5105,1101,1102,1103,1201,1202,1301,1302, 1401,1402,1501,1502,1601,1602,1701,1702,1703,1801,1802,1900, 2001,2002,2101,2102,2103,2111,2112,2113,2201,2202,2203,2301, 2302,2401,2402,2403,2500,0000,0000,2600,0000,2701,2702,2703, 2800,2900,3001,3002,3003,3101,3102,3103,3104,3200,3301,3302, 3401,3402,3501,3502,3601,3602,3701,3702,3800,3900,0000,4001, 4002,4100,4201,4202,4203,4204,4205,4301,4302,4303,4400,4501, 4502,4601,4602,4701,4702,4801,4802,4803,4901,4902,4903,4904, 5001,5002,5003,5004,5005,5006,5007,5008,5009,5200,0000,5400}; /* Initialize the State Plane projection ------------------------------------*/ int stplnforint( long zone, long sphere, char *fn27, char *fn83) { long ind; long i; long nadval; double table[9]; char pname[32]; char buf[100]; double r_maj,r_min,scale_fact,center_lon; double center_lat,false_east,false_north; double azimuth,lat_orig,lon_orig,lon1,lat1,lon2,lat2; long mode,iflg; FILE *ptr; #ifndef BIG_ENDIAN char swap[16]; char* swapPtr; long j; #endif ind = -1; if (inzone != zone) inzone = zone; else return(OK); if (zone > 0) { if (sphere == 0) { for (i = 0; i < 134; i++) { if (zone == NAD27[i]) { ind = i; break; } } } else if (sphere == 8) { for (i = 0; i < 134; i++) { if (zone == NAD83[i]) { ind = i; break; } } } } if (ind == -1) { sprintf(buf,"Illegal zone #%4ld for spheroid #%4ld",zone,sphere); p_error(buf,"state-init"); return(21); } if (sphere == 0) ptr = fopen(fn27,"r"); else ptr = fopen(fn83,"r"); if (ptr == NULL) { p_error("Error opening State Plane parameter file","state-for"); return(22); } fseek(ptr,(ind) * 432, 0); fread(pname,1,32,ptr); fread(&id,sizeof(int),1,ptr); fread(table,sizeof(double),9,ptr); fclose(ptr); #ifndef BIG_ENDIAN /* swap bytes as necessary */ swapPtr = (char*) (&id); for (i=0;i 0 setting lat1 and lat2 to zero do make any difference in omerforint */ lat2 = 0.0; omerforint(r_maj,r_min,scale_fact,azimuth,lon_orig,lat_orig,false_east, false_north,lon1,lat1,lon2,lat2,mode); } return(OK); } /* State plane forward equations--mapping lat,long to x,y -----------------------------------------------------*/ int stplnfor( double lon, /* (I) Longitude */ double lat, /* (I) Latitude */ double *x, /* (O) X projection coordinate */ double *y) /* (O) Y projection coordinate */ { long iflg; /* Forward equations -----------------*/ if (id == 1) { if ((iflg = tmfor(lon, lat, x, y)) != 0) return(iflg); } else if (id == 2) { if ((iflg = lamccfor(lon, lat, x, y)) != 0) return(iflg); } else if (id == 3) { if ((iflg = polyfor(lon, lat, x, y)) != 0) return(iflg); } else if (id == 4) { if ((iflg = omerfor(lon, lat, x, y)) != 0) return(iflg); } return(OK); } hdf-eos5-2.0/gctp/src/stplninv.c000077500000000000000000000165161507520047200165500ustar00rootroot00000000000000/******************************************************************************* NAME STATE PLANE PURPOSE: Transforms input Easting and Northing to longitude and latitude for the State Plane projection. The Easting and Northing must be in meters. The longitude and latitude values will be returned in radians. PROGRAMMER DATE ---------- ---- T. Mittan Apr, 1993 ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. *******************************************************************************/ #include #include "cproj.h" static int id; static long inzone = 0; static long nad27[134] = {101,102,5010,5300,201,202,203,301,302,401,402,403, 404,405,406,407,501,502,503,600,700,901,902,903,1001,1002, 5101,5102,5103,5104,5105,1101,1102,1103,1201,1202,1301,1302, 1401,1402,1501,1502,1601,1602,1701,1702,1703,1801,1802,1900, 2001,2002,2101,2102,2103,2111,2112,2113,2201,2202,2203,2301, 2302,2401,2402,2403,2501,2502,2503,2601,2602,2701,2702,2703, 2800,2900,3001,3002,3003,3101,3102,3103,3104,3200,3301,3302, 3401,3402,3501,3502,3601,3602,3701,3702,3800,3901,3902,4001, 4002,4100,4201,4202,4203,4204,4205,4301,4302,4303,4400,4501, 4502,4601,4602,4701,4702,4801,4802,4803,4901,4902,4903,4904, 5001,5002,5003,5004,5005,5006,5007,5008,5009,5201,5202,5400}; static long nad83[134] = {101,102,5010,5300,201,202,203,301,302,401,402,403, 404,405,406,0000,501,502,503,600,700,901,902,903,1001,1002, 5101,5102,5103,5104,5105,1101,1102,1103,1201,1202,1301,1302, 1401,1402,1501,1502,1601,1602,1701,1702,1703,1801,1802,1900, 2001,2002,2101,2102,2103,2111,2112,2113,2201,2202,2203,2301, 2302,2401,2402,2403,2500,0000,0000,2600,0000,2701,2702,2703, 2800,2900,3001,3002,3003,3101,3102,3103,3104,3200,3301,3302, 3401,3402,3501,3502,3601,3602,3701,3702,3800,3900,0000,4001, 4002,4100,4201,4202,4203,4204,4205,4301,4302,4303,4400,4501, 4502,4601,4602,4701,4702,4801,4802,4803,4901,4902,4903,4904, 5001,5002,5003,5004,5005,5006,5007,5008,5009,5200,0000,5400}; /* Initialize the State Plane projection ------------------------------------*/ int stplninvint( long zone, long sphere, char *fn27, char *fn83) { long ind; long i; long nadval; double table[9]; char pname[33]; char buf[100]; double r_maj,r_min,scale_fact,center_lon; double center_lat,false_east,false_north; double azimuth,lat_orig,lon_orig,lon1,lat1,lon2,lat2; long mode,iflg; FILE *ptr; #ifndef BIG_ENDIAN char swap[16]; char* swapPtr; long j; #endif ind = -1; if (inzone != zone) inzone = zone; else return(OK); if (zone > 0) { if (sphere == 0) { for (i = 0; i < 134; i++) { if (zone == nad27[i]) { ind = i; break; } } } else if (sphere == 8) { for (i = 0; i < 134; i++) { if (zone == nad83[i]) { ind = i; break; } } } } if (ind == -1) { sprintf(buf,"Illegal zone #%4ld for spheroid #%4ld",zone,sphere); p_error(buf,"state-init"); return(21); } if (sphere == 0) ptr = fopen(fn27,"r"); else ptr = fopen(fn83,"r"); if (ptr == NULL) { p_error("Error opening State Plane parameter file","state-inv"); return(22); } fseek(ptr,ind * 432, 0); ftell(ptr); fread(pname,sizeof(char),32,ptr); fread(&id,sizeof(int),1,ptr); fread(table,sizeof(double),9,ptr); fclose(ptr); #ifndef BIG_ENDIAN /* swap bytes as necessary */ swapPtr = (char*) (&id); for (i=0;i 0 setting lat1 and lat2 to zero do make any difference in omerinvint */ lat2 = 0.0; omerinvint(r_maj,r_min,scale_fact,azimuth,lon_orig,lat_orig,false_east, false_north,lon1,lat1,lon2,lat2,mode); } return(OK); } /* State Plane inverse equations--mapping x,y to lat/long -----------------------------------------------------*/ int stplninv( double x, /* (O) X projection coordinate */ double y, /* (O) Y projection coordinate */ double *lon, /* (I) Longitude */ double *lat) /* (I) Latitude */ { long iflg; /* Inverse equations -----------------*/ if (id == 1) { if ((iflg = tminv(x, y, lon, lat)) != 0) return(iflg); } else if (id == 2) { if ((iflg = lamccinv(x, y, lon, lat)) != 0) return(iflg); } else if (id == 3) { if ((iflg = polyinv(x, y, lon, lat)) != 0) return(iflg); } else if (id == 4) { if ((iflg = omerinv(x, y, lon, lat)) != 0) return(iflg); } return(OK); } hdf-eos5-2.0/gctp/src/tmfor.c000077500000000000000000000123501507520047200160120ustar00rootroot00000000000000/******************************************************************************* NAME TRANSVERSE MERCATOR PURPOSE: Transforms input longitude and latitude to Easting and Northing for the Transverse Mercator projection. The longitude and latitude must be in radians. The Easting and Northing values will be returned in meters. PROGRAMMER DATE REASON ---------- ---- ------ D. Steinwand, EROS Nov, 1991 T. Mittan Mar, 1993 S. Nelson Feb, 1995 Divided tmfor.c into two files, one for UTM (utmfor.c) and one for TM (tmfor.c). This was a necessary change to run forward projection conversions for both UTM and TM in the same process. ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double r_major; /* major axis */ static double r_minor; /* minor axis */ static double scale_factor; /* scale factor */ static double lon_center; /* Center longitude (projection center) */ static double lat_origin; /* center latitude */ static double e0,e1,e2,e3; /* eccentricity constants */ static double es,esp; /* eccentricity constants */ static double ml0; /* small value m */ static double false_northing; /* y offset in meters */ static double false_easting; /* x offset in meters */ static double ind; /* spherical flag */ /* Initialize the Transverse Mercator (TM) projection -------------------------------------------------*/ int tmforint( double r_maj, /* major axis */ double r_min, /* minor axis */ double scale_fact, /* scale factor */ double center_lon, /* center longitude */ double center_lat, /* center latitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { double temp; /* temporary variable */ /* Place parameters in static storage for common use -------------------------------------------------*/ r_major = r_maj; r_minor = r_min; scale_factor = scale_fact; lon_center = center_lon; lat_origin = center_lat; false_northing = false_north; false_easting = false_east; temp = r_minor / r_major; es = 1.0 - SQUARE(temp); e0 = e0fn(es); e1 = e1fn(es); e2 = e2fn(es); e3 = e3fn(es); ml0 = r_major * mlfn(e0, e1, e2, e3, lat_origin); esp = es / (1.0 - es); if (es < .00001) ind = 1; else ind = 0; /* Report parameters to the user -----------------------------*/ ptitle("TRANSVERSE MERCATOR (TM)"); radius2(r_major, r_minor); genrpt(scale_factor,"Scale Factor at C. Meridian: "); cenlonmer(lon_center); origin(lat_origin); offsetp(false_easting,false_northing); return(OK); } /* Transverse Mercator forward equations--mapping lat,long to x,y Note: The algorithm for TM is exactly the same as UTM and therefore if a change is implemented, also make the change to UTMFOR.c --------------------------------------------------------------*/ int tmfor( double lon, /* (I) Longitude */ double lat, /* (I) Latitude */ double *x, /* (O) X projection coordinate */ double *y) /* (O) Y projection coordinate */ { double delta_lon; /* Delta longitude (Given longitude - center */ double sin_phi, cos_phi;/* sin and cos value */ double al, als; /* temporary values */ double b; /* temporary values */ double c, t, tq; /* temporary values */ double con, n, ml; /* cone constant, small m */ /* Forward equations -----------------*/ delta_lon = adjust_lon(lon - lon_center); tsincos(lat, &sin_phi, &cos_phi); /* This part was in the fortran code and is for the spherical form ----------------------------------------------------------------*/ if (ind != 0) { b = cos_phi * sin(delta_lon); if ((fabs(fabs(b) - 1.0)) < .0000000001) { p_error("Point projects into infinity","tm-for"); return(93); } else { *x = .5 * r_major * scale_factor * log((1.0 + b)/(1.0 - b)); con = acos(cos_phi * cos(delta_lon)/sqrt(1.0 - b*b)); if (lat < 0) con = - con; *y = r_major * scale_factor * (con - lat_origin); return(OK); } } al = cos_phi * delta_lon; als = SQUARE(al); c = esp * SQUARE(cos_phi); tq = tan(lat); t = SQUARE(tq); con = 1.0 - es * SQUARE(sin_phi); n = r_major / sqrt(con); ml = r_major * mlfn(e0, e1, e2, e3, lat); *x = scale_factor * n * al * (1.0 + als / 6.0 * (1.0 - t + c + als / 20.0 * (5.0 - 18.0 * t + SQUARE(t) + 72.0 * c - 58.0 * esp))) + false_easting; *y = scale_factor * (ml - ml0 + n * tq * (als * (0.5 + als / 24.0 * (5.0 - t + 9.0 * c + 4.0 * SQUARE(c) + als / 30.0 * (61.0 - 58.0 * t + SQUARE(t) + 600.0 * c - 330.0 * esp))))) + false_northing; return(OK); } hdf-eos5-2.0/gctp/src/tminv.c000077500000000000000000000137671507520047200160350ustar00rootroot00000000000000/******************************************************************************* NAME TRANSVERSE MERCATOR PURPOSE: Transforms input Easting and Northing to longitude and latitude for the Transverse Mercator projection. The Easting and Northing must be in meters. The longitude and latitude values will be returned in radians. PROGRAMMER DATE REASON ---------- ---- ------ D. Steinwand, EROS Nov, 1991 T. Mittan Mar, 1993 S. Nelson Feb, 1995 Divided tminv.c into two files, one for UTM (utminv.c) and one for TM (tminv.c). This was a necessary change to run inverse projection conversions for both UTM and TM in the same process. ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double r_major; /* major axis */ static double r_minor; /* minor axis */ static double scale_factor; /* scale factor */ static double lon_center; /* Center longitude (projection center) */ static double lat_origin; /* center latitude */ static double e0,e1,e2,e3; /* eccentricity constants */ static double es,esp; /* eccentricity constants */ static double ml0; /* small value m */ static double false_northing; /* y offset in meters */ static double false_easting; /* x offset in meters */ static long ind; /* sphere flag value */ /* Initialize the Transverse Mercator (TM) projection -------------------------------------------------------------*/ int tminvint( double r_maj, /* major axis */ double r_min, /* minor axis */ double scale_fact, /* scale factor */ double center_lon, /* center longitude */ double center_lat, /* center latitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { double temp; /* temporary variable */ /* Place parameters in static storage for common use -------------------------------------------------*/ r_major = r_maj; r_minor = r_min; scale_factor = scale_fact; lon_center = center_lon; lat_origin = center_lat; false_northing = false_north; false_easting = false_east; temp = r_minor / r_major; es = 1.0 - SQUARE(temp); e0 = e0fn(es); e1 = e1fn(es); e2 = e2fn(es); e3 = e3fn(es); ml0 = r_major * mlfn(e0, e1, e2, e3, lat_origin); esp = es / (1.0 - es); if (es < .00001) ind = 1; /* Report parameters to the user -----------------------------*/ ptitle("TRANSVERSE MERCATOR (TM)"); radius2(r_major, r_minor); genrpt(scale_factor,"Scale Factor at C. Meridian: "); cenlonmer(lon_center); origin(lat_origin); offsetp(false_easting,false_northing); return(OK); } /* Transverse Mercator inverse equations--mapping x,y to lat,long Note: The algorithm for UTM is exactly the same as TM and therefore if a change is implemented, also make the change to UTMINV.c --------------------------------------------------------------*/ int tminv( double x, /* (I) X projection coordinate */ double y, /* (I) Y projection coordinate */ double *lon, /* (O) Longitude */ double *lat) /* (O) Latitude */ { double con,phi; /* temporary angles */ double delta_phi; /* difference between longitudes */ long i; /* counter variable */ double sin_phi, cos_phi, tan_phi; /* sin cos and tangent values */ double c, cs, t, ts, n, r, d, ds; /* temporary variables */ double f, h, g, temp; /* temporary variables */ long max_iter = 6; /* maximun number of iterations */ /* fortran code for spherical form --------------------------------*/ if (ind != 0) { f = exp(x/(r_major * scale_factor)); g = .5 * (f - 1/f); temp = lat_origin + y/(r_major * scale_factor); h = cos(temp); con = sqrt((1.0 - h * h)/(1.0 + g * g)); *lat = asinz(con); if (temp < 0) *lat = -*lat; if ((g == 0) && (h == 0)) { *lon = lon_center; return(OK); } else { *lon = adjust_lon(atan2(g,h) + lon_center); return(OK); } } /* Inverse equations -----------------*/ x = x - false_easting; y = y - false_northing; con = (ml0 + y / scale_factor) / r_major; phi = con; for (i=0;;i++) { delta_phi = ((con + e1 * sin(2.0*phi) - e2 * sin(4.0*phi) + e3 * sin(6.0*phi)) / e0) - phi; /* delta_phi = ((con + e1 * sin(2.0*phi) - e2 * sin(4.0*phi)) / e0) - phi; */ phi += delta_phi; if (fabs(delta_phi) <= EPSLN) break; if (i >= max_iter) { p_error("Latitude failed to converge","TM-INVERSE"); return(95); } } if (fabs(phi) < HALF_PI) { tsincos(phi, &sin_phi, &cos_phi); tan_phi = tan(phi); c = esp * SQUARE(cos_phi); cs = SQUARE(c); t = SQUARE(tan_phi); ts = SQUARE(t); con = 1.0 - es * SQUARE(sin_phi); n = r_major / sqrt(con); r = n * (1.0 - es) / con; d = x / (n * scale_factor); ds = SQUARE(d); *lat = phi - (n * tan_phi * ds / r) * (0.5 - ds / 24.0 * (5.0 + 3.0 * t + 10.0 * c - 4.0 * cs - 9.0 * esp - ds / 30.0 * (61.0 + 90.0 * t + 298.0 * c + 45.0 * ts - 252.0 * esp - 3.0 * cs))); *lon = adjust_lon(lon_center + (d * (1.0 - ds / 6.0 * (1.0 + 2.0 * t + c - ds / 20.0 * (5.0 - 2.0 * c + 28.0 * t - 3.0 * cs + 8.0 * esp + 24.0 * ts))) / cos_phi)); } else { *lat = HALF_PI * sign(y); *lon = lon_center; } return(OK); } hdf-eos5-2.0/gctp/src/untfz.c000077500000000000000000000035421507520047200160340ustar00rootroot00000000000000/******************************************************************************* NAME UNTFZ PURPOSE: This function determines the convergence factor between the input unit type and the output unit type. Valid types include: 0 = Radians 3 = Seconds of arc 1 = U.S. feet 4 = Degrees of arc 2 = Meters 5 = International feet PROGRAMMER DATE ---------- ---- T. Mittan MARCH, 1993 ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. *******************************************************************************/ #include #include "cproj.h" #include "proj.h" static double factors[6][6] = {{1.0, 0.0, 0.0, 206264.8062470963, 57.29577951308231, 0.0}, {0.0, 1.0, .3048006096012192, 0.0, 0.0, 1.000002000004}, {0.0, 3.280833333333333, 1.0, 0.0, 0.0, 3.280839895013124}, {.484813681109536e-5, 0.0, 0.0, 1.0, .27777777777778e-3, 0.0}, {.0174532925199433, 0.0, 0.0, 3600, 1.0, 0.0}, {0.0, .999998, .3048, 0.0, 0.0, 1.0}}; /* Convert DMS packed angle into deg ----------------------------------*/ long untfz( long inunit, long outunit, double *factor) { if ((outunit >= 0) && (outunit <= MAXUNIT) && (inunit >= 0) && (inunit <= MAXUNIT)) { *factor = factors[inunit][outunit]; if (*factor == 0.0) { p_error("Uncompatable unit codes","untfz-code"); return(1101); } } else { p_error("Illegal source or target unit code","untfz-unit"); return(5); } return(OK); } hdf-eos5-2.0/gctp/src/utmfor.c000077500000000000000000000121171507520047200162000ustar00rootroot00000000000000/******************************************************************************* NAME UNIVERSAL TRANSVERSE MERCATOR PURPOSE: Transforms input longitude and latitude to Easting and Northing for the Universal Transverse Mercator projection. The longitude and latitude must be in radians. The Easting and Northing values will be returned in meters. PROGRAMMER DATE REASON ---------- ---- ------ D. Steinwand, EROS Nov, 1991 T. Mittan Mar, 1993 S. Nelson Feb, 1995 Divided tmfor.c into two files, one for UTM (utmfor.c) and one for TM (tmfor.c). This was a necessary change to run forward projection conversions for both UTM and TM in the same process. ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. *******************************************************************************/ #include #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double r_major; /* major axis */ static double r_minor; /* minor axis */ static double scale_factor; /* scale factor */ static double lon_center; /* Center longitude (projection center) */ static double lat_origin; /* center latitude */ static double e0,e1,e2,e3; /* eccentricity constants */ static double es,esp; /* eccentricity constants */ static double ml0; /* small value m */ static double false_northing; /* y offset in meters */ static double false_easting; /* x offset in meters */ static double ind; /* spherical flag */ /* Initialize the Universal Transverse Mercator (UTM) projection -------------------------------------------------------------*/ int utmforint( double r_maj, /* major axis */ double r_min, /* minor axis */ double scale_fact, /* scale factor */ long zone) /* zone number */ { double temp; /* temporary variable */ if ((labs(zone) < 1) || (labs(zone) > 60)) { p_error("Illegal zone number","utm-forint"); return(11); } r_major = r_maj; r_minor = r_min; scale_factor = scale_fact; lat_origin = 0.0; lon_center = ((6 * labs(zone)) - 183) * D2R; false_easting = 500000.0; false_northing = (zone < 0) ? 10000000.0 : 0.0; temp = r_minor / r_major; es = 1.0 - SQUARE(temp); e0 = e0fn(es); e1 = e1fn(es); e2 = e2fn(es); e3 = e3fn(es); ml0 = r_major * mlfn(e0, e1, e2, e3, lat_origin); esp = es / (1.0 - es); if (es < .00001) ind = 1; /* Report parameters to the user -----------------------------*/ ptitle("UNIVERSAL TRANSVERSE MERCATOR (UTM)"); genrpt_long(zone, "Zone: "); radius2(r_major, r_minor); genrpt(scale_factor,"Scale Factor at C. Meridian: "); cenlonmer(lon_center); return(OK); } /* Universal Transverse Mercator forward equations--mapping lat,long to x,y Note: The algorithm for UTM is exactly the same as TM and therefore if a change is implemented, also make the change to TMFOR.c -----------------------------------------------------------------------*/ int utmfor( double lon, /* (I) Longitude */ double lat, /* (I) Latitude */ double *x, /* (O) X projection coordinate */ double *y) /* (O) Y projection coordinate */ { double delta_lon; /* Delta longitude (Given longitude - center */ double sin_phi, cos_phi;/* sin and cos value */ double al, als; /* temporary values */ double b; /* temporary values */ double c, t, tq; /* temporary values */ double con, n, ml; /* cone constant, small m */ /* Forward equations -----------------*/ delta_lon = adjust_lon(lon - lon_center); tsincos(lat, &sin_phi, &cos_phi); /* This part was in the fortran code and is for the spherical form ----------------------------------------------------------------*/ if (ind != 0) { b = cos_phi * sin(delta_lon); if ((fabs(fabs(b) - 1.0)) < .0000000001) { p_error("Point projects into infinity","utm-for"); return(93); } else { *x = .5 * r_major * scale_factor * log((1.0 + b)/(1.0 - b)); con = acos(cos_phi * cos(delta_lon)/sqrt(1.0 - b*b)); if (lat < 0) con = - con; *y = r_major * scale_factor * (con - lat_origin); return(OK); } } al = cos_phi * delta_lon; als = SQUARE(al); c = esp * SQUARE(cos_phi); tq = tan(lat); t = SQUARE(tq); con = 1.0 - es * SQUARE(sin_phi); n = r_major / sqrt(con); ml = r_major * mlfn(e0, e1, e2, e3, lat); *x = scale_factor * n * al * (1.0 + als / 6.0 * (1.0 - t + c + als / 20.0 * (5.0 - 18.0 * t + SQUARE(t) + 72.0 * c - 58.0 * esp))) + false_easting; *y = scale_factor * (ml - ml0 + n * tq * (als * (0.5 + als / 24.0 * (5.0 - t + 9.0 * c + 4.0 * SQUARE(c) + als / 30.0 * (61.0 - 58.0 * t + SQUARE(t) + 600.0 * c - 330.0 * esp))))) + false_northing; return(OK); } hdf-eos5-2.0/gctp/src/utminv.c000077500000000000000000000137101507520047200162060ustar00rootroot00000000000000/******************************************************************************* NAME UNIVERSAL TRANSVERSE MERCATOR PURPOSE: Transforms input Easting and Northing to longitude and latitude for the Universal Transverse Mercator projection. The Easting and Northing must be in meters. The longitude and latitude values will be returned in radians. PROGRAMMER DATE REASON ---------- ---- ------ D. Steinwand, EROS Nov, 1991 T. Mittan Mar, 1993 S. Nelson Feb, 1995 Divided tminv.c into two files, one for UTM (utminv.c) and one for TM (tminv.c). This was a necessary change to run inverse projection conversions for both UTM and TM in the same process. ALGORITHM REFERENCES 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. *******************************************************************************/ #include #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double r_major; /* major axis */ static double r_minor; /* minor axis */ static double scale_factor; /* scale factor */ static double lon_center; /* Center longitude (projection center) */ static double lat_origin; /* center latitude */ static double e0,e1,e2,e3; /* eccentricity constants */ static double es,esp; /* eccentricity constants */ static double ml0; /* small value m */ static double false_northing; /* y offset in meters */ static double false_easting; /* x offset in meters */ static long ind; /* sphere flag value */ /* Initialize the Universal Transverse Mercator (UTM) projection -------------------------------------------------------------*/ int utminvint( double r_maj, /* major axis */ double r_min, /* minor axis */ double scale_fact, /* scale factor */ long zone) /* zone number */ { double temp; /* temprorary variables */ if ((labs(zone) < 1) || (labs(zone) > 60)) { p_error("Illegal zone number","utm-invint"); return(11); } r_major = r_maj; r_minor = r_min; scale_factor = scale_fact; lat_origin = 0.0; lon_center = ((6 * labs(zone)) - 183) * D2R; false_easting = 500000.0; false_northing = (zone < 0) ? 10000000.0 : 0.0; temp = r_minor / r_major; es = 1.0 - SQUARE(temp); e0 = e0fn(es); e1 = e1fn(es); e2 = e2fn(es); e3 = e3fn(es); ml0 = r_major * mlfn(e0, e1, e2, e3, lat_origin); esp = es / (1.0 - es); if (es < .00001) ind = 1; else ind = 0; /* Report parameters to the user -----------------------------*/ ptitle("UNIVERSAL TRANSVERSE MERCATOR (UTM)"); genrpt_long(zone, "Zone: "); radius2(r_major, r_minor); genrpt(scale_factor,"Scale Factor at C. Meridian: "); cenlonmer(lon_center); return(OK); } /* Universal Transverse Mercator inverse equations--mapping x,y to lat,long Note: The algorithm for UTM is exactly the same as TM and therefore if a change is implemented, also make the change to TMINV.c -----------------------------------------------------------------------*/ int utminv( double x, /* (I) X projection coordinate */ double y, /* (I) Y projection coordinate */ double *lon, /* (O) Longitude */ double *lat) /* (O) Latitude */ { double con,phi; /* temporary angles */ double delta_phi; /* difference between longitudes */ long i; /* counter variable */ double sin_phi, cos_phi, tan_phi; /* sin cos and tangent values */ double c, cs, t, ts, n, r, d, ds; /* temporary variables */ double f, h, g, temp; /* temporary variables */ long max_iter = 6; /* maximun number of iterations */ /* fortran code for spherical form --------------------------------*/ if (ind != 0) { f = exp(x/(r_major * scale_factor)); g = .5 * (f - 1/f); temp = lat_origin + y/(r_major * scale_factor); h = cos(temp); con = sqrt((1.0 - h * h)/(1.0 + g * g)); *lat = asinz(con); if (temp < 0) *lat = -*lat; if ((g == 0) && (h == 0)) { *lon = lon_center; return(OK); } else { *lon = adjust_lon(atan2(g,h) + lon_center); return(OK); } } /* Inverse equations -----------------*/ x = x - false_easting; y = y - false_northing; con = (ml0 + y / scale_factor) / r_major; phi = con; for (i=0;;i++) { delta_phi=((con + e1 * sin(2.0*phi) - e2 * sin(4.0*phi) + e3 * sin(6.0*phi)) / e0) - phi; /* delta_phi = ((con + e1 * sin(2.0*phi) - e2 * sin(4.0*phi)) / e0) - phi; */ phi += delta_phi; if (fabs(delta_phi) <= EPSLN) break; if (i >= max_iter) { p_error("Latitude failed to converge","UTM-INVERSE"); return(95); } } if (fabs(phi) < HALF_PI) { tsincos(phi, &sin_phi, &cos_phi); tan_phi = tan(phi); c = esp * SQUARE(cos_phi); cs = SQUARE(c); t = SQUARE(tan_phi); ts = SQUARE(t); con = 1.0 - es * SQUARE(sin_phi); n = r_major / sqrt(con); r = n * (1.0 - es) / con; d = x / (n * scale_factor); ds = SQUARE(d); *lat = phi - (n * tan_phi * ds / r) * (0.5 - ds / 24.0 * (5.0 + 3.0 * t + 10.0 * c - 4.0 * cs - 9.0 * esp - ds / 30.0 * (61.0 + 90.0 * t + 298.0 * c + 45.0 * ts - 252.0 * esp - 3.0 * cs))); *lon = adjust_lon(lon_center + (d * (1.0 - ds / 6.0 * (1.0 + 2.0 * t + c - ds / 20.0 * (5.0 - 2.0 * c + 28.0 * t - 3.0 * cs + 8.0 * esp + 24.0 * ts))) / cos_phi)); } else { *lat = HALF_PI * sign(y); *lon = lon_center; } return(OK); } hdf-eos5-2.0/gctp/src/vandgfor.c000077500000000000000000000073521507520047200164770ustar00rootroot00000000000000/******************************************************************************* NAME VAN DER GRINTEN PURPOSE: Transforms input longitude and latitude to Easting and Northing for the Van der Grinten projection. The longitude and latitude must be in radians. The Easting and Northing values will be returned in meters. PROGRAMMER DATE ---------- ---- T. Mittan March, 1993 This function was adapted from the Lambert Azimuthal Equal Area projection code (FORTRAN) in the General Cartographic Transformation Package software which is available from the U.S. Geological Survey National Mapping Division. ALGORITHM REFERENCES 1. "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder, The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355. 2. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 3. "Software Documentation for GCTP General Cartographic Transformation Package", U.S. Geological Survey National Mapping Division, May 1982. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double lon_center; /* Center longitude (projection center) */ static double R; /* Radius of the earth (sphere) */ static double false_easting; /* x offset in meters */ static double false_northing; /* y offset in meters */ /* Initialize the Van Der Grinten projection ----------------------------------------*/ int vandgforint( double r, /* (I) Radius of the earth (sphere) */ double center_long, /* (I) Center longitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { /* Place parameters in static storage for common use -------------------------------------------------*/ R = r; lon_center = center_long; false_easting = false_east; false_northing = false_north; /* Report parameters to the user -----------------------------*/ ptitle("VAN DER GRINTEN"); radius(r); cenlon(center_long); offsetp(false_easting,false_northing); return(OK); } /* Van Der Grinten forward equations--mapping lat,long to x,y ---------------------------------------------------------*/ int vandgfor( double lon, /* (I) Longitude */ double lat, /* (I) Latitude */ double *x, /* (O) X projection coordinate */ double *y) /* (O) Y projection coordinate */ { double dlon; double theta; double al,asq; double g,gsq; double m,msq; double con; double costh,sinth; /* Forward equations -----------------*/ dlon = adjust_lon(lon - lon_center); if (fabs(lat) <= EPSLN) { *x = false_easting + R * dlon; *y = false_northing; return (OK); } theta = asinz(2.0 * fabs(lat / PI)); if ((fabs(dlon) <= EPSLN) || (fabs(fabs(lat) - HALF_PI) <= EPSLN)) { *x = false_easting; if (lat >= 0) *y = false_northing + PI * R * tan(.5 * theta); else *y = false_northing + PI * R * -tan(.5 * theta); return(OK); } al = .5 * fabs((PI / dlon) - (dlon / PI)); asq = al * al; tsincos(theta,&sinth,&costh); g = costh / (sinth + costh - 1.0); gsq = g * g; m = g * (2.0 / sinth - 1.0); msq = m * m; con = PI * R * (al * (g - msq) + sqrt(asq * (g - msq) * (g - msq) - (msq + asq) * (gsq - msq))) / (msq + asq); if (dlon < 0) con = -con; *x = false_easting + con; con = fabs(con / (PI * R)); if (lat >= 0) *y = false_northing + PI * R * sqrt(1.0 - con * con - 2.0 * al * con); else *y = false_northing - PI * R * sqrt(1.0 - con * con - 2.0 * al * con); return(OK); } hdf-eos5-2.0/gctp/src/vandginv.c000077500000000000000000000071121507520047200164770ustar00rootroot00000000000000/******************************************************************************* NAME VAN DER GRINTEN PURPOSE: Transforms input Easting and Northing to longitude and latitude for the Van der Grinten projection. The Easting and Northing must be in meters. The longitude and latitude values will be returned in radians. PROGRAMMER DATE ---------- ---- T. Mittan March, 1993 This function was adapted from the Van Der Grinten projection code (FORTRAN) in the General Cartographic Transformation Package software which is available from the U.S. Geological Survey National Mapping Division. ALGORITHM REFERENCES 1. "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder, The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355. 2. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United State Government Printing Office, Washington D.C., 1987. 3. "Software Documentation for GCTP General Cartographic Transformation Package", U.S. Geological Survey National Mapping Division, May 1982. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double lon_center; /* Center longitude (projection center) */ static double R; /* Radius of the earth (sphere) */ static double false_easting; /* x offset in meters */ static double false_northing; /* y offset in meters */ /* Initialize the Van Der Grinten projection ----------------------------------------*/ int vandginvint( double r, /* (I) Radius of the earth (sphere) */ double center_long, /* (I) Center longitude */ double false_east, /* x offset in meters */ double false_north) /* y offset in meters */ { /* Place parameters in static storage for common use -------------------------------------------------*/ R = r; lon_center = center_long; false_easting = false_east; false_northing = false_north; /* Report parameters to the user -----------------------------*/ ptitle("VAN DER GRINTEN"); radius(r); cenlon(center_long); offsetp(false_easting,false_northing); return(OK); } /* Van Der Grinten inverse equations--mapping x,y to lat/long ---------------------------------------------------------*/ int vandginv( double x, /* (O) X projection coordinate */ double y, /* (O) Y projection coordinate */ double *lon, /* (I) Longitude */ double *lat) /* (I) Latitude */ { double xx,yy,xys,c1,c2,c3; double a1; double m1; double con; double th1; double d; /* inverse equations -----------------*/ x -= false_easting; y -= false_northing; con = PI * R; xx = x / con; yy = y / con; xys = xx * xx + yy * yy; c1 = -fabs(yy) * (1.0 + xys); c2 = c1 - 2.0 * yy * yy + xx * xx; c3 = -2.0 * c1 + 1.0 + 2.0 * yy * yy + xys * xys; d = yy * yy / c3 + (2.0 * c2 * c2 * c2 / c3 / c3 / c3 - 9.0 * c1 * c2 / c3 /c3) / 27.0; a1 = (c1 - c2 * c2 / 3.0 / c3) / c3; m1 = 2.0 * sqrt( -a1 / 3.0); con = ((3.0 * d) / a1) / m1; if (fabs(con) > 1.0) { if (con >= 0.0) con = 1.0; else con = -1.0; } th1 = acos(con) / 3.0; if (y >= 0) *lat = (-m1 * cos(th1 + PI / 3.0) - c2 / 3.0 / c3) * PI; else *lat = -(-m1 * cos(th1 + PI / 3.0) - c2 / 3.0 / c3) * PI; if (fabs(xx) < EPSLN) { *lon = lon_center; return(OK); } *lon = adjust_lon(lon_center + PI * (xys - 1.0 + sqrt(1.0 + 2.0 * (xx * xx - yy * yy) + xys * xys)) / 2.0 / xx); return(OK); } hdf-eos5-2.0/gctp/src/wivfor.c000077500000000000000000000056411507520047200162040ustar00rootroot00000000000000/******************************************************************************* NAME WAGNER IV PURPOSE: Transforms input longitude and latitude to Easting and Northing for the Wagner IV projection. The longitude and latitude must be in radians. The Easting and Northing values will be returned in meters. PROGRAMMER DATE REASON ---------- ---- ------ D. Steinwand, EROS May, 1991 S. Nelson, EROS Feb, 1995 Changed perror to p_error. This function was implemented with formulas supplied by John P. Snyder. ALGORITHM REFERENCES 1. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. 2. Snyder, John P., Personal correspondence, January 1991. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double lon_center; /* Center longitude (projection center) */ static double R; /* Radius of the earth (sphere) */ static double false_easting; /* x offset */ static double false_northing; /* y offset */ /* Initialize the Wagner IV projection ------------------------------------*/ int wivforint( double r, /* (I) Radius of the earth (sphere) */ double center_long, /* (I) Center longitude */ double false_east, /* x offset */ double false_north) /* y offset */ { /* Place parameters in static storage for common use -------------------------------------------------*/ R = r; lon_center = center_long; false_easting = false_east; false_northing = false_north; /* Report parameters to the user -----------------------------*/ ptitle("WAGNER IV"); radius(r); cenlon(center_long); offsetp(false_east,false_north); return(OK); } /* Wagner IV forward equations--mapping lat,long to x,y ----------------------------------------------------*/ int wivfor( double lon, /* (I) Longitude */ double lat, /* (I) Latitude */ double *x, /* (O) X projection coordinate */ double *y) /* (O) Y projection coordinate */ { double delta_lon; /* Delta longitude (Given longitude - center */ double theta; double delta_theta; double con; long i; /* Forward equations -----------------*/ delta_lon = adjust_lon(lon - lon_center); theta = lat; con = 2.9604205062 * sin(lat); /* Iterate using the Newton-Raphson method to find theta -----------------------------------------------------*/ for (i=0;;i++) { delta_theta = -(theta + sin(theta) - con) / (1.0 + cos(theta)); theta += delta_theta; if (fabs(delta_theta) < EPSLN) break; if (i >= 30) p_error("Iteration failed to converge","wagneriv-forward"); } theta /= 2.0; *x = 0.86310 * R * delta_lon * cos(theta) + false_easting; *y = 1.56548 * R * sin(theta) + false_northing; return(OK); } hdf-eos5-2.0/gctp/src/wivinv.c000077500000000000000000000046141507520047200162110ustar00rootroot00000000000000/******************************************************************************* NAME WAGNER IV PURPOSE: Transforms input Easting and Northing to longitude and latitude for the Wagner IV projection. The Easting and Northing must be in meters. The longitude and latitude values will be returned in radians. PROGRAMMER DATE ---------- ---- D. Steinwand, EROS May, 1991 This function was implemented with formulas supplied by John P. Snyder. ALGORITHM REFERENCES 1. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. 2. Snyder, John P., Personal correspondence, January 1991. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double lon_center; /* Center longitude (projection center) */ static double R; /* Radius of the earth (sphere) */ static double false_easting; /* x offset */ static double false_northing; /* y offset */ /* Initialize the Wagner IV projection ------------------------------------*/ int wivinvint( double r, /* (I) Radius of the earth (sphere) */ double center_long, /* (I) Center longitude */ double false_east, /* x offset */ double false_north) /* y offset */ { /* Place parameters in static storage for common use -------------------------------------------------*/ R = r; lon_center = center_long; false_easting = false_east; false_northing = false_north; /* Report parameters to the user -----------------------------*/ ptitle("WAGNER IV"); radius(r); cenlon(center_long); offsetp(false_east,false_north); return(OK); } /* Wagner IV inverse equations--mapping x,y to lat,long ----------------------------------------------------*/ int wivinv( double x, /* (I) X projection coordinate */ double y, /* (I) Y projection coordinate */ double *lon, /* (O) Longitude */ double *lat) /* (O) Latitude */ { double theta; /* Inverse equations -----------------*/ x -= false_easting; y -= false_northing; theta = asin(y / (1.56548 * R)); *lon = adjust_lon(lon_center + (x / (0.86310 * R * cos(theta)))); *lat = asin((2.0 * theta + sin(2.0 * theta)) / 2.9604205062); return(OK); } hdf-eos5-2.0/gctp/src/wviifor.c000077500000000000000000000051231507520047200163500ustar00rootroot00000000000000/******************************************************************************* NAME WAGNER VII PURPOSE: Transforms input longitude and latitude to Easting and Northing for the Wagner VII projection. The longitude and latitude must be in radians. The Easting and Northing values will be returned in meters. PROGRAMMER DATE ---------- ---- D. Steinwand, EROS May, 1991 This function was implemented with formulas supplied by John P. Snyder. ALGORITHM REFERENCES 1. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. 2. Snyder, John P., Personal correspondence, January 1991. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double lon_center; /* Center longitude (projection center) */ static double R; /* Radius of the earth (sphere) */ static double false_easting; /* x offset */ static double false_northing; /* y offset */ /* Initialize the Wagner VII projection ------------------------------------*/ int wviiforint( double r, /* (I) Radius of the earth (sphere) */ double center_long, /* (I) Center longitude */ double false_east, /* x offset */ double false_north) /* y offset */ { /* Place parameters in static storage for common use -------------------------------------------------*/ R = r; lon_center = center_long; false_easting = false_east; false_northing = false_north; /* Report parameters to the user -----------------------------*/ ptitle("WAGNER VII"); radius(r); cenlon(center_long); offsetp(false_easting,false_northing); return(OK); } /* Wagner VII forward equations--mapping lat,long to x,y -----------------------------------------------------*/ int wviifor( double lon, /* (I) Longitude */ double lat, /* (I) Latitude */ double *x, /* (O) X projection coordinate */ double *y) /* (O) Y projection coordinate */ { double delta_lon; /* Delta longitude (Given longitude - center */ double sin_lon, cos_lon; double s, c0, c1; /* Forward equations -----------------*/ delta_lon = adjust_lon(lon - lon_center); tsincos((delta_lon/3.0), &sin_lon, &cos_lon); s = 0.90631 * sin(lat); c0 = sqrt(1-s*s); c1 = sqrt(2.0 / (1.0 + c0 * cos_lon)); *x = 2.66723 * R * c0 * c1 * sin_lon + false_easting; *y = 1.24104 * R * s * c1 + false_northing; return(OK); } hdf-eos5-2.0/gctp/src/wviiinv.c000077500000000000000000000053641507520047200163650ustar00rootroot00000000000000/******************************************************************************* NAME WAGNER VII PURPOSE: Transforms input Easting and Northing to longitude and latitude for the Wagner VII projection. The Easting and Northing must be in meters. The longitude and latitude values will be returned in radians. PROGRAMMER DATE ---------- ---- D. Steinwand, EROS May, 1991 S. Nelson, EROS Dec, 1993 Added function call to "asinz" to fix errors at 90 and -90 deg lat. This replaced calls to "asin". This function was implemented with formulas supplied by John P. Snyder. ALGORITHM REFERENCES 1. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", U.S. Geological Survey Professional Paper 1453 , United State Government Printing Office, Washington D.C., 1989. 2. Snyder, John P., Personal correspondence, January 1991. *******************************************************************************/ #include #include "cproj.h" /* Variables common to all subroutines in this code file -----------------------------------------------------*/ static double lon_center; /* Center longitude (projection center) */ static double R; /* Radius of the earth (sphere) */ static double false_easting; /* x offset */ static double false_northing; /* y offset */ /* Initialize the Wagner VII projection ------------------------------------*/ int wviiinvint( double r, /* (I) Radius of the earth (sphere) */ double center_long, /* (I) Center longitude */ double false_east, /* x offset */ double false_north) /* y offset */ { /* Place parameters in static storage for common use -------------------------------------------------*/ R = r; lon_center = center_long; false_easting = false_east; false_northing = false_north; /* Report parameters to the user -----------------------------*/ ptitle("WAGNER VII"); radius(r); cenlon(center_long); offsetp(false_easting,false_northing); return(OK); } /* Wagner VII inverse equations--mapping x,y to lat,long -----------------------------------------------------*/ int wviiinv( double x, /* (I) X projection coordinate */ double y, /* (I) Y projection coordinate */ double *lon, /* (O) Longitude */ double *lat) /* (O) Latitude */ { double t1, t2, p, c; /* Inverse equations -----------------*/ x -= false_easting; y -= false_northing; t1 = x / 2.66723; t2 = y / 1.24104; t1 *= t1; t2 *= t2; p = sqrt(t1 + t2); c = 2.0 * asinz(p / (2.0 * R)); *lat = asinz(y * sin(c) / (1.24104 * 0.90631 * p)); *lon = adjust_lon(lon_center + 3.0 * atan2(x * tan(c), 2.66723 * p)); return(OK); } hdf-eos5-2.0/include/000077500000000000000000000000001507520047200144125ustar00rootroot00000000000000hdf-eos5-2.0/include/HE5_GctpFunc.h000077500000000000000000000362411507520047200167460ustar00rootroot00000000000000/*--------------------------------------------------------------------------------- | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | | Permission to use, 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 and that both that copyright notice and | | this permission notice appear in supporting documentation. | | | | BEGIN_FILE_PROLOG: | | FILENAME: | | HE5_GCTPFUNC.H | | DESCRIPTION: | | This file contains function prototypes that are specific to the GCTP | | AUTHOR: | | Alex Muslimov / Emergent Information Tecnologies, Inc. | | HISTORY: | | 14-May-01 AM Initial version | | END_FILE_PROLOG: | ---------------------------------------------------------------------------------- */ #ifndef HE5_GctpFunc_h #define HE5_GctpFunc_h /***************************************************************** Function prototypes. *****************************************************************/ int stplnfor(double lon, double lat, double *x, double *y); int stplninv(double x, double y, double *lon, double *lat); int stplnforint(long zone, long sphere, char *fn27, char *fn83); int stplninvint(long zone, long sphere, char *fn27, char *fn83); int alberfor(double lon, double lat, double *x, double *y); int alberinv(double x, double y, double *lon, double *lat); int alberforint(double r_maj, double r_min, double lat1, double lat2, double lon0, double lat0, double false_east, double false_north); int alberinvint(double r_maj, double r_min, double lat1, double lat2, double lon0, double lat0, double false_east, double false_north); int lamccfor(double lon, double lat, double *x, double *y); int lamccinv(double x, double y, double *lon, double *lat); int lamccforint(double r_maj, double r_min, double lat1, double lat2, double c_lon, double c_lat, double false_east, double false_north); int lamccinvint(double r_maj, double r_min, double lat1, double lat2, double c_lon, double c_lat, double false_east, double false_north); int merfor(double lon, double lat, double *x, double *y); int merinv(double x, double y, double *lon, double *lat); int merforint(double r_maj, double r_min, double center_lon, double center_lat, double false_east, double false_north); int merinvint(double r_maj, double r_min, double center_lon, double center_lat, double false_east, double false_north); int psfor(double lon, double lat, double *x, double *y); int psinv(double x, double y, double *lon, double *lat); int psforint(double r_maj, double r_min, double c_lon, double c_lat, double false_east, double false_north); int psinvint(double r_maj, double r_min, double c_lon, double c_lat, double false_east, double false_north); int polyfor(double lon, double lat, double *x, double *y); int polyinv(double x, double y, double *lon, double *lat); int polyforint(double r_maj, double r_min, double center_lon, double center_lat, double false_east, double false_north); int polyinvint(double r_maj, double r_min, double center_lon, double center_lat, double false_east, double false_north); int eqconfor(double lon, double lat, double *x, double *y); int eqconinv(double x, double y, double *lon, double *lat); int eqconforint(double r_maj, double r_min, double lat1, double lat2, double center_lon, double center_lat, double false_east, double false_north, long mode); int eqconinvint(double r_maj, double r_min, double lat1, double lat2, double center_lon, double center_lat, double false_east, double false_north, long mode); int tmfor(double lon, double lat, double *x, double *y); int tminv(double x, double y, double *lon, double *lat); int tmforint(double r_maj, double r_min, double scale_fact, double center_lon, double center_lat, double false_east, double false_north); int tminvint(double r_maj, double r_min, double scale_fact, double center_lon, double center_lat, double false_east, double false_north); int sterfor(double lon, double lat, double *x, double *y); int sterinv(double x, double y, double *lon, double *lat); int sterforint(double r_maj, double center_lon, double center_lat, double false_east, double false_north); int sterinvint(double r_maj, double center_lon, double center_lat, double false_east, double false_north); int lamazfor(double lon, double lat, double *x, double *y); int lamazinv(double x, double y, double *lon, double *lat); int lamazforint(double r, double center_long, double center_lat, double false_east, double false_north); int lamazinvint(double r, double center_long, double center_lat, double false_east, double false_north); int azimfor(double lon, double lat, double *x, double *y); int aziminv(double x, double y, double *lon, double *lat); int azimforint(double r_maj, double center_lon, double center_lat, double false_east, double false_north); int aziminvint(double r_maj, double center_lon, double center_lat, double false_east, double false_north); int gnomfor(double lon, double lat, double *x, double *y); int gnominv(double x, double y, double *lon, double *lat); int gnomforint(double r, double center_long, double center_lat, double false_east, double false_north); int gnominvint(double r, double center_long, double center_lat, double false_east, double false_north); int orthfor(double lon, double lat, double *x, double *y); int orthinv(double x, double y, double *lon, double *lat); int orthforint(double r_maj, double center_lon, double center_lat, double false_east, double false_north); int orthinvint(double r_maj, double center_lon, double center_lat, double false_east, double false_north); int gvnspfor(double lon, double lat, double *x, double *y); int gvnspinv(double x, double y, double *lon, double *lat); int gvnspforint(double r, double h, double center_long, double center_lat, double false_east, double false_north); int gvnspinvint(double r, double h, double center_long, double center_lat, double false_east, double false_north); int sinfor(double lon, double lat, double *x, double *y); int sininv(double x, double y, double *lon, double *lat); int sinforint(double r, double center_long, double false_east, double false_north); int sininvint(double r, double center_long, double false_east, double false_north); int equifor(double lon, double lat, double *x, double *y); int equiinv(double x, double y, double *lon, double *lat); int equiforint(double r_maj, double center_lon, double lat1, double false_east, double false_north); int equiinvint(double r_maj, double center_lon, double lat1, double false_east, double false_north); int millfor(double lon, double lat, double *x, double *y); int millinv(double x, double y, double *lon, double *lat); int millforint(double r, double center_long, double false_east, double false_north); int millinvint(double r, double center_long, double false_east, double false_north); int vandgfor(double lon, double lat, double *x, double *y); int vandginv(double x, double y, double *lon, double *lat); int vandgforint(double r, double center_long, double false_east, double false_north); int vandginvint(double r, double center_long, double false_east, double false_north); int omerfor(double lon, double lat, double *x, double *y); int omerinv(double x, double y, double *lon, double *lat); int omerforint(double r_maj, double r_min, double scale_fact, double azimuth, double lon_orig, double lat_orig, double false_east, double false_north, double lon1, double lat1, double lon2, double lat2, long mode); int omerinvint(double r_maj, double r_min, double scale_fact, double azimuth, double lon_orig, double lat_orig, double false_east, double false_north, double lon1, double lat1, double lon2, double lat2, long mode); int somfor(double lon, double lat, double *x, double *y); int sominv(double x, double y, double *lon, double *lat); int somforint(double r_major, double r_minor, long satnum, long path, double alf_in, double lon, double false_east, double false_north, double time, long start1, long flag, double sat_ratio); int sominvint(double r_major, double r_minor, long satnum, long path, double alf_in, double lon, double false_east, double false_north, double time, long start1, long flag, double sat_ratio); int hamfor(double lon, double lat, double *x, double *y); int haminv(double x, double y, double *lon, double *lat); int hamforint(double r, double center_long, double false_east, double false_north); int haminvint(double r, double center_long, double false_east, double false_north); int robfor(double lon, double lat, double *x, double *y); int robinv(double x, double y, double *lon, double *lat); int robforint(double r, double center_long, double false_east, double false_north); int robinvint(double r, double center_long, double false_east, double false_north); int goodfor(double lon, double lat, double *x, double *y); int goodinv(double x, double y, double *lon, double *lat); int goodforint(double r); int goodinvint(double r); int molwfor(double lon, double lat, double *x, double *y); int molwinv(double x, double y, double *lon, double *lat); int molwforint(double r, double center_long, double false_east, double false_north); int molwinvint(double r, double center_long, double false_east, double false_north); int imolwfor(double lon, double lat, double *x, double *y); int imolwinv(double x, double y, double *lon, double *lat); int imolwforint(double r); int imolwinvint(double r); int alconfor(double lon, double lat, double *x, double *y); int alconinv(double x, double y, double *lon, double *lat); int alconforint(double r_maj, double r_min, double false_east, double false_north); int alconinvint(double r_maj, double r_min, double false_east, double false_north); int wivfor(double lon, double lat, double *x, double *y); int wivinv(double x, double y, double *lon, double *lat); int wivforint(double r, double center_long, double false_east, double false_north); int wivinvint(double r, double center_long, double false_east, double false_north); int wviifor(double lon, double lat, double *x, double *y); int wviiinv(double x, double y, double *lon, double *lat); int wviiforint(double r, double center_long, double false_east, double false_north); int wviiinvint(double r, double center_long, double false_east, double false_north); int obleqfor(double lon, double lat, double *x, double *y); int obleqinv(double x, double y, double *lon, double *lat); int obleqforint(double r, double center_long, double center_lat, double shape_m, double shape_n, double angle, double false_east, double false_north); int obleqinvint(double r, double center_long, double center_lat, double shape_m, double shape_n, double angle, double false_east, double false_north); int isinusfor(double lon, double lat, double *x, double *y); int isinusinv(double x, double y, double *lon, double *lat); long isinusforinit(double sphere, double lon_cen_mer, double false_east, double false_north, double dzone, double djustify); long isinusinvinit(double sphere, double lon_cen_mer, double false_east, double false_north, double dzone, double djustify); int utmfor(double lon, double lat, double *x, double *y); int utminv(double x, double y, double *lon, double *lat); int utmforint(double r_maj, double r_min, double scale_fact, long zone); int utminvint(double r_maj, double r_min, double scale_fact, long zone); long calc_utm_zone(double lon); int bceaforint(double r_maj, double center_lon, double center_lat, double false_east, double false_north); int bceafor(double lon, double lat, double *x, double *y); int bceainvint(double r_maj, double center_lon, double center_lat, double false_east, double false_north); int bceainv(double x, double y, double *lon, double *lat); int ceaforint(double r_maj, double r_min, double center_lon, double center_lat, double false_east, double false_north); int ceafor(double lon, double lat, double *x, double *y); int ceainvint(double r_maj, double r_min, double center_lon, double center_lat, double false_east, double false_north); int ceainv(double x, double y, double *lon, double *lat); void p_error(char *what, char *where); void ptitle(char *A); void tsincos(double val, double *sin_val, double *cos_val); double msfnz(double eccent, double sinphi, double cosphi); double qsfnz(double eccent, double sinphi, double cosphi); double tsfnz(double eccent, double phi, double sinphi); void radius2(double A, double B); void radius(double A); void stanparl(double A, double B); void cenlonmer(double A); void cenlon(double A); void cenlat(double A); void origin(double A); void offsetp(double A, double B); double adjust_lon(double x); double phi1z(double eccent, double qs, long *flag); double phi2z(double eccent, double ts, long *flag); double phi3z(double ml, double e0, double e1, double e2, double e3, long *flag); double phi4z(double eccent, double e0, double e1, double e2, double e3, double a, double b, double *c, double *phi); double asinz(double con); int sign(double x); double e0fn(double x); double e1fn(double x); double e2fn(double x); double e3fn(double x); double e4fn(double x); double mlfn(double e0, double e1, double e2, double e3, double phi); double paksz(double ang, long *iflg); double pakcz(double pak); void stparl1(double A); void genrpt(double A, char *S); void genrpt_long(long A, char *S); void pblank(); void for_init(int a, int b, double c[], int d, char *str1, char *str2, int *e, int (**func)(double, double, double *, double *)); void inv_init(int a,int b,double *c,int d,char *str1,char *str2,int *e,int (**func)(double, double, double*, double*)); #endif hdf-eos5-2.0/include/HE5_HdfEosDef.h000077500000000000000000001351551507520047200170300ustar00rootroot00000000000000/*----------------------------------------------------------------------------| | | | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | | | |Permission to use, 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 and that both that copyright notice and| |this permission notice appear in supporting documentation. | | | |-----------------------------------------------------------------------------| | | | This is the main header file to be distributed with the HDF-EOS library. | | | | Last date updated: June 5, 2001 | | Aug 23, 2001 A.M. Added thread-safe related blocks. | | May 29, 2002 S.Z Added ZA interface | | August, 2003 S.Z Added szip compression methods. | | April, 2004 S.Z Added a data type flag HE5T_CHARSTRING| | August, 2004 S.Z Added field number type in | | HE5_CmpDTSinfo | -----------------------------------------------------------------------------*/ #ifndef HE5_HDFEOSDEF_H_ #define HE5_HDFEOSDEF_H_ #include #ifdef H5_USE_16_API #include #endif #include #include #include #include #ifndef __cplusplus /* #include */ #endif #ifdef _HDFEOS5_THREADSAFE #include #endif #define HE5_HDFEOSVERSION "1.17" #define H5_USE_16_API 1 #ifndef FALSE # define FALSE 0 #endif #ifndef TRUE # define TRUE (!FALSE) #endif #ifndef SUCCEED # define SUCCEED 0 #endif #ifndef FAIL # define FAIL (-1) #endif #ifndef HDstrcmp # define HDstrcmp(X,Y) strcmp(X,Y) #endif #ifndef MAX # define MAX(X,Y) ((X)>(Y)?(X):(Y)) #endif #ifndef MIN # define MIN(X,Y) ((X)<(Y)?(X):(Y)) #endif #define CHECKPOINTER(p) { \ status = HE5_EHchkptr((void *)p,#p); \ if (status == FAIL) goto COMPLETION; \ } #define CHECKNAME(p) { \ status = HE5_EHchkname((char *)p,#p); \ if (status == FAIL) goto COMPLETION; \ } #ifndef HDFI_H typedef unsigned uintn; #endif #ifdef WIN32 #define LONGLONG __int64 #else #define LONGLONG long long #endif /* ---------------------------------------------- | HDF-EOS Defined Sizes | ---------------------------------------------- */ #define HE5_DTSETRANKMAX 8 #define HE5_FLDNUMBERMAX 500 #define HE5_OBJNAMELENMAX 256 #define HE5_BLKSIZE 640000 #define HE5_CHUNKSIZE 1000 #define HE5_DIMNUMBERMAX 500 #define HE5_ATTRNUMBERMAX 100 /* max number of attr for each dim scale */ #define HE5_HDFE_TYPESTRSIZE 80 #define HE5_HDFE_DIMBUFSIZE 256 #define HE5_HDFE_NAMBUFSIZE 256 #define HE5_HDFE_ERRBUFSIZE 256 #define HE5_HDFE_UTLBUFSIZE 1024 /* ---------------------------------------------- | HDF-EOS Global Data Structures | ---------------------------------------------- */ typedef struct { hid_t ID; /* Field-associated dataset ID */ char *name; /* HDF-EOS field name */ }HE5_DTSinfo; /* Field-associated dataset Info */ typedef struct { char *attrname[HE5_ATTRNUMBERMAX]; /* attribute name */ hid_t numtype[HE5_ATTRNUMBERMAX]; hsize_t count[HE5_ATTRNUMBERMAX][8]; uint8_t *datbuf[HE5_ATTRNUMBERMAX]; int dsnumberOfAttrs; /* total number of attributes for one dim scale */ }HE5_dimscaleAttr; /* ---------------------------------------------- | Compound Dataset Information Data | | Structure | ---------------------------------------------- */ typedef struct { int nfields; /* Number of data fields */ int rank[HE5_FLDNUMBERMAX]; /* Fields rank array */ int array[HE5_FLDNUMBERMAX]; /* Flag if field is an array*/ char *fieldname[HE5_FLDNUMBERMAX];/* Array of field names */ /* Array of dimension sizes */ size_t dims[HE5_FLDNUMBERMAX][HE5_DTSETRANKMAX]; size_t datasize; /* Size of data (bytes) */ size_t offset[HE5_FLDNUMBERMAX]; /* Array of field offsets */ hid_t dtype[HE5_FLDNUMBERMAX]; /* Array of field type IDs */ hid_t numtype[HE5_FLDNUMBERMAX];/* Array of field number type IDs */ H5T_class_t dclass[HE5_FLDNUMBERMAX]; /* Array of field class IDs */ }HE5_CmpDTSinfo; typedef struct { long count; /* Object counter */ long strsize; /* Operator data */ char *name; /* Object name */ }HE5_OBJINFO; /* File access flags for TOOLKIT */ /* ----------------------------- */ #ifndef HDF4_ACC_RDONLY # define HDF4_ACC_RDONLY 1 #endif #ifndef HDF5_ACC_RDONLY # define HDF5_ACC_RDONLY 11 #endif #ifndef HDF4_ACC_RDWR # define HDF4_ACC_RDWR 3 #endif #ifndef HDF5_ACC_RDWR # define HDF5_ACC_RDWR 13 #endif #ifndef HDF4_ACC_CREATE # define HDF4_ACC_CREATE 4 #endif #ifndef HDF5_ACC_CREATE # define HDF5_ACC_CREATE 14 #endif /* Data type flags for FORTRAN wrappers */ /* ------------------------------------ */ #ifndef HE5F_ACC_RDWR #define HE5F_ACC_RDWR 100 #endif #ifndef HE5F_ACC_RDONLY #define HE5F_ACC_RDONLY 101 #endif #ifndef HE5F_ACC_TRUNC #define HE5F_ACC_TRUNC 102 #endif #define HE5T_NATIVE_INT ((hid_t) 0) #define HE5T_NATIVE_UINT ((hid_t) 1) #define HE5T_NATIVE_SHORT ((hid_t) 2) #define HE5T_NATIVE_USHORT ((hid_t) 3) #define HE5T_NATIVE_SCHAR ((hid_t) 4) #define HE5T_NATIVE_UCHAR ((hid_t) 5) #define HE5T_NATIVE_LONG ((hid_t) 6) #define HE5T_NATIVE_ULONG ((hid_t) 7) #define HE5T_NATIVE_LLONG ((hid_t) 8) #define HE5T_NATIVE_ULLONG ((hid_t) 9) #define HE5T_NATIVE_FLOAT ((hid_t) 10) #define HE5T_NATIVE_REAL ((hid_t) 10) #define HE5T_NATIVE_DOUBLE ((hid_t) 11) #define HE5T_NATIVE_LDOUBLE ((hid_t) 12) #define HE5T_NATIVE_INT8 ((hid_t) 13) #define HE5T_NATIVE_UINT8 ((hid_t) 14) #define HE5T_NATIVE_INT16 ((hid_t) 15) #define HE5T_NATIVE_UINT16 ((hid_t) 16) #define HE5T_NATIVE_INT32 ((hid_t) 17) #define HE5T_NATIVE_UINT32 ((hid_t) 18) #define HE5T_NATIVE_INT64 ((hid_t) 19) #define HE5T_NATIVE_UINT64 ((hid_t) 20) #define HE5T_NATIVE_B8 ((hid_t) 21) #define HE5T_NATIVE_B16 ((hid_t) 22) #define HE5T_NATIVE_B32 ((hid_t) 23) #define HE5T_NATIVE_B64 ((hid_t) 24) #define HE5T_NATIVE_HSIZE ((hid_t) 25) #define HE5T_NATIVE_HERR ((hid_t) 26) #define HE5T_NATIVE_HBOOL ((hid_t) 27) #define HE5T_STD_I8BE ((hid_t) 28) #define HE5T_STD_I8LE ((hid_t) 29) #define HE5T_STD_I16BE ((hid_t) 30) #define HE5T_STD_I16LE ((hid_t) 31) #define HE5T_STD_I32BE ((hid_t) 32) #define HE5T_STD_I32LE ((hid_t) 33) #define HE5T_STD_I64BE ((hid_t) 34) #define HE5T_STD_I64LE ((hid_t) 35) #define HE5T_STD_U8BE ((hid_t) 36) #define HE5T_STD_U8LE ((hid_t) 37) #define HE5T_STD_U16BE ((hid_t) 38) #define HE5T_STD_U16LE ((hid_t) 39) #define HE5T_STD_U32BE ((hid_t) 40) #define HE5T_STD_U32LE ((hid_t) 41) #define HE5T_STD_U64BE ((hid_t) 42) #define HE5T_STD_U64LE ((hid_t) 43) #define HE5T_STD_B8BE ((hid_t) 44) #define HE5T_STD_B8LE ((hid_t) 45) #define HE5T_STD_B16BE ((hid_t) 46) #define HE5T_STD_B16LE ((hid_t) 47) #define HE5T_STD_B32BE ((hid_t) 48) #define HE5T_STD_B32LE ((hid_t) 49) #define HE5T_STD_B64BE ((hid_t) 50) #define HE5T_STD_B64LE ((hid_t) 51) #define HE5T_IEEE_F32BE ((hid_t) 52) #define HE5T_IEEE_F32LE ((hid_t) 53) #define HE5T_IEEE_F64BE ((hid_t) 54) #define HE5T_IEEE_F64LE ((hid_t) 55) #define HE5T_NATIVE_CHAR ((hid_t) 56) #define HE5T_CHARSTRING ((hid_t) 57) #define HE5S_UNLIMITED_F ((hid_t) -1) #define HE5S_UNLIMITED_F_64 ((hid_t) -1) /* Field Merge Flags */ /* ------------------- */ #define HE5_HDFE_NOMERGE 0 #define HE5_HDFE_AUTOMERGE 1 /* XXentries Codes */ /* ------------------- */ #define HE5_HDFE_NENTDIM 0 #define HE5_HDFE_NENTMAP 1 #define HE5_HDFE_NENTIMAP 2 #define HE5_HDFE_NENTGFLD 3 #define HE5_HDFE_NENTDFLD 4 /* Angle Conversion Codes */ /* ---------------------- */ #define HE5_HDFE_RAD_DEG 0 #define HE5_HDFE_DEG_RAD 1 #define HE5_HDFE_DMS_DEG 2 #define HE5_HDFE_DEG_DMS 3 #define HE5_HDFE_RAD_DMS 4 #define HE5_HDFE_DMS_RAD 5 /* Swath Subset Modes */ /* ------------------------ */ #define HE5_HDFE_MIDPOINT 0 #define HE5_HDFE_ENDPOINT 1 #define HE5_HDFE_ANYPOINT 2 #define HE5_HDFE_INTERNAL 0 #define HE5_HDFE_EXTERNAL 1 #define HE5_HDFE_NOPREVSUB -1 /* Grid Origin Codes */ /* ----------------------- */ #define HE5_HDFE_GD_UL 0 #define HE5_HDFE_GD_UR 1 #define HE5_HDFE_GD_LL 2 #define HE5_HDFE_GD_LR 3 /* Pixel Registration Codes */ /* ------------------------ */ #define HE5_HDFE_CENTER 0 #define HE5_HDFE_CORNER 1 /* GCTP Projection Codes */ /* --------------------- */ #define HE5_GCTP_GEO 0 #define HE5_GCTP_UTM 1 #define HE5_GCTP_SPCS 2 #define HE5_GCTP_ALBERS 3 #define HE5_GCTP_LAMCC 4 #define HE5_GCTP_MERCAT 5 #define HE5_GCTP_PS 6 #define HE5_GCTP_POLYC 7 #define HE5_GCTP_EQUIDC 8 #define HE5_GCTP_TM 9 #define HE5_GCTP_STEREO 10 #define HE5_GCTP_LAMAZ 11 #define HE5_GCTP_AZMEQD 12 #define HE5_GCTP_GNOMON 13 #define HE5_GCTP_ORTHO 14 #define HE5_GCTP_GVNSP 15 #define HE5_GCTP_SNSOID 16 #define HE5_GCTP_EQRECT 17 #define HE5_GCTP_MILLER 18 #define HE5_GCTP_VGRINT 19 #define HE5_GCTP_HOM 20 #define HE5_GCTP_ROBIN 21 #define HE5_GCTP_SOM 22 #define HE5_GCTP_ALASKA 23 #define HE5_GCTP_GOOD 24 #define HE5_GCTP_MOLL 25 #define HE5_GCTP_IMOLL 26 #define HE5_GCTP_HAMMER 27 #define HE5_GCTP_WAGIV 28 #define HE5_GCTP_WAGVII 29 #define HE5_GCTP_OBLEQA 30 #define HE5_GCTP_CEA 97 #define HE5_GCTP_BCEA 98 #define HE5_GCTP_ISINUS 99 /* Tiling Codes */ /* ----------------------- */ #define HE5_HDFE_NOTILE 0 #define HE5_HDFE_TILE 1 /* Compression Methods */ /* ------------------------- */ #define HE5_HDFE_COMP_NONE 0 #define HE5_HDFE_COMP_RLE 1 #define HE5_HDFE_COMP_NBIT 2 #define HE5_HDFE_COMP_SKPHUFF 3 #define HE5_HDFE_COMP_DEFLATE 4 #define HE5_HDFE_COMP_SZIP_CHIP 5 #define HE5_HDFE_COMP_SZIP_K13 6 #define HE5_HDFE_COMP_SZIP_EC 7 #define HE5_HDFE_COMP_SZIP_NN 8 #define HE5_HDFE_COMP_SZIP_K13orEC 9 #define HE5_HDFE_COMP_SZIP_K13orNN 10 #define HE5_HDFE_COMP_SHUF_DEFLATE 11 #define HE5_HDFE_COMP_SHUF_SZIP_CHIP 12 #define HE5_HDFE_COMP_SHUF_SZIP_K13 13 #define HE5_HDFE_COMP_SHUF_SZIP_EC 14 #define HE5_HDFE_COMP_SHUF_SZIP_NN 15 #define HE5_HDFE_COMP_SHUF_SZIP_K13orEC 16 #define HE5_HDFE_COMP_SHUF_SZIP_K13orNN 17 /* HDFEOS Group Codes */ /* ------------------------------- */ #define HE5_HDFE_GEOGROUP 0 #define HE5_HDFE_DATAGROUP 1 #define HE5_HDFE_ATTRGROUP 2 #define HE5_HDFE_GRPATTRGROUP 3 #define HE5_HDFE_LOCATTRGROUP 4 #define HE5_HDFE_PROFGROUP 5 #define HE5_HDFE_PROFGRPATTRGROUP 6 #define HE5_HDFE_GEOGRPATTRGROUP 7 /* ---------------------------------------------- | For HDF-EOS5 Thread Safe Library | ---------------------------------------------- */ #ifdef _HDFEOS5_THREADSAFE typedef struct { pthread_mutex_t Lock; pthread_t *MasterThread; pthread_cond_t CondVar; unsigned int LockCount; } HE5_HDFE_MutexStruct; extern HE5_HDFE_MutexStruct GlobalMutex; /* Macro for first thread initialization */ /* ------------------------------------- */ #define HE5_FIRST_THREAD_INIT { \ status = pthread_once(&HE5_HDFE_TS_FirstInit, HE5_TSinitfirst); \ } /* Macro for locking the mutex */ /* --------------------------- */ #define HE5_LOCK { \ status = HE5_TSmutexlock(&GlobalMutex); \ if (status != SUCCEED) goto COMPLETION; \ } /* Macro for unlocking the mutex */ /* ----------------------------- */ #define HE5_UNLOCK { \ status = HE5_TSmutexunlock(&GlobalMutex); \ if (status != SUCCEED) goto COMPLETION; \ } #else /* -D_HDFEOS5_THREADSAFE */ typedef struct { int dummyVar; } HE5_HDFE_MutexStruct; /* disable any first thread init mechanism */ /* --------------------------------------- */ #define HE5_FIRST_THREAD_INIT /* disable locks */ /* ------------- */ #define HE5_LOCK #define HE5_UNLOCK #endif /* -D_HDFEOS5_THREADSAFE */ #ifdef __cplusplus extern "C" { #endif /* Thread-safe function prototypes */ /* ------------------------------- */ void HE5_TSinitfirst( void); herr_t HE5_TSmutexlock(HE5_HDFE_MutexStruct *); herr_t HE5_TSmutexunlock(HE5_HDFE_MutexStruct *); /* GCTP function prototypes */ /* ------------------------ */ /* #include "HE5_GctpFunc.h" */ /* HDF5 Error handling function (from "H5private.h") */ /* ------------------------------------------------- */ herr_t H5E_push(H5E_major_t maj_num, H5E_minor_t min_num, const char *func_name, const char *file_name, unsigned line, const char *desc); /* ********************************************************************** * E R R O R H A N D L I N G I N T E R F A C E * ********************************************************************** */ /* File access/info routines */ hid_t HE5_EHopen(const char *filename, unsigned flags, hid_t access_id); herr_t HE5_EHclose(hid_t fid); herr_t HE5_EHgetversion(hid_t fid, char *version); herr_t HE5_EHchkfid(hid_t fid, const char *name, hid_t *HDFfid, hid_t *grpID, uintn *access); herr_t HE5_EHidinfo(hid_t fid, hid_t *HDFfid, hid_t *gid); long HE5_EHattrcat(hid_t fid, char *grpname, char *objectlist, long *strbufsize); long HE5_EHinquire(const char *filename, char *grpname, char *objectlist, long *strbufsize); hsize_t HE5_EHset_error_on(int flag, int err_level); herr_t HE5_EHwritemeta(hid_t fid, const char *MetadataName, char *metabuff); herr_t HE5_EHreadmeta(hid_t fid, const char *MetadataName, char *metabufout, long *bufferSize); long HE5_EHinqmetadatas(hid_t fid, char *metadatanames, long *strbufsize); /* PROTOTYPES: functions to turn HDFEOS5 error printing off */ herr_t HE5_EHprint(char *errbuf, const char *file, unsigned line); /* Metadata access/info routines */ char *HE5_EHmetagroup(hid_t fid , char *structname, char *structcode, char *groupname, char *metaptrs[]); herr_t HE5_EHgetmetavalue(char *metaptrs[], char *parameter, char *retstr); herr_t HE5_EHinsertmeta(hid_t fid, const char *structname, char *structcode, long metacode, char *metastr, hsize_t metadata[]) ; herr_t HE5_EHmetalist(char *instring, char *outstring); herr_t HE5_EHupdatemeta(hid_t fid, const char *structname, char *structcode, long metacode, char *metastr, hsize_t metadata[]); /* Object info routines */ long HE5_EHcntOBJECT(char *metabuf[]); long HE5_EHcntGROUP(char *metabuf[]); herr_t HE5_EHattr( hid_t attgrpID, const char *attrname, hid_t ntype, hsize_t count[], char *wrcode, void *datbuf); herr_t HE5_EHattrinfo( hid_t attgrpID, const char *attrname, hid_t ntype[], hsize_t *count); herr_t HE5_EHattrinfo2( hid_t attgrpID, const char *attrname, hid_t ntype[], hsize_t *count, hsize_t *size); long HE5_EHdatasetcat(hid_t fid, char *grpname, char *objectlist, long *strbufsize); int HE5_EHobj_info(hid_t loc_id, const char *name, void *opdata); /* Utility routines */ long HE5_EHparsestr(const char *instring, char delim, char *pntr[], size_t len[]); long HE5_EHstrwithin(char *target, char *search, char delim); long HE5_EHstrwithin_index(char *target, char *search, char delim,int* index_found); herr_t HE5_EHloadliststr(char *ptr[], long nentries, char *liststr, char delim); double HE5_EHconvAng(double inAngle, int code); herr_t HE5_EHrevflds(char *dimlist, char *revdimlist); herr_t HE5_EHbisect(double(*func) (double[]), double funcParms[], long nParms, double limLft, double limRgt, double convCrit, double *root); hid_t HE5_EHdtype2mtype(hid_t dtypeID); hid_t HE5_EHdtype2numtype(hid_t dtype); hid_t HE5_EHconvdatatype(hid_t fortdatatype); herr_t HE5_EHwriteglbattr(hid_t fid, const char *attrname, hid_t ntype, hsize_t count[], void *datbuf); herr_t HE5_EHreadglbattr(hid_t fid, const char *attrname, void * datbuf); herr_t HE5_EHglbattrinfo(hid_t fid, const char *attrname, hid_t *ntype, hsize_t *count); herr_t HE5_EHglbattrinfo2(hid_t fid, const char *attrname, hid_t *ntype, hsize_t *count, hsize_t *size); long HE5_EHinqglbattrs(hid_t fid, char *attrnames, long *strbufsize); herr_t HE5_EHinqglbdatatype(hid_t fid, const char *attrname, hid_t *dtype, H5T_class_t *classid, H5T_order_t *order, size_t *size); int HE5_szip_can_encode(void ); /* Data type conversion wrappers */ long HE5_EHhid2long(hid_t invalue); long HE5_EHint2long(int invalue); int HE5_EHhid2int(hid_t invalue); hid_t HE5_EHint2hid(int invalue); hid_t HE5_EHlong2hid(long invalue); int HE5_EHlong2int(long invalue); hsize_t HE5_EHhid2hsize(hid_t invalue); hsize_t HE5_EHint2hsize(int invalue); hsize_t HE5_EHlong2hsize(long invalue); hid_t HE5_EHhsize2hid(hsize_t invalue); long HE5_EHhsize2long(hsize_t invalue); int HE5_EHhsize2int(hsize_t invalue); hssize_t HE5_EHhsize2hssize(hsize_t invalue); hssize_t HE5_EHhid2hssize(hid_t invalue); hssize_t HE5_EHint2hssize(int invalue); hssize_t HE5_EHlong2hssize(long invalue); hid_t HE5_EHhssize2hid(hssize_t invalue); long HE5_EHhssize2long(hssize_t invalue); int HE5_EHhssize2int(hssize_t invalue); hsize_t HE5_EHhssize2hsize(hssize_t invalue); unsigned LONGLONG HE5_EHint2ullong(int invalue); long HE5_EHullong2long(unsigned LONGLONG invalue); herr_t HE5_EHchkptr(void *p, char *name); herr_t HE5_EHchkname(char *p, char *name); int HE5_EHHEisHE5(char *filename); /* ********************************************************************** * S W A T H I N T E R F A C E * ********************************************************************** */ /* File/Swath access routines */ hid_t HE5_SWopen(const char *filename, uintn flags); hid_t HE5_SWcreate(hid_t fid, const char *swathname); hid_t HE5_SWattach(hid_t fid, const char *swathname); herr_t HE5_SWdetach(hid_t swathID); herr_t HE5_SWclose(hid_t fid); /* Definition routines */ herr_t HE5_SWdefdim(hid_t swathID, char *dimname, hsize_t dim); herr_t HE5_SWdefdimmap(hid_t swathID, char *geodim, char *datadim, hsize_t offset, hsize_t increment); herr_t HE5_SWdefidxmap(hid_t swathID, char *geodim, char *datadim, long index[]); herr_t HE5_SWdefgeofield(hid_t swathID, const char *fieldname, char *dimlist, char *maxdimlist, hid_t ntype , int merge); herr_t HE5_SWdefdatafield(hid_t swathID, const char *fieldname, char *dimlist, char *maxdimlist, hid_t ntype, int merge); herr_t HE5_SWdefchunk(hid_t swathID, int ndims, const hsize_t *dim); herr_t HE5_SWdefcomp(hid_t swathID, int compcode, int *compparm); herr_t HE5_SWdefcomchunk(hid_t swathID, int compcode, int *compparm, int ndims, const hsize_t *dim); herr_t HE5_SWsetfillvalue(hid_t swathID, char *fieldname, hid_t ntype, void *fillval); herr_t HE5_SWsetalias(hid_t swathID, char *fieldname, const char *aliaslist); herr_t HE5_SWdropalias(hid_t swathID, int fldgroup, const char *aliasname); herr_t HE5_SWfldrename(hid_t swathID, char *oldfieldname, const char *newfieldname); herr_t HE5_SWsetdimscale(hid_t swathID, char *fieldname, char *dimname,const hsize_t dimsize, hid_t numbertype, void * databuff); herr_t HE5_SWdefdimscale(hid_t swathID, char *dimname, const hsize_t dimsize, hid_t numbertype, void * datbuff); /* I/O routines */ herr_t HE5_SWwritedatameta(hid_t swathID, const char *fieldname, char *dimlist, hid_t mvalue); herr_t HE5_SWwriteattr(hid_t swathID, const char *attrname, hid_t ntype, hsize_t count[], void *datbuf); herr_t HE5_SWwritegrpattr(hid_t swathID, const char *attrname, hid_t ntype, hsize_t count[], void *datbuf); herr_t HE5_SWwritegeogrpattr(hid_t swathID, const char *attrname, hid_t ntype, hsize_t count[], void *datbuf); herr_t HE5_SWwritelocattr(hid_t swathID, const char *fieldname, const char *attrname, hid_t ntype, hsize_t count[], void *datbuf); herr_t HE5_SWreadattr(hid_t swathID, const char *attrname, void *datbuf); herr_t HE5_SWreadgrpattr(hid_t swathID, const char *attrname, void *datbuf); herr_t HE5_SWreadgeogrpattr(hid_t swathID, const char *attrname, void *datbuf); herr_t HE5_SWreadlocattr(hid_t swathID, const char *fieldname, const char *attrname, void *datbuf); herr_t HE5_SWwritefield(hid_t swathID, char *fieldname, const hssize_t start[], const hsize_t stride[], const hsize_t edge[], void *data); herr_t HE5_SWreadfield(hid_t swathID, char *fieldname, const hssize_t start[], const hsize_t stride[], const hsize_t edge[], void *data); herr_t HE5_SWwritegeometa(hid_t swathID, const char *fieldname, char *dimlist, hid_t mvalue); herr_t HE5_SWwritedscaleattr(hid_t swathID, const char *fieldname, const char *attrname, hid_t numtype, hsize_t count[], void *datbuf); /* Inquiry routines */ herr_t HE5_SWchunkinfo(hid_t swathID, char *fieldname, int *ndims, hsize_t dims[]); hsize_t HE5_SWdiminfo(hid_t swathID, char *dimname); herr_t HE5_SWmapinfo(hid_t swathID, char *geodim, char *datadim, long *offset, long *increment); hsize_t HE5_SWidxmapinfo(hid_t swathID, char *geodim, char *datadim, long index[]); int HE5_SWfldsrch(hid_t swathID, char *fieldname, hid_t *fieldID, int *rank, hsize_t dims[], hid_t *typeID); herr_t HE5_SWfieldinfo(hid_t swathID, char *fieldname, int *rank, hsize_t dims[], hid_t ntype[], char *dimlist, char *maxdimlist); herr_t HE5_SWcompinfo(hid_t swathID, char *fieldname, int *compcode, int compparm[]); herr_t HE5_SWattrinfo(hid_t swathID, const char *attrname, hid_t *ntype, hsize_t *count); herr_t HE5_SWgrpattrinfo(hid_t swathID, const char *attrname, hid_t *ntype, hsize_t *count); herr_t HE5_SWgeogrpattrinfo(hid_t swathID, const char *attrname, hid_t *ntype, hsize_t *count); herr_t HE5_SWlocattrinfo(hid_t swathID, const char *fieldname, const char *attrname, hid_t *ntype, hsize_t *count); herr_t HE5_SWattrinfo2(hid_t swathID, const char *attrname, hid_t *ntype, hsize_t *count, hsize_t *size); herr_t HE5_SWgrpattrinfo2(hid_t swathID, const char *attrname, hid_t *ntype, hsize_t *count, hsize_t *size); herr_t HE5_SWgeogrpattrinfo2(hid_t swathID, const char *attrname, hid_t *ntype, hsize_t *count, hsize_t *size); herr_t HE5_SWlocattrinfo2(hid_t swathID, const char *fieldname, const char *attrname, hid_t *ntype, hsize_t *count, hsize_t *size); herr_t HE5_SWinqdatatype(hid_t swathID, const char *fieldname, const char *attrname, int group, hid_t *dtype, H5T_class_t *classid, H5T_order_t *order, size_t *size); long HE5_SWinqdims(hid_t swathID, char *dimnames, hsize_t dims[]); long HE5_SWinqmaps(hid_t swathID, char *dimmaps, long offset[], long increment[]); long HE5_SWinqidxmaps(hid_t swathID, char *idxmaps, hsize_t idxsizes[]); long HE5_SWinqgeofields(hid_t swathID, char *fieldlist, int rank[], hid_t ntype[]); long HE5_SWinqdatafields(hid_t swathID, char *fieldlist, int rank[], hid_t ntype[]); long HE5_SWinqattrs(hid_t swathID, char *attrnames, long *strbufsize); long HE5_SWinqgrpattrs(hid_t swathID, char *attrnames, long *strbufsize); long HE5_SWinqgeogrpattrs(hid_t swathID, char *attrnames, long *strbufsize); long HE5_SWinqlocattrs(hid_t swathID, const char *fieldname, char *attrnames, long *strbufsize); long HE5_SWnentries(hid_t swathID, int entrycode, long *strbufsize); long HE5_SWinqswath(const char *filename, char *swathlist, long *strbufsize); herr_t HE5_SWregioninfo(hid_t swathID, hid_t regionID, char *fieldname, hid_t *ntype, int *rank, hsize_t dims[], size_t *size); herr_t HE5_SWperiodinfo(hid_t swathID, hid_t periodID, char *fieldname, hid_t *ntype, int *rank, hsize_t dims[], size_t *size); herr_t HE5_SWgeomapinfo(hid_t swathID, char *geodim); herr_t HE5_SWgetfillvalue(hid_t swathID, char *fieldname, void *fillval); herr_t HE5_SWaliasinfo(hid_t swathID, int fldgroup, const char *aliasname, int *length, char *buffer); long HE5_SWinqdfldalias(hid_t swathID, char *fldalias, long *strbufsize); long HE5_SWinqgfldalias(hid_t swathID, char *fldalias, long *strbufsize); long HE5_SWgetaliaslist(hid_t swathID, int fldgroup, char *aliaslist, long *strbufsize); long HE5_SWgetdimscale(hid_t swathID, char *fieldname, char *dimname, hsize_t *dimsize, hid_t *numbertype, void * databuff); herr_t HE5_SWdscaleattrinfo(hid_t swathID, const char *fieldname, const char *attrname, hid_t *ntype, hsize_t *count); herr_t HE5_SWdscaleattrinfo2(hid_t swathID, const char *fieldname, const char *attrname, hid_t *ntype, hsize_t *count, hsize_t *size); herr_t HE5_SWreaddscaleattr(hid_t swathID, const char *fieldname, const char *attrname, void *datbuf); long HE5_SWinqdscaleattrs(hid_t swathID, const char *fieldname, char *attrnames, long *strbufsize); /* Subsetting/Retrieving routines */ hid_t HE5_SWdefboxregion(hid_t swathID, double cornerlon[], double cornerlat[], int mode); hid_t HE5_SWdefvrtregion(hid_t swathID, hid_t regionID, char *vertObj, double range[]); hid_t HE5_SWregionindex(hid_t swathID, double cornerlon[], double cornerlat[], int mode, char *geodim, hsize_t idxrange[]); hid_t HE5_SWdupregion(hid_t oldregionID); hid_t HE5_SWdeftimeperiod(hid_t swathID, double starttime, double stoptime, int mode); herr_t HE5_SWextractregion(hid_t swathID, hid_t regionID, char *fieldname, int externalflag, void *buffer); herr_t HE5_SWextractperiod(hid_t swathID, hid_t periodID, char *fieldname, int externalflag, void *buffer); long HE5_SWupdateidxmap(hid_t swathID, hid_t regionID, long indexin[], long indexout[], long indicies[]); herr_t HE5_SWupdatescene(hid_t swathID, hid_t regionID); herr_t HE5_SWindexinfo(hid_t regionID, char *object, int *rank, char *dimlist, hsize_t *indices[HE5_DTSETRANKMAX]); /* ******************************** * PROFILE INTERFACE * ******************************** */ herr_t HE5_PRdefine(hid_t swathID, const char *profilename, char *dimlist, char *maxdimlist, hid_t datatype_id); herr_t HE5_PRwrite(hid_t swathID, const char *profilename, const hssize_t start[], const hsize_t stride[], const hsize_t edge[], size_t size, void *buffer); herr_t HE5_PRread(hid_t swathID, const char *profilename, const hssize_t start[], const hsize_t stride[], const hsize_t edge[], void *buffer); herr_t HE5_PRreclaimspace(hid_t swathID, const char *profilename, void *buffer); long HE5_PRinquire(hid_t swathID, char *profnames, int *rank, H5T_class_t *classID); herr_t HE5_PRinfo(hid_t swathID, const char *profname, int *rank, hsize_t dims[], hsize_t maxdims[], hid_t *ntype, char *dimlist, char *maxdimlist); herr_t HE5_PRwritegrpattr(hid_t swathID, const char *attrname, hid_t ntype, hsize_t count[], void *datbuf); herr_t HE5_PRreadgrpattr(hid_t swathID, const char *attrname, void *datbuf); herr_t HE5_PRgrpattrinfo(hid_t swathID, const char *attrname, hid_t *ntype, hsize_t *count); herr_t HE5_PRgrpattrinfo2(hid_t swathID, const char *attrname, hid_t *ntype, hsize_t *count, hsize_t *size); long HE5_PRinqgrpattrs(hid_t swathID, char *attrnames, long *strbufsize); /* ******************************* * EXTERNAL DATA FILES * ******************************* */ herr_t HE5_SWsetextdata(hid_t swathID, const char *filelist, off_t offset[], hsize_t size[]); int HE5_SWgetextdata(hid_t swathID, char *fieldname, size_t namelength, char *filelist, off_t offset[], hsize_t size[]); /* ******************************* * MOUNTING EXTERNAL FILES * ******************************* */ hid_t HE5_SWmountexternal(hid_t swathID, int fldgroup, const char *extfilename); herr_t HE5_SWunmount(hid_t swathID, int fldgroup, hid_t fileID); herr_t HE5_SWreadexternal(hid_t swathID, int fldgroup, const char *fieldname, void *buffer); /* ********************************************************************** * G R I D I N T E R F A C E * ********************************************************************** */ /* File/Grid access routines */ hid_t HE5_GDopen(const char *filename, uintn flags); hid_t HE5_GDcreate(hid_t fid, const char *gridname, long xdimsize, long ydimsize, double upleftpt[], double lowrightpt[]); hid_t HE5_GDattach(hid_t fid, const char *gridname); herr_t HE5_GDdetach(hid_t gridID); herr_t HE5_GDclose(hid_t fid); /* Definition routines */ herr_t HE5_GDdefdim(hid_t gridID, char *dimname, hsize_t dim); herr_t HE5_GDdefproj(hid_t gridID, int projcode, int zonecode, int spherecode, double projparm[]); herr_t HE5_GDdefcomp(hid_t gridID, int compcode, int compparm[]); herr_t HE5_GDdeftile(hid_t gridID, int tilecode, int tilerank, const hsize_t *tiledims); herr_t HE5_GDdefcomtile(hid_t gridID, int compcode, int compparm[], int tilerank, const hsize_t *tiledims); herr_t HE5_GDdeforigin(hid_t gridID, int origincode); herr_t HE5_GDdefpixreg(hid_t gridID, int pixregcode); herr_t HE5_GDdeffield(hid_t gridID, const char *fieldname, char *dimlist, char *maxdimlist, hid_t ntype, int merge); herr_t HE5_GDsetfillvalue(hid_t gridID, const char *fieldname, hid_t ntype, void *fillval); herr_t HE5_GDsetalias(hid_t gridID, char *fieldname, const char *aliaslist); herr_t HE5_GDdropalias(hid_t gridID, int fldgroup, const char *aliasname); herr_t HE5_GDsetdimscale(hid_t gridID, char *fieldname, char *dimname,const hsize_t dimsize, hid_t numbertype, void * databuff); herr_t HE5_GDdefdimscale(hid_t gridID, char *dimname, const hsize_t dimsize, hid_t numbertype, void * datbuff); /* I/O routines */ herr_t HE5_GDwritefieldmeta(hid_t gridID, const char *fieldname, char *dimlist, hid_t ntype); herr_t HE5_GDwritefield(hid_t gridID, const char *fieldname, const hssize_t start[], const hsize_t stride[], const hsize_t edge[], void *data); herr_t HE5_GDreadfield(hid_t gridID, const char *fieldname, const hssize_t start[], const hsize_t stride[], const hsize_t edge[], void * buffer); herr_t HE5_GDwriteattr(hid_t gridID, const char *attrname, hid_t ntype, hsize_t count[], void *datbuf); herr_t HE5_GDwritegrpattr(hid_t gridID, const char *attrname, hid_t ntype, hsize_t count[], void *datbuf); herr_t HE5_GDwritelocattr(hid_t gridID, const char *fieldname, const char *attrname, hid_t ntype, hsize_t count[], void *datbuf); herr_t HE5_GDreadattr(hid_t gridID, const char *attrname, void *datbuf); herr_t HE5_GDreadgrpattr(hid_t gridID, const char *attrname, void *datbuf); herr_t HE5_GDreadlocattr(hid_t gridID, const char *fieldname, const char *attrname, void *datbuf); herr_t HE5_GDblkSOMoffset(hid_t gridID, long offset[], hsize_t count[], char *code); /* Inquiry routines */ long HE5_GDinqgrid(const char *filename, char *gridlist, long *strbufsize); hsize_t HE5_GDdiminfo(hid_t gridID, char *dimname); herr_t HE5_GDgridinfo(hid_t gridID, long *xdimsize, long *ydimsize, double upleftpt[], double lowrightpt[]); herr_t HE5_GDprojinfo(hid_t gridID, int *projcode, int *zonecode, int *spherecode, double projparm[]); herr_t HE5_GDorigininfo(hid_t gridID, int *origincode); herr_t HE5_GDpixreginfo(hid_t gridID, int *pixregcode); herr_t HE5_GDcompinfo(hid_t gridID, const char *fieldname, int *compcode, int compparm[]); herr_t HE5_GDfieldinfo(hid_t gridID, const char *fieldname, int *rank, hsize_t dims[], hid_t ntype[], char *dimlist, char *maxdimlist); herr_t HE5_GDregioninfo(hid_t gridID, hid_t regionID, const char *fieldname, hid_t *ntype, int *rank, hsize_t dims[], long *size, double upleftpt[], double lowrightpt[]); long HE5_GDnentries(hid_t gridID, int entrycode, long *strbufsize); int HE5_GDinqdims(hid_t gridID, char *dimnames, hsize_t dims[]); herr_t HE5_GDattrinfo(hid_t gridID, const char *attrname, hid_t *ntype, hsize_t *count); herr_t HE5_GDgrpattrinfo(hid_t gridID, const char *attrname, hid_t *ntype, hsize_t *count); herr_t HE5_GDlocattrinfo(hid_t gridID, const char *fieldname, const char *attrname, hid_t *ntype, hsize_t *count); herr_t HE5_GDattrinfo2(hid_t gridID, const char *attrname, hid_t *ntype, hsize_t *count, hsize_t *size); herr_t HE5_GDgrpattrinfo2(hid_t gridID, const char *attrname, hid_t *ntype, hsize_t *count, hsize_t *size); herr_t HE5_GDlocattrinfo2(hid_t gridID, const char *fieldname, const char *attrname, hid_t *ntype, hsize_t *count, hsize_t *size); long HE5_GDinqattrs(hid_t gridID, char *attrnames, long *strbufsize); long HE5_GDinqgrpattrs(hid_t gridID, char *attrnames, long *strbufsize); long HE5_GDinqlocattrs(hid_t gridID, const char *fieldname, char *attrnames, long *strbufsize); int HE5_GDinqfields(hid_t gridID, char *fieldlist, int rank[], hid_t ntype[]); herr_t HE5_GDinqdatatype(hid_t gridID, const char *fieldname, const char *attrname, int fieldgroup, hid_t *dtype, H5T_class_t *classid, H5T_order_t *order, size_t *size); herr_t HE5_GDgetfillvalue(hid_t gridID, const char *fieldname, void *fillval); herr_t HE5_GDtileinfo(hid_t gridID, char *fieldname, int *tilecode, int *tilerank, hsize_t tiledims[]); herr_t HE5_GDaliasinfo(hid_t gridID, int fldgroup, const char *aliasname, int *length, char *buffer); long HE5_GDinqfldalias(hid_t gridID, char *fldalias, long *strbufsize); long HE5_GDgetaliaslist(hid_t gridID, int fldgroup, char *aliaslist, long *strbufsize); long HE5_GDgetdimscale(hid_t gridID, char *fieldname, char *dimname, hsize_t *dimsize, hid_t *numbertype, void * databuff); herr_t HE5_GDwritedscaleattr(hid_t gridID, const char *fieldname, const char *attrname, hid_t numtype, hsize_t count[], void *datbuf); herr_t HE5_GDdscaleattrinfo(hid_t gridID, const char *fieldname, const char *attrname, hid_t *ntype, hsize_t *count); herr_t HE5_GDdscaleattrinfo2(hid_t gridID, const char *fieldname, const char *attrname, hid_t *ntype, hsize_t *count, hsize_t *size); herr_t HE5_GDreaddscaleattr(hid_t gridID, const char *fieldname, const char *attrname, void *datbuf); long HE5_GDinqdscaleattrs(hid_t gridID, const char *fieldname, char *attrnames, long *strbufsize); /* Subsetting/Retrieving routines */ hid_t HE5_GDdefboxregion(hid_t gridID, double cornerlon[], double cornerlat[]); hid_t HE5_GDdefvrtregion(hid_t gridID, hid_t regionID, char *vertObj, double range[]); hid_t HE5_GDdeftimeperiod(hid_t gridID, hid_t periodID, double starttime, double stoptime); herr_t HE5_GDextractregion(hid_t gridID, hid_t regionID, const char *fieldname, void *buffer); hid_t HE5_GDdupregion(hid_t oldregionID); herr_t HE5_GDgetpixels(hid_t gridID, long nLonLat, double lonVal[], double latVal[], long pixRow[], long pixCol[]); long HE5_GDgetpixvalues(hid_t gridID, long nPixels, long pixRow[], long pixCol[], const char *fieldname, void * buffer); long HE5_GDinterpolate(hid_t gridID, long nValues, double lonVal[], double latVal[], const char *fieldname, double interpVal[]); /* Utility routine */ herr_t HE5_GDij2ll(int, int, double[], int, long, long, double[], double[], long, long[], long[], double[], double[], int, int); herr_t HE5_GDll2ij(int, int, double[], int, long, long, double[], double[], long, double[], double[], long[], long[], double[], double[]); herr_t HE5_GDrs2ll(int projcode, double projparm[], long xdimsize, long ydimsize, double upleft[], double lowright[], int npnts, double r[], double s[], double longitude[], double latitude[], int pixcen, int pixcnr); /* ******************************* * EXTERNAL DATA FILES * ******************************* */ herr_t HE5_GDsetextdata(hid_t gridID, const char *filelist, off_t offset[], hsize_t size[]); int HE5_GDgetextdata(hid_t gridID, char *fieldname, size_t namelength, char *filelist, off_t offset[], hsize_t size[]); /* ********************************************************************** * P O I N T I N T E R F A C E * ********************************************************************** */ /* File/Point access routine */ hid_t HE5_PTopen(const char *filename, uintn flags); hid_t HE5_PTcreate(hid_t fid, const char *pointname); hid_t HE5_PTattach(hid_t fid, const char *pointname); herr_t HE5_PTdetach(hid_t pointID); herr_t HE5_PTclose(hid_t fid); /* Definition routines */ herr_t HE5_PTdeflevel(hid_t pointID, const char *levelname, HE5_CmpDTSinfo *levelinfo); herr_t HE5_PTdeflinkage(hid_t pointID, char *parent, char *child, char *linkfield); /* I/O routines */ herr_t HE5_PTwritelevel(hid_t pointID, int level, hsize_t count[], size_t *size, void *data); herr_t HE5_PTupdatelevel(hid_t pointID, int level, char *fieldlist, hsize_t nrec, hssize_t recs[], void *data); herr_t HE5_PTreadlevel(hid_t pointID, int level, HE5_CmpDTSinfo *inStruct, size_t *size, void *datbuf); herr_t HE5_PTwriteattr(hid_t pointID, const char *attrname, hid_t ntype, hsize_t count[], void * datbuf); herr_t HE5_PTwritegrpattr(hid_t pointID, const char *attrname, hid_t ntype, hsize_t count[], void * datbuf); herr_t HE5_PTwritelocattr(hid_t pointID, const char *levelname, const char *attrname, hid_t ntype, hsize_t count[], void * datbuf); herr_t HE5_PTreadattr(hid_t pointID, const char *attrname, void * datbuf); herr_t HE5_PTreadgrpattr(hid_t pointID, const char *attrname, void * datbuf); herr_t HE5_PTreadlocattr(hid_t pointID, const char *levelname, const char *attrname, void *datbuf); /* Inquiry routines */ hsize_t HE5_PTnrecs(hid_t pointID, int level); int HE5_PTnlevels(hid_t pointID); int HE5_PTnfields(hid_t pointID, int level, char *fieldlist, long *strbufsize); int HE5_PTlevelindx(hid_t pointID, const char *levelname); herr_t HE5_PTgetlevelname(hid_t pointID, int level, char *levelname, long *strbufsize); herr_t HE5_PTbcklinkinfo(hid_t pointID, int level, char *linkfield); herr_t HE5_PTfwdlinkinfo(hid_t pointID, int level, char *linkfield); herr_t HE5_PTlevelinfo(hid_t pointID, int level, HE5_CmpDTSinfo *info); herr_t HE5_PTinqdatatype(hid_t pointID, const char *levelname, const char *attrname, int fieldgroup, hid_t *dtype, H5T_class_t *classid, H5T_order_t *order, size_t *size); int HE5_PTinqpoint(const char *filename, char *pointlist, long *strbufsize); herr_t HE5_PTgetrecnums(hid_t pointID, int inlevel, int outlevel, hsize_t inNrec, hssize_t inRecs[], hsize_t * outNrec, hssize_t outRecs[]); herr_t HE5_PTattrinfo(hid_t pointID, const char *attrname, hid_t *ntype, hsize_t *count); herr_t HE5_PTgrpattrinfo(hid_t pointID, const char *attrname, hid_t *ntype, hsize_t *count); herr_t HE5_PTlocattrinfo(hid_t pointID, const char *levelname, const char *attrname, hid_t *ntype, hsize_t *count); herr_t HE5_PTattrinfo2(hid_t pointID, const char *attrname, hid_t *ntype, hsize_t *count, hsize_t *size); herr_t HE5_PTgrpattrinfo2(hid_t pointID, const char *attrname, hid_t *ntype, hsize_t *count, hsize_t *size); herr_t HE5_PTlocattrinfo2(hid_t pointID, const char *levelname, const char *attrname, hid_t *ntype, hsize_t *count, hsize_t *size); long HE5_PTinqattrs(hid_t pointID, char *attrnames, long *strbufsize); long HE5_PTinqgrpattrs(hid_t pointID, char *attrnames, long *strbufsize); long HE5_PTinqlocattrs(hid_t pointID, const char *levelname, char *attrnames, long *strbufsize); /* ********************************************************************** * Z A I N T E R F A C E * ********************************************************************** */ /* File/ZA access routines */ hid_t HE5_ZAopen(const char *filename, uintn flags); hid_t HE5_ZAcreate(hid_t fid, const char *zaname); hid_t HE5_ZAattach(hid_t fid, const char *zaname); herr_t HE5_ZAdetach(hid_t zaID); herr_t HE5_ZAclose(hid_t fid); /* Definition routines */ herr_t HE5_ZAdefdim(hid_t zaID, char *dimname, hsize_t dim); herr_t HE5_ZAdefine(hid_t zaID, const char *za_name, char *dimlist, char *maxdimlist, hid_t dtype); herr_t HE5_ZAdefchunk(hid_t zaID, int ndims, const hsize_t *dim); herr_t HE5_ZAdefcomp(hid_t zaID, int compcode, int *compparm); herr_t HE5_ZAdefcomchunk(hid_t zaID, int compcode, int *compparm, int ndims, const hsize_t *dim); herr_t HE5_ZAsetfillvalue(hid_t zaID, char *fieldname, hid_t ntype, void *fillval); herr_t HE5_ZAsetalias(hid_t zaID, char *fieldname, const char *aliaslist); herr_t HE5_ZAdropalias(hid_t zaID, int fldgroup, const char *aliasname); herr_t HE5_ZAfldrename(hid_t zaID, char *oldfieldname, const char *newfieldname); herr_t HE5_ZAsetdimscale(hid_t zaID, char *fieldname, char *dimname, const hsize_t dimsize, hid_t numbertype, void * data); long HE5_ZAgetdimscale(hid_t zaID, char *fieldname, char *dimname, hsize_t *dimsize, hid_t *numbertype, void * databuff); herr_t HE5_ZAdefdimscale(hid_t zaID, char *dimname, const hsize_t dimsize, hid_t numbertype, void * datbuff); /* I/O routines */ herr_t HE5_ZAwritedatameta(hid_t zaID, const char *fieldname, char *dimlist, hid_t mvalue); herr_t HE5_ZAwriteattr(hid_t zaID, const char *attrname, hid_t ntype, hsize_t count[], void *datbuf); herr_t HE5_ZAwritegrpattr(hid_t zaID, const char *attrname, hid_t ntype, hsize_t count[], void *datbuf); herr_t HE5_ZAwritelocattr(hid_t zaID, const char *fieldname, const char *attrname, hid_t ntype, hsize_t count[], void *datbuf); herr_t HE5_ZAreadattr(hid_t zaID, const char *attrname, void *datbuf); herr_t HE5_ZAreadgrpattr(hid_t zaID, const char *attrname, void *datbuf); herr_t HE5_ZAreadlocattr(hid_t zaID, const char *fieldname, const char *attrname, void *datbuf); herr_t HE5_ZAwrite(hid_t zaID, char *za_name, const hssize_t start[], const hsize_t stride[], const hsize_t count[], void *datbuf); herr_t HE5_ZAread(hid_t zaID, char *za_name, const hssize_t start[], const hsize_t stride[], const hsize_t count[], void *datbuf); herr_t HE5_ZAreaddscaleattr(hid_t zaID, const char *fieldname, const char *attrname, void *datbuf); herr_t HE5_ZAwritedscaleattr(hid_t zaID, const char *fieldname, const char *attrname, hid_t numtype, hsize_t count[], void *datbuf); /* Inquiry routines */ hsize_t HE5_ZAdiminfo(hid_t zaID, char *dimname); int HE5_ZAfldsrch(hid_t zaID, char *fieldname, hid_t *fieldID, int *rank, hsize_t dims[], hid_t *typeID); herr_t HE5_ZAinfo(hid_t zaID, char *za_name, int *rank, hsize_t dims[], hid_t dtype[], char *dimlist, char *maxdimlist); herr_t HE5_ZAcompinfo(hid_t zaID, char *fieldname, int *compcode, int compparm[]); herr_t HE5_ZAattrinfo(hid_t zaID, const char *attrname, hid_t *ntype, hsize_t *count); herr_t HE5_ZAgrpattrinfo(hid_t zaID, const char *attrname, hid_t *ntype, hsize_t *count); herr_t HE5_ZAlocattrinfo(hid_t zaID, const char *fieldname, const char *attrname, hid_t *ntype, hsize_t *count); herr_t HE5_ZAattrinfo2(hid_t zaID, const char *attrname, hid_t *ntype, hsize_t *count, hsize_t *size); herr_t HE5_ZAgrpattrinfo2(hid_t zaID, const char *attrname, hid_t *ntype, hsize_t *count, hsize_t *size); herr_t HE5_ZAlocattrinfo2(hid_t zaID, const char *fieldname, const char *attrname, hid_t *ntype, hsize_t *count, hsize_t *size); herr_t HE5_ZAinqdatatype(hid_t zaID, const char *fieldname, const char *attrname, int group, hid_t *dtype, H5T_class_t *classid, H5T_order_t *order, size_t *size); long HE5_ZAinqdims(hid_t zaID, char *dimnames, hsize_t dims[]); long HE5_ZAinquire(hid_t zaID, char *za_name_list, int rank[], hid_t dtype[]); long HE5_ZAinqattrs(hid_t zaID, char *attrnames, long *strbufsize); long HE5_ZAinqgrpattrs(hid_t zaID, char *attrnames, long *strbufsize); long HE5_ZAinqlocattrs(hid_t zaID, const char *fieldname, char *attrnames, long *strbufsize); long HE5_ZAnentries(hid_t zaID, int entrycode, long *strbufsize); long HE5_ZAinqza(const char *filename, char *zalist, long *strbufsize); herr_t HE5_ZAgetfillvalue(hid_t zaID, char *fieldname, void *fillval); herr_t HE5_ZAaliasinfo(hid_t zaID, int fldgroup, const char *aliasname, int *length, char *buffer); long HE5_ZAinqfldalias(hid_t zaID, char *fldalias, long *strbufsize); herr_t HE5_ZAchunkinfo(hid_t zaID, char *fieldname, int *ndims, hsize_t dims[]); long HE5_ZAgetaliaslist(hid_t zaID, int fldgroup, char *aliaslist, long *strbufsize); herr_t HE5_ZAdscaleattrinfo(hid_t zaID, const char *fieldname, const char *attrname, hid_t *ntype, hsize_t *count); herr_t HE5_ZAdscaleattrinfo2(hid_t zaID, const char *fieldname, const char *attrname, hid_t *ntype, hsize_t *count, hsize_t *size); long HE5_ZAinqdscaleattrs(hid_t zaID, const char *fieldname, char *attrnames, long *strbufsize); /* ******************************* * EXTERNAL DATA FILES * ******************************* */ herr_t HE5_ZAsetextdata(hid_t zaID, const char *filelist, off_t offset[], hsize_t size[]); int HE5_ZAgetextdata(hid_t zaID, char *fieldname, size_t namelength, char *filelist, off_t offset[], hsize_t size[]); /* ******************************* * MOUNTING EXTERNAL FILES * ******************************* */ hid_t HE5_ZAmountexternal(hid_t zaID, int fldgroup, const char *extfilename); herr_t HE5_ZAunmount(hid_t zaID, int fldgroup, hid_t fileID); herr_t HE5_ZAreadexternal(hid_t zaID, int fldgroup, const char *fieldname, void *buffer); #ifdef __cplusplus } #endif #endif /* #ifndef HE5_HDFEOSDEF_H_ */ hdf-eos5-2.0/include/HE5_config.h.in000066400000000000000000000103221507520047200170740ustar00rootroot00000000000000/* include/HE5_config.h.in. Generated from configure.ac by autoheader. */ /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD /* Define if system is big-endian */ #undef BIG_ENDIAN /* Define if HDF5 has szip any type of filter */ #undef H5_HAVE_FILTER_SZIP /* Define if HDF-EOS5 should use version 1 api */ #undef H5_USE_16_API /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define if support for szip filter is enabled */ #undef HAVE_FILTER_SZIP /* Define if support for szip encoder filter is enabled */ #undef HAVE_FILTER_SZIP_ENCODER /* Define to 1 if you have the `H5free_memory' function. */ #undef HAVE_H5FREE_MEMORY /* Define to 1 if you have the header file. */ #undef HAVE_HDF5_H /* Defined if HDF5 has szip decoder filter */ #undef HAVE_HDF5_SZIP_DECODER /* Define if HDF5 has szip encoder filter */ #undef HAVE_HDF5_SZIP_ENCODER /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `hdf5_hl' library (-lhdf5_hl). */ #undef HAVE_LIBHDF5_HL /* Define to 1 if you have the `m' library (-lm). */ #undef HAVE_LIBM /* Define to 1 if you have the `pthread' library (-lpthread). */ #undef HAVE_LIBPTHREAD /* Define to 1 if you have the `sz' library (-lsz). */ #undef HAVE_LIBSZ /* Define to 1 if you have the `z' library (-lz). */ #undef HAVE_LIBZ /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H /* Define to 1 if you have the header file. */ #undef HAVE_MALLOC_H /* Define to 1 if you have the `memchr' function. */ #undef HAVE_MEMCHR /* Define to 1 if you have the `memmove' function. */ #undef HAVE_MEMMOVE /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the `memset' function. */ #undef HAVE_MEMSET /* Define to 1 if you have the `pow' function. */ #undef HAVE_POW /* Define to 1 if you have the `sqrt' function. */ #undef HAVE_SQRT /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strchr' function. */ #undef HAVE_STRCHR /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strstr' function. */ #undef HAVE_STRSTR /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_SZLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #undef LT_OBJDIR /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* The size of `int*', as computed by sizeof. */ #undef SIZEOF_INTP /* The size of `long', as computed by sizeof. */ #undef SIZEOF_LONG /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN # undef WORDS_BIGENDIAN # endif #endif /* Define if threadsafe HDF-EOS is enabled */ #undef _HDFEOS5_THREADSAFE /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `long int' if does not define. */ #undef off_t /* Define to `unsigned int' if does not define. */ #undef size_t hdf-eos5-2.0/include/Makefile.am000077500000000000000000000004141507520047200164500ustar00rootroot00000000000000# gctp/include Makefile.am # Boilerplate include include $(top_srcdir)/config/include.am # Headers to install include_HEADERS = HE5_HdfEosDef.h HE5_GctpFunc.h EXTRA_DIST = cfortHdf.h cproj.h ease.h HE5_HdfEosDef.h isin.h proj.h tutils.h hdfeos5.inc hdfeos5_64.inc hdf-eos5-2.0/include/Makefile.in000066400000000000000000000416011507520047200164610ustar00rootroot00000000000000# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # gctp/include Makefile.am VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(top_srcdir)/config/include.am $(srcdir)/Makefile.in \ $(srcdir)/Makefile.am $(srcdir)/HE5_config.h.in \ $(include_HEADERS) subdir = include ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/stdlib.m4 $(top_srcdir)/m4/stdinc.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = HE5_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(includedir)" HEADERS = $(include_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ $(LISP)HE5_config.h.in # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FC = @FC@ FCFLAGS = @FCFLAGS@ FFLAGS = @FFLAGS@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ ac_ct_FC = @ac_ct_FC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ LIBHDFEOS5 = $(top_builddir)/src/libhe5_hdfeos.la LIBGCTP = $(top_builddir)/gctp/src/libGctp.la # Boilerplate include # Headers to install include_HEADERS = HE5_HdfEosDef.h HE5_GctpFunc.h EXTRA_DIST = cfortHdf.h cproj.h ease.h HE5_HdfEosDef.h isin.h proj.h tutils.h hdfeos5.inc hdfeos5_64.inc all: HE5_config.h $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/include.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign include/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/config/include.am: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): HE5_config.h: stamp-h1 @if test ! -f $@; then rm -f stamp-h1; else :; fi @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi stamp-h1: $(srcdir)/HE5_config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status include/HE5_config.h $(srcdir)/HE5_config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f HE5_config.h stamp-h1 mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-includeHEADERS: $(include_HEADERS) @$(NORMAL_INSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ done uninstall-includeHEADERS: @$(NORMAL_UNINSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(HEADERS) HE5_config.h installdirs: for dir in "$(DESTDIR)$(includedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic distclean-hdr distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-includeHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-includeHEADERS .MAKE: all install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool cscopelist-am ctags ctags-am distclean \ distclean-generic distclean-hdr distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-includeHEADERS install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am uninstall-includeHEADERS # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: hdf-eos5-2.0/include/cfortHdf.h000077500000000000000000002442561507520047200163420ustar00rootroot00000000000000/* Copyright (C) 1996 Hughes and Applied Research Corporation Permission to use, 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 and that both that copyright notice and this permission notice appear in supporting documentation. */ /* cfortran.h */ /* 2.8 */ /* anonymous ftp: zebra.desy.de */ /* Burkhard Burow, burow@vxdesy.cern.ch, University of Toronto, 1993. */ /* Feb 2008 Abe Taaheri extensed "fortran to C calls" to 15 argument funcs */ #ifndef __CFORTRAN_LOADED #define __CFORTRAN_LOADED /* THIS FILE IS PROPERTY OF BURKHARD BUROW. IF YOU ARE USING THIS FILE YOU SHOULD ALSO HAVE ACCESS TO CFORTRAN.DOC WHICH PROVIDES TERMS FOR USING, MODIFYING, COPYING AND DISTRIBUTING THE CFORTRAN.H PACKAGE. */ /* Before using cfortran.h on CRAY, RS/6000, Apollo >=6.8, gcc -ansi, or any other ANSI C compiler, you must once do: prompt> mv cfortran.h cf_temp.h && sed 's/\/\*\*\//\#\#/g' cf_temp.h >cfortran.h i.e. we change the ' / * * / ' kludge to # #. */ /* First prepare for the C compiler. */ #if (defined(vax)&&defined(unix)) || (defined(__vax__)&&defined(__unix__)) #define VAXUltrix #endif #include /* NULL [in all machines stdio.h] */ #include /* strlen, memset, memcpy, memchr. */ #if !( defined(VAXUltrix) || defined(sun) || (defined(apollo)&&!defined(__STDCPP__)) ) #include /* malloc,free */ #else #include #ifdef apollo #define __CF__APOLLO67 /* __STDCPP__ is in Apollo 6.8 (i.e. ANSI) and onwards */ #endif #endif #if (!defined(__GNUC__) && (defined(sun)||defined(VAXUltrix)||defined(lynx))) #define __CF__KnR /* Sun, LynxOS and VAX Ultrix cc only supports K&R. */ /* Manually define __CF__KnR for HP if desired/required.*/ #endif /* i.e. We will generate Kernighan and Ritchie C. */ /* Note that you may define __CF__KnR before #include cfortran.h, in order to generate K&R C instead of the default ANSI C. The differences are mainly in the function prototypes and declarations. All machines, except the Apollo, work with either style. The Apollo's argument promotion rules require ANSI or use of the obsolete std_$call which we have not implemented here. Hence on the Apollo, only C calling FORTRAN subroutines will work using K&R style.*/ /* Remainder of cfortran.h depends on the Fortran compiler. */ /* VAX/VMS does not let us \-split these long lines. */ #if !(defined(NAGf90Fortran)||defined(f2cFortran)||defined(hpuxFortran)||defined(apolloFortran)||defined(sunFortran)||defined(IBMR2Fortran)||defined(CRAYFortran)||defined(mipsFortran)||defined(DECFortran)||defined(vmsFortran)) /* If no Fortran compiler is given, we choose one for the machines we know. */ #if defined(lynx) || defined(VAXUltrix) #define f2cFortran /* Lynx: Only support f2c at the moment. VAXUltrix: f77 behaves like f2c. Support f2c or f77 with gcc, vcc with f2c. f77 with vcc works, missing link magic for f77 I/O.*/ #endif #if defined(__hpux) /* 921107: Use __hpux instead of __hp9000s300 */ #define hpuxFortran /* Should also allow hp9000s7/800 use.*/ #endif #if defined(apollo) #define apolloFortran /* __CF__APOLLO67 defines some behavior. */ #endif #if defined(sun) #define sunFortran #endif #if defined(_IBMR2) #define IBMR2Fortran #endif #if defined(_CRAY) #define CRAYFortran /* _CRAY2 defines some behavior. */ #endif #if defined(mips) || defined(__mips) #define mipsFortran #endif #if defined(vms) || defined(__vms) #define vmsFortran #endif #if defined(__alpha) && defined(__unix__) #define DECFortran #endif #endif /* ...Fortran */ #if defined(VAXC) && !defined(__VAXC) #define OLD_VAXC #pragma nostandard /* Prevent %CC-I-PARAMNOTUSED. */ #endif /* Throughout cfortran.h we use: UN = Uppercase Name. LN = Lowercase Name. */ #if defined(f2cFortran) || defined(NAGf90Fortran) || defined(DECFortran) || defined(mipsFortran) || defined(apolloFortran) || defined(sunFortran) || defined(extname) #if defined(f2cFortran) #define CFC_(UN,LN) LN##_ /* Lowercase FORTRAN symbols. */ #else #define CFC_(UN,LN) LN##_ /* Lowercase FORTRAN symbols. */ #endif /* f2cFortran */ #define orig_fcallsc CFC_ #else #ifdef CRAYFortran #define CFC_(UN,LN) UN /* Uppercase FORTRAN symbols. */ #define orig_fcallsc(UN,LN) CFC_(UN,LN) /* CRAY insists on arg.'s here. */ #else /* For following machines one may wish to change the fcallsc default. */ #define CF_SAME_NAMESPACE #ifdef vmsFortran #define CFC_(UN,LN) LN /* Either case FORTRAN symbols. */ /* BUT we usually use UN for C macro to FORTRAN routines, so use LN here,*/ /* because VAX/VMS doesn't do recursive macros. */ #define orig_fcallsc(UN,LN) UN #else /* HP-UX without +ppu or IBMR2 without -qextname. NOT reccomended. */ #define CFC_(UN,LN) LN /* Lowercase FORTRAN symbols. */ #define orig_fcallsc CFC_ #endif /* vmsFortran */ #endif /* CRAYFortran */ #endif /* ....Fortran */ #define fcallsc orig_fcallsc #define preface_fcallsc(P,p,UN,LN) CFC_(P##UN,p##LN) #define append_fcallsc(P,p,UN,LN) CFC_(UN##P,LN##p) #define C_FUNCTION fcallsc #define FORTRAN_FUNCTION CFC_ #define COMMON_BLOCK CFC_ #if defined(NAGf90Fortran) || defined(f2cFortran) || defined(mipsFortran) #define LOGICAL_STRICT /* These have .eqv./.neqv. == .eq./.ne. */ #endif #ifdef CRAYFortran #if _CRAY #include #else #include "fortran.h" /* i.e. if crosscompiling assume user has file. */ #endif #define DOUBLE_PRECISION long double #define PPFLOATVVVVVVV (float *) /* Used for C calls FORTRAN. */ /* CRAY's double==float but CRAY says pointers to doubles and floats are diff.*/ #define VOIDP0 (void *) /* When FORTRAN calls C, we don't know if C routine arg.'s have been declared float *, or double *. */ #else #define DOUBLE_PRECISION double #define PPFLOATVVVVVVV #define VOIDP0 #endif #ifdef vmsFortran #if defined(vms) || defined(__vms) #include #else #include "descrip.h" /* i.e. if crosscompiling assume user has file. */ #endif #endif #ifdef sunFortran #if sun #include /* Sun's FLOATFUNCTIONTYPE, ASSIGNFLOAT, RETURNFLOAT. */ #else #include "math.h" /* i.e. if crosscompiling assume user has file. */ #endif #endif #ifdef __cplusplus extern "C" { #endif #ifndef apolloFortran #define COMMON_BLOCK_DEF(DEFINITION, NAME) extern DEFINITION NAME #define CF_NULL_PROTO #else /* HP doesn't understand #elif. */ /* Without ANSI prototyping, Apollo promotes float functions to double. */ /* Note that VAX/VMS, IBM, Mips choke on 'type function(...);' prototypes. */ #define CF_NULL_PROTO ... #ifndef __CF__APOLLO67 #define COMMON_BLOCK_DEF(DEFINITION, NAME) \ DEFINITION NAME __attribute((__section(NAME))) #else #define COMMON_BLOCK_DEF(DEFINITION, NAME) \ DEFINITION NAME #attribute[section(NAME)] #endif #endif #ifdef mipsFortran #define CF_DECLARE_GETARG int f77argc; char **f77argv #define CF_SET_GETARG(ARGC,ARGV) f77argc = ARGC; f77argv = ARGV #else #define CF_DECLARE_GETARG #define CF_SET_GETARG(ARGC,ARGV) #endif #ifdef OLD_VAXC /* Allow %CC-I-PARAMNOTUSED. */ #pragma standard #endif #define ACOMMA , #define ACOLON ; /*-------------------------------------------------------------------------*/ /* UTILITIES USED WITHIN CFORTRAN.H */ #define PGSMIN(A,B) (As) { /* Need this to handle NULL string.*/ while (e>s && *--e==t); /* Don't follow t's past beginning. */ e[*e==t?0:1] = '\0'; /* Handle s[0]=t correctly. */ } return s; } /* kill_trailingn(s,t,e) will kill the trailing t's in string s. e normally points to the terminating '\0' of s, but may actually point to anywhere in s. s's new '\0' will be placed at e or earlier in order to remove any trailing t's. If es) { /* Watch out for neg. length string.*/ while (e>s && *--e==t); /* Don't follow t's past beginning. */ e[*e==t?0:1] = '\0'; /* Handle s[0]=t correctly. */ } return s; } /* Note the following assumes that any element which has t's to be chopped off, does indeed fill the entire element. */ #ifndef __CF__KnR static char *vkill_trailing(char* cstr, int elem_len, int sizeofcstr, char t) #else static char *vkill_trailing( cstr, elem_len, sizeofcstr, t) char* cstr; int elem_len; int sizeofcstr; char t; #endif { int i; for (i=0; i 30 == MAX # of arg.'s C can pass to a */ #define ZTRINGV_NUM(I) I /* FORTRAN function. */ #define ZTRINGV_ARGF(I) __cfztringv[I] #define ZTRINGV_ARGS(I) B##I #define VPPBYTE VPPINT #define VPPDOUBLE VPPINT #define VPPFLOAT VPPINT #define VPPINT( A,B) int B = (int)A; /* For ZSTRINGV_ARGS */ #define VPPLOGICAL(A,B) int *B; /* Returning LOGICAL in FUNn and SUBn.*/ #define VPPLONG VPPINT #define VPPSHORT VPPINT #define VCF(TN,I) _INT(3,V,TN,A##I,B##I) #define VVCF(TN,AI,BI) _INT(3,V,TN,AI,BI) #define VINT( T,A,B) typeP##T##VVVVVVV B = A; #define VINTV( T,A,B) #define VINTVV( T,A,B) #define VINTVVV( T,A,B) #define VINTVVVV( T,A,B) #define VINTVVVVV( T,A,B) #define VINTVVVVVV( T,A,B) #define VINTVVVVVVV(T,A,B) #define VPINT( T,A,B) VP##T(A,B) #define VPVOID( T,A,B) #ifdef apolloFortran #define VROUTINE( T,A,B) void (*B)() = (void (*)())A; #else #define VROUTINE( T,A,B) #endif #define VSIMPLE( T,A,B) #ifdef vmsFortran #define VSTRING( T,A,B) static struct {fstring f; unsigned clen;} B = \ {{0,DSC$K_DTYPE_T,DSC$K_CLASS_S,NULL},0}; #define VPSTRING( T,A,B) static fstring B={0,DSC$K_DTYPE_T,DSC$K_CLASS_S,NULL}; #define VSTRINGV( T,A,B) static fstringvector B = \ {sizeof(A),DSC$K_DTYPE_T,DSC$K_CLASS_A,NULL,0,0,{0,0,1,1,1},1,0,NULL,0,{1,0}}; #define VPSTRINGV( T,A,B) static fstringvector B = \ {0,DSC$K_DTYPE_T,DSC$K_CLASS_A,NULL,0,0,{0,0,1,1,1},1,0,NULL,0,{1,0}}; #else #define VSTRING( T,A,B) struct {unsigned short clen, flen;} B; #define VSTRINGV( T,A,B) struct {char *s, *fs; unsigned flen;} B; #define VPSTRING( T,A,B) int B; #define VPSTRINGV( T,A,B) struct {char *fs; unsigned short sizeofA, flen;} B; #endif #define VZTRINGV VSTRINGV #define VPZTRINGV VPSTRINGV /* Note that the actions of the A table were performed inside the AA table. VAX Ultrix vcc, and HP-UX cc, didn't evaluate arguments to functions left to right, so we had to split the original table into the current robust two. */ #define ACF(NAME,TN,AI,I) STR_##TN(4,A,NAME,I,AI,B##I) #define ALOGICAL( M,I,A,B) B=C2FLOGICAL(B); #define APLOGICAL(M,I,A,B) A=C2FLOGICAL(A); #define ASTRING( M,I,A,B) CSTRING(A,B,sizeof(A)) #define APSTRING( M,I,A,B) CPSTRING(A,B,sizeof(A)) #ifdef vmsFortran #define AATRINGV( M,I,A,B, sA,filA,silA) \ initfstr(B,malloc((sA)-(filA)),(filA),(silA)-1), \ c2fstrv(A[0],B.dsc$a_pointer,(silA),(sA)); #define APATRINGV(M,I,A,B, sA,filA,silA) \ initfstr(B,A[0],(filA),(silA)-1),c2fstrv(A[0],A[0],(silA),(sA)); #else #define AATRINGV( M,I,A,B, sA,filA,silA) \ (B.s=malloc((sA)-(filA)),B.fs=c2fstrv(A[0],B.s,(B.flen=(silA)-1)+1,(sA))); #define APATRINGV(M,I,A,B, sA,filA,silA) \ B.fs=c2fstrv(A[0],A[0],(B.flen=(silA)-1)+1,B.sizeofA=(sA)); #endif #define ASTRINGV( M,I,A,B) \ AATRINGV( M,I,A,B,sizeof(A),firstindexlength(A),secondindexlength(A)) #define APSTRINGV(M,I,A,B) \ APATRINGV( M,I,A,B,sizeof(A),firstindexlength(A),secondindexlength(A)) #define AZTRINGV( M,I,A,B) AATRINGV( M,I,A,B, \ (M##_ELEMS_##I)*(( M##_ELEMLEN_##I)+1), \ (M##_ELEMS_##I),(M##_ELEMLEN_##I)+1) #define APZTRINGV(M,I,A,B) APATRINGV( M,I,A,B, \ (M##_ELEMS_##I)*(( M##_ELEMLEN_##I)+1), \ (M##_ELEMS_##I),(M##_ELEMLEN_##I)+1) #define AAPPBYTE( A,B) &A #define AAPPDOUBLE( A,B) &A #define AAPPFLOAT( A,B) PPFLOATVVVVVVV &A #define AAPPINT( A,B) &A #define AAPPLOGICAL(A,B) B= &A /* B used to keep a common W table. */ #define AAPPLONG( A,B) &A #define AAPPSHORT( A,B) &A #define AACF(TN,AI,I,C) _SEP_(TN,C,COMMA) _INT(3,AA,TN,AI,B##I) #define AAINT( T,A,B) &B #define AAINTV( T,A,B) PP##T##VVVVVV A #define AAINTVV( T,A,B) PP##T##VVVVV A[0] #define AAINTVVV( T,A,B) PP##T##VVVV A[0][0] #define AAINTVVVV( T,A,B) PP##T##VVV A[0][0][0] #define AAINTVVVVV( T,A,B) PP##T##VV A[0][0][0][0] #define AAINTVVVVVV( T,A,B) PP##T##V A[0][0][0][0][0] #define AAINTVVVVVVV(T,A,B) PP##T A[0][0][0][0][0][0] #define AAPINT( T,A,B) AAP##T(A,B) #define AAPVOID( T,A,B) (void *) A #ifdef apolloFortran #define AAROUTINE( T,A,B) &B #else #define AAROUTINE( T,A,B) (void(*)())A #endif #define AASTRING( T,A,B) CCSTRING(T,A,B) #define AAPSTRING( T,A,B) CCPSTRING(T,A,B) #ifdef vmsFortran #define AASTRINGV( T,A,B) &B #else #ifdef CRAYFortran #define AASTRINGV( T,A,B) _cptofcd(B.fs,B.flen) #else #define AASTRINGV( T,A,B) B.fs #endif #endif #define AAPSTRINGV AASTRINGV #define AAZTRINGV AASTRINGV #define AAPZTRINGV AASTRINGV #if defined(vmsFortran) || defined(CRAYFortran) #define JCF(TN,I) #else #define JCF(TN,I) STR_##TN(1,J,B##I, 0,0,0) #define JLOGICAL( B) #define JPLOGICAL(B) #define JSTRING( B) ,B.flen #define JPSTRING( B) ,B #define JSTRINGV JSTRING #define JPSTRINGV JSTRING #define JZTRINGV JSTRING #define JPZTRINGV JSTRING #endif #define WCF(TN,AN,I) STR_##TN(2,W,AN,B##I, 0,0) #define WLOGICAL( A,B) #define WPLOGICAL(A,B) *B=F2CLOGICAL(*B); #define WSTRING( A,B) (A[B.clen]!='\0'?A[B.clen]='\0':0); /* A?="constnt"*/ #define WPSTRING( A,B) kill_trailing(A,' '); #ifdef vmsFortran #define WSTRINGV( A,B) free(B.dsc$a_pointer); #define WPSTRINGV(A,B) \ vkill_trailing(f2cstrv((char*)A, (char*)A, \ B.dsc$w_length+1, B.dsc$l_arsize+B.dsc$l_m[0]), \ B.dsc$w_length+1, B.dsc$l_arsize+B.dsc$l_m[0], ' '); #else #define WSTRINGV( A,B) free(B.s); #define WPSTRINGV(A,B) vkill_trailing( \ f2cstrv((char*)A,(char*)A,B.flen+1,B.sizeofA), B.flen+1,B.sizeofA,' '); #endif #define WZTRINGV WSTRINGV #define WPZTRINGV WPSTRINGV #define NCF(TN,I,C) _SEP_(TN,C,COMMA) _INT(2,N,TN,A##I,0) #define NNCF UUCF #define NNNCF(TN,I,C) _SEP_(TN,C,COLON) _INT(2,N,TN,A##I,0) #define NINT( T,A) typeP##T##VVVVVVV * A #define NINTV( T,A) typeP##T##VVVVVV * A #define NINTVV( T,A) typeP##T##VVVVV * A #define NINTVVV( T,A) typeP##T##VVVV * A #define NINTVVVV( T,A) typeP##T##VVV * A #define NINTVVVVV( T,A) typeP##T##VV * A #define NINTVVVVVV( T,A) typeP##T##V * A #define NINTVVVVVVV(T,A) typeP##T * A #define NPINT( T,A) type##T##VVVVVVV * A #define NPVOID( T,A) void * A #ifdef apolloFortran #define NROUTINE( T,A) void (**A)() #else #define NROUTINE( T,A) void ( *A)() #endif #ifdef vmsFortran #define NSTRING( T,A) fstring * A #define NSTRINGV( T,A) fstringvector * A #else #ifdef CRAYFortran #define NSTRING( T,A) _fcd A #define NSTRINGV( T,A) _fcd A #else #define NSTRING( T,A) char * A #define NSTRINGV( T,A) char * A #endif #endif #define NPSTRING( T,A) NSTRING(T,A) /* CRAY insists on arg.'s here. */ #define NPNSTRING( T,A) NSTRING(T,A) /* CRAY insists on arg.'s here. */ #define NPPSTRING( T,A) NSTRING(T,A) /* CRAY insists on arg.'s here. */ #define NSTRVOID( T,A) NSTRING(T,A) /* CRAY insists on arg.'s here. */ #define NPSTRINGV( T,A) NSTRINGV(T,A) #define NZTRINGV( T,A) NSTRINGV(T,A) #define NPZTRINGV( T,A) NPSTRINGV(T,A) /* Note: Prevent compiler warnings, null #define PROTOCCALLSFSUB14/20 after #include-ing cfortran.h if calling the FORTRAN wrapper within the same source code where the wrapper is created. */ #ifndef __CF__KnR #define PROTOCCALLSFSUB0(UN,LN) extern void CFC_(UN,LN)(); #define PROTOCCALLSFSUB14(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) \ extern void CFC_(UN,LN)(NCF(T1,1,0) NCF(T2,2,1) NCF(T3,3,1) NCF(T4,4,1) \ NCF(T5,5,1) NCF(T6,6,1) NCF(T7,7,1) NCF(T8,8,1) NCF(T9,9,1) NCF(TA,A,1) \ NCF(TB,B,1) NCF(TC,C,1) NCF(TD,D,1) NCF(TE,E,1) ,...); #define PROTOCCALLSFSUB20(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK)\ extern void CFC_(UN,LN)(NCF(T1,1,0) NCF(T2,2,1) NCF(T3,3,1) NCF(T4,4,1) \ NCF(T5,5,1) NCF(T6,6,1) NCF(T7,7,1) NCF(T8,8,1) NCF(T9,9,1) NCF(TA,A,1) \ NCF(TB,B,1) NCF(TC,C,1) NCF(TD,D,1) NCF(TE,E,1) NCF(TF,F,1) NCF(TG,G,1) \ NCF(TH,H,1) NCF(TI,I,1) NCF(TJ,J,1) NCF(TK,K,1) ,...); #else #define PROTOCCALLSFSUB0( UN,LN) #define PROTOCCALLSFSUB14(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) #define PROTOCCALLSFSUB20(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK) #endif #ifdef OLD_VAXC /* Allow %CC-I-PARAMNOTUSED. */ #pragma standard #endif /* do{...}while(FALSE) allows if(a==b) FORT(); else BORT(); */ #define CCALLSFSUB0(UN,LN) \ do{PROTOCCALLSFSUB0(UN,LN) CFC_(UN,LN)();}while(FALSE) #define CCALLSFSUB1( UN,LN,T1, A1) \ CCALLSFSUB5 (UN,LN,T1,CF_0,CF_0,CF_0,CF_0,A1,0,0,0,0) #define CCALLSFSUB2( UN,LN,T1,T2, A1,A2) \ CCALLSFSUB5 (UN,LN,T1,T2,CF_0,CF_0,CF_0,A1,A2,0,0,0) #define CCALLSFSUB3( UN,LN,T1,T2,T3, A1,A2,A3) \ CCALLSFSUB5 (UN,LN,T1,T2,T3,CF_0,CF_0,A1,A2,A3,0,0) #define CCALLSFSUB4( UN,LN,T1,T2,T3,T4, A1,A2,A3,A4)\ CCALLSFSUB5 (UN,LN,T1,T2,T3,T4,CF_0,A1,A2,A3,A4,0) #define CCALLSFSUB5( UN,LN,T1,T2,T3,T4,T5, A1,A2,A3,A4,A5) \ CCALLSFSUB10(UN,LN,T1,T2,T3,T4,T5,CF_0,CF_0,CF_0,CF_0,CF_0,A1,A2,A3,A4,A5,0,0,0,0,0) #define CCALLSFSUB6( UN,LN,T1,T2,T3,T4,T5,T6, A1,A2,A3,A4,A5,A6) \ CCALLSFSUB10(UN,LN,T1,T2,T3,T4,T5,T6,CF_0,CF_0,CF_0,CF_0,A1,A2,A3,A4,A5,A6,0,0,0,0) #define CCALLSFSUB7( UN,LN,T1,T2,T3,T4,T5,T6,T7, A1,A2,A3,A4,A5,A6,A7) \ CCALLSFSUB10(UN,LN,T1,T2,T3,T4,T5,T6,T7,CF_0,CF_0,CF_0,A1,A2,A3,A4,A5,A6,A7,0,0,0) #define CCALLSFSUB8( UN,LN,T1,T2,T3,T4,T5,T6,T7,T8, A1,A2,A3,A4,A5,A6,A7,A8) \ CCALLSFSUB10(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,CF_0,CF_0,A1,A2,A3,A4,A5,A6,A7,A8,0,0) #define CCALLSFSUB9( UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,A1,A2,A3,A4,A5,A6,A7,A8,A9)\ CCALLSFSUB10(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,CF_0,A1,A2,A3,A4,A5,A6,A7,A8,A9,0) #define CCALLSFSUB10(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA)\ CCALLSFSUB14(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,CF_0,CF_0,CF_0,CF_0,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,0,0,0,0) #define CCALLSFSUB11(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB)\ CCALLSFSUB14(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,CF_0,CF_0,CF_0,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,0,0,0) #define CCALLSFSUB12(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC)\ CCALLSFSUB14(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,CF_0,CF_0,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,0,0) #define CCALLSFSUB13(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD)\ CCALLSFSUB14(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,CF_0,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,0) #define CCALLSFSUB14(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE)\ do{VVCF(T1,A1,B1) VVCF(T2,A2,B2) VVCF(T3,A3,B3) VVCF(T4,A4,B4) VVCF(T5,A5,B5) \ VVCF(T6,A6,B6) VVCF(T7,A7,B7) VVCF(T8,A8,B8) VVCF(T9,A9,B9) VVCF(TA,AA,BA) \ VVCF(TB,AB,BB) VVCF(TC,AC,BC) VVCF(TD,AD,BD) VVCF(TE,AE,BE) \ PROTOCCALLSFSUB14(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) \ ACF(LN,T1,A1,1) ACF(LN,T2,A2,2) ACF(LN,T3,A3,3) \ ACF(LN,T4,A4,4) ACF(LN,T5,A5,5) ACF(LN,T6,A6,6) ACF(LN,T7,A7,7) \ ACF(LN,T8,A8,8) ACF(LN,T9,A9,9) ACF(LN,TA,AA,A) ACF(LN,TB,AB,B) \ ACF(LN,TC,AC,C) ACF(LN,TD,AD,D) ACF(LN,TE,AE,E) \ CFC_(UN,LN)(AACF(T1,A1,1,0) AACF(T2,A2,2,1) AACF(T3,A3,3,1) \ AACF(T4,A4,4,1) AACF(T5,A5,5,1) AACF(T6,A6,6,1) AACF(T7,A7,7,1) \ AACF(T8,A8,8,1) AACF(T9,A9,9,1) AACF(TA,AA,A,1) AACF(TB,AB,B,1) \ AACF(TC,AC,C,1) AACF(TD,AD,D,1) AACF(TE,AE,E,1) \ JCF(T1,1) JCF(T2,2) JCF(T3,3) JCF(T4,4) JCF(T5,5) JCF(T6,6) JCF(T7,7) \ JCF(T8,8) JCF(T9,9) JCF(TA,A) JCF(TB,B) JCF(TC,C) JCF(TD,D) JCF(TE,E) );\ WCF(T1,A1,1) WCF(T2,A2,2) WCF(T3,A3,3) WCF(T4,A4,4) WCF(T5,A5,5) \ WCF(T6,A6,6) WCF(T7,A7,7) WCF(T8,A8,8) WCF(T9,A9,9) WCF(TA,AA,A) \ WCF(TB,AB,B) WCF(TC,AC,C) WCF(TD,AD,D) WCF(TE,AE,E) }while(FALSE) /* Apollo 6.7, CRAY, Sun, VAX/Ultrix vcc/cc and HP can't hack more than 31 arg's */ #if !(defined(VAXUltrix)&&!defined(__GNUC__)) && !defined(__CF__APOLLO67) && !defined(sun) && !defined(__hpux) && !defined(_CRAY) #define CCALLSFSUB15(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF)\ CCALLSFSUB20(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,CF_0,CF_0,CF_0,CF_0,CF_0,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF,0,0,0,0,0) #define CCALLSFSUB16(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF,AG)\ CCALLSFSUB20(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,CF_0,CF_0,CF_0,CF_0,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF,AG,0,0,0,0) #define CCALLSFSUB17(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF,AG,AH)\ CCALLSFSUB20(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,CF_0,CF_0,CF_0,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF,AG,AH,0,0,0) #define CCALLSFSUB18(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF,AG,AH,AI)\ CCALLSFSUB20(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,CF_0,CF_0,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF,AG,AH,AI,0,0) #define CCALLSFSUB19(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ)\ CCALLSFSUB20(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,CF_0,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,0) /* PROTOCCALLSFSUB20 is commented out, because it chokes the VAX VMS compiler. It isn't required since we so far only pass pointers and integers to FORTRAN routines and these arg.'s aren't promoted to anything else. */ #define CCALLSFSUB20(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH, \ TI,TJ,TK, A1,A2,A3,A4,A5,A6,A7,A8,A9,AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK) \ do{VVCF(T1,A1,B1) VVCF(T2,A2,B2) VVCF(T3,A3,B3) VVCF(T4,A4,B4) VVCF(T5,A5,B5) \ VVCF(T6,A6,B6) VVCF(T7,A7,B7) VVCF(T8,A8,B8) VVCF(T9,A9,B9) VVCF(TA,AA,BA) \ VVCF(TB,AB,BB) VVCF(TC,AC,BC) VVCF(TD,AD,BD) VVCF(TE,AE,BE) VVCF(TF,AF,BF) \ VVCF(TG,AG,BG) VVCF(TH,AH,BH) VVCF(TI,AI,BI) VVCF(TJ,AJ,BJ) VVCF(TK,AK,BK) \ /* PROTOCCALLSFSUB20(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF,TG,TH,TI,TJ,TK)*/\ ACF(LN,T1,A1,1) ACF(LN,T2,A2,2) ACF(LN,T3,A3,3) ACF(LN,T4,A4,4) \ ACF(LN,T5,A5,5) ACF(LN,T6,A6,6) ACF(LN,T7,A7,7) ACF(LN,T8,A8,8) \ ACF(LN,T9,A9,9) ACF(LN,TA,AA,A) ACF(LN,TB,AB,B) ACF(LN,TC,AC,C) \ ACF(LN,TD,AD,D) ACF(LN,TE,AE,E) ACF(LN,TF,AF,F) ACF(LN,TG,AG,G) \ ACF(LN,TH,AH,H) ACF(LN,TI,AI,I) ACF(LN,TJ,AJ,J) ACF(LN,TK,AK,K) \ CFC_(UN,LN)(AACF(T1,A1,1,0) AACF(T2,A2,2,1) AACF(T3,A3,3,1) AACF(T4,A4,4,1) \ AACF(T5,A5,5,1) AACF(T6,A6,6,1) AACF(T7,A7,7,1) AACF(T8,A8,8,1) \ AACF(T9,A9,9,1) AACF(TA,AA,A,1) AACF(TB,AB,B,1) AACF(TC,AC,C,1) \ AACF(TD,AD,D,1) AACF(TE,AE,E,1) AACF(TF,AF,F,1) AACF(TG,AG,G,1) \ AACF(TH,AH,H,1) AACF(TI,AI,I,1) AACF(TJ,AJ,J,1) AACF(TK,AK,K,1) \ JCF(T1,1) JCF(T2,2) JCF(T3,3) JCF(T4,4) JCF(T5,5) JCF(T6,6) JCF(T7,7) \ JCF(T8,8) JCF(T9,9) JCF(TA,A) JCF(TB,B) JCF(TC,C) JCF(TD,D) JCF(TE,E) \ JCF(TF,F) JCF(TG,G) JCF(TH,H) JCF(TI,I) JCF(TJ,J) JCF(TK,K) ); \ WCF(T1,A1,1) WCF(T2,A2,2) WCF(T3,A3,3) WCF(T4,A4,4) WCF(T5,A5,5) WCF(T6,A6,6) \ WCF(T7,A7,7) WCF(T8,A8,8) WCF(T9,A9,9) WCF(TA,AA,A) WCF(TB,AB,B) WCF(TC,AC,C) \ WCF(TD,AD,D) WCF(TE,AE,E) WCF(TF,AF,F) WCF(TG,AG,G) WCF(TH,AH,H) WCF(TI,AI,I) \ WCF(TJ,AJ,J) WCF(TK,AK,K) }while(FALSE) #endif /* Apollo 6.7, CRAY, Sun and HP can't hack more than 31 arg.'s */ /*-------------------------------------------------------------------------*/ /* UTILITIES FOR C TO CALL FORTRAN FUNCTIONS */ /*N.B. PROTOCCALLSFFUNn(..) generates code, whether or not the FORTRAN function is called. Therefore, especially for creator's of C header files for large FORTRAN libraries which include many functions, to reduce compile time and object code size, it may be desirable to create preprocessor directives to allow users to create code for only those functions which they use. */ /* The following defines the maximum length string that a function can return. Of course it may be undefine-d and re-define-d before individual PROTOCCALLSFFUNn(..) as required. It would also be nice to have this derived from the individual machines' limits. */ #define MAX_LEN_FORTRAN_FUNCTION_STRING 0x4FE /* The following defines a character used by CFORTRAN.H to flag the end of a string coming out of a FORTRAN routine. */ #define CFORTRAN_NON_CHAR 0x7F #ifdef OLD_VAXC /* Prevent %CC-I-PARAMNOTUSED. */ #pragma nostandard #endif #define _SEP_(TN,C,COMMA) __SEP_##C(TN,COMMA) #define __SEP_0(TN,COMMA) #define __SEP_1(TN,COMMA) _INT(2,SEP_,TN,COMMA,0) #define SEP_INT(T,B) A##B #define SEP_INTV SEP_INT #define SEP_INTVV SEP_INT #define SEP_INTVVV SEP_INT #define SEP_INTVVVV SEP_INT #define SEP_INTVVVVV SEP_INT #define SEP_INTVVVVVV SEP_INT #define SEP_INTVVVVVVV SEP_INT #define SEP_PINT SEP_INT #define SEP_PVOID SEP_INT #define SEP_ROUTINE SEP_INT #define SEP_SIMPLE SEP_INT #define SEP_VOID SEP_INT /* Need for FORTRAN calls to C subroutines. */ #define SEP_STRING SEP_INT #define SEP_STRINGV SEP_INT #define SEP_PSTRING SEP_INT #define SEP_PSTRINGV SEP_INT #define SEP_PNSTRING SEP_INT #define SEP_PPSTRING SEP_INT #define SEP_STRVOID SEP_INT #define SEP_ZTRINGV SEP_INT #define SEP_PZTRINGV SEP_INT #if defined(SIGNED_BYTE) || !defined(UNSIGNED_BYTE) #ifdef OLD_VAXC #define INTEGER_BYTE char /* Old VAXC barfs on 'signed char' */ #else #define INTEGER_BYTE signed char /* default */ #endif #else #define INTEGER_BYTE unsigned char #endif #define typePBYTEVVVVVVV INTEGER_BYTE #define typePDOUBLEVVVVVVV DOUBLE_PRECISION #define typePFLOATVVVVVVV float #define typePINTVVVVVVV int #define typePLOGICALVVVVVVV int #define typePLONGVVVVVVV long #define typePSHORTVVVVVVV short #define CFARGS0(A,T,W,X,Y,Z) A##T #define CFARGS1(A,T,W,X,Y,Z) A##T(W) #define CFARGS2(A,T,W,X,Y,Z) A##T(W,X) #define CFARGS3(A,T,W,X,Y,Z) A##T(W,X,Y) #define CFARGS4(A,T,W,X,Y,Z) A##T(W,X,Y,Z) #define _INT(N,T,I,Y,Z) INT_##I(N,T,I,Y,Z) #define INT_BYTE INT_DOUBLE #define INT_DOUBLE( N,A,B,Y,Z) CFARGS##N(A,INT,B,Y,Z,0) #define INT_FLOAT INT_DOUBLE #define INT_INT INT_DOUBLE #define INT_LOGICAL INT_DOUBLE #define INT_LONG INT_DOUBLE #define INT_SHORT INT_DOUBLE #define INT_PBYTE INT_PDOUBLE #define INT_PDOUBLE( N,A,B,Y,Z) CFARGS##N(A,PINT,B,Y,Z,0) #define INT_PFLOAT INT_PDOUBLE #define INT_PINT INT_PDOUBLE #define INT_PLOGICAL INT_PDOUBLE #define INT_PLONG INT_PDOUBLE #define INT_PSHORT INT_PDOUBLE #define INT_BYTEV INT_DOUBLEV #define INT_BYTEVV INT_DOUBLEVV #define INT_BYTEVVV INT_DOUBLEVVV #define INT_BYTEVVVV INT_DOUBLEVVVV #define INT_BYTEVVVVV INT_DOUBLEVVVVV #define INT_BYTEVVVVVV INT_DOUBLEVVVVVV #define INT_BYTEVVVVVVV INT_DOUBLEVVVVVVV #define INT_DOUBLEV( N,A,B,Y,Z) CFARGS##N(A,INTV,B,Y,Z,0) #define INT_DOUBLEVV( N,A,B,Y,Z) CFARGS##N(A,INTVV,B,Y,Z,0) #define INT_DOUBLEVVV( N,A,B,Y,Z) CFARGS##N(A,INTVVV,B,Y,Z,0) #define INT_DOUBLEVVVV( N,A,B,Y,Z) CFARGS##N(A,INTVVVV,B,Y,Z,0) #define INT_DOUBLEVVVVV( N,A,B,Y,Z) CFARGS##N(A,INTVVVVV,B,Y,Z,0) #define INT_DOUBLEVVVVVV( N,A,B,Y,Z) CFARGS##N(A,INTVVVVVV,B,Y,Z,0) #define INT_DOUBLEVVVVVVV(N,A,B,Y,Z) CFARGS##N(A,INTVVVVVVV,B,Y,Z,0) #define INT_FLOATV INT_DOUBLEV #define INT_FLOATVV INT_DOUBLEVV #define INT_FLOATVVV INT_DOUBLEVVV #define INT_FLOATVVVV INT_DOUBLEVVVV #define INT_FLOATVVVVV INT_DOUBLEVVVVV #define INT_FLOATVVVVVV INT_DOUBLEVVVVVV #define INT_FLOATVVVVVVV INT_DOUBLEVVVVVVV #define INT_INTV INT_DOUBLEV #define INT_INTVV INT_DOUBLEVV #define INT_INTVVV INT_DOUBLEVVV #define INT_INTVVVV INT_DOUBLEVVVV #define INT_INTVVVVV INT_DOUBLEVVVVV #define INT_INTVVVVVV INT_DOUBLEVVVVVV #define INT_INTVVVVVVV INT_DOUBLEVVVVVVV #define INT_LOGICALV INT_DOUBLEV #define INT_LOGICALVV INT_DOUBLEVV #define INT_LOGICALVVV INT_DOUBLEVVV #define INT_LOGICALVVVV INT_DOUBLEVVVV #define INT_LOGICALVVVVV INT_DOUBLEVVVVV #define INT_LOGICALVVVVVV INT_DOUBLEVVVVVV #define INT_LOGICALVVVVVVV INT_DOUBLEVVVVVVV #define INT_LONGV INT_DOUBLEV #define INT_LONGVV INT_DOUBLEVV #define INT_LONGVVV INT_DOUBLEVVV #define INT_LONGVVVV INT_DOUBLEVVVV #define INT_LONGVVVVV INT_DOUBLEVVVVV #define INT_LONGVVVVVV INT_DOUBLEVVVVVV #define INT_LONGVVVVVVV INT_DOUBLEVVVVVVV #define INT_SHORTV INT_DOUBLEV #define INT_SHORTVV INT_DOUBLEVV #define INT_SHORTVVV INT_DOUBLEVVV #define INT_SHORTVVVV INT_DOUBLEVVVV #define INT_SHORTVVVVV INT_DOUBLEVVVVV #define INT_SHORTVVVVVV INT_DOUBLEVVVVVV #define INT_SHORTVVVVVVV INT_DOUBLEVVVVVVV #define INT_PVOID( N,A,B,Y,Z) CFARGS##N(A,B,B,Y,Z,0) #define INT_ROUTINE INT_PVOID /*CRAY coughs on the first, i.e. the usual trouble of not being able to define macros to macros with arguments. */ /*#define INT_SIMPLE INT_PVOID*/ #define INT_SIMPLE( N,A,B,Y,Z) INT_PVOID(N,A,B,Y,Z) #define INT_VOID INT_PVOID #define INT_STRING INT_PVOID #define INT_STRINGV INT_PVOID #define INT_PSTRING INT_PVOID #define INT_PSTRINGV INT_PVOID #define INT_PNSTRING INT_PVOID #define INT_PPSTRING INT_PVOID #define INT_ZTRINGV INT_PVOID #define INT_PZTRINGV INT_PVOID #define INT_STRVOID INT_PVOID #define INT_CF_0( N,A,B,Y,Z) #define UCF(TN,I,C) _SEP_(TN,C,COMMA) _INT(2,U,TN,A##I,0) #define UUCF(TN,I,C) _SEP_(TN,C,COMMA) _SEP_(TN,1,I) #define UUUCF(TN,I,C) _SEP_(TN,C,COLON) _INT(2,U,TN,A##I,0) #define UINT( T,A) typeP##T##VVVVVVV A #define UINTV( T,A) typeP##T##VVVVVV *A #define UINTVV( T,A) typeP##T##VVVVV *A #define UINTVVV( T,A) typeP##T##VVVV *A #define UINTVVVV( T,A) typeP##T##VVV *A #define UINTVVVVV( T,A) typeP##T##VV *A #define UINTVVVVVV( T,A) typeP##T##V *A #define UINTVVVVVVV(T,A) typeP##T *A #define UPINT( T,A) type##T##VVVVVVV *A #define UPVOID( T,A) void *A #define UROUTINE( T,A) void (*A)() #define UVOID( T,A) void A /* Needed for C calls FORTRAN subroutines. */ #define USTRING( T,A) char *A /* via VOID and wrapper. */ #define USTRINGV( T,A) char *A #define UPSTRING( T,A) char *A #define UPSTRINGV( T,A) char *A #define UZTRINGV( T,A) char *A #define UPZTRINGV( T,A) char *A /* VOID breaks U into U and UU. */ #define UUINT( T,A) typeP##T##VVVVVVV A #define UUVOID( T,A) /* Needed for FORTRAN calls C subroutines. */ #define UUSTRING( T,A) char *A /* Sun and VOID break U into U and PU. */ #define PUBYTE( A) INTEGER_BYTE A #define PUDOUBLE( A) DOUBLE_PRECISION A #ifndef sunFortran #define PUFLOAT( A) float A #else #define PUFLOAT( A) FLOATFUNCTIONTYPE A #endif #define PUINT( A) int A #define PULOGICAL( A) int A #define PULONG( A) long A #define PUSHORT( A) short A #define PUSTRING( A) char *A #define PUVOID( A) void A #define EBYTE INTEGER_BYTE A0; #define EDOUBLE DOUBLE_PRECISION A0; #ifndef sunFortran #define EFLOAT float A0; #else #define EFLOAT float AA0; FLOATFUNCTIONTYPE A0; #endif #define EINT int A0; #define ELOGICAL int A0; #define ELONG long A0; #define ESHORT short A0; #define EVOID #ifdef vmsFortran #define ESTRING static char AA0[MAX_LEN_FORTRAN_FUNCTION_STRING+1]; \ static fstring A0 = \ {MAX_LEN_FORTRAN_FUNCTION_STRING,DSC$K_DTYPE_T,DSC$K_CLASS_S,AA0};\ memset(AA0, CFORTRAN_NON_CHAR, MAX_LEN_FORTRAN_FUNCTION_STRING);\ *(AA0+MAX_LEN_FORTRAN_FUNCTION_STRING)='\0'; #else #ifdef CRAYFortran #define ESTRING static char AA0[MAX_LEN_FORTRAN_FUNCTION_STRING+1]; \ static _fcd A0; *(AA0+MAX_LEN_FORTRAN_FUNCTION_STRING)='\0';\ memset(AA0,CFORTRAN_NON_CHAR, MAX_LEN_FORTRAN_FUNCTION_STRING);\ A0 = _cptofcd(AA0,MAX_LEN_FORTRAN_FUNCTION_STRING); #else #define ESTRING static char A0[MAX_LEN_FORTRAN_FUNCTION_STRING+1]; \ memset(A0, CFORTRAN_NON_CHAR, \ MAX_LEN_FORTRAN_FUNCTION_STRING); \ *(A0+MAX_LEN_FORTRAN_FUNCTION_STRING)='\0'; #endif #endif /* ESTRING must use static char. array which is guaranteed to exist after function returns. */ /* N.B.i) The diff. for 0 (Zero) and >=1 arguments. ii)That the following create an unmatched bracket, i.e. '(', which must of course be matched in the call. iii)Commas must be handled very carefully */ #define GZINT( T,UN,LN) A0=CFC_(UN,LN)( #define GZVOID( T,UN,LN) CFC_(UN,LN)( #ifdef vmsFortran #define GZSTRING( T,UN,LN) CFC_(UN,LN)(&A0 #else #ifdef CRAYFortran #define GZSTRING( T,UN,LN) CFC_(UN,LN)( A0 #else #define GZSTRING( T,UN,LN) CFC_(UN,LN)( A0,MAX_LEN_FORTRAN_FUNCTION_STRING #endif #endif #define GINT GZINT #define GVOID GZVOID #define GSTRING( T,UN,LN) GZSTRING(T,UN,LN), #define PPBYTEVVVVVVV #define PPINTVVVVVVV /* These complement PPFLOATVVVVVVV. */ #define PPDOUBLEVVVVVVV #define PPLOGICALVVVVVVV #define PPLONGVVVVVVV #define PPSHORTVVVVVVV #define BCF(TN,AN,C) _SEP_(TN,C,COMMA) _INT(2,B,TN,AN,0) #define BINT( T,A) (typeP##T##VVVVVVV) A #define BINTV( T,A) A #define BINTVV( T,A) (A)[0] #define BINTVVV( T,A) (A)[0][0] #define BINTVVVV( T,A) (A)[0][0][0] #define BINTVVVVV( T,A) (A)[0][0][0][0] #define BINTVVVVVV( T,A) (A)[0][0][0][0][0] #define BINTVVVVVVV(T,A) (A)[0][0][0][0][0][0] #define BPINT( T,A) P##T##VVVVVVV &A #define BSTRING( T,A) (char *) A #define BSTRINGV( T,A) (char *) A #define BPSTRING( T,A) (char *) A #define BPSTRINGV( T,A) (char *) A #define BPVOID( T,A) (void *) A #define BROUTINE( T,A) (void(*)())A #define BZTRINGV( T,A) (char *) A #define BPZTRINGV( T,A) (char *) A #define ZCF(TN,N,AN) _INT(3,Z,TN,N,AN) #define ZINT( T,I,A) (__cfztringv[I]=(int)A), #define ZPINT ZINT #define ZINTV( T,I,A) #define ZINTVV( T,I,A) #define ZINTVVV( T,I,A) #define ZINTVVVV( T,I,A) #define ZINTVVVVV( T,I,A) #define ZINTVVVVVV( T,I,A) #define ZINTVVVVVVV(T,I,A) #define ZSTRING( T,I,A) #define ZSTRINGV( T,I,A) #define ZPSTRING( T,I,A) #define ZPSTRINGV( T,I,A) #define ZPVOID( T,I,A) #define ZROUTINE( T,I,A) #define ZSIMPLE( T,I,A) #define ZZTRINGV( T,I,A) #define ZPZTRINGV( T,I,A) #define SCF(TN,NAME,I,A) STR_##TN(3,S,NAME,I,A,0) #define SLOGICAL( M,I,A) #define SPLOGICAL(M,I,A) #define SSTRING( M,I,A) ,sizeof(A) #define SSTRINGV( M,I,A) ,( (unsigned)0xFFFF*firstindexlength(A) \ +secondindexlength(A)) #define SPSTRING( M,I,A) ,sizeof(A) #define SPSTRINGV SSTRINGV #define SZTRINGV( M,I,A) ,( (unsigned)0xFFFF*M##_ELEMS_##I \ +M##_ELEMLEN_##I+1) #define SPZTRINGV SZTRINGV #define HCF(TN,I) STR_##TN(3,H,COMMA, H,C##I,0) #define HHCF(TN,I) STR_##TN(3,H,COMMA,HH,C##I,0) #define HHHCF(TN,I) STR_##TN(3,H,COLON, H,C##I,0) #define H_CF_SPECIAL unsigned #define HH_CF_SPECIAL #define HLOGICAL( S,U,B) #define HPLOGICAL(S,U,B) #define HSTRING( S,U,B) A##S U##_CF_SPECIAL B #define HSTRINGV HSTRING #define HPSTRING HSTRING #define HPSTRINGV HSTRING #define HPNSTRING HSTRING #define HPPSTRING HSTRING #define HSTRVOID HSTRING #define HZTRINGV HSTRING #define HPZTRINGV HSTRING #define STR_BYTE( N,T,A,B,C,D) #define STR_DOUBLE( N,T,A,B,C,D) /* Can't add spaces inside */ #define STR_FLOAT( N,T,A,B,C,D) /* expansion since it screws up */ #define STR_INT( N,T,A,B,C,D) /* macro catenation kludge. */ #define STR_LOGICAL( N,T,A,B,C,D) CFARGS##N(T,LOGICAL,A,B,C,D) #define STR_LONG( N,T,A,B,C,D) #define STR_SHORT( N,T,A,B,C,D) #define STR_BYTEV( N,T,A,B,C,D) #define STR_BYTEVV( N,T,A,B,C,D) #define STR_BYTEVVV( N,T,A,B,C,D) #define STR_BYTEVVVV( N,T,A,B,C,D) #define STR_BYTEVVVVV( N,T,A,B,C,D) #define STR_BYTEVVVVVV( N,T,A,B,C,D) #define STR_BYTEVVVVVVV( N,T,A,B,C,D) #define STR_DOUBLEV( N,T,A,B,C,D) #define STR_DOUBLEVV( N,T,A,B,C,D) #define STR_DOUBLEVVV( N,T,A,B,C,D) #define STR_DOUBLEVVVV( N,T,A,B,C,D) #define STR_DOUBLEVVVVV( N,T,A,B,C,D) #define STR_DOUBLEVVVVVV( N,T,A,B,C,D) #define STR_DOUBLEVVVVVVV( N,T,A,B,C,D) #define STR_FLOATV( N,T,A,B,C,D) #define STR_FLOATVV( N,T,A,B,C,D) #define STR_FLOATVVV( N,T,A,B,C,D) #define STR_FLOATVVVV( N,T,A,B,C,D) #define STR_FLOATVVVVV( N,T,A,B,C,D) #define STR_FLOATVVVVVV( N,T,A,B,C,D) #define STR_FLOATVVVVVVV( N,T,A,B,C,D) #define STR_INTV( N,T,A,B,C,D) #define STR_INTVV( N,T,A,B,C,D) #define STR_INTVVV( N,T,A,B,C,D) #define STR_INTVVVV( N,T,A,B,C,D) #define STR_INTVVVVV( N,T,A,B,C,D) #define STR_INTVVVVVV( N,T,A,B,C,D) #define STR_INTVVVVVVV( N,T,A,B,C,D) #define STR_LOGICALV( N,T,A,B,C,D) #define STR_LOGICALVV( N,T,A,B,C,D) #define STR_LOGICALVVV( N,T,A,B,C,D) #define STR_LOGICALVVVV( N,T,A,B,C,D) #define STR_LOGICALVVVVV( N,T,A,B,C,D) #define STR_LOGICALVVVVVV( N,T,A,B,C,D) #define STR_LOGICALVVVVVVV(N,T,A,B,C,D) #define STR_LONGV( N,T,A,B,C,D) #define STR_LONGVV( N,T,A,B,C,D) #define STR_LONGVVV( N,T,A,B,C,D) #define STR_LONGVVVV( N,T,A,B,C,D) #define STR_LONGVVVVV( N,T,A,B,C,D) #define STR_LONGVVVVVV( N,T,A,B,C,D) #define STR_LONGVVVVVVV( N,T,A,B,C,D) #define STR_SHORTV( N,T,A,B,C,D) #define STR_SHORTVV( N,T,A,B,C,D) #define STR_SHORTVVV( N,T,A,B,C,D) #define STR_SHORTVVVV( N,T,A,B,C,D) #define STR_SHORTVVVVV( N,T,A,B,C,D) #define STR_SHORTVVVVVV( N,T,A,B,C,D) #define STR_SHORTVVVVVVV( N,T,A,B,C,D) #define STR_PBYTE( N,T,A,B,C,D) #define STR_PDOUBLE( N,T,A,B,C,D) #define STR_PFLOAT( N,T,A,B,C,D) #define STR_PINT( N,T,A,B,C,D) #define STR_PLOGICAL( N,T,A,B,C,D) CFARGS##N(T,PLOGICAL,A,B,C,D) #define STR_PLONG( N,T,A,B,C,D) #define STR_PSHORT( N,T,A,B,C,D) #define STR_STRING( N,T,A,B,C,D) CFARGS##N(T,STRING,A,B,C,D) #define STR_PSTRING( N,T,A,B,C,D) CFARGS##N(T,PSTRING,A,B,C,D) #define STR_STRINGV( N,T,A,B,C,D) CFARGS##N(T,STRINGV,A,B,C,D) #define STR_PSTRINGV( N,T,A,B,C,D) CFARGS##N(T,PSTRINGV,A,B,C,D) #define STR_PNSTRING( N,T,A,B,C,D) CFARGS##N(T,PNSTRING,A,B,C,D) #define STR_PPSTRING( N,T,A,B,C,D) CFARGS##N(T,PPSTRING,A,B,C,D) #define STR_STRVOID( N,T,A,B,C,D) CFARGS##N(T,STRVOID,A,B,C,D) #define STR_PVOID( N,T,A,B,C,D) #define STR_ROUTINE( N,T,A,B,C,D) #define STR_SIMPLE( N,T,A,B,C,D) #define STR_ZTRINGV( N,T,A,B,C,D) CFARGS##N(T,ZTRINGV,A,B,C,D) #define STR_PZTRINGV( N,T,A,B,C,D) CFARGS##N(T,PZTRINGV,A,B,C,D) #define STR_CF_0( N,T,A,B,C,D) /* See ACF table comments, which explain why CCF was split into two. */ #define CCF(TN,I) STR_##TN(3,C,A##I,B##I,C##I,0) #define CLOGICAL( A,B,C) A=C2FLOGICAL( A); #define CPLOGICAL(A,B,C) *A=C2FLOGICAL(*A); #ifdef vmsFortran #define CSTRING( A,B,C) (B.clen=strlen(A),B.f.dsc$a_pointer=A, \ C==sizeof(char*)||C==B.clen+1?B.f.dsc$w_length=B.clen: \ (memset((A)+B.clen,' ',C-B.clen-1),A[B.f.dsc$w_length=C-1]='\0')); #define CSTRINGV( A,B,C) ( \ initfstr(B, malloc((C/0xFFFF)*(C%0xFFFF-1)), C/0xFFFF, C%0xFFFF-1), \ c2fstrv(A,B.dsc$a_pointer,C%0xFFFF,(C/0xFFFF)*(C%0xFFFF)) ); #define CPSTRING( A,B,C) (B.dsc$w_length=strlen(A),B.dsc$a_pointer=A, \ C==sizeof(char*)?0:(memset((A)+B.dsc$w_length,' ',C-B.dsc$w_length-1), \ A[B.dsc$w_length=C-1]='\0')); #define CPSTRINGV(A,B,C) (initfstr(B, A, C/0xFFFF, C%0xFFFF-1), \ c2fstrv(A,A,C%0xFFFF,(C/0xFFFF)*(C%0xFFFF)) ); #else #ifdef CRAYFortran #define CSTRING( A,B,C) (B.clen=strlen(A), \ C==sizeof(char*)||C==B.clen+1?B.flen=B.clen: \ (memset((A)+B.clen,' ',C-B.clen-1),A[B.flen=C-1]='\0')); #define CSTRINGV( A,B,C) (B.s=malloc((C/0xFFFF)*(C%0xFFFF-1)), \ c2fstrv(A,B.s,(B.flen=C%0xFFFF-1)+1,(C/0xFFFF)*(C%0xFFFF))); #define CPSTRING( A,B,C) (B=strlen(A), C==sizeof(char*)?0: \ (memset((A)+B,' ',C-B-1),A[B=C-1]='\0')); #define CPSTRINGV(A,B,C) c2fstrv(A,A,(B.flen=C%0xFFFF-1)+1, \ B.sizeofA=(C/0xFFFF)*(C%0xFFFF)); #else #define CSTRING( A,B,C) (B.clen=strlen(A), \ C==sizeof(char*)||C==B.clen+1?B.flen=B.clen: \ (memset((A)+B.clen,' ',C-B.clen-1),A[B.flen=C-1]='\0')); #define CSTRINGV( A,B,C) (B.s=malloc((C/0xFFFF)*(C%0xFFFF-1)), \ B.fs=c2fstrv(A,B.s,(B.flen=C%0xFFFF-1)+1,(C/0xFFFF)*(C%0xFFFF))); #define CPSTRING( A,B,C) (B=strlen(A), C==sizeof(char*)?0: \ (memset((A)+B,' ',C-B-1),A[B=C-1]='\0')); #define CPSTRINGV(A,B,C) B.fs=c2fstrv(A,A,(B.flen=C%0xFFFF-1)+1, \ B.sizeofA=(C/0xFFFF)*(C%0xFFFF)); #endif #endif #define CZTRINGV CSTRINGV #define CPZTRINGV CPSTRINGV #define CCCBYTE( A,B) &A #define CCCDOUBLE( A,B) &A #if !defined(__CF__KnR) #define CCCFLOAT( A,B) &A /* Although the VAX doesn't, at least the */ #else /* HP and K&R mips promote float arg.'s of */ #define CCCFLOAT( A,B) &B /* unprototyped functions to double. So we can't */ #endif /* use A here to pass the argument to FORTRAN. */ #define CCCINT( A,B) &A #define CCCLOGICAL( A,B) &A #define CCCLONG( A,B) &A #define CCCSHORT( A,B) &A #define CCCPBYTE( A,B) A #define CCCPDOUBLE( A,B) A #define CCCPFLOAT( A,B) A #define CCCPINT( A,B) A #define CCCPLOGICAL(A,B) B=A /* B used to keep a common W table. */ #define CCCPLONG( A,B) A #define CCCPSHORT( A,B) A #define CCCF(TN,I,M) _SEP_(TN,M,COMMA) _INT(3,CC,TN,A##I,B##I) #define CCINT( T,A,B) CCC##T(A,B) #define CCINTV( T,A,B) A #define CCINTVV( T,A,B) A #define CCINTVVV( T,A,B) A #define CCINTVVVV( T,A,B) A #define CCINTVVVVV( T,A,B) A #define CCINTVVVVVV( T,A,B) A #define CCINTVVVVVVV(T,A,B) A #define CCPINT( T,A,B) CCC##T(A,B) #define CCPVOID( T,A,B) A #ifdef apolloFortran #define CCROUTINE( T,A,B) &A #else #define CCROUTINE( T,A,B) A #endif #define CCSIMPLE( T,A,B) A #ifdef vmsFortran #define CCSTRING( T,A,B) &B.f #define CCSTRINGV( T,A,B) &B #define CCPSTRING( T,A,B) &B #define CCPSTRINGV( T,A,B) &B #else #ifdef CRAYFortran #define CCSTRING( T,A,B) _cptofcd(A,B.flen) #define CCSTRINGV( T,A,B) _cptofcd(B.s,B.flen) #define CCPSTRING( T,A,B) _cptofcd(A,B) #define CCPSTRINGV( T,A,B) _cptofcd(A,B.flen) #else #define CCSTRING( T,A,B) A #define CCSTRINGV( T,A,B) B.fs #define CCPSTRING( T,A,B) A #define CCPSTRINGV( T,A,B) B.fs #endif #endif #define CCZTRINGV CCSTRINGV #define CCPZTRINGV CCPSTRINGV #define XBYTE return A0; #define XDOUBLE return A0; #ifndef sunFortran #define XFLOAT return A0; #else #define XFLOAT ASSIGNFLOAT(AA0,A0); return AA0; #endif #define XINT return A0; #define XLOGICAL return F2CLOGICAL(A0); #define XLONG return A0; #define XSHORT return A0; #define XVOID return ; #if defined(vmsFortran) || defined(CRAYFortran) #define XSTRING return kill_trailing( \ kill_trailing(AA0,CFORTRAN_NON_CHAR),' '); #else #define XSTRING return kill_trailing( \ kill_trailing( A0,CFORTRAN_NON_CHAR),' '); #endif #define CFFUN(NAME) __cf__##NAME /* Note that we don't use LN here, but we keep it for consistency. */ #define CCALLSFFUN0(UN,LN) CFFUN(UN)() #ifdef OLD_VAXC /* Allow %CC-I-PARAMNOTUSED. */ #pragma standard #endif #define CCALLSFFUN1( UN,LN,T1, A1) \ CCALLSFFUN5 (UN,LN,T1,CF_0,CF_0,CF_0,CF_0,A1,0,0,0,0) #define CCALLSFFUN2( UN,LN,T1,T2, A1,A2) \ CCALLSFFUN5 (UN,LN,T1,T2,CF_0,CF_0,CF_0,A1,A2,0,0,0) #define CCALLSFFUN3( UN,LN,T1,T2,T3, A1,A2,A3) \ CCALLSFFUN5 (UN,LN,T1,T2,T3,CF_0,CF_0,A1,A2,A3,0,0) #define CCALLSFFUN4( UN,LN,T1,T2,T3,T4, A1,A2,A3,A4)\ CCALLSFFUN5 (UN,LN,T1,T2,T3,T4,CF_0,A1,A2,A3,A4,0) #define CCALLSFFUN5( UN,LN,T1,T2,T3,T4,T5, A1,A2,A3,A4,A5) \ CCALLSFFUN10(UN,LN,T1,T2,T3,T4,T5,CF_0,CF_0,CF_0,CF_0,CF_0,A1,A2,A3,A4,A5,0,0,0,0,0) #define CCALLSFFUN6( UN,LN,T1,T2,T3,T4,T5,T6, A1,A2,A3,A4,A5,A6) \ CCALLSFFUN10(UN,LN,T1,T2,T3,T4,T5,T6,CF_0,CF_0,CF_0,CF_0,A1,A2,A3,A4,A5,A6,0,0,0,0) #define CCALLSFFUN7( UN,LN,T1,T2,T3,T4,T5,T6,T7, A1,A2,A3,A4,A5,A6,A7) \ CCALLSFFUN10(UN,LN,T1,T2,T3,T4,T5,T6,T7,CF_0,CF_0,CF_0,A1,A2,A3,A4,A5,A6,A7,0,0,0) #define CCALLSFFUN8( UN,LN,T1,T2,T3,T4,T5,T6,T7,T8, A1,A2,A3,A4,A5,A6,A7,A8) \ CCALLSFFUN10(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,CF_0,CF_0,A1,A2,A3,A4,A5,A6,A7,A8,0,0) #define CCALLSFFUN9( UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,A1,A2,A3,A4,A5,A6,A7,A8,A9)\ CCALLSFFUN10(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,CF_0,A1,A2,A3,A4,A5,A6,A7,A8,A9,0) #define CCALLSFFUN10(UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,A1,A2,A3,A4,A5,A6,A7,A8,A9,AA)\ (ZCF(T1,1,A1) ZCF(T2,2,A2) ZCF(T3,3,A3) ZCF(T4,4,A4) ZCF(T5,5,A5) \ ZCF(T6,6,A6) ZCF(T7,7,A7) ZCF(T8,8,A8) ZCF(T9,9,A9) ZCF(TA,A,AA) \ (CFFUN(UN)( BCF(T1,A1,0) BCF(T2,A2,1) BCF(T3,A3,1) BCF(T4,A4,1) BCF(T5,A5,1) \ BCF(T6,A6,1) BCF(T7,A7,1) BCF(T8,A8,1) BCF(T9,A9,1) BCF(TA,AA,1) \ SCF(T1,LN,1,A1) SCF(T2,LN,2,A2) SCF(T3,LN,3,A3) SCF(T4,LN,4,A4) \ SCF(T5,LN,5,A5) SCF(T6,LN,6,A6) SCF(T7,LN,7,A7) SCF(T8,LN,8,A8) \ SCF(T9,LN,9,A9) SCF(TA,LN,A,AA)))) /* N.B. Create a separate function instead of using (call function, function value here) because in order to create the variables needed for the input arg.'s which may be const.'s one has to do the creation within {}, but these can never be placed within ()'s. Therefore one must create wrapper functions. gcc, on the other hand may be able to avoid the wrapper functions. */ /* Prototypes are needed to correctly handle the value returned correctly. N.B. Can only have prototype arg.'s with difficulty, a la G... table since FORTRAN functions returning strings have extra arg.'s. Don't bother, since this only causes a compiler warning to come up when one uses FCALLSCFUNn and CCALLSFFUNn for the same function in the same source code. Something done by the experts in debugging only.*/ #define PROTOCCALLSFFUN0(F,UN,LN) \ PU##F( CFC_(UN,LN))(CF_NULL_PROTO); \ static _INT(2,U,F,CFFUN(UN),0)() {E##F _INT(3,GZ,F,UN,LN)); X##F} #define PROTOCCALLSFFUN1( T0,UN,LN,T1) \ PROTOCCALLSFFUN5 (T0,UN,LN,T1,CF_0,CF_0,CF_0,CF_0) #define PROTOCCALLSFFUN2( T0,UN,LN,T1,T2) \ PROTOCCALLSFFUN5 (T0,UN,LN,T1,T2,CF_0,CF_0,CF_0) #define PROTOCCALLSFFUN3( T0,UN,LN,T1,T2,T3) \ PROTOCCALLSFFUN5 (T0,UN,LN,T1,T2,T3,CF_0,CF_0) #define PROTOCCALLSFFUN4( T0,UN,LN,T1,T2,T3,T4) \ PROTOCCALLSFFUN5 (T0,UN,LN,T1,T2,T3,T4,CF_0) #define PROTOCCALLSFFUN5( T0,UN,LN,T1,T2,T3,T4,T5) \ PROTOCCALLSFFUN10(T0,UN,LN,T1,T2,T3,T4,T5,CF_0,CF_0,CF_0,CF_0,CF_0) #define PROTOCCALLSFFUN6( T0,UN,LN,T1,T2,T3,T4,T5,T6) \ PROTOCCALLSFFUN10(T0,UN,LN,T1,T2,T3,T4,T5,T6,CF_0,CF_0,CF_0,CF_0) #define PROTOCCALLSFFUN7( T0,UN,LN,T1,T2,T3,T4,T5,T6,T7) \ PROTOCCALLSFFUN10(T0,UN,LN,T1,T2,T3,T4,T5,T6,T7,CF_0,CF_0,CF_0) #define PROTOCCALLSFFUN8( T0,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8) \ PROTOCCALLSFFUN10(T0,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,CF_0,CF_0) #define PROTOCCALLSFFUN9( T0,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9) \ PROTOCCALLSFFUN10(T0,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,CF_0) /* HP/UX 9.01 cc requires the blank between '_INT(3,G,T0,UN,LN) CCCF(T1,1,0)' */ #ifndef __CF__KnR #define PROTOCCALLSFFUN10(T0,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA) \ PU##T0(CFC_(UN,LN))(CF_NULL_PROTO); \ static _INT(2,U,T0,CFFUN(UN),0)(UCF(T1,1,0) UCF(T2,2,1) UCF(T3,3,1) UCF(T4,4,1) \ UCF(T5,5,1) UCF(T6,6,1) UCF(T7,7,1) UCF(T8,8,1) UCF(T9,9,1) UCF(TA,A,1) \ HCF(T1,1) HCF(T2,2) HCF(T3,3) HCF(T4,4) HCF(T5,5) \ HCF(T6,6) HCF(T7,7) HCF(T8,8) HCF(T9,9) HCF(TA,A) ) \ {VCF(T1,1) VCF(T2,2) VCF(T3,3) VCF(T4,4) VCF(T5,5) \ VCF(T6,6) VCF(T7,7) VCF(T8,8) VCF(T9,9) VCF(TA,A) E##T0 \ CCF(T1,1) CCF(T2,2) CCF(T3,3) CCF(T4,4) CCF(T5,5) \ CCF(T6,6) CCF(T7,7) CCF(T8,8) CCF(T9,9) CCF(TA,A) \ _INT(3,G,T0,UN,LN) CCCF(T1,1,0) CCCF(T2,2,1) CCCF(T3,3,1) CCCF(T4,4,1) CCCF(T5,5,1)\ CCCF(T6,6,1) CCCF(T7,7,1) CCCF(T8,8,1) CCCF(T9,9,1) CCCF(TA,A,1)\ JCF(T1,1) JCF(T2,2) JCF(T3,3) JCF(T4,4) JCF(T5,5) \ JCF(T6,6) JCF(T7,7) JCF(T8,8) JCF(T9,9) JCF(TA,A)); \ WCF(T1,A1,1) WCF(T2,A2,2) WCF(T3,A3,3) WCF(T4,A4,4) WCF(T5,A5,5) \ WCF(T6,A6,6) WCF(T7,A7,7) WCF(T8,A8,8) WCF(T9,A9,9) WCF(TA,AA,A) X##T0} #else #define PROTOCCALLSFFUN10(T0,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA) \ PU##T0(CFC_(UN,LN))(CF_NULL_PROTO); \ static _INT(2,U,T0,CFFUN(UN),0)(UUCF(T1,1,0) UUCF(T2,2,1) UUCF(T3,3,1) UUCF(T4,4,1) \ UUCF(T5,5,1) UUCF(T6,6,1) UUCF(T7,7,1) UUCF(T8,8,1) UUCF(T9,9,1) UUCF(TA,A,1) \ HHCF(T1,1) HHCF(T2,2) HHCF(T3,3) HHCF(T4,4) HHCF(T5,5) \ HHCF(T6,6) HHCF(T7,7) HHCF(T8,8) HHCF(T9,9) HHCF(TA,A)) \ UUUCF(T1,1,0) UUUCF(T2,2,1) UUUCF(T3,3,1) UUUCF(T4,4,1) UUUCF(T5,5,1) \ UUUCF(T6,6,1) UUUCF(T7,7,1) UUUCF(T8,8,1) UUUCF(T9,9,1) UUUCF(TA,A,1) \ HHHCF(T1,1) HHHCF(T2,2) HHHCF(T3,3) HHHCF(T4,4) HHHCF(T5,5) \ HHHCF(T6,6) HHHCF(T7,7) HHHCF(T8,8) HHHCF(T9,9) HHHCF(TA,A); \ {VCF(T1,1) VCF(T2,2) VCF(T3,3) VCF(T4,4) VCF(T5,5) \ VCF(T6,6) VCF(T7,7) VCF(T8,8) VCF(T9,9) VCF(TA,A) E##T0 \ CCF(T1,1) CCF(T2,2) CCF(T3,3) CCF(T4,4) CCF(T5,5) \ CCF(T6,6) CCF(T7,7) CCF(T8,8) CCF(T9,9) CCF(TA,A) \ _INT(3,G,T0,UN,LN) CCCF(T1,1,0) CCCF(T2,2,1) CCCF(T3,3,1) CCCF(T4,4,1) CCCF(T5,5,1)\ CCCF(T6,6,1) CCCF(T7,7,1) CCCF(T8,8,1) CCCF(T9,9,1) CCCF(TA,A,1)\ JCF(T1,1) JCF(T2,2) JCF(T3,3) JCF(T4,4) JCF(T5,5) \ JCF(T6,6) JCF(T7,7) JCF(T8,8) JCF(T9,9) JCF(TA,A) ); \ WCF(T1,A1,1) WCF(T2,A2,2) WCF(T3,A3,3) WCF(T4,A4,4) WCF(T5,A5,5) \ WCF(T6,A6,6) WCF(T7,A7,7) WCF(T8,A8,8) WCF(T9,A9,9) WCF(TA,AA,A) X##T0} #endif /*-------------------------------------------------------------------------*/ /* UTILITIES FOR FORTRAN TO CALL C ROUTINES */ #ifdef OLD_VAXC /* Prevent %CC-I-PARAMNOTUSED. */ #pragma nostandard #endif #if defined(vmsFortran) || defined(CRAYFortran) #define DCF(TN,I) #define DDCF(TN,I) #define DDDCF(TN,I) #else #define DCF HCF #define DDCF HHCF #define DDDCF HHHCF #endif #define QCF(TN,I) STR_##TN(1,Q,B##I, 0,0,0) #define QLOGICAL( B) #define QPLOGICAL(B) #define QSTRINGV( B) char *B; unsigned int B##N; #define QSTRING( B) char *B=NULL; #define QPSTRING( B) char *B=NULL; #define QPSTRINGV QSTRINGV #define QPNSTRING(B) char *B=NULL; #define QPPSTRING(B) #define QSTRVOID( B) #ifdef apolloFortran #define ROUTINE_orig (void *)* /* Else, function value has to match. */ #else /* !apolloFortran */ #ifdef __sgi /* Else SGI gives warning 182 contrary to its C LRM A.17.7 */ #define ROUTINE_orig *(void**)& #else /* !__sgi */ #define ROUTINE_orig (void *) #endif /* __sgi */ #endif /* apolloFortran */ #define ROUTINE_1 ROUTINE_orig #define ROUTINE_2 ROUTINE_orig #define ROUTINE_3 ROUTINE_orig #define ROUTINE_4 ROUTINE_orig #define ROUTINE_5 ROUTINE_orig #define ROUTINE_6 ROUTINE_orig #define ROUTINE_7 ROUTINE_orig #define ROUTINE_8 ROUTINE_orig #define ROUTINE_9 ROUTINE_orig #define ROUTINE_10 ROUTINE_orig #define ROUTINE_11 ROUTINE_orig #define ROUTINE_12 ROUTINE_orig #define ROUTINE_13 ROUTINE_orig #define ROUTINE_14 ROUTINE_orig #define ROUTINE_15 ROUTINE_orig #define TCF(NAME,TN,I,M) _SEP_(TN,M,COMMA) T##TN(NAME,I,A##I,B##I,C##I) #define TBYTE( M,I,A,B,D) *A #define TDOUBLE( M,I,A,B,D) *A #define TFLOAT( M,I,A,B,D) *A #define TINT( M,I,A,B,D) *A #define TLOGICAL( M,I,A,B,D) F2CLOGICAL(*A) #define TLONG( M,I,A,B,D) *A #define TSHORT( M,I,A,B,D) *A #define TBYTEV( M,I,A,B,D) A #define TDOUBLEV( M,I,A,B,D) A #define TFLOATV( M,I,A,B,D) VOIDP0 A #define TINTV( M,I,A,B,D) A #define TLOGICALV( M,I,A,B,D) A #define TLONGV( M,I,A,B,D) A #define TSHORTV( M,I,A,B,D) A #define TBYTEVV( M,I,A,B,D) (void *)A /* We have to cast to void *, */ #define TBYTEVVV( M,I,A,B,D) (void *)A /* since we don't know the */ #define TBYTEVVVV( M,I,A,B,D) (void *)A /* dimensions of the array. */ #define TBYTEVVVVV( M,I,A,B,D) (void *)A /* i.e. Unfortunately, can't */ #define TBYTEVVVVVV( M,I,A,B,D) (void *)A /* check that the type matches */ #define TBYTEVVVVVVV( M,I,A,B,D) (void *)A /* with the prototype. */ #define TDOUBLEVV( M,I,A,B,D) (void *)A #define TDOUBLEVVV( M,I,A,B,D) (void *)A #define TDOUBLEVVVV( M,I,A,B,D) (void *)A #define TDOUBLEVVVVV( M,I,A,B,D) (void *)A #define TDOUBLEVVVVVV( M,I,A,B,D) (void *)A #define TDOUBLEVVVVVVV( M,I,A,B,D) (void *)A #define TFLOATVV( M,I,A,B,D) (void *)A #define TFLOATVVV( M,I,A,B,D) (void *)A #define TFLOATVVVV( M,I,A,B,D) (void *)A #define TFLOATVVVVV( M,I,A,B,D) (void *)A #define TFLOATVVVVVV( M,I,A,B,D) (void *)A #define TFLOATVVVVVVV( M,I,A,B,D) (void *)A #define TINTVV( M,I,A,B,D) (void *)A #define TINTVVV( M,I,A,B,D) (void *)A #define TINTVVVV( M,I,A,B,D) (void *)A #define TINTVVVVV( M,I,A,B,D) (void *)A #define TINTVVVVVV( M,I,A,B,D) (void *)A #define TINTVVVVVVV( M,I,A,B,D) (void *)A #define TLOGICALVV( M,I,A,B,D) (void *)A #define TLOGICALVVV( M,I,A,B,D) (void *)A #define TLOGICALVVVV( M,I,A,B,D) (void *)A #define TLOGICALVVVVV( M,I,A,B,D) (void *)A #define TLOGICALVVVVVV( M,I,A,B,D) (void *)A #define TLOGICALVVVVVVV(M,I,A,B,D) (void *)A #define TLONGVV( M,I,A,B,D) (void *)A #define TLONGVVV( M,I,A,B,D) (void *)A #define TLONGVVVV( M,I,A,B,D) (void *)A #define TLONGVVVVV( M,I,A,B,D) (void *)A #define TLONGVVVVVV( M,I,A,B,D) (void *)A #define TLONGVVVVVVV( M,I,A,B,D) (void *)A #define TSHORTVV( M,I,A,B,D) (void *)A #define TSHORTVVV( M,I,A,B,D) (void *)A #define TSHORTVVVV( M,I,A,B,D) (void *)A #define TSHORTVVVVV( M,I,A,B,D) (void *)A #define TSHORTVVVVVV( M,I,A,B,D) (void *)A #define TSHORTVVVVVVV( M,I,A,B,D) (void *)A #define TPBYTE( M,I,A,B,D) A #define TPDOUBLE( M,I,A,B,D) A #define TPFLOAT( M,I,A,B,D) VOIDP0 A #define TPINT( M,I,A,B,D) A #define TPLOGICAL( M,I,A,B,D) ((*A=F2CLOGICAL(*A)),A) #define TPLONG( M,I,A,B,D) A #define TPSHORT( M,I,A,B,D) A #define TPVOID( M,I,A,B,D) A #define TROUTINE( M,I,A,B,D) ROUTINE_##I A /* A == pointer to the characters D == length of the string, or of an element in an array of strings E == number of elements in an array of strings */ #define TTSTR( A,B,D) \ ((B=malloc(D+1))[D]='\0', memcpy(B,A,D), kill_trailing(B,' ')) #define TTTTSTR( A,B,D) (!(D<4||A[0]||A[1]||A[2]||A[3]))?NULL: \ memchr(A,'\0',D) ?A : TTSTR(A,B,D) #define TTTTSTRV( A,B,D,E) (B##N=E,B=malloc(B##N*(D+1)), (void *) \ vkill_trailing(f2cstrv(A,B,D+1, B##N*(D+1)), D+1,B##N*(D+1),' ')) #ifdef vmsFortran #define TSTRING( M,I,A,B,D) TTTTSTR( A->dsc$a_pointer,B,A->dsc$w_length) #define TSTRINGV( M,I,A,B,D) TTTTSTRV(A->dsc$a_pointer, B, \ A->dsc$w_length , A->dsc$l_m[0]) #define TPSTRING( M,I,A,B,D) TTSTR( A->dsc$a_pointer,B,A->dsc$w_length) #define TPPSTRING( M,I,A,B,D) A->dsc$a_pointer #define TSTRVOID( M,I,A,B,D) A->dsc$a_pointer,A->dsc$w_length #else #ifdef CRAYFortran #define TSTRING( M,I,A,B,D) TTTTSTR( _fcdtocp(A),B,_fcdlen(A)) #define TSTRINGV( M,I,A,B,D) TTTTSTRV(_fcdtocp(A),B,_fcdlen(A), \ num_elem(_fcdtocp(A),_fcdlen(A),M##_STRV_##A)) #define TPSTRING( M,I,A,B,D) TTSTR( _fcdtocp(A),B,_fcdlen(A)) #define TPPSTRING( M,I,A,B,D) _fcdtocp(A) #define TSTRVOID( M,I,A,B,D) _fcdtocp(A),_fcdlen(A) #else #define TSTRING( M,I,A,B,D) TTTTSTR( A,B,D) #define TSTRINGV( M,I,A,B,D) TTTTSTRV(A,B,D, \ num_elem(A,D,M##_STRV_##A)) #define TPSTRING( M,I,A,B,D) TTSTR( A,B,D) #define TPPSTRING( M,I,A,B,D) A #define TSTRVOID( M,I,A,B,D) A,D #endif #endif #define TPNSTRING TSTRING #define TPSTRINGV TSTRINGV #define TCF_0( M,I,A,B,D) #define RCF(TN,I) STR_##TN(3,R,A##I,B##I,C##I,0) #define RLOGICAL( A,B,D) #define RPLOGICAL(A,B,D) *A=C2FLOGICAL(*A); #define RSTRING( A,B,D) if (B) free(B); #define RSTRINGV( A,B,D) free(B); /* A and D as defined above for TSTRING(V) */ #define RRRRPSTR( A,B,D) if (B) memcpy(A,B,PGSMIN(strlen(B),D)), \ (D>strlen(B)?memset(A+strlen(B),' ', D-strlen(B)):0), free(B); #define RRRRPSTRV(A,B,D) c2fstrv(B,A,D+1,(D+1)*B##N), free(B); #ifdef vmsFortran #define RPSTRING( A,B,D) RRRRPSTR( A->dsc$a_pointer,B,A->dsc$w_length) #define RPSTRINGV(A,B,D) RRRRPSTRV(A->dsc$a_pointer,B,A->dsc$w_length) #else #ifdef CRAYFortran #define RPSTRING( A,B,D) RRRRPSTR( _fcdtocp(A),B,_fcdlen(A)) #define RPSTRINGV(A,B,D) RRRRPSTRV(_fcdtocp(A),B,_fcdlen(A)) #else #define RPSTRING( A,B,D) RRRRPSTR( A,B,D) #define RPSTRINGV(A,B,D) RRRRPSTRV(A,B,D) #endif #endif #define RPNSTRING(A,B,D) RPSTRING( A,B,D) #define RPPSTRING(A,B,D) #define RSTRVOID( A,B,D) #define FZBYTE( UN,LN) INTEGER_BYTE fcallsc(UN,LN)( #define FZDOUBLE( UN,LN) DOUBLE_PRECISION fcallsc(UN,LN)( #define FZINT( UN,LN) int fcallsc(UN,LN)( #define FZLOGICAL(UN,LN) int fcallsc(UN,LN)( #define FZLONG( UN,LN) long fcallsc(UN,LN)( #define FZSHORT( UN,LN) short fcallsc(UN,LN)( #define FZVOID( UN,LN) void fcallsc(UN,LN)( #ifndef __CF__KnR /* The void is req'd by the Apollo, to make this an ANSI function declaration. The Apollo promotes K&R float functions to double. */ #define FZFLOAT( UN,LN) float fcallsc(UN,LN)(void #ifdef vmsFortran #define FZSTRING( UN,LN) void fcallsc(UN,LN)(fstring *AS #else #ifdef CRAYFortran #define FZSTRING( UN,LN) void fcallsc(UN,LN)(_fcd AS #else #define FZSTRING( UN,LN) void fcallsc(UN,LN)(char *AS, unsigned D0 #endif #endif #else #ifndef sunFortran #define FZFLOAT( UN,LN) float fcallsc(UN,LN)( #else #define FZFLOAT( UN,LN) FLOATFUNCTIONTYPE fcallsc(UN,LN)( #endif #if defined(vmsFortran) || defined(CRAYFortran) #define FZSTRING( UN,LN) void fcallsc(UN,LN)(AS #else #define FZSTRING( UN,LN) void fcallsc(UN,LN)(AS, D0 #endif #endif #define FBYTE FZBYTE #define FDOUBLE FZDOUBLE #ifndef __CF_KnR #define FFLOAT( UN,LN) float fcallsc(UN,LN)( #else #define FFLOAT FZFLOAT #endif #define FINT FZINT #define FLOGICAL FZLOGICAL #define FLONG FZLONG #define FSHORT FZSHORT #define FVOID FZVOID #define FSTRING( UN,LN) FZSTRING(UN,LN), #define FFINT #define FFVOID #ifdef vmsFortran #define FFSTRING fstring *AS; #else #ifdef CRAYFortran #define FFSTRING _fcd AS; #else #define FFSTRING char *AS; unsigned D0; #endif #endif #define LLINT A0= #define LLSTRING A0= #define LLVOID #define KINT #define KVOID /* KSTRING copies the string into the position provided by the caller. */ #ifdef vmsFortran #define KSTRING \ memcpy(AS->dsc$a_pointer,A0, PGSMIN(AS->dsc$w_length,(A0==NULL?0:strlen(A0))) ); \ AS->dsc$w_length>(A0==NULL?0:strlen(A0))? \ memset(AS->dsc$a_pointer+(A0==NULL?0:strlen(A0)),' ', \ AS->dsc$w_length-(A0==NULL?0:strlen(A0))):0; #else #ifdef CRAYFortran #define KSTRING \ memcpy(_fcdtocp(AS),A0, PGSMIN(_fcdlen(AS),(A0==NULL?0:strlen(A0))) ); \ _fcdlen(AS)>(A0==NULL?0:strlen(A0))? \ memset(_fcdtocp(AS)+(A0==NULL?0:strlen(A0)),' ', \ _fcdlen(AS)-(A0==NULL?0:strlen(A0))):0; #else #define KSTRING memcpy(AS,A0, PGSMIN(D0,(A0==NULL?0:strlen(A0))) ); \ D0>(A0==NULL?0:strlen(A0))?memset(AS+(A0==NULL?0:strlen(A0)), \ ' ', D0-(A0==NULL?0:strlen(A0))):0; #endif #endif /* Note that K.. and I.. can't be combined since K.. has to access data before R.., in order for functions returning strings which are also passed in as arguments to work correctly. Note that R.. frees and hence may corrupt the string. */ #define IBYTE return A0; #define IDOUBLE return A0; #ifndef sunFortran #define IFLOAT return A0; #else #define IFLOAT RETURNFLOAT(A0); #endif #define IINT return A0; #define ILOGICAL return C2FLOGICAL(A0); #define ILONG return A0; #define ISHORT return A0; #define ISTRING return ; #define IVOID return ; #ifdef OLD_VAXC /* Allow %CC-I-PARAMNOTUSED. */ #pragma standard #endif #define FCALLSCSUB0( CN,UN,LN) FCALLSCFUN0(VOID,CN,UN,LN) #define FCALLSCSUB1( CN,UN,LN,T1) FCALLSCFUN1(VOID,CN,UN,LN,T1) #define FCALLSCSUB2( CN,UN,LN,T1,T2) FCALLSCFUN2(VOID,CN,UN,LN,T1,T2) #define FCALLSCSUB3( CN,UN,LN,T1,T2,T3) FCALLSCFUN3(VOID,CN,UN,LN,T1,T2,T3) #define FCALLSCSUB4( CN,UN,LN,T1,T2,T3,T4) FCALLSCFUN4(VOID,CN,UN,LN,T1,T2,T3,T4) #define FCALLSCSUB5( CN,UN,LN,T1,T2,T3,T4,T5) \ FCALLSCFUN5(VOID,CN,UN,LN,T1,T2,T3,T4,T5) #define FCALLSCSUB6( CN,UN,LN,T1,T2,T3,T4,T5,T6) \ FCALLSCFUN6(VOID,CN,UN,LN,T1,T2,T3,T4,T5,T6) #define FCALLSCSUB7( CN,UN,LN,T1,T2,T3,T4,T5,T6,T7) \ FCALLSCFUN7(VOID,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7) #define FCALLSCSUB8( CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8) \ FCALLSCFUN8(VOID,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8) #define FCALLSCSUB9( CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9) \ FCALLSCFUN9(VOID,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9) #define FCALLSCSUB10(CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA) \ FCALLSCFUN10(VOID,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA) #define FCALLSCSUB11(CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB) \ FCALLSCFUN11(VOID,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB) #define FCALLSCSUB12(CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC) \ FCALLSCFUN12(VOID,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC) #define FCALLSCSUB13(CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD) \ FCALLSCFUN13(VOID,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD) #define FCALLSCSUB14(CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) \ FCALLSCFUN14(VOID,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) #define FCALLSCSUB15(CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF) \ FCALLSCFUN15(VOID,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF) #define FCALLSCFUN1( T0,CN,UN,LN,T1) \ FCALLSCFUN5 (T0,CN,UN,LN,T1,CF_0,CF_0,CF_0,CF_0) #define FCALLSCFUN2( T0,CN,UN,LN,T1,T2) \ FCALLSCFUN5 (T0,CN,UN,LN,T1,T2,CF_0,CF_0,CF_0) #define FCALLSCFUN3( T0,CN,UN,LN,T1,T2,T3) \ FCALLSCFUN5 (T0,CN,UN,LN,T1,T2,T3,CF_0,CF_0) #define FCALLSCFUN4( T0,CN,UN,LN,T1,T2,T3,T4) \ FCALLSCFUN5 (T0,CN,UN,LN,T1,T2,T3,T4,CF_0) #define FCALLSCFUN5( T0,CN,UN,LN,T1,T2,T3,T4,T5)\ FCALLSCFUN10(T0,CN,UN,LN,T1,T2,T3,T4,T5,CF_0,CF_0,CF_0,CF_0,CF_0) #define FCALLSCFUN6( T0,CN,UN,LN,T1,T2,T3,T4,T5,T6) \ FCALLSCFUN10(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,CF_0,CF_0,CF_0,CF_0) #define FCALLSCFUN7( T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7) \ FCALLSCFUN10(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,CF_0,CF_0,CF_0) #define FCALLSCFUN8( T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8) \ FCALLSCFUN10(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,CF_0,CF_0) #define FCALLSCFUN9( T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9) \ FCALLSCFUN10(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,CF_0) #define FCALLSCFUN10( T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA) \ FCALLSCFUN15(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,CF_0,CF_0,CF_0,CF_0,CF_0) #define FCALLSCFUN11( T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB) \ FCALLSCFUN15(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,CF_0,CF_0,CF_0,CF_0) #define FCALLSCFUN12( T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC) \ FCALLSCFUN15(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,CF_0,CF_0,CF_0) #define FCALLSCFUN13( T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD) \ FCALLSCFUN15(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,CF_0,CF_0) #define FCALLSCFUN14( T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE) \ FCALLSCFUN15(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,CF_0) #ifndef __CF__KnR #define FCALLSCFUN0(T0,CN,UN,LN) \ FZ##T0(UN,LN)) {_INT(2,UU,T0,A0,0); _INT(0,LL,T0,0,0) CN(); _INT(0,K,T0,0,0) I##T0} #define FCALLSCFUN15(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF) \ F##T0(UN,LN) NCF(T1,1,0) NCF(T2,2,1) NCF(T3,3,1) NCF(T4,4,1) NCF(T5,5,1) \ NCF(T6,6,1) NCF(T7,7,1) NCF(T8,8,1) NCF(T9,9,1) NCF(TA,A,1) \ NCF(TB,B,1) NCF(TC,C,1) NCF(TD,D,1) NCF(TE,E,1) NCF(TF,F,1) \ DCF(T1,1) DCF(T2,2) DCF(T3,3) DCF(T4,4) DCF(T5,5) \ DCF(T6,6) DCF(T7,7) DCF(T8,8) DCF(T9,9) DCF(TA,A) \ DCF(TB,B) DCF(TC,C) DCF(TD,D) DCF(TE,E) DCF(TF,F) ) \ {QCF(T1,1) QCF(T2,2) QCF(T3,3) QCF(T4,4) QCF(T5,5) \ QCF(T6,6) QCF(T7,7) QCF(T8,8) QCF(T9,9) QCF(TA,A) \ QCF(TB,B) QCF(TC,C) QCF(TD,D) QCF(TE,E) QCF(TF,F) _INT(2,UU,T0,A0,0); \ _INT(0,LL,T0,0,0) CN(TCF(LN,T1,1,0) TCF(LN,T2,2,1) TCF(LN,T3,3,1) TCF(LN,T4,4,1) \ TCF(LN,T5,5,1) TCF(LN,T6,6,1) TCF(LN,T7,7,1) TCF(LN,T8,8,1) TCF(LN,T9,9,1) \ TCF(LN,TA,A,1) TCF(LN,TB,B,1) TCF(LN,TC,C,1) TCF(LN,TD,D,1) TCF(LN,TE,E,1) TCF(LN,TF,F,1)); \ _INT(0,K,T0,0,0) RCF(T1,1) RCF(T2,2) RCF(T3,3) RCF(T4,4) \ RCF(T5,5) RCF(T6,6) RCF(T7,7) RCF(T8,8) RCF(T9,9) RCF(TA,A) \ RCF(TB,B) RCF(TC,C) RCF(TD,D) RCF(TE,E) RCF(TF,F) I##T0} #else #define FCALLSCFUN0(T0,CN,UN,LN) FZ##T0(UN,LN)) _INT(0,FF,T0,0,0) \ {_INT(2,UU,T0,A0,0); _INT(0,LL,T0,0,0) CN(); _INT(0,K,T0,0,0) I##T0} #define FCALLSCFUN15(T0,CN,UN,LN,T1,T2,T3,T4,T5,T6,T7,T8,T9,TA,TB,TC,TD,TE,TF) \ F##T0(UN,LN) NNCF(T1,1,0) NNCF(T2,2,1) NNCF(T3,3,1) NNCF(T4,4,1) NNCF(T5,5,1)\ NNCF(T6,6,1) NNCF(T7,7,1) NNCF(T8,8,1) NNCF(T9,9,1) \ NNCF(TA,A,1) NNCF(TB,B,1) NNCF(TC,C,1) NNCF(TD,D,1) NNCF(TE,E,1) NNCF(TF,F,1) \ DDCF(T1,1) DDCF(T2,2) DDCF(T3,3) DDCF(T4,4) DDCF(T5,5) \ DDCF(T6,6) DDCF(T7,7) DDCF(T8,8) DDCF(T9,9) \ DDCF(TA,A) DDCF(TB,B) DDCF(TC,C) DDCF(TD,D) DDCF(TE,E) DDCF(TF,F)) _INT(0,FF,T0,0,0) \ NNNCF(T1,1,0) NNNCF(T2,2,1) NNNCF(T3,3,1) NNNCF(T4,4,1) NNNCF(T5,5,1) \ NNNCF(T6,6,1) NNNCF(T7,7,1) NNNCF(T8,8,1) NNNCF(T9,9,1) \ NNNCF(TA,A,1) NNNCF(TB,B,1) NNNCF(TC,C,1) NNNCF(TD,D,1) NNNCF(TE,E,1) NNNCF(TF,F,1) \ DDDCF(T1,1) DDDCF(T2,2) DDDCF(T3,3) DDDCF(T4,4) DDDCF(T5,5) \ DDDCF(T6,6) DDDCF(T7,7) DDDCF(T8,8) DDDCF(T9,9) \ DDDCF(TA,A) DDDCF(TB,B) DDDCF(TC,C) DDDCF(TD,D) DDDCF(TE,E) DDDCF(TF,F); \ {QCF(T1,1) QCF(T2,2) QCF(T3,3) QCF(T4,4) QCF(T5,5) \ QCF(T6,6) QCF(T7,7) QCF(T8,8) QCF(T9,9) \ QCF(TA,A) QCF(TB,B) QCF(TC,C) QCF(TD,D) QCF(TE,E) QCF(TF,F) _INT(2,UU,T0,A0,0); \ _INT(0,LL,T0,0,0) CN( TCF(LN,T1,1,0) TCF(LN,T2,2,1) TCF(LN,T3,3,1) \ TCF(LN,T4,4,1) TCF(LN,T5,5,1) TCF(LN,T6,6,1) \ TCF(LN,T7,7,1) TCF(LN,T8,8,1) TCF(LN,T9,9,1) \ TCF(LN,TA,A,1) TCF(LN,TB,B,1) TCF(LN,TC,C,1) TCF(LN,TD,D,1) TCF(LN,TE,E,1) TCF(LN,TF,F,1)); \ _INT(0,K,T0,0,0) RCF(T1,1) RCF(T2,2) RCF(T3,3) RCF(T4,4) RCF(T5,5) \ RCF(T6,6) RCF(T7,7) RCF(T8,8) RCF(T9,9) \ RCF(TA,A) RCF(TB,B) RCF(TC,C) RCF(TD,D) RCF(TE,E) RCF(TF,F) I##T0} #endif #endif /* VAX VMS or Ultrix, Mips, CRAY, Sun, Apollo, HP9000, LynxOS, IBMR2. f2c, NAG f90. */ #ifdef __cplusplus } #endif hdf-eos5-2.0/include/cproj.h000077500000000000000000000016451507520047200157110ustar00rootroot00000000000000#include #ifdef __cplusplus extern "C" { #endif #define PI 3.141592653589793238 #define HALF_PI (PI*0.5) #define TWO_PI (PI*2.0) #define EPSLN 1.0e-10 #define R2D 57.2957795131 /* #define D2R 0.0174532925199 */ #define D2R 1.745329251994328e-2 #define S2R 4.848136811095359e-6 #define OK 0 #define ERROR -1 #define IN_BREAK -2 /* Misc macros -----------*/ #define SQUARE(x) ((x) * (x)) /* x**2 */ #define CUBE(x) ((x) * (x) * (x)) /* x**3 */ #define QUAD(x) ((x) * (x) * (x) * (x)) /* x**4 */ #define GMAX(A, B) ((A) > (B) ? (A) : (B)) /* assign maximum of a and b */ #define GMIN(A, B) ((A) < (B) ? (A) : (B)) /* assign minimum of a and b */ #define IMOD(A, B) (A) - (((A) / (B)) * (B)) /* Integer mod function */ /*#include "cproj_prototypes.h"*/ /* causes problem to hdfeos5 clearcase Lastpass build */ #include "HE5_GctpFunc.h" #ifdef __cplusplus } #endif hdf-eos5-2.0/include/ease.h000066400000000000000000000014371507520047200155050ustar00rootroot00000000000000#ifndef EASE_H_ #define EASE_H_ #include #define BCEA_COLS25 1383 /* total number of columns for EASE grid */ #define BCEA_ROWS25 586 /* total number of rows for EASE grid */ #define BCEA_CELL_M 25067.525 /* Cell size for EASE grid */ #define BCEA_RE_M 6371228.0 /* Earth radius used in GCTP projection tools for Behrmann Cylindrical Equal Area projection */ #define DEFAULT_BCEA_LTRUESCALE 30.00 /*Latitude of true scale in DMS */ #define BCEA_COS_PHI1 cos(DEFAULT_BCEA_LTRUESCALE *3.141592653589793238 /180.0) #define PI 3.141592653589793238 #define EASE_GRID_DEFAULT_UPLEFT_LON -180.0 #define EASE_GRID_DEFAULT_UPLEFT_LAT 86.72 #define EASE_GRID_DEFAULT_LOWRGT_LON 180.0 #define EASE_GRID_DEFAULT_LOWRGT_LAT -86.72 #endif /* #ifndef EASE_H_ */ hdf-eos5-2.0/include/hdfeos5.inc000066400000000000000000000351131507520047200164450ustar00rootroot00000000000000! * ========================================================== ! * File: hdfeos5.inc ! * Author: A. Muslimov, Emergent Technology Services, Inc. ! * Date: March 11, 2002 ! * Purpose: Fortran header file for HDFEOS5 routines ! * ========================================================== ! * Contents: ! * HDFEOS5 data type tags ! * HDFEOS5 logical constants ! * HDFEOS5 file access tags ! * HDFEOS5/GCTP library codes ! * ! * =========================================================== ! HDFEOS5 DATA TYPE TAGS ! ======================= integer HE5T_NATIVE_INT integer HE5T_NATIVE_UINT integer HE5T_NATIVE_SHORT integer HE5T_NATIVE_USHORT integer HE5T_NATIVE_SCHAR integer HE5T_NATIVE_UCHAR integer HE5T_NATIVE_LONG integer HE5T_NATIVE_ULONG integer HE5T_NATIVE_LLONG integer HE5T_NATIVE_ULLONG integer HE5T_NATIVE_FLOAT integer HE5T_NATIVE_REAL integer HE5T_NATIVE_DOUBLE integer HE5T_NATIVE_LDOUBLE integer HE5T_NATIVE_INT8 integer HE5T_NATIVE_UINT8 integer HE5T_NATIVE_INT16 integer HE5T_NATIVE_UINT16 integer HE5T_NATIVE_INT32 integer HE5T_NATIVE_UINT32 integer HE5T_NATIVE_INT64 integer HE5T_NATIVE_UINT64 integer HE5T_NATIVE_B8 integer HE5T_NATIVE_B16 integer HE5T_NATIVE_B32 integer HE5T_NATIVE_B64 integer HE5T_NATIVE_HSIZE integer HE5T_NATIVE_HERR integer HE5T_NATIVE_HBOOL integer HE5T_STD_I8BE integer HE5T_STD_I8LE integer HE5T_STD_I16BE integer HE5T_STD_I16LE integer HE5T_STD_I32BE integer HE5T_STD_I32LE integer HE5T_STD_I64BE integer HE5T_STD_I64LE integer HE5T_STD_U8BE integer HE5T_STD_U8LE integer HE5T_STD_U16BE integer HE5T_STD_U16LE integer HE5T_STD_U32BE integer HE5T_STD_U32LE integer HE5T_STD_U64BE integer HE5T_STD_U64LE integer HE5T_STD_B8BE integer HE5T_STD_B8LE integer HE5T_STD_B16BE integer HE5T_STD_B16LE integer HE5T_STD_B32BE integer HE5T_STD_B32LE integer HE5T_STD_B64BE integer HE5T_STD_B64LE integer HE5T_IEEE_F32BE integer HE5T_IEEE_F32LE integer HE5T_IEEE_F64BE integer HE5T_IEEE_F64LE integer HE5T_NATIVE_CHAR integer HE5T_CHARSTRING parameter(HE5T_NATIVE_INT = 0) parameter(HE5T_NATIVE_UINT = 1) parameter(HE5T_NATIVE_SHORT = 2) parameter(HE5T_NATIVE_USHORT = 3) parameter(HE5T_NATIVE_SCHAR = 4) parameter(HE5T_NATIVE_UCHAR = 5) parameter(HE5T_NATIVE_LONG = 6) parameter(HE5T_NATIVE_ULONG = 7) parameter(HE5T_NATIVE_LLONG = 8) parameter(HE5T_NATIVE_ULLONG = 9) parameter(HE5T_NATIVE_FLOAT =10) parameter(HE5T_NATIVE_REAL =10) parameter(HE5T_NATIVE_DOUBLE =11) parameter(HE5T_NATIVE_LDOUBLE =12) parameter(HE5T_NATIVE_INT8 =13) parameter(HE5T_NATIVE_UINT8 =14) parameter(HE5T_NATIVE_INT16 =15) parameter(HE5T_NATIVE_UINT16 =16) parameter(HE5T_NATIVE_INT32 =17) parameter(HE5T_NATIVE_UINT32 =18) parameter(HE5T_NATIVE_INT64 =19) parameter(HE5T_NATIVE_UINT64 =20) parameter(HE5T_NATIVE_B8 =21) parameter(HE5T_NATIVE_B16 =22) parameter(HE5T_NATIVE_B32 =23) parameter(HE5T_NATIVE_B64 =24) parameter(HE5T_NATIVE_HSIZE =25) parameter(HE5T_NATIVE_HERR =26) parameter(HE5T_NATIVE_HBOOL =27) parameter(HE5T_STD_I8BE =28) parameter(HE5T_STD_I8LE =29) parameter(HE5T_STD_I16BE =30) parameter(HE5T_STD_I16LE =31) parameter(HE5T_STD_I32BE =32) parameter(HE5T_STD_I32LE =33) parameter(HE5T_STD_I64BE =34) parameter(HE5T_STD_I64LE =35) parameter(HE5T_STD_U8BE =36) parameter(HE5T_STD_U8LE =37) parameter(HE5T_STD_U16BE =38) parameter(HE5T_STD_U16LE =39) parameter(HE5T_STD_U32BE =40) parameter(HE5T_STD_U32LE =41) parameter(HE5T_STD_U64BE =42) parameter(HE5T_STD_U64LE =43) parameter(HE5T_STD_B8BE =44) parameter(HE5T_STD_B8LE =45) parameter(HE5T_STD_B16BE =46) parameter(HE5T_STD_B16LE =47) parameter(HE5T_STD_B32BE =48) parameter(HE5T_STD_B32LE =49) parameter(HE5T_STD_B64BE =50) parameter(HE5T_STD_B64LE =51) parameter(HE5T_IEEE_F32BE =52) parameter(HE5T_IEEE_F32LE =53) parameter(HE5T_IEEE_F64BE =54) parameter(HE5T_IEEE_F64LE =55) parameter(HE5T_NATIVE_CHAR =56) parameter(HE5T_CHARSTRING =57) integer HE5S_UNLIMITED_F parameter(HE5S_UNLIMITED_F = -1) ! HDFEOS5 FILE ACCESS TAGS ! ======================== integer HE5F_ACC_RDWR integer HE5F_ACC_RDONLY integer HE5F_ACC_TRUNC parameter(HE5F_ACC_RDWR = 100) parameter(HE5F_ACC_RDONLY = 101) parameter(HE5F_ACC_TRUNC = 102) ! TOOLKIT FILE ACCESS TAGS ! ======================== integer HDF4_ACC_RDONLY integer HDF4_ACC_RDWR integer HDF4_ACC_CREATE integer HDF5_ACC_RDONLY integer HDF5_ACC_RDWR integer HDF5_ACC_CREATE parameter(HDF4_ACC_RDONLY = 1) parameter(HDF4_ACC_RDWR = 3) parameter(HDF4_ACC_CREATE = 4) parameter(HDF5_ACC_RDONLY = 11) parameter(HDF5_ACC_RDWR = 13) parameter(HDF5_ACC_CREATE = 14) ! HDFEOS5 MERGE CODES ! ==================== integer HE5_HDFE_NOMERGE integer HE5_HDFE_AUTOMERGE parameter(HE5_HDFE_NOMERGE =0) parameter(HE5_HDFE_AUTOMERGE =1) ! HDFEOS5 XXentries CODES ! ======================= integer HE5_HDFE_NENTDIM integer HE5_HDFE_NENTMAP integer HE5_HDFE_NENTIMAP integer HE5_HDFE_NENTGFLD integer HE5_HDFE_NENTDFLD parameter(HE5_HDFE_NENTDIM =0) parameter(HE5_HDFE_NENTMAP =1) parameter(HE5_HDFE_NENTIMAP =2) parameter(HE5_HDFE_NENTGFLD =3) parameter(HE5_HDFE_NENTDFLD =4) ! HDFEOS5 ANGLE CONVERSION CODES ! ============================== integer HE5_HDFE_RAD_DEG integer HE5_HDFE_DEG_RAD integer HE5_HDFE_DMS_DEG integer HE5_HDFE_DEG_DMS integer HE5_HDFE_RAD_DMS integer HE5_HDFE_DMS_RAD parameter(HE5_HDFE_RAD_DEG =0) parameter(HE5_HDFE_DEG_RAD =1) parameter(HE5_HDFE_DMS_DEG =2) parameter(HE5_HDFE_DEG_DMS =3) parameter(HE5_HDFE_RAD_DMS =4) parameter(HE5_HDFE_DMS_RAD =5) ! HDFEOS5 SWATH SUBSET CODES ! ========================== integer HE5_HDFE_MIDPOINT integer HE5_HDFE_ENDPOINT integer HE5_HDFE_ANYPOINT integer HE5_HDFE_INTERNAL integer HE5_HDFE_EXTERNAL integer HE5_HDFE_NOPREVSUB parameter(HE5_HDFE_MIDPOINT =0) parameter(HE5_HDFE_ENDPOINT =1) parameter(HE5_HDFE_ANYPOINT =2) parameter(HE5_HDFE_INTERNAL =0) parameter(HE5_HDFE_EXTERNAL =1) parameter(HE5_HDFE_NOPREVSUB =-1) ! HDFEOS5 GRID ORIGIN CODES ! ========================= integer HE5_HDFE_GD_UL integer HE5_HDFE_GD_UR integer HE5_HDFE_GD_LL integer HE5_HDFE_GD_LR parameter(HE5_HDFE_GD_UL =0) parameter(HE5_HDFE_GD_UR =1) parameter(HE5_HDFE_GD_LL =2) parameter(HE5_HDFE_GD_LR =3) ! HDFEOS5 PIXEL REGISTRATION CODES ! ================================ integer HE5_HDFE_CENTER integer HE5_HDFE_CORNER parameter(HE5_HDFE_CENTER =0) parameter(HE5_HDFE_CORNER =1) ! HDFEOS5 GCTP PROJECTION CODES ! ============================= integer HE5_GCTP_GEO integer HE5_GCTP_UTM integer HE5_GCTP_SPCS integer HE5_GCTP_ALBERS integer HE5_GCTP_LAMCC integer HE5_GCTP_MERCAT integer HE5_GCTP_PS integer HE5_GCTP_POLYC integer HE5_GCTP_EQUIDC integer HE5_GCTP_TM integer HE5_GCTP_STEREO integer HE5_GCTP_LAMAZ integer HE5_GCTP_AZMEQD integer HE5_GCTP_GNOMON integer HE5_GCTP_ORTHO integer HE5_GCTP_GVNSP integer HE5_GCTP_SNSOID integer HE5_GCTP_EQRECT integer HE5_GCTP_MILLER integer HE5_GCTP_VGRINT integer HE5_GCTP_HOM integer HE5_GCTP_ROBIN integer HE5_GCTP_SOM integer HE5_GCTP_ALASKA integer HE5_GCTP_GOOD integer HE5_GCTP_MOLL integer HE5_GCTP_IMOLL integer HE5_GCTP_HAMMER integer HE5_GCTP_WAGIV integer HE5_GCTP_WAGVII integer HE5_GCTP_OBLEQA integer HE5_GCTP_ISINUS parameter(HE5_GCTP_GEO =0) parameter(HE5_GCTP_UTM =1) parameter(HE5_GCTP_SPCS =2) parameter(HE5_GCTP_ALBERS =3) parameter(HE5_GCTP_LAMCC =4) parameter(HE5_GCTP_MERCAT =5) parameter(HE5_GCTP_PS =6) parameter(HE5_GCTP_POLYC =7) parameter(HE5_GCTP_EQUIDC =8) parameter(HE5_GCTP_TM =9) parameter(HE5_GCTP_STEREO =10) parameter(HE5_GCTP_LAMAZ =11) parameter(HE5_GCTP_AZMEQD =12) parameter(HE5_GCTP_GNOMON =13) parameter(HE5_GCTP_ORTHO =14) parameter(HE5_GCTP_GVNSP =15) parameter(HE5_GCTP_SNSOID =16) parameter(HE5_GCTP_EQRECT =17) parameter(HE5_GCTP_MILLER =18) parameter(HE5_GCTP_VGRINT =19) parameter(HE5_GCTP_HOM =20) parameter(HE5_GCTP_ROBIN =21) parameter(HE5_GCTP_SOM =22) parameter(HE5_GCTP_ALASKA =23) parameter(HE5_GCTP_GOOD =24) parameter(HE5_GCTP_MOLL =25) parameter(HE5_GCTP_IMOLL =26) parameter(HE5_GCTP_HAMMER =27) parameter(HE5_GCTP_WAGIV =28) parameter(HE5_GCTP_WAGVII =29) parameter(HE5_GCTP_OBLEQA =30) parameter(HE5_GCTP_ISINUS =99) ! HDFEOS5 TILIND/COMPRESSION CODES ! ================================ integer HE5_HDFE_NOTILE integer HE5_HDFE_TILE integer HE5_HDFE_COMP_NONE integer HE5_HDFE_COMP_RLE integer HE5_HDFE_COMP_NBIT integer HE5_HDFE_COMP_SKPHUFF integer HE5_HDFE_COMP_DEFLATE integer HE5_HDFE_COMP_SZIP_CHIP integer HE5_HDFE_COMP_SZIP_K13 integer HE5_HDFE_COMP_SZIP_EC integer HE5_HDFE_COMP_SZIP_NN integer HE5_HDFE_COMP_SZIP_K13orEC integer HE5_HDFE_COMP_SZIP_K13orNN integer HE5_HDFE_COMP_SHUF_DEFLATE integer HE5_HDFE_COMP_SHUF_SZIP_CHIP integer HE5_HDFE_COMP_SHUF_SZIP_K13 integer HE5_HDFE_COMP_SHUF_SZIP_EC integer HE5_HDFE_COMP_SHUF_SZIP_NN integer HE5_HDFE_COMP_SHUF_SZIP_K13orEC integer HE5_HDFE_COMP_SHUF_SZIP_K13orNN parameter(HE5_HDFE_NOTILE =0) parameter(HE5_HDFE_TILE =1) parameter(HE5_HDFE_COMP_NONE =0) parameter(HE5_HDFE_COMP_RLE =1) parameter(HE5_HDFE_COMP_NBIT =2) parameter(HE5_HDFE_COMP_SKPHUFF =3) parameter(HE5_HDFE_COMP_DEFLATE =4) parameter(HE5_HDFE_COMP_SZIP_CHIP =5) parameter(HE5_HDFE_COMP_SZIP_K13 =6) parameter(HE5_HDFE_COMP_SZIP_EC =7) parameter(HE5_HDFE_COMP_SZIP_NN =8) parameter(HE5_HDFE_COMP_SZIP_K13orEC =9) parameter(HE5_HDFE_COMP_SZIP_K13orNN =10) parameter(HE5_HDFE_COMP_SHUF_DEFLATE =11) parameter(HE5_HDFE_COMP_SHUF_SZIP_CHIP =12) parameter(HE5_HDFE_COMP_SHUF_SZIP_K13 =13) parameter(HE5_HDFE_COMP_SHUF_SZIP_EC =14) parameter(HE5_HDFE_COMP_SHUF_SZIP_NN =15) parameter(HE5_HDFE_COMP_SHUF_SZIP_K13orEC =16) parameter(HE5_HDFE_COMP_SHUF_SZIP_K13orNN =17) ! HDFEOS5 GROUP CODES ! =================== integer HE5_HDFE_GEOGROUP integer HE5_HDFE_DATAGROUP integer HE5_HDFE_ATTRGROUP integer HE5_HDFE_GRPATTRGROUP integer HE5_HDFE_LOCATTRGROUP integer HE5_HDFE_PROFGROUP integer HE5_HDFE_PROFGRPATTRGROUP integer HE5_HDFE_GEOGRPATTRGROUP parameter(HE5_HDFE_GEOGROUP =0) parameter(HE5_HDFE_DATAGROUP =1) parameter(HE5_HDFE_ATTRGROUP =2) parameter(HE5_HDFE_GRPATTRGROUP =3) parameter(HE5_HDFE_LOCATTRGROUP =4) parameter(HE5_HDFE_PROFGROUP =5) parameter(HE5_HDFE_PROFGRPATTRGROUP =6) parameter(HE5_HDFE_GEOGRPATTRGROUP =7) hdf-eos5-2.0/include/hdfeos5_64.inc000066400000000000000000000010151507520047200167500ustar00rootroot00000000000000! * ========================================================== ! * File: hdfeos5_64.inc ! * Author: A. Muslimov, Emergent Technology Services, Inc. ! * Date: March 19, 2002 ! * Purpose: Fortran header file for HDFEOS5 routines on 64 ! * bit platforms ! * ========================================================== ! * Contents: ! * ! * ! * =========================================================== integer*8 HE5S_UNLIMITED_F_64 parameter(HE5S_UNLIMITED_F_64 = -1) hdf-eos5-2.0/include/isin.h000077500000000000000000000065571507520047200155450ustar00rootroot00000000000000/****************************************************************************** NAME ISIN.H PURPOSE: Integerized Sinusoidal Library Header - constants, data structures and prototypes for integerized sinusoidal library functions. PROGRAMMER DATE REASON ---------- ---- ------ Robert Wolfe (STX) 1-2-97 Initial version. Raj Gejjagaraguppe (ARC) 1-15-97 Modified the code to work with GCTP software. D*****************************************************************************/ #ifdef __cplusplus extern "C" { #endif /* Status returned */ #define ISIN_SUCCESS 0 /* Successful return */ #define ISIN_ERROR -1 /* Error return */ #define ISIN_ERANGE -2 /* Input variable out of range */ /* Data Structures */ /* Row Type; Information for Eash Row (longitudinal band) in Projection */ typedef struct { long ncol; /* Number of columns */ long icol_cen; /* Column number to left of center of grid */ double ncol_inv; /* Number of columns inverse */ } Isin_row_t; /* Handle Type; Values assigned in 'Isin_init' */ typedef struct { double false_east; /* Northing at projection origin */ double false_north; /* Easting at projection origin */ double sphere; /* Sphere radius (user's units) */ double sphere_inv; /* Sphere radius inverse (user's units) */ double ang_size_inv; /* Grid angular resolution inverse (1/rad)*/ long nrow; /* Number of rows (longitudinal zones) */ long nrow_half; /* Half of number of rows (longitudinal zones)*/ double ref_lon; /* Zero reference longitude (rad) */ double lon_cen_mer; /* Longitude of central meridian (rad) */ int ijustify; /* Justify flag (see Isin_init) */ double col_dist; /* Distance for one column in projection * (user's units) */ double col_dist_inv; /* Distance for one column in projection inverse * (user's units) */ Isin_row_t *row; /* Row data structure */ long key; /* Data structure key */ } Isin_t; /* Error Structure */ typedef struct { int num; /* Error number */ char *str; /* Error message */ } error_t; /* Prototypes */ /* Initialize integerized sinusoidal forward transformations */ long isinusforinit(double , double, double, double, double, double); Isin_t *Isin_for_init(double , double, double, double, long, int); /* Initialize integerized sinusoidal inverse transformations */ long isinusinvinit(double , double, double, double, double, double); Isin_t *Isin_inv_init(double , double, double, double, long, int); /* Forward mapping; converts geographic coordinates ('lon', 'lat') * to map projection coordinates ('x', 'y') */ long isinusfor(double, double, double *, double *); int Isin_fwd(const Isin_t *, double, double, double *, double *); /* Inverse mapping; converts map projection coordinates ('x', 'y') to * geographic coordinates ('lon', 'lat') */ long isinusinv(double, double, double *, double *); int Isin_inv(const Isin_t *, double, double, double *, double *); /* Deallocate the 'isin' data structure and array memory */ int Isin_for_free(Isin_t *); int Isin_inv_free(Isin_t *); /* Private function to handle errors */ static int Isin_error(const error_t *, const char *); #ifdef __cplusplus } #endif hdf-eos5-2.0/include/proj.h000077500000000000000000000043521507520047200155440ustar00rootroot00000000000000/* 0 = Geographic 1 = Universal Transverse Mercator (UTM) 2 = State Plane Coordinates 3 = Albers Conical Equal Area 4 = Lambert Conformal Conic 5 = Mercator 6 = Polar Stereographic 7 = Polyconic 8 = Equidistant Conic 9 = Transverse Mercator 10 = Stereographic 11 = Lambert Azimuthal Equal Area 12 = Azimuthal Equidistant 13 = Gnomonic 14 = Orthographic 15 = General Vertical Near-Side Perspective 16 = Sinusiodal 17 = Equirectangular 18 = Miller Cylindrical 19 = Van der Grinten 20 = (Hotine) Oblique Mercator 21 = Robinson 22 = Space Oblique Mercator (SOM) 23 = Alaska Conformal 24 = Interrupted Goode Homolosine 25 = Mollweide 26 = Interrupted Mollweide 27 = Hammer 28 = Wagner IV 29 = Wagner VII 30 = Oblated Equal Area 31 = Integerized Sinusoidal Grid (the same as 99) 97 = Cylindrical Equal Area (Grid corners set in meters for EASE grid) 98 = Cylindrical Equal Area (Grid corners set in DMS degs for EASE grid) 99 = Integerized Sinusoidal Grid (added by Raj Gejjagaraguppe ARC for MODIS) */ #ifdef __cplusplus extern "C" { #endif #define GEO 0 #define UTM 1 #define SPCS 2 #define ALBERS 3 #define LAMCC 4 #define MERCAT 5 #define PS 6 #define POLYC 7 #define EQUIDC 8 #define TM 9 #define STEREO 10 #define LAMAZ 11 #define AZMEQD 12 #define GNOMON 13 #define ORTHO 14 #define GVNSP 15 #define SNSOID 16 #define EQRECT 17 #define MILLER 18 #define VGRINT 19 #define HOM 20 #define ROBIN 21 #define SOM 22 #define ALASKA 23 #define GOODE 24 #define MOLL 25 #define IMOLL 26 #define HAMMER 27 #define WAGIV 28 #define WAGVII 29 #define OBEQA 30 #define ISINUS1 31 #define CEA 97 #define BCEA 98 #define ISINUS 99 #define IN_BREAK -2 #define COEFCT 15 /* projection coefficient count */ #define PROJCT 31 /* projection count */ #define DATMCT 20 /* datum count */ #define MAXPROJ 100 /* Maximum projection number */ #define MAXUNIT 5 /* Maximum unit code number */ #define GEO_TERM 0 /* Array index for print-to-term flag */ #define GEO_FILE 1 /* Array index for print-to-file flag */ #define GEO_TRUE 1 /* True value for geometric true/false flags */ #define GEO_FALSE -1 /* False val for geometric true/false flags */ #ifdef __cplusplus } #endif hdf-eos5-2.0/include/tutils.h000066400000000000000000000046621507520047200161170ustar00rootroot00000000000000/**************************************************************************** * 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. * * * ****************************************************************************/ /* tutils.h,v 1.12 1995/10/05 16:17:28 koziol 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 ; #ifdef TEST_PC #define FAR far #else #ifndef FAR #define FAR /* */ #endif /* FAR */ #endif /* TEST_PC */ /* 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}} #endif /* _TUTILS_H */ hdf-eos5-2.0/m4/000077500000000000000000000000001507520047200133075ustar00rootroot00000000000000hdf-eos5-2.0/m4/libtool.m4000066400000000000000000010574321507520047200152310ustar00rootroot00000000000000# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. m4_define([_LT_COPYING], [dnl # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ]) # serial 57 LT_INIT # LT_PREREQ(VERSION) # ------------------ # Complain and exit if this libtool version is less that VERSION. m4_defun([LT_PREREQ], [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], [m4_fatal([Libtool version $1 or higher is required], 63)])], [$2])]) # _LT_CHECK_BUILDDIR # ------------------ # Complain if the absolute build directory name contains unusual characters m4_defun([_LT_CHECK_BUILDDIR], [case `pwd` in *\ * | *\ *) AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; esac ]) # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl m4_require([_LT_CHECK_BUILDDIR])dnl dnl Autoconf doesn't catch unexpanded LT_ macros by default: m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 dnl unless we require an AC_DEFUNed macro: AC_REQUIRE([LTOPTIONS_VERSION])dnl AC_REQUIRE([LTSUGAR_VERSION])dnl AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl _LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl _LT_SETUP # Only expand once: m4_define([LT_INIT]) ])# LT_INIT # Old names: AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) # _LT_CC_BASENAME(CC) # ------------------- # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. m4_defun([_LT_CC_BASENAME], [for cc_temp in $1""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set # sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} ])# _LT_FILEUTILS_DEFAULTS # _LT_SETUP # --------- m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl _LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl dnl _LT_DECL([], [build_alias], [0], [The build system])dnl _LT_DECL([], [build], [0])dnl _LT_DECL([], [build_os], [0])dnl dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl dnl AC_REQUIRE([AC_PROG_LN_S])dnl test -z "$LN_S" && LN_S="ln -s" _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl dnl AC_REQUIRE([LT_CMD_MAX_LEN])dnl _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_WITH_SYSROOT])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi ]) if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then _LT_PATH_MAGIC fi ;; esac # Use C for the default configuration in the libtool script LT_SUPPORTED_TAG([CC]) _LT_LANG_C_CONFIG _LT_LANG_DEFAULT_CONFIG _LT_CONFIG_COMMANDS ])# _LT_SETUP # _LT_PREPARE_SED_QUOTE_VARS # -------------------------- # Define a few sed substitution that help us do robust quoting. m4_defun([_LT_PREPARE_SED_QUOTE_VARS], [# Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([["`\\]]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ]) # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from `configure', and `config.status' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, # `config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) ltmain="$ac_aux_dir/ltmain.sh" ])# _LT_PROG_LTMAIN ## ------------------------------------- ## ## Accumulate code for creating libtool. ## ## ------------------------------------- ## # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS # in macros and then make a single call at the end using the `libtool' # label. # _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) # ---------------------------------------- # Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL_INIT], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_INIT], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_INIT]) # _LT_CONFIG_LIBTOOL([COMMANDS]) # ------------------------------ # Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) # _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) # ----------------------------------------------------- m4_defun([_LT_CONFIG_SAVE_COMMANDS], [_LT_CONFIG_LIBTOOL([$1]) _LT_CONFIG_LIBTOOL_INIT([$2]) ]) # _LT_FORMAT_COMMENT([COMMENT]) # ----------------------------- # Add leading comment marks to the start of each line, and a trailing # full-stop to the whole comment if one is not present already. m4_define([_LT_FORMAT_COMMENT], [m4_ifval([$1], [ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) )]) ## ------------------------ ## ## FIXME: Eliminate VARNAME ## ## ------------------------ ## # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) # ------------------------------------------------------------------- # CONFIGNAME is the name given to the value in the libtool script. # VARNAME is the (base) name used in the configure script. # VALUE may be 0, 1 or 2 for a computed quote escaped value based on # VARNAME. Any other value will be used directly. m4_define([_LT_DECL], [lt_if_append_uniq([lt_decl_varnames], [$2], [, ], [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], [m4_ifval([$1], [$1], [$2])]) lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) m4_ifval([$4], [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) lt_dict_add_subkey([lt_decl_dict], [$2], [tagged?], [m4_ifval([$5], [yes], [no])])]) ]) # _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) # -------------------------------------------------------- m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) # lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_tag_varnames], [_lt_decl_filter([tagged?], [yes], $@)]) # _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) # --------------------------------------------------------- m4_define([_lt_decl_filter], [m4_case([$#], [0], [m4_fatal([$0: too few arguments: $#])], [1], [m4_fatal([$0: too few arguments: $#: $1])], [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], [lt_dict_filter([lt_decl_dict], $@)])[]dnl ]) # lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) # -------------------------------------------------- m4_define([lt_decl_quote_varnames], [_lt_decl_filter([value], [1], $@)]) # lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_dquote_varnames], [_lt_decl_filter([value], [2], $@)]) # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_varnames_tagged], [m4_assert([$# <= 2])dnl _$0(m4_quote(m4_default([$1], [[, ]])), m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) m4_define([_lt_decl_varnames_tagged], [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_all_varnames], [_$0(m4_quote(m4_default([$1], [[, ]])), m4_if([$2], [], m4_quote(lt_decl_varnames), m4_quote(m4_shift($@))))[]dnl ]) m4_define([_lt_decl_all_varnames], [lt_join($@, lt_decl_varnames_tagged([$1], lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl ]) # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ # Quote a variable value, and forward it to `config.status' so that its # declaration there will have the same value as in `configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], [$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS # ------------------------------ # We delimit libtool config variables with single quotes, so when # we write them to config.status, we have to be sure to quote all # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # # ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAGS # ---------------- # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl available_tags="_LT_TAGS"dnl ]) # _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) # ----------------------------------- # Extract the dictionary values for VARNAME (optionally with TAG) and # expand to a commented shell variable setting: # # # Some comment about what VAR is for. # visible_name=$lt_internal_name m4_define([_LT_LIBTOOL_DECLARE], [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [description])))[]dnl m4_pushdef([_libtool_name], m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), [0], [_libtool_name=[$]$1], [1], [_libtool_name=$lt_[]$1], [2], [_libtool_name=$lt_[]$1], [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl ]) # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables # suitable for insertion in the LIBTOOL CONFIG section of the `libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], [m4_foreach([_lt_var], m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAG_VARS(TAG) # ------------------------- m4_define([_LT_LIBTOOL_TAG_VARS], [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) # _LT_TAGVAR(VARNAME, [TAGNAME]) # ------------------------------ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # _LT_CONFIG_COMMANDS # ------------------- # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations # into `config.status', and then the shell code to quote escape them in # for loops in `config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], dnl If the libtool generation code has been placed in $CONFIG_LT, dnl instead of duplicating it all over again into config.status, dnl then we will have config.status run $CONFIG_LT later, so it dnl needs to know what name is stored there: [AC_CONFIG_COMMANDS([libtool], [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], dnl If the libtool generation code is destined for config.status, dnl expand the accumulated commands and init code now: [AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) ])#_LT_CONFIG_COMMANDS # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], [ # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' _LT_CONFIG_STATUS_DECLARATIONS LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$[]1 _LTECHO_EOF' } # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done _LT_OUTPUT_LIBTOOL_INIT ]) # _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) # ------------------------------------ # Generate a child script FILE with all initialization necessary to # reuse the environment learned by the parent script, and make the # file executable. If COMMENT is supplied, it is inserted after the # `#!' sequence but before initialization text begins. After this # macro, additional text can be appended to FILE to form the body of # the child script. The macro ends with non-zero status if the # file could not be fully written (such as if the disk is full). m4_ifdef([AS_INIT_GENERATED], [m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], [m4_defun([_LT_GENERATED_FILE_INIT], [m4_require([AS_PREPARE])]dnl [m4_pushdef([AS_MESSAGE_LOG_FD])]dnl [lt_write_fail=0 cat >$1 <<_ASEOF || lt_write_fail=1 #! $SHELL # Generated by $as_me. $2 SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$1 <<\_ASEOF || lt_write_fail=1 AS_SHELL_SANITIZE _AS_PREPARE exec AS_MESSAGE_FD>&1 _ASEOF test $lt_write_fail = 0 && chmod +x $1[]dnl m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT # --------- # This macro allows early generation of the libtool script (before # AC_OUTPUT is called), incase it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) _LT_GENERATED_FILE_INIT(["$CONFIG_LT"], [# Run this file to recreate a libtool stub with the current configuration.]) cat >>"$CONFIG_LT" <<\_LTEOF lt_cl_silent=false exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ \`$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2011 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." while test $[#] != 0 do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try \`$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try \`$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. lt_cl_success=: test "$silent" = yes && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) ])# LT_OUTPUT # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # _LT_COPYING _LT_LIBTOOL_TAGS # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) _LT_PROG_REPLACE_SHELLFNS mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Go], [_LT_LANG(GO)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ])# LT_LANG # _LT_LANG(LANGNAME) # ------------------ m4_defun([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], [LT_SUPPORTED_TAG([$1])dnl m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG m4_ifndef([AC_PROG_GO], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_GO. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_GO], [AC_LANG_PUSH(Go)dnl AC_ARG_VAR([GOC], [Go compiler command])dnl AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl _AC_ARG_VAR_LDFLAGS()dnl AC_CHECK_TOOL(GOC, gccgo) if test -z "$GOC"; then if test -n "$ac_tool_prefix"; then AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) fi fi if test -z "$GOC"; then AC_CHECK_PROG(GOC, gccgo, gccgo, false) fi ])#m4_defun ])#m4_ifndef # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], [AC_PROVIDE_IFELSE([AC_PROG_CXX], [LT_LANG(CXX)], [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) AC_PROVIDE_IFELSE([AC_PROG_F77], [LT_LANG(F77)], [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) AC_PROVIDE_IFELSE([AC_PROG_FC], [LT_LANG(FC)], [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal dnl pulling things in needlessly. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([LT_PROG_GCJ], [LT_LANG(GCJ)], [m4_ifdef([AC_PROG_GCJ], [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([A][M_PROG_GCJ], [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) AC_PROVIDE_IFELSE([AC_PROG_GO], [LT_LANG(GO)], [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) ])# _LT_LANG_DEFAULT_CONFIG # Obsolete macros: AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) dnl AC_DEFUN([AC_LIBTOOL_RC], []) # _LT_TAG_COMPILER # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_TAG_COMPILER # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. m4_defun([_LT_COMPILER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. m4_defun([_LT_LINKER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CHECK_TOOL([LIPO], [lipo], [:]) AC_CHECK_TOOL([OTOOL], [otool], [:]) AC_CHECK_TOOL([OTOOL64], [otool64], [:]) _LT_DECL([], [DSYMUTIL], [1], [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) _LT_DECL([], [NMEDIT], [1], [Tool to change global to local symbols on Mac OS X]) _LT_DECL([], [LIPO], [1], [Tool to manipulate fat objects and archives on Mac OS X]) _LT_DECL([], [OTOOL], [1], [ldd/readelf like tool for Mach-O binaries on Mac OS X]) _LT_DECL([], [OTOOL64], [1], [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test $_lt_result -eq 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS="$save_LDFLAGS" ]) AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], [lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then lt_cv_ld_force_load=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[[012]]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES([TAG]) # --------------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported if test "$lt_cv_ld_force_load" = "yes"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) else _LT_TAGVAR(whole_archive_flag_spec, $1)='' fi _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" m4_if([$1], [CXX], [ if test "$lt_cv_apple_cc_single_mod" != "yes"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi ],[]) else _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX([TAGNAME]) # ---------------------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. # Store the results from the different compilers for each TAGNAME. # Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ lt_aix_libpath_sed='[ /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }]' _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" fi ]) aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], [m4_divert_text([M4SH-INIT], [$1 ])])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- # Find how we can fake an echo command that does not interpret backslash. # In particular, with Autoconf 2.60 or later we add some code to the start # of the generated configure script which will find a shell with a builtin # printf (which we can use as an echo command). m4_defun([_LT_PROG_ECHO_BACKSLASH], [ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO AC_MSG_CHECKING([how to print strings]) # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $[]1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } case "$ECHO" in printf*) AC_MSG_RESULT([printf]) ;; print*) AC_MSG_RESULT([print -r]) ;; *) AC_MSG_RESULT([cat]) ;; esac m4_ifdef([_AS_DETECT_SUGGESTED], [_AS_DETECT_SUGGESTED([ test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test "X`printf %s $ECHO`" = "X$ECHO" \ || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH # _LT_WITH_SYSROOT # ---------------- AC_DEFUN([_LT_WITH_SYSROOT], [AC_MSG_CHECKING([for sysroot]) AC_ARG_WITH([sysroot], [ --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified).], [], [with_sysroot=no]) dnl lt_sysroot will always be passed unquoted. We quote it here dnl in case the user passed a directory name. lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) AC_MSG_RESULT([${with_sysroot}]) AC_MSG_ERROR([The sysroot must be an absolute path.]) ;; esac AC_MSG_RESULT([${lt_sysroot:-no}]) _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl [dependent libraries, and in which our libraries should be installed.])]) # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; *-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD="${LD-ld}_sol2" fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" ])# _LT_ENABLE_LOCK # _LT_PROG_AR # ----------- m4_defun([_LT_PROG_AR], [AC_CHECK_TOOLS(AR, [ar], false) : ${AR=ar} : ${AR_FLAGS=cru} _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], [lt_cv_ar_at_file=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM], [echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a ]) ]) if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi _LT_DECL([], [archiver_list_spec], [1], [How to feed a file listing to the archiver]) ])# _LT_PROG_AR # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], [_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) AC_CHECK_TOOL(RANLIB, ranlib, :) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) _LT_DECL([], [lock_old_archive_extraction], [0], [Whether to use a lock for old archive extraction]) ])# _LT_CMD_OLD_ARCHIVE # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $RM conftest* ]) if test x"[$]$2" = xyes; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" ]) if test x"[$]$2" = xyes; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n $lt_cv_sys_max_cmd_len ; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "$cross_compiling" = yes; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF [#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; }] _LT_EOF if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_TRY_DLOPEN_SELF # LT_SYS_DLOPEN_SELF # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen="shl_load"], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen="dlopen"], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) ]) ]) ]) ]) ]) ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* ]) _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], [Does compiler simultaneously support -c and -o options?]) ])# _LT_COMPILER_C_O # _LT_COMPILER_FILE_LOCKS([TAGNAME]) # ---------------------------------- # Check to see if we can do hard links to lock some files if needed m4_defun([_LT_COMPILER_FILE_LOCKS], [m4_require([_LT_ENABLE_LOCK])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) hard_links="nottested" if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", [Define to the sub-directory in which libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then # We can hardcode non-existent directories. if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[[4-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[23]].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[[3-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], [lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], [lt_cv_shlibpath_overrides_runpath=yes])]) LDFLAGS=$save_LDFLAGS libdir=$save_libdir ]) shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Add ABI-specific directories to the system library path. sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[[89]] | openbsd2.[[89]].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [install_override_mode], [1], [Permission mode override for installation of shared libraries]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], [Command to use after uninstallation of a shared archive]) _LT_DECL([], [finish_cmds], [2], [Commands used to finish a libtool library installation in a directory]) _LT_DECL([], [finish_eval], [1], [[As "finish_cmds", except a single script fragment to be evaled but not shown]]) _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) _LT_DECL([], [sys_lib_dlsearch_path_spec], [2], [Run-time system search path for libraries]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program which can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$1; then lt_cv_path_MAGIC_CMD="$ac_dir/$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac]) MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program which can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PROG_ECHO_BACKSLASH])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test "$withval" = no || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method = "file_magic"]) _LT_DECL([], [file_magic_glob], [1], [How to find potential files when deplibs_check_method = "file_magic"]) _LT_DECL([], [want_nocaseglob], [1], [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD # LT_PATH_NM # ---------- # find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi]) if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi AC_SUBST([DUMPBIN]) if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest*]) ])# LT_PATH_NM # Old names: AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) # _LT_CHECK_SHAREDLIB_FROM_LINKLIB # -------------------------------- # how to determine the name of the shared library # associated with a specific link library. # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) m4_require([_LT_DECL_DLLTOOL]) AC_CACHE_CHECK([how to associate runtime and link libraries], lt_cv_sharedlib_from_linklib_cmd, [lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac ]) sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO _LT_DECL([], [sharedlib_from_linklib_cmd], [1], [Command to associate shared and link libraries]) ])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB # _LT_PATH_MANIFEST_TOOL # ---------------------- # locate the manifest tool m4_defun([_LT_PATH_MANIFEST_TOOL], [AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], [lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&AS_MESSAGE_LOG_FD if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest*]) if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl ])# _LT_PATH_MANIFEST_TOOL # LT_LIB_M # -------- # check for math library AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM="-lm") ;; esac AC_SUBST([LIBM]) ])# LT_LIB_M # Old name: AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_CHECK_LIBM], []) # _LT_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------- m4_defun([_LT_COMPILER_NO_RTTI], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test "$GCC" = yes; then case $cc_basename in nvcc*) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; *) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; esac _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], [Compiler flag to turn off builtin functions]) ])# _LT_COMPILER_NO_RTTI # _LT_CMD_GLOBAL_SYMBOLS # ---------------------- m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_TAG_COMPILER])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[[ABCDEGRST]]' fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT@&t@_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT@&t@_DLSYM_CONST #else # define LT@&t@_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT@&t@_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then nm_file_list_spec='@' fi _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) _LT_DECL([], [nm_file_list_spec], [1], [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS # _LT_COMPILER_PIC([TAGNAME]) # --------------------------- m4_defun([_LT_COMPILER_PIC], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; dgux*) case $cc_basename in ec++*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64 which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL 8.0, 9.0 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd*) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test "$GCC" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; *Sun\ F* | *Sun*Fortran*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; *Intel*\ [[CF]]*Compiler*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; *Portland\ Group*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; esac ;; newsos6) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_CACHE_CHECK([for $compiler option to produce PIC], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) _LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], [How to pass a linker flag through the compiler]) # # Check to make sure the static flag actually works. # wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- # See if the linker supports building shared libraries. m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global defined # symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] ;; esac ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(old_archive_from_new_cmds, $1)= _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_TAGVAR(thread_safe_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) m4_if($1, [], [ # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) _LT_LINKER_OPTION([if $CC understands -b], _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) ;; esac fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], [lt_cv_irix_exported_symbol], [save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" AC_LINK_IFELSE( [AC_LANG_SOURCE( [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], [C++], [[int foo (void) { return 0; }]], [Fortran 77], [[ subroutine foo end]], [Fortran], [[ subroutine foo end]])])], [lt_cv_irix_exported_symbol=yes], [lt_cv_irix_exported_symbol=no]) LDFLAGS="$save_LDFLAGS"]) if test "$lt_cv_irix_exported_symbol" = yes; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' else case $host_os in openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' ;; esac fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_CACHE_CHECK([whether -lc should be explicitly linked in], [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), [$RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) _LT_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) then lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no else lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* ]) _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) ;; esac fi ;; esac _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], [Whether or not to add -lc for building shared libraries]) _LT_TAGDECL([allow_libtool_libs_with_static_runtimes], [enable_shared_with_static_runtimes], [0], [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [compiler_needs_object], [1], [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], [Create a temporary old-style archive to link instead of a shared archive]) _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) _LT_TAGDECL([], [archive_expsym_cmds], [2]) _LT_TAGDECL([], [module_cmds], [2], [Commands used to build a loadable module if different from building a shared archive.]) _LT_TAGDECL([], [module_expsym_cmds], [2]) _LT_TAGDECL([], [with_gnu_ld], [1], [Whether we are building with GNU ld or not]) _LT_TAGDECL([], [allow_undefined_flag], [1], [Flag that allows shared libraries with undefined symbols to be built]) _LT_TAGDECL([], [no_undefined_flag], [1], [Flag that enforces no undefined symbols]) _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary and the resulting library dependency is "absolute", i.e impossible to change by setting ${shlibpath_var} if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_shlibpath_var], [0], [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_automatic], [0], [Set to "yes" if building a shared library automatically hardcodes DIR into the library and all subsequent libraries and executables linked against it]) _LT_TAGDECL([], [inherit_rpath], [0], [Set to yes if linker adds runtime paths of dependent libraries to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], [The commands to list exported symbols]) _LT_TAGDECL([], [exclude_expsyms], [1], [Symbols that should not be listed in the preloaded symbols]) _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) _LT_TAGDECL([], [postlink_cmds], [2], [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) ])# _LT_LINKER_SHLIBS # _LT_LANG_C_CONFIG([TAG]) # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl lt_save_CC="$CC" AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_TAG_COMPILER # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB # Report which library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC="$lt_save_CC" ])# _LT_LANG_C_CONFIG # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes fi AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_caught_CXX_error" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GXX" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared # libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ func_to_tool_file "$lt_outputfile"~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes ;; gnu*) ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) _LT_TAGVAR(ld_shlibs, $1)=yes ;; openbsd2*) # C++ shared libraries are fairly broken _LT_TAGVAR(ld_shlibs, $1)=no ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; cxx*) case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ '"$_LT_TAGVAR(old_archive_cmds, $1)" _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ '"$_LT_TAGVAR(reload_cmds, $1)" ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(GCC, $1)="$GXX" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test "$_lt_caught_CXX_error" != yes AC_LANG_POP ])# _LT_LANG_CXX_CONFIG # _LT_FUNC_STRIPNAME_CNF # ---------------------- # func_stripname_cnf prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # # This function is identical to the (non-XSI) version of func_stripname, # except this one can be used by m4 code that may be executed by configure, # rather than the libtool script. m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl AC_REQUIRE([_LT_DECL_SED]) AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) func_stripname_cnf () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname_cnf ])# _LT_FUNC_STRIPNAME_CNF # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= _LT_TAGVAR(predeps, $1)= _LT_TAGVAR(postdeps, $1)= _LT_TAGVAR(compiler_lib_search_path, $1)= dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF int a; void foo (void) { a = 0; } _LT_EOF ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer*4 a a=0 return end _LT_EOF ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF public class foo { private int a; public void bar (void) { a = 0; } }; _LT_EOF ], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF package foo func foo() { } _LT_EOF ]) _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; esac dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case ${prev}${p} in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" || test $p = "-R"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test "$pre_test_object_deps_done" = no; then case ${prev} in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" else _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then _LT_TAGVAR(postdeps, $1)="${prev}${p}" else _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)="$p" else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)="$p" else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], [case $host_os in interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_TAGVAR(predep_objects,$1)= _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_LANG_PUSH(Fortran 77) if test -z "$F77" || test "X$F77" = "Xno"; then _lt_disable_F77=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_F77" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} CFLAGS=$FFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) GCC=$G77 if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$G77" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC="$lt_save_CC" CFLAGS="$lt_save_CFLAGS" fi # test "$_lt_disable_F77" != yes AC_LANG_POP ])# _LT_LANG_F77_CONFIG # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_LANG_PUSH(Fortran) if test -z "$FC" || test "X$FC" = "Xno"; then _lt_disable_FC=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_FC" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test "$_lt_disable_FC" != yes AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GCJ_CONFIG # _LT_LANG_GO_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Go compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GO_CONFIG], [AC_REQUIRE([LT_PROG_GO])dnl AC_LANG_SAVE # Source file extension for Go test sources. ac_ext=go # Object file extension for compiled Go test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="package main; func main() { }" # Code to be used in simple link tests lt_simple_link_test_code='package main; func main() { }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GOC-"gccgo"} CFLAGS=$GOFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # Go did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GO_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} CFLAGS= compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes if test -n "$compiler"; then : _LT_CONFIG($1) fi GCC=$lt_save_GCC AC_LANG_RESTORE CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_RC_CONFIG # LT_PROG_GCJ # ----------- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_GO # ---------- AC_DEFUN([LT_PROG_GO], [AC_CHECK_TOOL(GOC, gccgo,) ]) # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) # Old name: AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_RC], []) # _LT_DECL_EGREP # -------------- # If we don't have a new enough Autoconf to choose the best grep # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep _LT_DECL([], [GREP], [1], [A grep program that handles long lines]) _LT_DECL([], [EGREP], [1], [An ERE matcher]) _LT_DECL([], [FGREP], [1], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) # _LT_DECL_OBJDUMP # -------------- # If we don't have a new enough Autoconf to choose the best objdump # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_OBJDUMP], [AC_CHECK_TOOL(OBJDUMP, objdump, false) test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) # _LT_DECL_DLLTOOL # ---------------- # Ensure DLLTOOL variable is set. m4_defun([_LT_DECL_DLLTOOL], [AC_CHECK_TOOL(DLLTOOL, dlltool, false) test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program]) AC_SUBST([DLLTOOL]) ]) # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED m4_ifndef([AC_PROG_SED], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [AC_MSG_CHECKING([whether the shell understands some XSI constructs]) # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes AC_MSG_RESULT([$xsi_shell]) _LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) AC_MSG_CHECKING([whether the shell understands "+="]) lt_shell_append=no ( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes AC_MSG_RESULT([$lt_shell_append]) _LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) # ------------------------------------------------------ # In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and # '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. m4_defun([_LT_PROG_FUNCTION_REPLACE], [dnl { sed -e '/^$1 ()$/,/^} # $1 /c\ $1 ()\ {\ m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) } # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: ]) # _LT_PROG_REPLACE_SHELLFNS # ------------------------- # Replace existing portable implementations of several shell functions with # equivalent extended shell implementations where those features are available.. m4_defun([_LT_PROG_REPLACE_SHELLFNS], [if test x"$xsi_shell" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary parameter first. func_stripname_result=${3} func_stripname_result=${func_stripname_result#"${1}"} func_stripname_result=${func_stripname_result%"${2}"}]) _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl func_split_long_opt_name=${1%%=*} func_split_long_opt_arg=${1#*=}]) _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl case ${1} in *.lo) func_lo2o_result=${1%.lo}.${objext} ;; *) func_lo2o_result=${1} ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) fi if test x"$lt_shell_append" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl func_quote_for_eval "${2}" dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) fi ]) # _LT_PATH_CONVERSION_FUNCTIONS # ----------------------------- # Determine which file name conversion functions should be used by # func_to_host_file (and, implicitly, by func_to_host_path). These are needed # for certain cross-compile configurations and native mingw. m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_MSG_CHECKING([how to convert $build file names to $host format]) AC_CACHE_VAL(lt_cv_to_host_file_cmd, [case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac ]) to_host_file_cmd=$lt_cv_to_host_file_cmd AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) _LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], [0], [convert $build file names to $host format])dnl AC_MSG_CHECKING([how to convert $build file names to toolchain format]) AC_CACHE_VAL(lt_cv_to_tool_file_cmd, [#assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac ]) to_tool_file_cmd=$lt_cv_to_tool_file_cmd AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], [0], [convert $build files to toolchain format])dnl ])# _LT_PATH_CONVERSION_FUNCTIONS hdf-eos5-2.0/m4/ltoptions.m4000066400000000000000000000300731507520047200156070ustar00rootroot00000000000000# Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, # Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 7 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option `$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl `shared' nor `disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) ]) ])# _LT_SET_OPTIONS ## --------------------------------- ## ## Macros to handle LT_INIT options. ## ## --------------------------------- ## # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) # ----------------------------------------- m4_define([_LT_MANGLE_DEFUN], [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) # ----------------------------------------------- m4_define([LT_OPTION_DEFINE], [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl ])# LT_OPTION_DEFINE # dlopen # ------ LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes ]) AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) # win32-dll # --------- # Declare package support for building win32 dll's. LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; esac test -z "$AS" && AS=as _LT_DECL([], [AS], [1], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- # implement the --enable-shared flag, and supports the `shared' and # `disable-shared' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) _LT_DECL([build_libtool_libs], [enable_shared], [0], [Whether or not to build shared libraries]) ])# _LT_ENABLE_SHARED LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) # Old names: AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_SHARED], []) dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- # implement the --enable-static flag, and support the `static' and # `disable-static' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) _LT_DECL([build_old_libs], [enable_static], [0], [Whether or not to build static libraries]) ])# _LT_ENABLE_STATIC LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) # Old names: AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_STATIC], []) dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- # implement the --enable-fast-install flag, and support the `fast-install' # and `disable-fast-install' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) _LT_DECL([fast_install], [enable_fast_install], [0], [Whether or not to optimize for fast installation])dnl ])# _LT_ENABLE_FAST_INSTALL LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) # Old names: AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_PIC([MODE]) # -------------------- # implement the --with-pic flag, and support the `pic-only' and `no-pic' # LT_INIT options. # MODE is either `yes' or `no'. If omitted, it defaults to `both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for lt_pkg in $withval; do IFS="$lt_save_ifs" if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS="$lt_save_ifs" ;; esac], [pic_mode=default]) test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) ## ----------------- ## ## LTDL_INIT Options ## ## ----------------- ## m4_define([_LTDL_MODE], []) LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], [m4_define([_LTDL_MODE], [nonrecursive])]) LT_OPTION_DEFINE([LTDL_INIT], [recursive], [m4_define([_LTDL_MODE], [recursive])]) LT_OPTION_DEFINE([LTDL_INIT], [subproject], [m4_define([_LTDL_MODE], [subproject])]) m4_define([_LTDL_TYPE], []) LT_OPTION_DEFINE([LTDL_INIT], [installable], [m4_define([_LTDL_TYPE], [installable])]) LT_OPTION_DEFINE([LTDL_INIT], [convenience], [m4_define([_LTDL_TYPE], [convenience])]) hdf-eos5-2.0/m4/ltsugar.m4000066400000000000000000000104241507520047200152330ustar00rootroot00000000000000# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 6 ltsugar.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) # lt_join(SEP, ARG1, [ARG2...]) # ----------------------------- # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their # associated separator. # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier # versions in m4sugar had bugs. m4_define([lt_join], [m4_if([$#], [1], [], [$#], [2], [[$2]], [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) m4_define([_lt_join], [m4_if([$#$2], [2], [], [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) # lt_car(LIST) # lt_cdr(LIST) # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support # Autoconf-2.59 which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], [$#], 1, [], [m4_dquote(m4_shift($@))])]) m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ # Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different # than defined and empty). # # This macro is needed until we can rely on Autoconf 2.62, since earlier # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. m4_define([lt_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) # ---------------------------------------------------------- # Produce a SEP delimited list of all paired combinations of elements of # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list # has the form PREFIXmINFIXSUFFIXn. # Needed until we can rely on m4_combine added in Autoconf 2.62. m4_define([lt_combine], [m4_if(m4_eval([$# > 3]), [1], [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl [[m4_foreach([_Lt_prefix], [$2], [m4_foreach([_Lt_suffix], ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) # ----------------------------------------------------------------------- # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. m4_define([lt_if_append_uniq], [m4_ifdef([$1], [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], [lt_append([$1], [$2], [$3])$4], [$5])], [lt_append([$1], [$2], [$3])$4])]) # lt_dict_add(DICT, KEY, VALUE) # ----------------------------- m4_define([lt_dict_add], [m4_define([$1($2)], [$3])]) # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) # -------------------------------------------- m4_define([lt_dict_add_subkey], [m4_define([$1($2:$3)], [$4])]) # lt_dict_fetch(DICT, KEY, [SUBKEY]) # ---------------------------------- m4_define([lt_dict_fetch], [m4_ifval([$3], m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) # ----------------------------------------------------------------- m4_define([lt_if_dict_fetch], [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], [$5], [$6])]) # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) # -------------------------------------------------------------- m4_define([lt_dict_filter], [m4_if([$5], [], [], [lt_join(m4_quote(m4_default([$4], [[, ]])), lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl ]) hdf-eos5-2.0/m4/ltversion.m4000066400000000000000000000012621507520047200155770ustar00rootroot00000000000000# ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # @configure_input@ # serial 3337 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.4.2]) m4_define([LT_PACKAGE_REVISION], [1.3337]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4.2' macro_revision='1.3337' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) hdf-eos5-2.0/m4/lt~obsolete.m4000066400000000000000000000137561507520047200161370ustar00rootroot00000000000000# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 5 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us # using a macro with the same name in our local m4/libtool.m4 it'll # pull the old libtool.m4 in (it doesn't see our shiny new m4_define # and doesn't know about Autoconf macros at all.) # # So we provide this file, which has a silly filename so it's always # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until # we give up compatibility with versions before 1.7, at which point # we need to keep only those names which we still refer to. # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) hdf-eos5-2.0/m4/stdinc.m4000066400000000000000000000015731507520047200150430ustar00rootroot00000000000000################################################################################# ## Utility functions for testing the availability a given header file ## on a list of paths ################################################################################# # HDF_CHECK_INC_PATH([header],[path1,path2,path3]) AC_DEFUN( [HDF_CHECK_INC_PATH], [ m4_foreach([path], [$2], [ inc_path=path AS_IF( [test "x$AS_TR_SH([ac_cv_header_$1])" != "xyes"], [ saved_CPPFLAGS="$CPPFLAGS" AS_IF([test -n "$inc_path"], [CPPFLAGS="$CPPFLAGS -I$inc_path"]) unset AS_TR_SH([ac_cv_header_$1]) AC_CHECK_HEADERS( [$1],,[ CPPFLAGS="$saved_CPPFLAGS" ]) ]) ]) ]) hdf-eos5-2.0/m4/stdlib.m4000066400000000000000000000055161507520047200150410ustar00rootroot00000000000000################################################################################# ## Utility functions for testing the availability of generic libraries ## on a list of paths ################################################################################# # HDF_CHECK_LIB_PATH([lib],[func],[path1,path2,path3]) AC_DEFUN( [HDF_CHECK_LIB_PATH], [ m4_foreach([path], [$3], [ lib_path=path AS_IF( [test "x$AS_TR_SH([ac_cv_lib_$1_$2])" != "xyes"], [ unset AS_TR_SH([ac_cv_lib_$1_$2]) saved_LDFLAGS="$LDFLAGS" AS_IF([test -n "$lib_path"], [LDFLAGS="$LDFLAGS -L$lib_path"]) AC_CHECK_LIB( [$1],[$2], [ AS_TR_SH([ac_cv_lib_$1_$2])="yes" AS_TR_SH([AS_TR_SH([m4_toupper([HAVE_LIB$1])])])="yes" lib_name=AS_TR_SH([m4_toupper([HAVE_LIB$1])]) AC_DEFINE_UNQUOTED([$lib_name],[1],[something here]) LIBS="-l$1 $LIBS" ],[ LDFLAGS="$saved_LDFLAGS" AS_TR_SH([ac_cv_lib_$1_$2])="no" ]) ]) ]) ]) ################################################################################# ## Utility functions for testing the availability of generic libraries ################################################################################# # HDF_CHECK_LIB([zlib],[z],[compress2],[path]) AC_DEFUN( [HDF_CHECK_LIB], [ AC_ARG_WITH([$1], [AC_HELP_STRING([--with-$1=DIR], [Specify path to external $1 library. Linker must be able to find $1 if HDF4 was built with $1. [default=yes]])],, withval=yes) AS_IF( ## --with- with no directory. We must find it. ## [test "x$withval" == "xyes"], [ HDF_CHECK_LIB_PATH([$2],[$3],[$4]) ], ## --without- ## Nothing to do - library just does not get added. ## [test "x$withval" == "xno"],, ## All other cases ## [ AS_IF( [test -z "$withval"],[ AC_MSG_ERROR([no $1 library path provided]) ], [ LDFLAGS="$LDFLAGS -L$withval" AC_CHECK_LIB( [$2],[$3],, [ AC_MSG_ERROR([couldn't find $1 library]) ]) ]) ] ) ]) hdf-eos5-2.0/samples/000077500000000000000000000000001507520047200144335ustar00rootroot00000000000000hdf-eos5-2.0/samples/Makefile.am000066400000000000000000000231631507520047200164740ustar00rootroot00000000000000# samples Makefile.am # Sample programs for HDF-EOS5 # Boilerplate definitions file include $(top_srcdir)/config/include.am EXTRA_DIST = hdfeos5.inc hdfeos5_64.inc fixedBuoy0.txt fixedBuoy1.txt floatBuoy0.txt floatBuoy1.txt simple.txt # Link against GCTP library and HDF-EOS5 AM_CPPFLAGS=-I$(top_srcdir)/include -I$(top_srcdir)/gctp/include LDADD=$(LIBHDFEOS5) $(LIBGCTP) # The sample programs to be built when the user types 'make check' check_PROGRAMS=he5_gd_datainfo he5_gd_defexternalfld he5_gd_definefields \ he5_gd_defunlimfld he5_gd_info he5_gd_rdexternaldata he5_gd_readdata \ he5_gd_writedata he5_gd_setup he5_gd_subset he5_gd_wrexternaldata \ he5_gd_wrunlimfld \ he5_pt_datainfo he5_pt_definelevels he5_pt_readattrs he5_pt_readdata \ he5_pt_setup he5_pt_updatelevels he5_pt_writeattrs he5_pt_writedata \ he5_sw_datainfo he5_sw_defexternalfld he5_sw_definefields \ he5_sw_defunlimfld he5_sw_info he5_sw_rdexternaldata he5_sw_readdata \ he5_sw_setup he5_sw_subset he5_sw_wrextendrd he5_sw_wrexternaldata \ he5_sw_writedata he5_sw_wrunlimfld he5_za_datainfo \ he5_za_defexternalfld he5_za_definefields he5_za_info \ he5_za_rdexternaldata he5_za_readdata he5_za_setup \ he5_za_wrexternaldata he5_za_writedata if F2CFORTRAN_CONDITIONAL AM_LIBTOOLFLAGS=--tag=FC if F2CFORTRAN_32PTR_CONDITIONAL check_PROGRAMS += \ he5_gd_definefieldsF_32 \ he5_gd_infoF_32 \ he5_gd_readdataF_32 \ he5_gd_setupF_32 \ he5_gd_subsetF_32 \ he5_gd_writedataF_32 \ he5_pt_datainfoF_32 \ he5_pt_definelevelsF_32 \ he5_pt_readattrsF_32 \ he5_pt_readdataF_32 \ he5_pt_setupF_32 \ he5_pt_updatelevelsF_32 \ he5_pt_writeattrsF_32 \ he5_pt_writedataF_32 \ he5_sw_defexternalfldF_32 \ he5_sw_definefieldsF_32 \ he5_sw_infoF_32 \ he5_sw_rdexternaldataF_32 \ he5_sw_readdataF_32 \ he5_sw_setupF_32 \ he5_sw_subsetF_32 \ he5_sw_wrexternaldataF_32 \ he5_sw_writedataF_32 \ he5_za_defexternalfldF_32 \ he5_za_definefieldsF_32 \ he5_za_infoF_32 \ he5_za_rdexternaldataF_32 \ he5_za_readdataF_32 \ he5_za_setupF_32 \ he5_za_wrexternaldataF_32 \ he5_za_writedataF_32 he5_gd_definefieldsF_32_SOURCES = he5_gd_definefieldsF_32.f he5_gd_infoF_32_SOURCES = he5_gd_infoF_32.f he5_gd_readdataF_32_SOURCES = he5_gd_readdataF_32.f he5_gd_setupF_32_SOURCES = he5_gd_setupF_32.f he5_gd_subsetF_32_SOURCES = he5_gd_subsetF_32.f he5_gd_writedataF_32_SOURCES = he5_gd_writedataF_32.f he5_pt_datainfoF_32_SOURCES = he5_pt_datainfoF_32.f he5_pt_definelevelsF_32_SOURCES = he5_pt_definelevelsF_32.f he5_pt_readattrsF_32_SOURCES = he5_pt_readattrsF_32.f he5_pt_readdataF_32_SOURCES = he5_pt_readdataF_32.f he5_pt_setupF_32_SOURCES = he5_pt_setupF_32.f he5_pt_updatelevelsF_32_SOURCES = he5_pt_updatelevelsF_32.f he5_pt_writeattrsF_32_SOURCES = he5_pt_writeattrsF_32.f he5_pt_writedataF_32_SOURCES = he5_pt_writedataF_32.f he5_sw_defexternalfldF_32_SOURCES = he5_sw_defexternalfldF_32.f if SZIP_ENCODER_CONDITIONAL he5_sw_definefieldsF_32_SOURCES = he5_sw_definefields_szipF_32.f else he5_sw_definefieldsF_32_SOURCES = he5_sw_definefieldsF_32.f endif he5_sw_infoF_32_SOURCES = he5_sw_infoF_32.f he5_sw_rdexternaldataF_32_SOURCES = he5_sw_rdexternaldataF_32.f he5_sw_readdataF_32_SOURCES = he5_sw_readdataF_32.f he5_sw_setupF_32_SOURCES = he5_sw_setupF_32.f he5_sw_subsetF_32_SOURCES = he5_sw_subsetF_32.f he5_sw_wrexternaldataF_32_SOURCES = he5_sw_wrexternaldataF_32.f he5_sw_writedataF_32_SOURCES = he5_sw_writedataF_32.f he5_za_defexternalfldF_32_SOURCES = he5_za_defexternalfldF_32.f he5_za_definefieldsF_32_SOURCES = he5_za_definefieldsF_32.f he5_za_infoF_32_SOURCES = he5_za_infoF_32.f he5_za_rdexternaldataF_32_SOURCES = he5_za_rdexternaldataF_32.f he5_za_readdataF_32_SOURCES = he5_za_readdataF_32.f he5_za_setupF_32_SOURCES = he5_za_setupF_32.f he5_za_wrexternaldataF_32_SOURCES = he5_za_wrexternaldataF_32.f he5_za_writedataF_32_SOURCES = he5_za_writedataF_32.f else check_PROGRAMS += \ he5_gd_definefieldsF_64 \ he5_gd_infoF_64 \ he5_gd_readdataF_64 \ he5_gd_setupF_64 \ he5_gd_subsetF_64 \ he5_gd_writedataF_64 \ he5_pt_datainfoF_64 \ he5_pt_definelevelsF_64 \ he5_pt_readattrsF_64 \ he5_pt_readdataF_64 \ he5_pt_setupF_64 \ he5_pt_updatelevelsF_64 \ he5_pt_writeattrsF_64 \ he5_pt_writedataF_64 \ he5_sw_defexternalfldF_64 \ he5_sw_definefieldsF_64 \ he5_sw_infoF_64 \ he5_sw_rdexternaldataF_64 \ he5_sw_readdataF_64 \ he5_sw_setupF_64 \ he5_sw_subsetF_64 \ he5_sw_wrexternaldataF_64 \ he5_sw_writedataF_64 \ he5_za_defexternalfldF_64 \ he5_za_definefieldsF_64 \ he5_za_infoF_64 \ he5_za_rdexternaldataF_64 \ he5_za_readdataF_64 \ he5_za_setupF_64 \ he5_za_wrexternaldataF_64 \ he5_za_writedataF_64 he5_gd_definefieldsF_64_SOURCES = he5_gd_definefieldsF_64.f he5_gd_infoF_64_SOURCES = he5_gd_infoF_64.f he5_gd_readdataF_64_SOURCES = he5_gd_readdataF_64.f he5_gd_setupF_64_SOURCES = he5_gd_setupF_64.f he5_gd_subsetF_64_SOURCES = he5_gd_subsetF_64.f he5_gd_writedataF_64_SOURCES = he5_gd_writedataF_64.f he5_pt_datainfoF_64_SOURCES = he5_pt_datainfoF_64.f he5_pt_definelevelsF_64_SOURCES = he5_pt_definelevelsF_64.f he5_pt_readattrsF_64_SOURCES = he5_pt_readattrsF_64.f he5_pt_readdataF_64_SOURCES = he5_pt_readdataF_64.f he5_pt_setupF_64_SOURCES = he5_pt_setupF_64.f he5_pt_updatelevelsF_64_SOURCES = he5_pt_updatelevelsF_64.f he5_pt_writeattrsF_64_SOURCES = he5_pt_writeattrsF_64.f he5_pt_writedataF_64_SOURCES = he5_pt_writedataF_64.f he5_sw_defexternalfldF_64_SOURCES = he5_sw_defexternalfldF_64.f if SZIP_ENCODER_CONDITIONAL he5_sw_definefieldsF_64_SOURCES = he5_sw_definefields_szipF_64.f else he5_sw_definefieldsF_64_SOURCES = he5_sw_definefieldsF_64.f endif he5_sw_infoF_64_SOURCES = he5_sw_infoF_64.f he5_sw_rdexternaldataF_64_SOURCES = he5_sw_rdexternaldataF_64.f he5_sw_readdataF_64_SOURCES = he5_sw_readdataF_64.f he5_sw_setupF_64_SOURCES = he5_sw_setupF_64.f he5_sw_subsetF_64_SOURCES = he5_sw_subsetF_64.f he5_sw_wrexternaldataF_64_SOURCES = he5_sw_wrexternaldataF_64.f he5_sw_writedataF_64_SOURCES = he5_sw_writedataF_64.f he5_za_defexternalfldF_64_SOURCES = he5_za_defexternalfldF_64.f he5_za_definefieldsF_64_SOURCES = he5_za_definefieldsF_64.f he5_za_infoF_64_SOURCES = he5_za_infoF_64.f he5_za_rdexternaldataF_64_SOURCES = he5_za_rdexternaldataF_64.f he5_za_readdataF_64_SOURCES = he5_za_readdataF_64.f he5_za_setupF_64_SOURCES = he5_za_setupF_64.f he5_za_wrexternaldataF_64_SOURCES = he5_za_wrexternaldataF_64.f he5_za_writedataF_64_SOURCES = he5_za_writedataF_64.f endif endif # Tests consist of several programs run in succession. Each of these # names is the name of such a "sequence" of tests. TEST_SEQUENCES=gd_write_test gd_unlim_test pt_write_test sw_write_test \ sw_unlim_test sw_extend_test za_write_test if F2CFORTRAN_CONDITIONAL if F2CFORTRAN_32PTR_CONDITIONAL TEST_SEQUENCES+=gd_write_test_32f pt_write_test_32f sw_write_test_32f za_write_test_32f else TEST_SEQUENCES+=gd_write_test_64f pt_write_test_64f sw_write_test_64f za_write_test_64f endif endif # 'make check' should run each of the test sequences above check-local: $(TEST_SEQUENCES) # Manually list the tests to be run in order for each test sequence. gd_write_test: $(check_PROGRAMS) ./he5_gd_setup ./he5_gd_definefields ./he5_gd_writedata ./he5_gd_readdata ./he5_gd_info ./he5_gd_datainfo ./he5_gd_subset gd_write_test_32f: $(check_PROGRAMS) ./he5_gd_setupF_32 ./he5_gd_definefieldsF_32 ./he5_gd_writedataF_32 ./he5_gd_readdataF_32 ./he5_gd_infoF_32 ./he5_gd_subsetF_32 gd_write_test_64f: $(check_PROGRAMS) ./he5_gd_setupF_64 ./he5_gd_definefieldsF_64 ./he5_gd_writedataF_64 ./he5_gd_readdataF_64 ./he5_gd_infoF_64 ./he5_gd_subsetF_64 gd_unlim_test: $(check_PROGRAMS) ./he5_gd_setup ./he5_gd_defunlimfld ./he5_gd_wrunlimfld pt_write_test: $(check_PROGRAMS) ./he5_pt_setup ./he5_pt_definelevels srcdir=$(srcdir) ./he5_pt_writedata ./he5_pt_writeattrs ./he5_pt_readdata ./he5_pt_readattrs ./he5_pt_updatelevels ./he5_pt_datainfo pt_write_test_32f: $(check_PROGRAMS) ./he5_pt_setupF_32 ./he5_pt_definelevelsF_32 srcdir=$(srcdir) ./he5_pt_writedataF_32 ./he5_pt_writeattrsF_32 ./he5_pt_readdataF_32 ./he5_pt_readattrsF_32 ./he5_pt_updatelevelsF_32 ./he5_pt_datainfoF_32 pt_write_test_64f: $(check_PROGRAMS) ./he5_pt_setupF_64 ./he5_pt_definelevelsF_64 srcdir=$(srcdir) ./he5_pt_writedataF_64 ./he5_pt_writeattrsF_64 ./he5_pt_readdataF_64 ./he5_pt_readattrsF_64 ./he5_pt_updatelevelsF_64 ./he5_pt_datainfoF_64 sw_write_test: $(check_PROGRAMS) ./he5_sw_setup ./he5_sw_definefields ./he5_sw_writedata ./he5_sw_readdata ./he5_sw_info ./he5_sw_datainfo ./he5_sw_subset sw_write_test_32f: $(check_PROGRAMS) ./he5_sw_setupF_32 ./he5_sw_definefieldsF_32 ./he5_sw_writedataF_32 ./he5_sw_readdataF_32 ./he5_sw_infoF_32 ./he5_sw_subsetF_32 sw_write_test_64f: $(check_PROGRAMS) ./he5_sw_setupF_64 ./he5_sw_definefieldsF_64 ./he5_sw_writedataF_64 ./he5_sw_readdataF_64 ./he5_sw_infoF_64 ./he5_sw_subsetF_64 sw_unlim_test: $(check_PROGRAMS) ./he5_sw_setup ./he5_sw_defunlimfld ./he5_sw_wrunlimfld ./he5_sw_subset sw_extend_test: $(check_PROGRAMS) ./he5_sw_setup ./he5_sw_definefields ./he5_sw_wrextendrd za_write_test: $(check_PROGRAMS) ./he5_za_setup ./he5_za_definefields ./he5_za_writedata ./he5_za_readdata ./he5_za_info ./he5_za_datainfo za_write_test_32f: $(check_PROGRAMS) ./he5_za_setupF_32 ./he5_za_definefieldsF_32 ./he5_za_writedataF_32 ./he5_za_readdataF_32 ./he5_za_infoF_32 za_write_test_64f: $(check_PROGRAMS) ./he5_za_setupF_64 ./he5_za_definefieldsF_64 ./he5_za_writedataF_64 ./he5_za_readdataF_64 ./he5_za_infoF_64 # This avoids any confusion between the names of the sequences and # files with the same names. .PHONY: $(TEST_SEQUENCES) hdf-eos5-2.0/samples/Makefile.in000066400000000000000000003307251507520047200165120ustar00rootroot00000000000000# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # samples Makefile.am # Sample programs for HDF-EOS5 VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(top_srcdir)/config/include.am $(srcdir)/Makefile.in \ $(srcdir)/Makefile.am $(top_srcdir)/config/depcomp README check_PROGRAMS = he5_gd_datainfo$(EXEEXT) \ he5_gd_defexternalfld$(EXEEXT) he5_gd_definefields$(EXEEXT) \ he5_gd_defunlimfld$(EXEEXT) he5_gd_info$(EXEEXT) \ he5_gd_rdexternaldata$(EXEEXT) he5_gd_readdata$(EXEEXT) \ he5_gd_writedata$(EXEEXT) he5_gd_setup$(EXEEXT) \ he5_gd_subset$(EXEEXT) he5_gd_wrexternaldata$(EXEEXT) \ he5_gd_wrunlimfld$(EXEEXT) he5_pt_datainfo$(EXEEXT) \ he5_pt_definelevels$(EXEEXT) he5_pt_readattrs$(EXEEXT) \ he5_pt_readdata$(EXEEXT) he5_pt_setup$(EXEEXT) \ he5_pt_updatelevels$(EXEEXT) he5_pt_writeattrs$(EXEEXT) \ he5_pt_writedata$(EXEEXT) he5_sw_datainfo$(EXEEXT) \ he5_sw_defexternalfld$(EXEEXT) he5_sw_definefields$(EXEEXT) \ he5_sw_defunlimfld$(EXEEXT) he5_sw_info$(EXEEXT) \ he5_sw_rdexternaldata$(EXEEXT) he5_sw_readdata$(EXEEXT) \ he5_sw_setup$(EXEEXT) he5_sw_subset$(EXEEXT) \ he5_sw_wrextendrd$(EXEEXT) he5_sw_wrexternaldata$(EXEEXT) \ he5_sw_writedata$(EXEEXT) he5_sw_wrunlimfld$(EXEEXT) \ he5_za_datainfo$(EXEEXT) he5_za_defexternalfld$(EXEEXT) \ he5_za_definefields$(EXEEXT) he5_za_info$(EXEEXT) \ he5_za_rdexternaldata$(EXEEXT) he5_za_readdata$(EXEEXT) \ he5_za_setup$(EXEEXT) he5_za_wrexternaldata$(EXEEXT) \ he5_za_writedata$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2) @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am__append_1 = \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_gd_definefieldsF_32 \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_gd_infoF_32 \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_gd_readdataF_32 \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_gd_setupF_32 \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_gd_subsetF_32 \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_gd_writedataF_32 \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_pt_datainfoF_32 \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_pt_definelevelsF_32 \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_pt_readattrsF_32 \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_pt_readdataF_32 \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_pt_setupF_32 \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_pt_updatelevelsF_32 \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_pt_writeattrsF_32 \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_pt_writedataF_32 \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_sw_defexternalfldF_32 \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_sw_definefieldsF_32 \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_sw_infoF_32 \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_sw_rdexternaldataF_32 \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_sw_readdataF_32 \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_sw_setupF_32 \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_sw_subsetF_32 \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_sw_wrexternaldataF_32 \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_sw_writedataF_32 \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_za_defexternalfldF_32 \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_za_definefieldsF_32 \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_za_infoF_32 \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_za_rdexternaldataF_32 \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_za_readdataF_32 \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_za_setupF_32 \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_za_wrexternaldataF_32 \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_za_writedataF_32 @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am__append_2 = \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_gd_definefieldsF_64 \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_gd_infoF_64 \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_gd_readdataF_64 \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_gd_setupF_64 \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_gd_subsetF_64 \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_gd_writedataF_64 \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_pt_datainfoF_64 \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_pt_definelevelsF_64 \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_pt_readattrsF_64 \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_pt_readdataF_64 \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_pt_setupF_64 \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_pt_updatelevelsF_64 \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_pt_writeattrsF_64 \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_pt_writedataF_64 \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_sw_defexternalfldF_64 \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_sw_definefieldsF_64 \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_sw_infoF_64 \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_sw_rdexternaldataF_64 \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_sw_readdataF_64 \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_sw_setupF_64 \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_sw_subsetF_64 \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_sw_wrexternaldataF_64 \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_sw_writedataF_64 \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_za_defexternalfldF_64 \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_za_definefieldsF_64 \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_za_infoF_64 \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_za_rdexternaldataF_64 \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_za_readdataF_64 \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_za_setupF_64 \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_za_wrexternaldataF_64 \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_za_writedataF_64 @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am__append_3 = gd_write_test_32f pt_write_test_32f sw_write_test_32f za_write_test_32f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am__append_4 = gd_write_test_64f pt_write_test_64f sw_write_test_64f za_write_test_64f subdir = samples ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/stdlib.m4 $(top_srcdir)/m4/stdinc.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/HE5_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am__EXEEXT_1 = he5_gd_definefieldsF_32$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_gd_infoF_32$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_gd_readdataF_32$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_gd_setupF_32$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_gd_subsetF_32$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_gd_writedataF_32$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_pt_datainfoF_32$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_pt_definelevelsF_32$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_pt_readattrsF_32$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_pt_readdataF_32$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_pt_setupF_32$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_pt_updatelevelsF_32$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_pt_writeattrsF_32$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_pt_writedataF_32$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_sw_defexternalfldF_32$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_sw_definefieldsF_32$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_sw_infoF_32$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_sw_rdexternaldataF_32$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_sw_readdataF_32$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_sw_setupF_32$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_sw_subsetF_32$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_sw_wrexternaldataF_32$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_sw_writedataF_32$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_za_defexternalfldF_32$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_za_definefieldsF_32$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_za_infoF_32$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_za_rdexternaldataF_32$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_za_readdataF_32$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_za_setupF_32$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_za_wrexternaldataF_32$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_za_writedataF_32$(EXEEXT) @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am__EXEEXT_2 = he5_gd_definefieldsF_64$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_gd_infoF_64$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_gd_readdataF_64$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_gd_setupF_64$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_gd_subsetF_64$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_gd_writedataF_64$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_pt_datainfoF_64$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_pt_definelevelsF_64$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_pt_readattrsF_64$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_pt_readdataF_64$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_pt_setupF_64$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_pt_updatelevelsF_64$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_pt_writeattrsF_64$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_pt_writedataF_64$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_sw_defexternalfldF_64$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_sw_definefieldsF_64$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_sw_infoF_64$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_sw_rdexternaldataF_64$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_sw_readdataF_64$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_sw_setupF_64$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_sw_subsetF_64$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_sw_wrexternaldataF_64$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_sw_writedataF_64$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_za_defexternalfldF_64$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_za_definefieldsF_64$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_za_infoF_64$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_za_rdexternaldataF_64$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_za_readdataF_64$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_za_setupF_64$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_za_wrexternaldataF_64$(EXEEXT) \ @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@ he5_za_writedataF_64$(EXEEXT) he5_gd_datainfo_SOURCES = he5_gd_datainfo.c he5_gd_datainfo_OBJECTS = he5_gd_datainfo.$(OBJEXT) he5_gd_datainfo_LDADD = $(LDADD) he5_gd_datainfo_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = he5_gd_defexternalfld_SOURCES = he5_gd_defexternalfld.c he5_gd_defexternalfld_OBJECTS = he5_gd_defexternalfld.$(OBJEXT) he5_gd_defexternalfld_LDADD = $(LDADD) he5_gd_defexternalfld_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_gd_definefields_SOURCES = he5_gd_definefields.c he5_gd_definefields_OBJECTS = he5_gd_definefields.$(OBJEXT) he5_gd_definefields_LDADD = $(LDADD) he5_gd_definefields_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_gd_definefieldsF_32_SOURCES_DIST = he5_gd_definefieldsF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_gd_definefieldsF_32_OBJECTS = he5_gd_definefieldsF_32.$(OBJEXT) he5_gd_definefieldsF_32_OBJECTS = \ $(am_he5_gd_definefieldsF_32_OBJECTS) he5_gd_definefieldsF_32_LDADD = $(LDADD) he5_gd_definefieldsF_32_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_gd_definefieldsF_64_SOURCES_DIST = he5_gd_definefieldsF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_gd_definefieldsF_64_OBJECTS = he5_gd_definefieldsF_64.$(OBJEXT) he5_gd_definefieldsF_64_OBJECTS = \ $(am_he5_gd_definefieldsF_64_OBJECTS) he5_gd_definefieldsF_64_LDADD = $(LDADD) he5_gd_definefieldsF_64_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_gd_defunlimfld_SOURCES = he5_gd_defunlimfld.c he5_gd_defunlimfld_OBJECTS = he5_gd_defunlimfld.$(OBJEXT) he5_gd_defunlimfld_LDADD = $(LDADD) he5_gd_defunlimfld_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_gd_info_SOURCES = he5_gd_info.c he5_gd_info_OBJECTS = he5_gd_info.$(OBJEXT) he5_gd_info_LDADD = $(LDADD) he5_gd_info_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_gd_infoF_32_SOURCES_DIST = he5_gd_infoF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_gd_infoF_32_OBJECTS = he5_gd_infoF_32.$(OBJEXT) he5_gd_infoF_32_OBJECTS = $(am_he5_gd_infoF_32_OBJECTS) he5_gd_infoF_32_LDADD = $(LDADD) he5_gd_infoF_32_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_gd_infoF_64_SOURCES_DIST = he5_gd_infoF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_gd_infoF_64_OBJECTS = he5_gd_infoF_64.$(OBJEXT) he5_gd_infoF_64_OBJECTS = $(am_he5_gd_infoF_64_OBJECTS) he5_gd_infoF_64_LDADD = $(LDADD) he5_gd_infoF_64_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_gd_rdexternaldata_SOURCES = he5_gd_rdexternaldata.c he5_gd_rdexternaldata_OBJECTS = he5_gd_rdexternaldata.$(OBJEXT) he5_gd_rdexternaldata_LDADD = $(LDADD) he5_gd_rdexternaldata_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_gd_readdata_SOURCES = he5_gd_readdata.c he5_gd_readdata_OBJECTS = he5_gd_readdata.$(OBJEXT) he5_gd_readdata_LDADD = $(LDADD) he5_gd_readdata_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_gd_readdataF_32_SOURCES_DIST = he5_gd_readdataF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_gd_readdataF_32_OBJECTS = he5_gd_readdataF_32.$(OBJEXT) he5_gd_readdataF_32_OBJECTS = $(am_he5_gd_readdataF_32_OBJECTS) he5_gd_readdataF_32_LDADD = $(LDADD) he5_gd_readdataF_32_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_gd_readdataF_64_SOURCES_DIST = he5_gd_readdataF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_gd_readdataF_64_OBJECTS = he5_gd_readdataF_64.$(OBJEXT) he5_gd_readdataF_64_OBJECTS = $(am_he5_gd_readdataF_64_OBJECTS) he5_gd_readdataF_64_LDADD = $(LDADD) he5_gd_readdataF_64_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_gd_setup_SOURCES = he5_gd_setup.c he5_gd_setup_OBJECTS = he5_gd_setup.$(OBJEXT) he5_gd_setup_LDADD = $(LDADD) he5_gd_setup_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_gd_setupF_32_SOURCES_DIST = he5_gd_setupF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_gd_setupF_32_OBJECTS = he5_gd_setupF_32.$(OBJEXT) he5_gd_setupF_32_OBJECTS = $(am_he5_gd_setupF_32_OBJECTS) he5_gd_setupF_32_LDADD = $(LDADD) he5_gd_setupF_32_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_gd_setupF_64_SOURCES_DIST = he5_gd_setupF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_gd_setupF_64_OBJECTS = he5_gd_setupF_64.$(OBJEXT) he5_gd_setupF_64_OBJECTS = $(am_he5_gd_setupF_64_OBJECTS) he5_gd_setupF_64_LDADD = $(LDADD) he5_gd_setupF_64_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_gd_subset_SOURCES = he5_gd_subset.c he5_gd_subset_OBJECTS = he5_gd_subset.$(OBJEXT) he5_gd_subset_LDADD = $(LDADD) he5_gd_subset_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_gd_subsetF_32_SOURCES_DIST = he5_gd_subsetF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_gd_subsetF_32_OBJECTS = he5_gd_subsetF_32.$(OBJEXT) he5_gd_subsetF_32_OBJECTS = $(am_he5_gd_subsetF_32_OBJECTS) he5_gd_subsetF_32_LDADD = $(LDADD) he5_gd_subsetF_32_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_gd_subsetF_64_SOURCES_DIST = he5_gd_subsetF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_gd_subsetF_64_OBJECTS = he5_gd_subsetF_64.$(OBJEXT) he5_gd_subsetF_64_OBJECTS = $(am_he5_gd_subsetF_64_OBJECTS) he5_gd_subsetF_64_LDADD = $(LDADD) he5_gd_subsetF_64_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_gd_wrexternaldata_SOURCES = he5_gd_wrexternaldata.c he5_gd_wrexternaldata_OBJECTS = he5_gd_wrexternaldata.$(OBJEXT) he5_gd_wrexternaldata_LDADD = $(LDADD) he5_gd_wrexternaldata_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_gd_writedata_SOURCES = he5_gd_writedata.c he5_gd_writedata_OBJECTS = he5_gd_writedata.$(OBJEXT) he5_gd_writedata_LDADD = $(LDADD) he5_gd_writedata_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_gd_writedataF_32_SOURCES_DIST = he5_gd_writedataF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_gd_writedataF_32_OBJECTS = he5_gd_writedataF_32.$(OBJEXT) he5_gd_writedataF_32_OBJECTS = $(am_he5_gd_writedataF_32_OBJECTS) he5_gd_writedataF_32_LDADD = $(LDADD) he5_gd_writedataF_32_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_gd_writedataF_64_SOURCES_DIST = he5_gd_writedataF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_gd_writedataF_64_OBJECTS = he5_gd_writedataF_64.$(OBJEXT) he5_gd_writedataF_64_OBJECTS = $(am_he5_gd_writedataF_64_OBJECTS) he5_gd_writedataF_64_LDADD = $(LDADD) he5_gd_writedataF_64_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_gd_wrunlimfld_SOURCES = he5_gd_wrunlimfld.c he5_gd_wrunlimfld_OBJECTS = he5_gd_wrunlimfld.$(OBJEXT) he5_gd_wrunlimfld_LDADD = $(LDADD) he5_gd_wrunlimfld_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_pt_datainfo_SOURCES = he5_pt_datainfo.c he5_pt_datainfo_OBJECTS = he5_pt_datainfo.$(OBJEXT) he5_pt_datainfo_LDADD = $(LDADD) he5_pt_datainfo_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_pt_datainfoF_32_SOURCES_DIST = he5_pt_datainfoF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_pt_datainfoF_32_OBJECTS = he5_pt_datainfoF_32.$(OBJEXT) he5_pt_datainfoF_32_OBJECTS = $(am_he5_pt_datainfoF_32_OBJECTS) he5_pt_datainfoF_32_LDADD = $(LDADD) he5_pt_datainfoF_32_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_pt_datainfoF_64_SOURCES_DIST = he5_pt_datainfoF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_pt_datainfoF_64_OBJECTS = he5_pt_datainfoF_64.$(OBJEXT) he5_pt_datainfoF_64_OBJECTS = $(am_he5_pt_datainfoF_64_OBJECTS) he5_pt_datainfoF_64_LDADD = $(LDADD) he5_pt_datainfoF_64_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_pt_definelevels_SOURCES = he5_pt_definelevels.c he5_pt_definelevels_OBJECTS = he5_pt_definelevels.$(OBJEXT) he5_pt_definelevels_LDADD = $(LDADD) he5_pt_definelevels_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_pt_definelevelsF_32_SOURCES_DIST = he5_pt_definelevelsF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_pt_definelevelsF_32_OBJECTS = he5_pt_definelevelsF_32.$(OBJEXT) he5_pt_definelevelsF_32_OBJECTS = \ $(am_he5_pt_definelevelsF_32_OBJECTS) he5_pt_definelevelsF_32_LDADD = $(LDADD) he5_pt_definelevelsF_32_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_pt_definelevelsF_64_SOURCES_DIST = he5_pt_definelevelsF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_pt_definelevelsF_64_OBJECTS = he5_pt_definelevelsF_64.$(OBJEXT) he5_pt_definelevelsF_64_OBJECTS = \ $(am_he5_pt_definelevelsF_64_OBJECTS) he5_pt_definelevelsF_64_LDADD = $(LDADD) he5_pt_definelevelsF_64_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_pt_readattrs_SOURCES = he5_pt_readattrs.c he5_pt_readattrs_OBJECTS = he5_pt_readattrs.$(OBJEXT) he5_pt_readattrs_LDADD = $(LDADD) he5_pt_readattrs_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_pt_readattrsF_32_SOURCES_DIST = he5_pt_readattrsF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_pt_readattrsF_32_OBJECTS = he5_pt_readattrsF_32.$(OBJEXT) he5_pt_readattrsF_32_OBJECTS = $(am_he5_pt_readattrsF_32_OBJECTS) he5_pt_readattrsF_32_LDADD = $(LDADD) he5_pt_readattrsF_32_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_pt_readattrsF_64_SOURCES_DIST = he5_pt_readattrsF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_pt_readattrsF_64_OBJECTS = he5_pt_readattrsF_64.$(OBJEXT) he5_pt_readattrsF_64_OBJECTS = $(am_he5_pt_readattrsF_64_OBJECTS) he5_pt_readattrsF_64_LDADD = $(LDADD) he5_pt_readattrsF_64_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_pt_readdata_SOURCES = he5_pt_readdata.c he5_pt_readdata_OBJECTS = he5_pt_readdata.$(OBJEXT) he5_pt_readdata_LDADD = $(LDADD) he5_pt_readdata_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_pt_readdataF_32_SOURCES_DIST = he5_pt_readdataF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_pt_readdataF_32_OBJECTS = he5_pt_readdataF_32.$(OBJEXT) he5_pt_readdataF_32_OBJECTS = $(am_he5_pt_readdataF_32_OBJECTS) he5_pt_readdataF_32_LDADD = $(LDADD) he5_pt_readdataF_32_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_pt_readdataF_64_SOURCES_DIST = he5_pt_readdataF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_pt_readdataF_64_OBJECTS = he5_pt_readdataF_64.$(OBJEXT) he5_pt_readdataF_64_OBJECTS = $(am_he5_pt_readdataF_64_OBJECTS) he5_pt_readdataF_64_LDADD = $(LDADD) he5_pt_readdataF_64_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_pt_setup_SOURCES = he5_pt_setup.c he5_pt_setup_OBJECTS = he5_pt_setup.$(OBJEXT) he5_pt_setup_LDADD = $(LDADD) he5_pt_setup_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_pt_setupF_32_SOURCES_DIST = he5_pt_setupF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_pt_setupF_32_OBJECTS = he5_pt_setupF_32.$(OBJEXT) he5_pt_setupF_32_OBJECTS = $(am_he5_pt_setupF_32_OBJECTS) he5_pt_setupF_32_LDADD = $(LDADD) he5_pt_setupF_32_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_pt_setupF_64_SOURCES_DIST = he5_pt_setupF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_pt_setupF_64_OBJECTS = he5_pt_setupF_64.$(OBJEXT) he5_pt_setupF_64_OBJECTS = $(am_he5_pt_setupF_64_OBJECTS) he5_pt_setupF_64_LDADD = $(LDADD) he5_pt_setupF_64_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_pt_updatelevels_SOURCES = he5_pt_updatelevels.c he5_pt_updatelevels_OBJECTS = he5_pt_updatelevels.$(OBJEXT) he5_pt_updatelevels_LDADD = $(LDADD) he5_pt_updatelevels_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_pt_updatelevelsF_32_SOURCES_DIST = he5_pt_updatelevelsF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_pt_updatelevelsF_32_OBJECTS = he5_pt_updatelevelsF_32.$(OBJEXT) he5_pt_updatelevelsF_32_OBJECTS = \ $(am_he5_pt_updatelevelsF_32_OBJECTS) he5_pt_updatelevelsF_32_LDADD = $(LDADD) he5_pt_updatelevelsF_32_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_pt_updatelevelsF_64_SOURCES_DIST = he5_pt_updatelevelsF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_pt_updatelevelsF_64_OBJECTS = he5_pt_updatelevelsF_64.$(OBJEXT) he5_pt_updatelevelsF_64_OBJECTS = \ $(am_he5_pt_updatelevelsF_64_OBJECTS) he5_pt_updatelevelsF_64_LDADD = $(LDADD) he5_pt_updatelevelsF_64_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_pt_writeattrs_SOURCES = he5_pt_writeattrs.c he5_pt_writeattrs_OBJECTS = he5_pt_writeattrs.$(OBJEXT) he5_pt_writeattrs_LDADD = $(LDADD) he5_pt_writeattrs_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_pt_writeattrsF_32_SOURCES_DIST = he5_pt_writeattrsF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_pt_writeattrsF_32_OBJECTS = he5_pt_writeattrsF_32.$(OBJEXT) he5_pt_writeattrsF_32_OBJECTS = $(am_he5_pt_writeattrsF_32_OBJECTS) he5_pt_writeattrsF_32_LDADD = $(LDADD) he5_pt_writeattrsF_32_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_pt_writeattrsF_64_SOURCES_DIST = he5_pt_writeattrsF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_pt_writeattrsF_64_OBJECTS = he5_pt_writeattrsF_64.$(OBJEXT) he5_pt_writeattrsF_64_OBJECTS = $(am_he5_pt_writeattrsF_64_OBJECTS) he5_pt_writeattrsF_64_LDADD = $(LDADD) he5_pt_writeattrsF_64_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_pt_writedata_SOURCES = he5_pt_writedata.c he5_pt_writedata_OBJECTS = he5_pt_writedata.$(OBJEXT) he5_pt_writedata_LDADD = $(LDADD) he5_pt_writedata_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_pt_writedataF_32_SOURCES_DIST = he5_pt_writedataF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_pt_writedataF_32_OBJECTS = he5_pt_writedataF_32.$(OBJEXT) he5_pt_writedataF_32_OBJECTS = $(am_he5_pt_writedataF_32_OBJECTS) he5_pt_writedataF_32_LDADD = $(LDADD) he5_pt_writedataF_32_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_pt_writedataF_64_SOURCES_DIST = he5_pt_writedataF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_pt_writedataF_64_OBJECTS = he5_pt_writedataF_64.$(OBJEXT) he5_pt_writedataF_64_OBJECTS = $(am_he5_pt_writedataF_64_OBJECTS) he5_pt_writedataF_64_LDADD = $(LDADD) he5_pt_writedataF_64_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_sw_datainfo_SOURCES = he5_sw_datainfo.c he5_sw_datainfo_OBJECTS = he5_sw_datainfo.$(OBJEXT) he5_sw_datainfo_LDADD = $(LDADD) he5_sw_datainfo_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_sw_defexternalfld_SOURCES = he5_sw_defexternalfld.c he5_sw_defexternalfld_OBJECTS = he5_sw_defexternalfld.$(OBJEXT) he5_sw_defexternalfld_LDADD = $(LDADD) he5_sw_defexternalfld_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_sw_defexternalfldF_32_SOURCES_DIST = \ he5_sw_defexternalfldF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_sw_defexternalfldF_32_OBJECTS = he5_sw_defexternalfldF_32.$(OBJEXT) he5_sw_defexternalfldF_32_OBJECTS = \ $(am_he5_sw_defexternalfldF_32_OBJECTS) he5_sw_defexternalfldF_32_LDADD = $(LDADD) he5_sw_defexternalfldF_32_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_sw_defexternalfldF_64_SOURCES_DIST = \ he5_sw_defexternalfldF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_sw_defexternalfldF_64_OBJECTS = he5_sw_defexternalfldF_64.$(OBJEXT) he5_sw_defexternalfldF_64_OBJECTS = \ $(am_he5_sw_defexternalfldF_64_OBJECTS) he5_sw_defexternalfldF_64_LDADD = $(LDADD) he5_sw_defexternalfldF_64_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_sw_definefields_SOURCES = he5_sw_definefields.c he5_sw_definefields_OBJECTS = he5_sw_definefields.$(OBJEXT) he5_sw_definefields_LDADD = $(LDADD) he5_sw_definefields_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_sw_definefieldsF_32_SOURCES_DIST = he5_sw_definefieldsF_32.f \ he5_sw_definefields_szipF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@@SZIP_ENCODER_CONDITIONAL_FALSE@am_he5_sw_definefieldsF_32_OBJECTS = he5_sw_definefieldsF_32.$(OBJEXT) @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@@SZIP_ENCODER_CONDITIONAL_TRUE@am_he5_sw_definefieldsF_32_OBJECTS = he5_sw_definefields_szipF_32.$(OBJEXT) he5_sw_definefieldsF_32_OBJECTS = \ $(am_he5_sw_definefieldsF_32_OBJECTS) he5_sw_definefieldsF_32_LDADD = $(LDADD) he5_sw_definefieldsF_32_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_sw_definefieldsF_64_SOURCES_DIST = he5_sw_definefieldsF_64.f \ he5_sw_definefields_szipF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@@SZIP_ENCODER_CONDITIONAL_FALSE@am_he5_sw_definefieldsF_64_OBJECTS = he5_sw_definefieldsF_64.$(OBJEXT) @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@@SZIP_ENCODER_CONDITIONAL_TRUE@am_he5_sw_definefieldsF_64_OBJECTS = he5_sw_definefields_szipF_64.$(OBJEXT) he5_sw_definefieldsF_64_OBJECTS = \ $(am_he5_sw_definefieldsF_64_OBJECTS) he5_sw_definefieldsF_64_LDADD = $(LDADD) he5_sw_definefieldsF_64_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_sw_defunlimfld_SOURCES = he5_sw_defunlimfld.c he5_sw_defunlimfld_OBJECTS = he5_sw_defunlimfld.$(OBJEXT) he5_sw_defunlimfld_LDADD = $(LDADD) he5_sw_defunlimfld_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_sw_info_SOURCES = he5_sw_info.c he5_sw_info_OBJECTS = he5_sw_info.$(OBJEXT) he5_sw_info_LDADD = $(LDADD) he5_sw_info_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_sw_infoF_32_SOURCES_DIST = he5_sw_infoF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_sw_infoF_32_OBJECTS = he5_sw_infoF_32.$(OBJEXT) he5_sw_infoF_32_OBJECTS = $(am_he5_sw_infoF_32_OBJECTS) he5_sw_infoF_32_LDADD = $(LDADD) he5_sw_infoF_32_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_sw_infoF_64_SOURCES_DIST = he5_sw_infoF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_sw_infoF_64_OBJECTS = he5_sw_infoF_64.$(OBJEXT) he5_sw_infoF_64_OBJECTS = $(am_he5_sw_infoF_64_OBJECTS) he5_sw_infoF_64_LDADD = $(LDADD) he5_sw_infoF_64_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_sw_rdexternaldata_SOURCES = he5_sw_rdexternaldata.c he5_sw_rdexternaldata_OBJECTS = he5_sw_rdexternaldata.$(OBJEXT) he5_sw_rdexternaldata_LDADD = $(LDADD) he5_sw_rdexternaldata_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_sw_rdexternaldataF_32_SOURCES_DIST = \ he5_sw_rdexternaldataF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_sw_rdexternaldataF_32_OBJECTS = he5_sw_rdexternaldataF_32.$(OBJEXT) he5_sw_rdexternaldataF_32_OBJECTS = \ $(am_he5_sw_rdexternaldataF_32_OBJECTS) he5_sw_rdexternaldataF_32_LDADD = $(LDADD) he5_sw_rdexternaldataF_32_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_sw_rdexternaldataF_64_SOURCES_DIST = \ he5_sw_rdexternaldataF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_sw_rdexternaldataF_64_OBJECTS = he5_sw_rdexternaldataF_64.$(OBJEXT) he5_sw_rdexternaldataF_64_OBJECTS = \ $(am_he5_sw_rdexternaldataF_64_OBJECTS) he5_sw_rdexternaldataF_64_LDADD = $(LDADD) he5_sw_rdexternaldataF_64_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_sw_readdata_SOURCES = he5_sw_readdata.c he5_sw_readdata_OBJECTS = he5_sw_readdata.$(OBJEXT) he5_sw_readdata_LDADD = $(LDADD) he5_sw_readdata_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_sw_readdataF_32_SOURCES_DIST = he5_sw_readdataF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_sw_readdataF_32_OBJECTS = he5_sw_readdataF_32.$(OBJEXT) he5_sw_readdataF_32_OBJECTS = $(am_he5_sw_readdataF_32_OBJECTS) he5_sw_readdataF_32_LDADD = $(LDADD) he5_sw_readdataF_32_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_sw_readdataF_64_SOURCES_DIST = he5_sw_readdataF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_sw_readdataF_64_OBJECTS = he5_sw_readdataF_64.$(OBJEXT) he5_sw_readdataF_64_OBJECTS = $(am_he5_sw_readdataF_64_OBJECTS) he5_sw_readdataF_64_LDADD = $(LDADD) he5_sw_readdataF_64_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_sw_setup_SOURCES = he5_sw_setup.c he5_sw_setup_OBJECTS = he5_sw_setup.$(OBJEXT) he5_sw_setup_LDADD = $(LDADD) he5_sw_setup_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_sw_setupF_32_SOURCES_DIST = he5_sw_setupF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_sw_setupF_32_OBJECTS = he5_sw_setupF_32.$(OBJEXT) he5_sw_setupF_32_OBJECTS = $(am_he5_sw_setupF_32_OBJECTS) he5_sw_setupF_32_LDADD = $(LDADD) he5_sw_setupF_32_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_sw_setupF_64_SOURCES_DIST = he5_sw_setupF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_sw_setupF_64_OBJECTS = he5_sw_setupF_64.$(OBJEXT) he5_sw_setupF_64_OBJECTS = $(am_he5_sw_setupF_64_OBJECTS) he5_sw_setupF_64_LDADD = $(LDADD) he5_sw_setupF_64_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_sw_subset_SOURCES = he5_sw_subset.c he5_sw_subset_OBJECTS = he5_sw_subset.$(OBJEXT) he5_sw_subset_LDADD = $(LDADD) he5_sw_subset_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_sw_subsetF_32_SOURCES_DIST = he5_sw_subsetF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_sw_subsetF_32_OBJECTS = he5_sw_subsetF_32.$(OBJEXT) he5_sw_subsetF_32_OBJECTS = $(am_he5_sw_subsetF_32_OBJECTS) he5_sw_subsetF_32_LDADD = $(LDADD) he5_sw_subsetF_32_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_sw_subsetF_64_SOURCES_DIST = he5_sw_subsetF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_sw_subsetF_64_OBJECTS = he5_sw_subsetF_64.$(OBJEXT) he5_sw_subsetF_64_OBJECTS = $(am_he5_sw_subsetF_64_OBJECTS) he5_sw_subsetF_64_LDADD = $(LDADD) he5_sw_subsetF_64_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_sw_wrextendrd_SOURCES = he5_sw_wrextendrd.c he5_sw_wrextendrd_OBJECTS = he5_sw_wrextendrd.$(OBJEXT) he5_sw_wrextendrd_LDADD = $(LDADD) he5_sw_wrextendrd_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_sw_wrexternaldata_SOURCES = he5_sw_wrexternaldata.c he5_sw_wrexternaldata_OBJECTS = he5_sw_wrexternaldata.$(OBJEXT) he5_sw_wrexternaldata_LDADD = $(LDADD) he5_sw_wrexternaldata_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_sw_wrexternaldataF_32_SOURCES_DIST = \ he5_sw_wrexternaldataF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_sw_wrexternaldataF_32_OBJECTS = he5_sw_wrexternaldataF_32.$(OBJEXT) he5_sw_wrexternaldataF_32_OBJECTS = \ $(am_he5_sw_wrexternaldataF_32_OBJECTS) he5_sw_wrexternaldataF_32_LDADD = $(LDADD) he5_sw_wrexternaldataF_32_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_sw_wrexternaldataF_64_SOURCES_DIST = \ he5_sw_wrexternaldataF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_sw_wrexternaldataF_64_OBJECTS = he5_sw_wrexternaldataF_64.$(OBJEXT) he5_sw_wrexternaldataF_64_OBJECTS = \ $(am_he5_sw_wrexternaldataF_64_OBJECTS) he5_sw_wrexternaldataF_64_LDADD = $(LDADD) he5_sw_wrexternaldataF_64_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_sw_writedata_SOURCES = he5_sw_writedata.c he5_sw_writedata_OBJECTS = he5_sw_writedata.$(OBJEXT) he5_sw_writedata_LDADD = $(LDADD) he5_sw_writedata_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_sw_writedataF_32_SOURCES_DIST = he5_sw_writedataF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_sw_writedataF_32_OBJECTS = he5_sw_writedataF_32.$(OBJEXT) he5_sw_writedataF_32_OBJECTS = $(am_he5_sw_writedataF_32_OBJECTS) he5_sw_writedataF_32_LDADD = $(LDADD) he5_sw_writedataF_32_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_sw_writedataF_64_SOURCES_DIST = he5_sw_writedataF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_sw_writedataF_64_OBJECTS = he5_sw_writedataF_64.$(OBJEXT) he5_sw_writedataF_64_OBJECTS = $(am_he5_sw_writedataF_64_OBJECTS) he5_sw_writedataF_64_LDADD = $(LDADD) he5_sw_writedataF_64_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_sw_wrunlimfld_SOURCES = he5_sw_wrunlimfld.c he5_sw_wrunlimfld_OBJECTS = he5_sw_wrunlimfld.$(OBJEXT) he5_sw_wrunlimfld_LDADD = $(LDADD) he5_sw_wrunlimfld_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_za_datainfo_SOURCES = he5_za_datainfo.c he5_za_datainfo_OBJECTS = he5_za_datainfo.$(OBJEXT) he5_za_datainfo_LDADD = $(LDADD) he5_za_datainfo_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_za_defexternalfld_SOURCES = he5_za_defexternalfld.c he5_za_defexternalfld_OBJECTS = he5_za_defexternalfld.$(OBJEXT) he5_za_defexternalfld_LDADD = $(LDADD) he5_za_defexternalfld_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_za_defexternalfldF_32_SOURCES_DIST = \ he5_za_defexternalfldF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_za_defexternalfldF_32_OBJECTS = he5_za_defexternalfldF_32.$(OBJEXT) he5_za_defexternalfldF_32_OBJECTS = \ $(am_he5_za_defexternalfldF_32_OBJECTS) he5_za_defexternalfldF_32_LDADD = $(LDADD) he5_za_defexternalfldF_32_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_za_defexternalfldF_64_SOURCES_DIST = \ he5_za_defexternalfldF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_za_defexternalfldF_64_OBJECTS = he5_za_defexternalfldF_64.$(OBJEXT) he5_za_defexternalfldF_64_OBJECTS = \ $(am_he5_za_defexternalfldF_64_OBJECTS) he5_za_defexternalfldF_64_LDADD = $(LDADD) he5_za_defexternalfldF_64_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_za_definefields_SOURCES = he5_za_definefields.c he5_za_definefields_OBJECTS = he5_za_definefields.$(OBJEXT) he5_za_definefields_LDADD = $(LDADD) he5_za_definefields_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_za_definefieldsF_32_SOURCES_DIST = he5_za_definefieldsF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_za_definefieldsF_32_OBJECTS = he5_za_definefieldsF_32.$(OBJEXT) he5_za_definefieldsF_32_OBJECTS = \ $(am_he5_za_definefieldsF_32_OBJECTS) he5_za_definefieldsF_32_LDADD = $(LDADD) he5_za_definefieldsF_32_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_za_definefieldsF_64_SOURCES_DIST = he5_za_definefieldsF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_za_definefieldsF_64_OBJECTS = he5_za_definefieldsF_64.$(OBJEXT) he5_za_definefieldsF_64_OBJECTS = \ $(am_he5_za_definefieldsF_64_OBJECTS) he5_za_definefieldsF_64_LDADD = $(LDADD) he5_za_definefieldsF_64_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_za_info_SOURCES = he5_za_info.c he5_za_info_OBJECTS = he5_za_info.$(OBJEXT) he5_za_info_LDADD = $(LDADD) he5_za_info_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_za_infoF_32_SOURCES_DIST = he5_za_infoF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_za_infoF_32_OBJECTS = he5_za_infoF_32.$(OBJEXT) he5_za_infoF_32_OBJECTS = $(am_he5_za_infoF_32_OBJECTS) he5_za_infoF_32_LDADD = $(LDADD) he5_za_infoF_32_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_za_infoF_64_SOURCES_DIST = he5_za_infoF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_za_infoF_64_OBJECTS = he5_za_infoF_64.$(OBJEXT) he5_za_infoF_64_OBJECTS = $(am_he5_za_infoF_64_OBJECTS) he5_za_infoF_64_LDADD = $(LDADD) he5_za_infoF_64_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_za_rdexternaldata_SOURCES = he5_za_rdexternaldata.c he5_za_rdexternaldata_OBJECTS = he5_za_rdexternaldata.$(OBJEXT) he5_za_rdexternaldata_LDADD = $(LDADD) he5_za_rdexternaldata_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_za_rdexternaldataF_32_SOURCES_DIST = \ he5_za_rdexternaldataF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_za_rdexternaldataF_32_OBJECTS = he5_za_rdexternaldataF_32.$(OBJEXT) he5_za_rdexternaldataF_32_OBJECTS = \ $(am_he5_za_rdexternaldataF_32_OBJECTS) he5_za_rdexternaldataF_32_LDADD = $(LDADD) he5_za_rdexternaldataF_32_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_za_rdexternaldataF_64_SOURCES_DIST = \ he5_za_rdexternaldataF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_za_rdexternaldataF_64_OBJECTS = he5_za_rdexternaldataF_64.$(OBJEXT) he5_za_rdexternaldataF_64_OBJECTS = \ $(am_he5_za_rdexternaldataF_64_OBJECTS) he5_za_rdexternaldataF_64_LDADD = $(LDADD) he5_za_rdexternaldataF_64_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_za_readdata_SOURCES = he5_za_readdata.c he5_za_readdata_OBJECTS = he5_za_readdata.$(OBJEXT) he5_za_readdata_LDADD = $(LDADD) he5_za_readdata_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_za_readdataF_32_SOURCES_DIST = he5_za_readdataF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_za_readdataF_32_OBJECTS = he5_za_readdataF_32.$(OBJEXT) he5_za_readdataF_32_OBJECTS = $(am_he5_za_readdataF_32_OBJECTS) he5_za_readdataF_32_LDADD = $(LDADD) he5_za_readdataF_32_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_za_readdataF_64_SOURCES_DIST = he5_za_readdataF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_za_readdataF_64_OBJECTS = he5_za_readdataF_64.$(OBJEXT) he5_za_readdataF_64_OBJECTS = $(am_he5_za_readdataF_64_OBJECTS) he5_za_readdataF_64_LDADD = $(LDADD) he5_za_readdataF_64_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_za_setup_SOURCES = he5_za_setup.c he5_za_setup_OBJECTS = he5_za_setup.$(OBJEXT) he5_za_setup_LDADD = $(LDADD) he5_za_setup_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_za_setupF_32_SOURCES_DIST = he5_za_setupF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_za_setupF_32_OBJECTS = he5_za_setupF_32.$(OBJEXT) he5_za_setupF_32_OBJECTS = $(am_he5_za_setupF_32_OBJECTS) he5_za_setupF_32_LDADD = $(LDADD) he5_za_setupF_32_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_za_setupF_64_SOURCES_DIST = he5_za_setupF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_za_setupF_64_OBJECTS = he5_za_setupF_64.$(OBJEXT) he5_za_setupF_64_OBJECTS = $(am_he5_za_setupF_64_OBJECTS) he5_za_setupF_64_LDADD = $(LDADD) he5_za_setupF_64_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_za_wrexternaldata_SOURCES = he5_za_wrexternaldata.c he5_za_wrexternaldata_OBJECTS = he5_za_wrexternaldata.$(OBJEXT) he5_za_wrexternaldata_LDADD = $(LDADD) he5_za_wrexternaldata_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_za_wrexternaldataF_32_SOURCES_DIST = \ he5_za_wrexternaldataF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_za_wrexternaldataF_32_OBJECTS = he5_za_wrexternaldataF_32.$(OBJEXT) he5_za_wrexternaldataF_32_OBJECTS = \ $(am_he5_za_wrexternaldataF_32_OBJECTS) he5_za_wrexternaldataF_32_LDADD = $(LDADD) he5_za_wrexternaldataF_32_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_za_wrexternaldataF_64_SOURCES_DIST = \ he5_za_wrexternaldataF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_za_wrexternaldataF_64_OBJECTS = he5_za_wrexternaldataF_64.$(OBJEXT) he5_za_wrexternaldataF_64_OBJECTS = \ $(am_he5_za_wrexternaldataF_64_OBJECTS) he5_za_wrexternaldataF_64_LDADD = $(LDADD) he5_za_wrexternaldataF_64_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) he5_za_writedata_SOURCES = he5_za_writedata.c he5_za_writedata_OBJECTS = he5_za_writedata.$(OBJEXT) he5_za_writedata_LDADD = $(LDADD) he5_za_writedata_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_za_writedataF_32_SOURCES_DIST = he5_za_writedataF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_za_writedataF_32_OBJECTS = he5_za_writedataF_32.$(OBJEXT) he5_za_writedataF_32_OBJECTS = $(am_he5_za_writedataF_32_OBJECTS) he5_za_writedataF_32_LDADD = $(LDADD) he5_za_writedataF_32_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__he5_za_writedataF_64_SOURCES_DIST = he5_za_writedataF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am_he5_za_writedataF_64_OBJECTS = he5_za_writedataF_64.$(OBJEXT) he5_za_writedataF_64_OBJECTS = $(am_he5_za_writedataF_64_OBJECTS) he5_za_writedataF_64_LDADD = $(LDADD) he5_za_writedataF_64_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = F77COMPILE = $(F77) $(AM_FFLAGS) $(FFLAGS) LTF77COMPILE = $(LIBTOOL) $(AM_V_lt) --tag=F77 $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) AM_V_F77 = $(am__v_F77_@AM_V@) am__v_F77_ = $(am__v_F77_@AM_DEFAULT_V@) am__v_F77_0 = @echo " F77 " $@; am__v_F77_1 = F77LD = $(F77) F77LINK = $(LIBTOOL) $(AM_V_lt) --tag=F77 $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(F77LD) $(AM_FFLAGS) $(FFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_F77LD = $(am__v_F77LD_@AM_V@) am__v_F77LD_ = $(am__v_F77LD_@AM_DEFAULT_V@) am__v_F77LD_0 = @echo " F77LD " $@; am__v_F77LD_1 = SOURCES = he5_gd_datainfo.c he5_gd_defexternalfld.c \ he5_gd_definefields.c $(he5_gd_definefieldsF_32_SOURCES) \ $(he5_gd_definefieldsF_64_SOURCES) he5_gd_defunlimfld.c \ he5_gd_info.c $(he5_gd_infoF_32_SOURCES) \ $(he5_gd_infoF_64_SOURCES) he5_gd_rdexternaldata.c \ he5_gd_readdata.c $(he5_gd_readdataF_32_SOURCES) \ $(he5_gd_readdataF_64_SOURCES) he5_gd_setup.c \ $(he5_gd_setupF_32_SOURCES) $(he5_gd_setupF_64_SOURCES) \ he5_gd_subset.c $(he5_gd_subsetF_32_SOURCES) \ $(he5_gd_subsetF_64_SOURCES) he5_gd_wrexternaldata.c \ he5_gd_writedata.c $(he5_gd_writedataF_32_SOURCES) \ $(he5_gd_writedataF_64_SOURCES) he5_gd_wrunlimfld.c \ he5_pt_datainfo.c $(he5_pt_datainfoF_32_SOURCES) \ $(he5_pt_datainfoF_64_SOURCES) he5_pt_definelevels.c \ $(he5_pt_definelevelsF_32_SOURCES) \ $(he5_pt_definelevelsF_64_SOURCES) he5_pt_readattrs.c \ $(he5_pt_readattrsF_32_SOURCES) \ $(he5_pt_readattrsF_64_SOURCES) he5_pt_readdata.c \ $(he5_pt_readdataF_32_SOURCES) $(he5_pt_readdataF_64_SOURCES) \ he5_pt_setup.c $(he5_pt_setupF_32_SOURCES) \ $(he5_pt_setupF_64_SOURCES) he5_pt_updatelevels.c \ $(he5_pt_updatelevelsF_32_SOURCES) \ $(he5_pt_updatelevelsF_64_SOURCES) he5_pt_writeattrs.c \ $(he5_pt_writeattrsF_32_SOURCES) \ $(he5_pt_writeattrsF_64_SOURCES) he5_pt_writedata.c \ $(he5_pt_writedataF_32_SOURCES) \ $(he5_pt_writedataF_64_SOURCES) he5_sw_datainfo.c \ he5_sw_defexternalfld.c $(he5_sw_defexternalfldF_32_SOURCES) \ $(he5_sw_defexternalfldF_64_SOURCES) he5_sw_definefields.c \ $(he5_sw_definefieldsF_32_SOURCES) \ $(he5_sw_definefieldsF_64_SOURCES) he5_sw_defunlimfld.c \ he5_sw_info.c $(he5_sw_infoF_32_SOURCES) \ $(he5_sw_infoF_64_SOURCES) he5_sw_rdexternaldata.c \ $(he5_sw_rdexternaldataF_32_SOURCES) \ $(he5_sw_rdexternaldataF_64_SOURCES) he5_sw_readdata.c \ $(he5_sw_readdataF_32_SOURCES) $(he5_sw_readdataF_64_SOURCES) \ he5_sw_setup.c $(he5_sw_setupF_32_SOURCES) \ $(he5_sw_setupF_64_SOURCES) he5_sw_subset.c \ $(he5_sw_subsetF_32_SOURCES) $(he5_sw_subsetF_64_SOURCES) \ he5_sw_wrextendrd.c he5_sw_wrexternaldata.c \ $(he5_sw_wrexternaldataF_32_SOURCES) \ $(he5_sw_wrexternaldataF_64_SOURCES) he5_sw_writedata.c \ $(he5_sw_writedataF_32_SOURCES) \ $(he5_sw_writedataF_64_SOURCES) he5_sw_wrunlimfld.c \ he5_za_datainfo.c he5_za_defexternalfld.c \ $(he5_za_defexternalfldF_32_SOURCES) \ $(he5_za_defexternalfldF_64_SOURCES) he5_za_definefields.c \ $(he5_za_definefieldsF_32_SOURCES) \ $(he5_za_definefieldsF_64_SOURCES) he5_za_info.c \ $(he5_za_infoF_32_SOURCES) $(he5_za_infoF_64_SOURCES) \ he5_za_rdexternaldata.c $(he5_za_rdexternaldataF_32_SOURCES) \ $(he5_za_rdexternaldataF_64_SOURCES) he5_za_readdata.c \ $(he5_za_readdataF_32_SOURCES) $(he5_za_readdataF_64_SOURCES) \ he5_za_setup.c $(he5_za_setupF_32_SOURCES) \ $(he5_za_setupF_64_SOURCES) he5_za_wrexternaldata.c \ $(he5_za_wrexternaldataF_32_SOURCES) \ $(he5_za_wrexternaldataF_64_SOURCES) he5_za_writedata.c \ $(he5_za_writedataF_32_SOURCES) \ $(he5_za_writedataF_64_SOURCES) DIST_SOURCES = he5_gd_datainfo.c he5_gd_defexternalfld.c \ he5_gd_definefields.c \ $(am__he5_gd_definefieldsF_32_SOURCES_DIST) \ $(am__he5_gd_definefieldsF_64_SOURCES_DIST) \ he5_gd_defunlimfld.c he5_gd_info.c \ $(am__he5_gd_infoF_32_SOURCES_DIST) \ $(am__he5_gd_infoF_64_SOURCES_DIST) he5_gd_rdexternaldata.c \ he5_gd_readdata.c $(am__he5_gd_readdataF_32_SOURCES_DIST) \ $(am__he5_gd_readdataF_64_SOURCES_DIST) he5_gd_setup.c \ $(am__he5_gd_setupF_32_SOURCES_DIST) \ $(am__he5_gd_setupF_64_SOURCES_DIST) he5_gd_subset.c \ $(am__he5_gd_subsetF_32_SOURCES_DIST) \ $(am__he5_gd_subsetF_64_SOURCES_DIST) he5_gd_wrexternaldata.c \ he5_gd_writedata.c $(am__he5_gd_writedataF_32_SOURCES_DIST) \ $(am__he5_gd_writedataF_64_SOURCES_DIST) he5_gd_wrunlimfld.c \ he5_pt_datainfo.c $(am__he5_pt_datainfoF_32_SOURCES_DIST) \ $(am__he5_pt_datainfoF_64_SOURCES_DIST) he5_pt_definelevels.c \ $(am__he5_pt_definelevelsF_32_SOURCES_DIST) \ $(am__he5_pt_definelevelsF_64_SOURCES_DIST) he5_pt_readattrs.c \ $(am__he5_pt_readattrsF_32_SOURCES_DIST) \ $(am__he5_pt_readattrsF_64_SOURCES_DIST) he5_pt_readdata.c \ $(am__he5_pt_readdataF_32_SOURCES_DIST) \ $(am__he5_pt_readdataF_64_SOURCES_DIST) he5_pt_setup.c \ $(am__he5_pt_setupF_32_SOURCES_DIST) \ $(am__he5_pt_setupF_64_SOURCES_DIST) he5_pt_updatelevels.c \ $(am__he5_pt_updatelevelsF_32_SOURCES_DIST) \ $(am__he5_pt_updatelevelsF_64_SOURCES_DIST) \ he5_pt_writeattrs.c $(am__he5_pt_writeattrsF_32_SOURCES_DIST) \ $(am__he5_pt_writeattrsF_64_SOURCES_DIST) he5_pt_writedata.c \ $(am__he5_pt_writedataF_32_SOURCES_DIST) \ $(am__he5_pt_writedataF_64_SOURCES_DIST) he5_sw_datainfo.c \ he5_sw_defexternalfld.c \ $(am__he5_sw_defexternalfldF_32_SOURCES_DIST) \ $(am__he5_sw_defexternalfldF_64_SOURCES_DIST) \ he5_sw_definefields.c \ $(am__he5_sw_definefieldsF_32_SOURCES_DIST) \ $(am__he5_sw_definefieldsF_64_SOURCES_DIST) \ he5_sw_defunlimfld.c he5_sw_info.c \ $(am__he5_sw_infoF_32_SOURCES_DIST) \ $(am__he5_sw_infoF_64_SOURCES_DIST) he5_sw_rdexternaldata.c \ $(am__he5_sw_rdexternaldataF_32_SOURCES_DIST) \ $(am__he5_sw_rdexternaldataF_64_SOURCES_DIST) \ he5_sw_readdata.c $(am__he5_sw_readdataF_32_SOURCES_DIST) \ $(am__he5_sw_readdataF_64_SOURCES_DIST) he5_sw_setup.c \ $(am__he5_sw_setupF_32_SOURCES_DIST) \ $(am__he5_sw_setupF_64_SOURCES_DIST) he5_sw_subset.c \ $(am__he5_sw_subsetF_32_SOURCES_DIST) \ $(am__he5_sw_subsetF_64_SOURCES_DIST) he5_sw_wrextendrd.c \ he5_sw_wrexternaldata.c \ $(am__he5_sw_wrexternaldataF_32_SOURCES_DIST) \ $(am__he5_sw_wrexternaldataF_64_SOURCES_DIST) \ he5_sw_writedata.c $(am__he5_sw_writedataF_32_SOURCES_DIST) \ $(am__he5_sw_writedataF_64_SOURCES_DIST) he5_sw_wrunlimfld.c \ he5_za_datainfo.c he5_za_defexternalfld.c \ $(am__he5_za_defexternalfldF_32_SOURCES_DIST) \ $(am__he5_za_defexternalfldF_64_SOURCES_DIST) \ he5_za_definefields.c \ $(am__he5_za_definefieldsF_32_SOURCES_DIST) \ $(am__he5_za_definefieldsF_64_SOURCES_DIST) he5_za_info.c \ $(am__he5_za_infoF_32_SOURCES_DIST) \ $(am__he5_za_infoF_64_SOURCES_DIST) he5_za_rdexternaldata.c \ $(am__he5_za_rdexternaldataF_32_SOURCES_DIST) \ $(am__he5_za_rdexternaldataF_64_SOURCES_DIST) \ he5_za_readdata.c $(am__he5_za_readdataF_32_SOURCES_DIST) \ $(am__he5_za_readdataF_64_SOURCES_DIST) he5_za_setup.c \ $(am__he5_za_setupF_32_SOURCES_DIST) \ $(am__he5_za_setupF_64_SOURCES_DIST) he5_za_wrexternaldata.c \ $(am__he5_za_wrexternaldataF_32_SOURCES_DIST) \ $(am__he5_za_wrexternaldataF_64_SOURCES_DIST) \ he5_za_writedata.c $(am__he5_za_writedataF_32_SOURCES_DIST) \ $(am__he5_za_writedataF_64_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FC = @FC@ FCFLAGS = @FCFLAGS@ FFLAGS = @FFLAGS@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ ac_ct_FC = @ac_ct_FC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ LIBHDFEOS5 = $(top_builddir)/src/libhe5_hdfeos.la LIBGCTP = $(top_builddir)/gctp/src/libGctp.la # Boilerplate definitions file EXTRA_DIST = hdfeos5.inc hdfeos5_64.inc fixedBuoy0.txt fixedBuoy1.txt floatBuoy0.txt floatBuoy1.txt simple.txt # Link against GCTP library and HDF-EOS5 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/gctp/include LDADD = $(LIBHDFEOS5) $(LIBGCTP) @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_gd_definefieldsF_32_SOURCES = he5_gd_definefieldsF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_gd_infoF_32_SOURCES = he5_gd_infoF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_gd_readdataF_32_SOURCES = he5_gd_readdataF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_gd_setupF_32_SOURCES = he5_gd_setupF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_gd_subsetF_32_SOURCES = he5_gd_subsetF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_gd_writedataF_32_SOURCES = he5_gd_writedataF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_pt_datainfoF_32_SOURCES = he5_pt_datainfoF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_pt_definelevelsF_32_SOURCES = he5_pt_definelevelsF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_pt_readattrsF_32_SOURCES = he5_pt_readattrsF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_pt_readdataF_32_SOURCES = he5_pt_readdataF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_pt_setupF_32_SOURCES = he5_pt_setupF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_pt_updatelevelsF_32_SOURCES = he5_pt_updatelevelsF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_pt_writeattrsF_32_SOURCES = he5_pt_writeattrsF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_pt_writedataF_32_SOURCES = he5_pt_writedataF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_sw_defexternalfldF_32_SOURCES = he5_sw_defexternalfldF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@@SZIP_ENCODER_CONDITIONAL_FALSE@he5_sw_definefieldsF_32_SOURCES = he5_sw_definefieldsF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@@SZIP_ENCODER_CONDITIONAL_TRUE@he5_sw_definefieldsF_32_SOURCES = he5_sw_definefields_szipF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_sw_infoF_32_SOURCES = he5_sw_infoF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_sw_rdexternaldataF_32_SOURCES = he5_sw_rdexternaldataF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_sw_readdataF_32_SOURCES = he5_sw_readdataF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_sw_setupF_32_SOURCES = he5_sw_setupF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_sw_subsetF_32_SOURCES = he5_sw_subsetF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_sw_wrexternaldataF_32_SOURCES = he5_sw_wrexternaldataF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_sw_writedataF_32_SOURCES = he5_sw_writedataF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_za_defexternalfldF_32_SOURCES = he5_za_defexternalfldF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_za_definefieldsF_32_SOURCES = he5_za_definefieldsF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_za_infoF_32_SOURCES = he5_za_infoF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_za_rdexternaldataF_32_SOURCES = he5_za_rdexternaldataF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_za_readdataF_32_SOURCES = he5_za_readdataF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_za_setupF_32_SOURCES = he5_za_setupF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_za_wrexternaldataF_32_SOURCES = he5_za_wrexternaldataF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_za_writedataF_32_SOURCES = he5_za_writedataF_32.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_gd_definefieldsF_64_SOURCES = he5_gd_definefieldsF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_gd_infoF_64_SOURCES = he5_gd_infoF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_gd_readdataF_64_SOURCES = he5_gd_readdataF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_gd_setupF_64_SOURCES = he5_gd_setupF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_gd_subsetF_64_SOURCES = he5_gd_subsetF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_gd_writedataF_64_SOURCES = he5_gd_writedataF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_pt_datainfoF_64_SOURCES = he5_pt_datainfoF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_pt_definelevelsF_64_SOURCES = he5_pt_definelevelsF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_pt_readattrsF_64_SOURCES = he5_pt_readattrsF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_pt_readdataF_64_SOURCES = he5_pt_readdataF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_pt_setupF_64_SOURCES = he5_pt_setupF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_pt_updatelevelsF_64_SOURCES = he5_pt_updatelevelsF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_pt_writeattrsF_64_SOURCES = he5_pt_writeattrsF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_pt_writedataF_64_SOURCES = he5_pt_writedataF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_sw_defexternalfldF_64_SOURCES = he5_sw_defexternalfldF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@@SZIP_ENCODER_CONDITIONAL_FALSE@he5_sw_definefieldsF_64_SOURCES = he5_sw_definefieldsF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@@SZIP_ENCODER_CONDITIONAL_TRUE@he5_sw_definefieldsF_64_SOURCES = he5_sw_definefields_szipF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_sw_infoF_64_SOURCES = he5_sw_infoF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_sw_rdexternaldataF_64_SOURCES = he5_sw_rdexternaldataF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_sw_readdataF_64_SOURCES = he5_sw_readdataF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_sw_setupF_64_SOURCES = he5_sw_setupF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_sw_subsetF_64_SOURCES = he5_sw_subsetF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_sw_wrexternaldataF_64_SOURCES = he5_sw_wrexternaldataF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_sw_writedataF_64_SOURCES = he5_sw_writedataF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_za_defexternalfldF_64_SOURCES = he5_za_defexternalfldF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_za_definefieldsF_64_SOURCES = he5_za_definefieldsF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_za_infoF_64_SOURCES = he5_za_infoF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_za_rdexternaldataF_64_SOURCES = he5_za_rdexternaldataF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_za_readdataF_64_SOURCES = he5_za_readdataF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_za_setupF_64_SOURCES = he5_za_setupF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_za_wrexternaldataF_64_SOURCES = he5_za_wrexternaldataF_64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@he5_za_writedataF_64_SOURCES = he5_za_writedataF_64.f # Tests consist of several programs run in succession. Each of these # names is the name of such a "sequence" of tests. TEST_SEQUENCES = gd_write_test gd_unlim_test pt_write_test \ sw_write_test sw_unlim_test sw_extend_test za_write_test \ $(am__append_3) $(am__append_4) all: all-am .SUFFIXES: .SUFFIXES: .c .f .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/include.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign samples/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign samples/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/config/include.am: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list he5_gd_datainfo$(EXEEXT): $(he5_gd_datainfo_OBJECTS) $(he5_gd_datainfo_DEPENDENCIES) $(EXTRA_he5_gd_datainfo_DEPENDENCIES) @rm -f he5_gd_datainfo$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_gd_datainfo_OBJECTS) $(he5_gd_datainfo_LDADD) $(LIBS) he5_gd_defexternalfld$(EXEEXT): $(he5_gd_defexternalfld_OBJECTS) $(he5_gd_defexternalfld_DEPENDENCIES) $(EXTRA_he5_gd_defexternalfld_DEPENDENCIES) @rm -f he5_gd_defexternalfld$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_gd_defexternalfld_OBJECTS) $(he5_gd_defexternalfld_LDADD) $(LIBS) he5_gd_definefields$(EXEEXT): $(he5_gd_definefields_OBJECTS) $(he5_gd_definefields_DEPENDENCIES) $(EXTRA_he5_gd_definefields_DEPENDENCIES) @rm -f he5_gd_definefields$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_gd_definefields_OBJECTS) $(he5_gd_definefields_LDADD) $(LIBS) he5_gd_definefieldsF_32$(EXEEXT): $(he5_gd_definefieldsF_32_OBJECTS) $(he5_gd_definefieldsF_32_DEPENDENCIES) $(EXTRA_he5_gd_definefieldsF_32_DEPENDENCIES) @rm -f he5_gd_definefieldsF_32$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_gd_definefieldsF_32_OBJECTS) $(he5_gd_definefieldsF_32_LDADD) $(LIBS) he5_gd_definefieldsF_64$(EXEEXT): $(he5_gd_definefieldsF_64_OBJECTS) $(he5_gd_definefieldsF_64_DEPENDENCIES) $(EXTRA_he5_gd_definefieldsF_64_DEPENDENCIES) @rm -f he5_gd_definefieldsF_64$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_gd_definefieldsF_64_OBJECTS) $(he5_gd_definefieldsF_64_LDADD) $(LIBS) he5_gd_defunlimfld$(EXEEXT): $(he5_gd_defunlimfld_OBJECTS) $(he5_gd_defunlimfld_DEPENDENCIES) $(EXTRA_he5_gd_defunlimfld_DEPENDENCIES) @rm -f he5_gd_defunlimfld$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_gd_defunlimfld_OBJECTS) $(he5_gd_defunlimfld_LDADD) $(LIBS) he5_gd_info$(EXEEXT): $(he5_gd_info_OBJECTS) $(he5_gd_info_DEPENDENCIES) $(EXTRA_he5_gd_info_DEPENDENCIES) @rm -f he5_gd_info$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_gd_info_OBJECTS) $(he5_gd_info_LDADD) $(LIBS) he5_gd_infoF_32$(EXEEXT): $(he5_gd_infoF_32_OBJECTS) $(he5_gd_infoF_32_DEPENDENCIES) $(EXTRA_he5_gd_infoF_32_DEPENDENCIES) @rm -f he5_gd_infoF_32$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_gd_infoF_32_OBJECTS) $(he5_gd_infoF_32_LDADD) $(LIBS) he5_gd_infoF_64$(EXEEXT): $(he5_gd_infoF_64_OBJECTS) $(he5_gd_infoF_64_DEPENDENCIES) $(EXTRA_he5_gd_infoF_64_DEPENDENCIES) @rm -f he5_gd_infoF_64$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_gd_infoF_64_OBJECTS) $(he5_gd_infoF_64_LDADD) $(LIBS) he5_gd_rdexternaldata$(EXEEXT): $(he5_gd_rdexternaldata_OBJECTS) $(he5_gd_rdexternaldata_DEPENDENCIES) $(EXTRA_he5_gd_rdexternaldata_DEPENDENCIES) @rm -f he5_gd_rdexternaldata$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_gd_rdexternaldata_OBJECTS) $(he5_gd_rdexternaldata_LDADD) $(LIBS) he5_gd_readdata$(EXEEXT): $(he5_gd_readdata_OBJECTS) $(he5_gd_readdata_DEPENDENCIES) $(EXTRA_he5_gd_readdata_DEPENDENCIES) @rm -f he5_gd_readdata$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_gd_readdata_OBJECTS) $(he5_gd_readdata_LDADD) $(LIBS) he5_gd_readdataF_32$(EXEEXT): $(he5_gd_readdataF_32_OBJECTS) $(he5_gd_readdataF_32_DEPENDENCIES) $(EXTRA_he5_gd_readdataF_32_DEPENDENCIES) @rm -f he5_gd_readdataF_32$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_gd_readdataF_32_OBJECTS) $(he5_gd_readdataF_32_LDADD) $(LIBS) he5_gd_readdataF_64$(EXEEXT): $(he5_gd_readdataF_64_OBJECTS) $(he5_gd_readdataF_64_DEPENDENCIES) $(EXTRA_he5_gd_readdataF_64_DEPENDENCIES) @rm -f he5_gd_readdataF_64$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_gd_readdataF_64_OBJECTS) $(he5_gd_readdataF_64_LDADD) $(LIBS) he5_gd_setup$(EXEEXT): $(he5_gd_setup_OBJECTS) $(he5_gd_setup_DEPENDENCIES) $(EXTRA_he5_gd_setup_DEPENDENCIES) @rm -f he5_gd_setup$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_gd_setup_OBJECTS) $(he5_gd_setup_LDADD) $(LIBS) he5_gd_setupF_32$(EXEEXT): $(he5_gd_setupF_32_OBJECTS) $(he5_gd_setupF_32_DEPENDENCIES) $(EXTRA_he5_gd_setupF_32_DEPENDENCIES) @rm -f he5_gd_setupF_32$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_gd_setupF_32_OBJECTS) $(he5_gd_setupF_32_LDADD) $(LIBS) he5_gd_setupF_64$(EXEEXT): $(he5_gd_setupF_64_OBJECTS) $(he5_gd_setupF_64_DEPENDENCIES) $(EXTRA_he5_gd_setupF_64_DEPENDENCIES) @rm -f he5_gd_setupF_64$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_gd_setupF_64_OBJECTS) $(he5_gd_setupF_64_LDADD) $(LIBS) he5_gd_subset$(EXEEXT): $(he5_gd_subset_OBJECTS) $(he5_gd_subset_DEPENDENCIES) $(EXTRA_he5_gd_subset_DEPENDENCIES) @rm -f he5_gd_subset$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_gd_subset_OBJECTS) $(he5_gd_subset_LDADD) $(LIBS) he5_gd_subsetF_32$(EXEEXT): $(he5_gd_subsetF_32_OBJECTS) $(he5_gd_subsetF_32_DEPENDENCIES) $(EXTRA_he5_gd_subsetF_32_DEPENDENCIES) @rm -f he5_gd_subsetF_32$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_gd_subsetF_32_OBJECTS) $(he5_gd_subsetF_32_LDADD) $(LIBS) he5_gd_subsetF_64$(EXEEXT): $(he5_gd_subsetF_64_OBJECTS) $(he5_gd_subsetF_64_DEPENDENCIES) $(EXTRA_he5_gd_subsetF_64_DEPENDENCIES) @rm -f he5_gd_subsetF_64$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_gd_subsetF_64_OBJECTS) $(he5_gd_subsetF_64_LDADD) $(LIBS) he5_gd_wrexternaldata$(EXEEXT): $(he5_gd_wrexternaldata_OBJECTS) $(he5_gd_wrexternaldata_DEPENDENCIES) $(EXTRA_he5_gd_wrexternaldata_DEPENDENCIES) @rm -f he5_gd_wrexternaldata$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_gd_wrexternaldata_OBJECTS) $(he5_gd_wrexternaldata_LDADD) $(LIBS) he5_gd_writedata$(EXEEXT): $(he5_gd_writedata_OBJECTS) $(he5_gd_writedata_DEPENDENCIES) $(EXTRA_he5_gd_writedata_DEPENDENCIES) @rm -f he5_gd_writedata$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_gd_writedata_OBJECTS) $(he5_gd_writedata_LDADD) $(LIBS) he5_gd_writedataF_32$(EXEEXT): $(he5_gd_writedataF_32_OBJECTS) $(he5_gd_writedataF_32_DEPENDENCIES) $(EXTRA_he5_gd_writedataF_32_DEPENDENCIES) @rm -f he5_gd_writedataF_32$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_gd_writedataF_32_OBJECTS) $(he5_gd_writedataF_32_LDADD) $(LIBS) he5_gd_writedataF_64$(EXEEXT): $(he5_gd_writedataF_64_OBJECTS) $(he5_gd_writedataF_64_DEPENDENCIES) $(EXTRA_he5_gd_writedataF_64_DEPENDENCIES) @rm -f he5_gd_writedataF_64$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_gd_writedataF_64_OBJECTS) $(he5_gd_writedataF_64_LDADD) $(LIBS) he5_gd_wrunlimfld$(EXEEXT): $(he5_gd_wrunlimfld_OBJECTS) $(he5_gd_wrunlimfld_DEPENDENCIES) $(EXTRA_he5_gd_wrunlimfld_DEPENDENCIES) @rm -f he5_gd_wrunlimfld$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_gd_wrunlimfld_OBJECTS) $(he5_gd_wrunlimfld_LDADD) $(LIBS) he5_pt_datainfo$(EXEEXT): $(he5_pt_datainfo_OBJECTS) $(he5_pt_datainfo_DEPENDENCIES) $(EXTRA_he5_pt_datainfo_DEPENDENCIES) @rm -f he5_pt_datainfo$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_pt_datainfo_OBJECTS) $(he5_pt_datainfo_LDADD) $(LIBS) he5_pt_datainfoF_32$(EXEEXT): $(he5_pt_datainfoF_32_OBJECTS) $(he5_pt_datainfoF_32_DEPENDENCIES) $(EXTRA_he5_pt_datainfoF_32_DEPENDENCIES) @rm -f he5_pt_datainfoF_32$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_pt_datainfoF_32_OBJECTS) $(he5_pt_datainfoF_32_LDADD) $(LIBS) he5_pt_datainfoF_64$(EXEEXT): $(he5_pt_datainfoF_64_OBJECTS) $(he5_pt_datainfoF_64_DEPENDENCIES) $(EXTRA_he5_pt_datainfoF_64_DEPENDENCIES) @rm -f he5_pt_datainfoF_64$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_pt_datainfoF_64_OBJECTS) $(he5_pt_datainfoF_64_LDADD) $(LIBS) he5_pt_definelevels$(EXEEXT): $(he5_pt_definelevels_OBJECTS) $(he5_pt_definelevels_DEPENDENCIES) $(EXTRA_he5_pt_definelevels_DEPENDENCIES) @rm -f he5_pt_definelevels$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_pt_definelevels_OBJECTS) $(he5_pt_definelevels_LDADD) $(LIBS) he5_pt_definelevelsF_32$(EXEEXT): $(he5_pt_definelevelsF_32_OBJECTS) $(he5_pt_definelevelsF_32_DEPENDENCIES) $(EXTRA_he5_pt_definelevelsF_32_DEPENDENCIES) @rm -f he5_pt_definelevelsF_32$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_pt_definelevelsF_32_OBJECTS) $(he5_pt_definelevelsF_32_LDADD) $(LIBS) he5_pt_definelevelsF_64$(EXEEXT): $(he5_pt_definelevelsF_64_OBJECTS) $(he5_pt_definelevelsF_64_DEPENDENCIES) $(EXTRA_he5_pt_definelevelsF_64_DEPENDENCIES) @rm -f he5_pt_definelevelsF_64$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_pt_definelevelsF_64_OBJECTS) $(he5_pt_definelevelsF_64_LDADD) $(LIBS) he5_pt_readattrs$(EXEEXT): $(he5_pt_readattrs_OBJECTS) $(he5_pt_readattrs_DEPENDENCIES) $(EXTRA_he5_pt_readattrs_DEPENDENCIES) @rm -f he5_pt_readattrs$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_pt_readattrs_OBJECTS) $(he5_pt_readattrs_LDADD) $(LIBS) he5_pt_readattrsF_32$(EXEEXT): $(he5_pt_readattrsF_32_OBJECTS) $(he5_pt_readattrsF_32_DEPENDENCIES) $(EXTRA_he5_pt_readattrsF_32_DEPENDENCIES) @rm -f he5_pt_readattrsF_32$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_pt_readattrsF_32_OBJECTS) $(he5_pt_readattrsF_32_LDADD) $(LIBS) he5_pt_readattrsF_64$(EXEEXT): $(he5_pt_readattrsF_64_OBJECTS) $(he5_pt_readattrsF_64_DEPENDENCIES) $(EXTRA_he5_pt_readattrsF_64_DEPENDENCIES) @rm -f he5_pt_readattrsF_64$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_pt_readattrsF_64_OBJECTS) $(he5_pt_readattrsF_64_LDADD) $(LIBS) he5_pt_readdata$(EXEEXT): $(he5_pt_readdata_OBJECTS) $(he5_pt_readdata_DEPENDENCIES) $(EXTRA_he5_pt_readdata_DEPENDENCIES) @rm -f he5_pt_readdata$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_pt_readdata_OBJECTS) $(he5_pt_readdata_LDADD) $(LIBS) he5_pt_readdataF_32$(EXEEXT): $(he5_pt_readdataF_32_OBJECTS) $(he5_pt_readdataF_32_DEPENDENCIES) $(EXTRA_he5_pt_readdataF_32_DEPENDENCIES) @rm -f he5_pt_readdataF_32$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_pt_readdataF_32_OBJECTS) $(he5_pt_readdataF_32_LDADD) $(LIBS) he5_pt_readdataF_64$(EXEEXT): $(he5_pt_readdataF_64_OBJECTS) $(he5_pt_readdataF_64_DEPENDENCIES) $(EXTRA_he5_pt_readdataF_64_DEPENDENCIES) @rm -f he5_pt_readdataF_64$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_pt_readdataF_64_OBJECTS) $(he5_pt_readdataF_64_LDADD) $(LIBS) he5_pt_setup$(EXEEXT): $(he5_pt_setup_OBJECTS) $(he5_pt_setup_DEPENDENCIES) $(EXTRA_he5_pt_setup_DEPENDENCIES) @rm -f he5_pt_setup$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_pt_setup_OBJECTS) $(he5_pt_setup_LDADD) $(LIBS) he5_pt_setupF_32$(EXEEXT): $(he5_pt_setupF_32_OBJECTS) $(he5_pt_setupF_32_DEPENDENCIES) $(EXTRA_he5_pt_setupF_32_DEPENDENCIES) @rm -f he5_pt_setupF_32$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_pt_setupF_32_OBJECTS) $(he5_pt_setupF_32_LDADD) $(LIBS) he5_pt_setupF_64$(EXEEXT): $(he5_pt_setupF_64_OBJECTS) $(he5_pt_setupF_64_DEPENDENCIES) $(EXTRA_he5_pt_setupF_64_DEPENDENCIES) @rm -f he5_pt_setupF_64$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_pt_setupF_64_OBJECTS) $(he5_pt_setupF_64_LDADD) $(LIBS) he5_pt_updatelevels$(EXEEXT): $(he5_pt_updatelevels_OBJECTS) $(he5_pt_updatelevels_DEPENDENCIES) $(EXTRA_he5_pt_updatelevels_DEPENDENCIES) @rm -f he5_pt_updatelevels$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_pt_updatelevels_OBJECTS) $(he5_pt_updatelevels_LDADD) $(LIBS) he5_pt_updatelevelsF_32$(EXEEXT): $(he5_pt_updatelevelsF_32_OBJECTS) $(he5_pt_updatelevelsF_32_DEPENDENCIES) $(EXTRA_he5_pt_updatelevelsF_32_DEPENDENCIES) @rm -f he5_pt_updatelevelsF_32$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_pt_updatelevelsF_32_OBJECTS) $(he5_pt_updatelevelsF_32_LDADD) $(LIBS) he5_pt_updatelevelsF_64$(EXEEXT): $(he5_pt_updatelevelsF_64_OBJECTS) $(he5_pt_updatelevelsF_64_DEPENDENCIES) $(EXTRA_he5_pt_updatelevelsF_64_DEPENDENCIES) @rm -f he5_pt_updatelevelsF_64$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_pt_updatelevelsF_64_OBJECTS) $(he5_pt_updatelevelsF_64_LDADD) $(LIBS) he5_pt_writeattrs$(EXEEXT): $(he5_pt_writeattrs_OBJECTS) $(he5_pt_writeattrs_DEPENDENCIES) $(EXTRA_he5_pt_writeattrs_DEPENDENCIES) @rm -f he5_pt_writeattrs$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_pt_writeattrs_OBJECTS) $(he5_pt_writeattrs_LDADD) $(LIBS) he5_pt_writeattrsF_32$(EXEEXT): $(he5_pt_writeattrsF_32_OBJECTS) $(he5_pt_writeattrsF_32_DEPENDENCIES) $(EXTRA_he5_pt_writeattrsF_32_DEPENDENCIES) @rm -f he5_pt_writeattrsF_32$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_pt_writeattrsF_32_OBJECTS) $(he5_pt_writeattrsF_32_LDADD) $(LIBS) he5_pt_writeattrsF_64$(EXEEXT): $(he5_pt_writeattrsF_64_OBJECTS) $(he5_pt_writeattrsF_64_DEPENDENCIES) $(EXTRA_he5_pt_writeattrsF_64_DEPENDENCIES) @rm -f he5_pt_writeattrsF_64$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_pt_writeattrsF_64_OBJECTS) $(he5_pt_writeattrsF_64_LDADD) $(LIBS) he5_pt_writedata$(EXEEXT): $(he5_pt_writedata_OBJECTS) $(he5_pt_writedata_DEPENDENCIES) $(EXTRA_he5_pt_writedata_DEPENDENCIES) @rm -f he5_pt_writedata$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_pt_writedata_OBJECTS) $(he5_pt_writedata_LDADD) $(LIBS) he5_pt_writedataF_32$(EXEEXT): $(he5_pt_writedataF_32_OBJECTS) $(he5_pt_writedataF_32_DEPENDENCIES) $(EXTRA_he5_pt_writedataF_32_DEPENDENCIES) @rm -f he5_pt_writedataF_32$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_pt_writedataF_32_OBJECTS) $(he5_pt_writedataF_32_LDADD) $(LIBS) he5_pt_writedataF_64$(EXEEXT): $(he5_pt_writedataF_64_OBJECTS) $(he5_pt_writedataF_64_DEPENDENCIES) $(EXTRA_he5_pt_writedataF_64_DEPENDENCIES) @rm -f he5_pt_writedataF_64$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_pt_writedataF_64_OBJECTS) $(he5_pt_writedataF_64_LDADD) $(LIBS) he5_sw_datainfo$(EXEEXT): $(he5_sw_datainfo_OBJECTS) $(he5_sw_datainfo_DEPENDENCIES) $(EXTRA_he5_sw_datainfo_DEPENDENCIES) @rm -f he5_sw_datainfo$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_sw_datainfo_OBJECTS) $(he5_sw_datainfo_LDADD) $(LIBS) he5_sw_defexternalfld$(EXEEXT): $(he5_sw_defexternalfld_OBJECTS) $(he5_sw_defexternalfld_DEPENDENCIES) $(EXTRA_he5_sw_defexternalfld_DEPENDENCIES) @rm -f he5_sw_defexternalfld$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_sw_defexternalfld_OBJECTS) $(he5_sw_defexternalfld_LDADD) $(LIBS) he5_sw_defexternalfldF_32$(EXEEXT): $(he5_sw_defexternalfldF_32_OBJECTS) $(he5_sw_defexternalfldF_32_DEPENDENCIES) $(EXTRA_he5_sw_defexternalfldF_32_DEPENDENCIES) @rm -f he5_sw_defexternalfldF_32$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_sw_defexternalfldF_32_OBJECTS) $(he5_sw_defexternalfldF_32_LDADD) $(LIBS) he5_sw_defexternalfldF_64$(EXEEXT): $(he5_sw_defexternalfldF_64_OBJECTS) $(he5_sw_defexternalfldF_64_DEPENDENCIES) $(EXTRA_he5_sw_defexternalfldF_64_DEPENDENCIES) @rm -f he5_sw_defexternalfldF_64$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_sw_defexternalfldF_64_OBJECTS) $(he5_sw_defexternalfldF_64_LDADD) $(LIBS) he5_sw_definefields$(EXEEXT): $(he5_sw_definefields_OBJECTS) $(he5_sw_definefields_DEPENDENCIES) $(EXTRA_he5_sw_definefields_DEPENDENCIES) @rm -f he5_sw_definefields$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_sw_definefields_OBJECTS) $(he5_sw_definefields_LDADD) $(LIBS) he5_sw_definefieldsF_32$(EXEEXT): $(he5_sw_definefieldsF_32_OBJECTS) $(he5_sw_definefieldsF_32_DEPENDENCIES) $(EXTRA_he5_sw_definefieldsF_32_DEPENDENCIES) @rm -f he5_sw_definefieldsF_32$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_sw_definefieldsF_32_OBJECTS) $(he5_sw_definefieldsF_32_LDADD) $(LIBS) he5_sw_definefieldsF_64$(EXEEXT): $(he5_sw_definefieldsF_64_OBJECTS) $(he5_sw_definefieldsF_64_DEPENDENCIES) $(EXTRA_he5_sw_definefieldsF_64_DEPENDENCIES) @rm -f he5_sw_definefieldsF_64$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_sw_definefieldsF_64_OBJECTS) $(he5_sw_definefieldsF_64_LDADD) $(LIBS) he5_sw_defunlimfld$(EXEEXT): $(he5_sw_defunlimfld_OBJECTS) $(he5_sw_defunlimfld_DEPENDENCIES) $(EXTRA_he5_sw_defunlimfld_DEPENDENCIES) @rm -f he5_sw_defunlimfld$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_sw_defunlimfld_OBJECTS) $(he5_sw_defunlimfld_LDADD) $(LIBS) he5_sw_info$(EXEEXT): $(he5_sw_info_OBJECTS) $(he5_sw_info_DEPENDENCIES) $(EXTRA_he5_sw_info_DEPENDENCIES) @rm -f he5_sw_info$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_sw_info_OBJECTS) $(he5_sw_info_LDADD) $(LIBS) he5_sw_infoF_32$(EXEEXT): $(he5_sw_infoF_32_OBJECTS) $(he5_sw_infoF_32_DEPENDENCIES) $(EXTRA_he5_sw_infoF_32_DEPENDENCIES) @rm -f he5_sw_infoF_32$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_sw_infoF_32_OBJECTS) $(he5_sw_infoF_32_LDADD) $(LIBS) he5_sw_infoF_64$(EXEEXT): $(he5_sw_infoF_64_OBJECTS) $(he5_sw_infoF_64_DEPENDENCIES) $(EXTRA_he5_sw_infoF_64_DEPENDENCIES) @rm -f he5_sw_infoF_64$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_sw_infoF_64_OBJECTS) $(he5_sw_infoF_64_LDADD) $(LIBS) he5_sw_rdexternaldata$(EXEEXT): $(he5_sw_rdexternaldata_OBJECTS) $(he5_sw_rdexternaldata_DEPENDENCIES) $(EXTRA_he5_sw_rdexternaldata_DEPENDENCIES) @rm -f he5_sw_rdexternaldata$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_sw_rdexternaldata_OBJECTS) $(he5_sw_rdexternaldata_LDADD) $(LIBS) he5_sw_rdexternaldataF_32$(EXEEXT): $(he5_sw_rdexternaldataF_32_OBJECTS) $(he5_sw_rdexternaldataF_32_DEPENDENCIES) $(EXTRA_he5_sw_rdexternaldataF_32_DEPENDENCIES) @rm -f he5_sw_rdexternaldataF_32$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_sw_rdexternaldataF_32_OBJECTS) $(he5_sw_rdexternaldataF_32_LDADD) $(LIBS) he5_sw_rdexternaldataF_64$(EXEEXT): $(he5_sw_rdexternaldataF_64_OBJECTS) $(he5_sw_rdexternaldataF_64_DEPENDENCIES) $(EXTRA_he5_sw_rdexternaldataF_64_DEPENDENCIES) @rm -f he5_sw_rdexternaldataF_64$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_sw_rdexternaldataF_64_OBJECTS) $(he5_sw_rdexternaldataF_64_LDADD) $(LIBS) he5_sw_readdata$(EXEEXT): $(he5_sw_readdata_OBJECTS) $(he5_sw_readdata_DEPENDENCIES) $(EXTRA_he5_sw_readdata_DEPENDENCIES) @rm -f he5_sw_readdata$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_sw_readdata_OBJECTS) $(he5_sw_readdata_LDADD) $(LIBS) he5_sw_readdataF_32$(EXEEXT): $(he5_sw_readdataF_32_OBJECTS) $(he5_sw_readdataF_32_DEPENDENCIES) $(EXTRA_he5_sw_readdataF_32_DEPENDENCIES) @rm -f he5_sw_readdataF_32$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_sw_readdataF_32_OBJECTS) $(he5_sw_readdataF_32_LDADD) $(LIBS) he5_sw_readdataF_64$(EXEEXT): $(he5_sw_readdataF_64_OBJECTS) $(he5_sw_readdataF_64_DEPENDENCIES) $(EXTRA_he5_sw_readdataF_64_DEPENDENCIES) @rm -f he5_sw_readdataF_64$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_sw_readdataF_64_OBJECTS) $(he5_sw_readdataF_64_LDADD) $(LIBS) he5_sw_setup$(EXEEXT): $(he5_sw_setup_OBJECTS) $(he5_sw_setup_DEPENDENCIES) $(EXTRA_he5_sw_setup_DEPENDENCIES) @rm -f he5_sw_setup$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_sw_setup_OBJECTS) $(he5_sw_setup_LDADD) $(LIBS) he5_sw_setupF_32$(EXEEXT): $(he5_sw_setupF_32_OBJECTS) $(he5_sw_setupF_32_DEPENDENCIES) $(EXTRA_he5_sw_setupF_32_DEPENDENCIES) @rm -f he5_sw_setupF_32$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_sw_setupF_32_OBJECTS) $(he5_sw_setupF_32_LDADD) $(LIBS) he5_sw_setupF_64$(EXEEXT): $(he5_sw_setupF_64_OBJECTS) $(he5_sw_setupF_64_DEPENDENCIES) $(EXTRA_he5_sw_setupF_64_DEPENDENCIES) @rm -f he5_sw_setupF_64$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_sw_setupF_64_OBJECTS) $(he5_sw_setupF_64_LDADD) $(LIBS) he5_sw_subset$(EXEEXT): $(he5_sw_subset_OBJECTS) $(he5_sw_subset_DEPENDENCIES) $(EXTRA_he5_sw_subset_DEPENDENCIES) @rm -f he5_sw_subset$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_sw_subset_OBJECTS) $(he5_sw_subset_LDADD) $(LIBS) he5_sw_subsetF_32$(EXEEXT): $(he5_sw_subsetF_32_OBJECTS) $(he5_sw_subsetF_32_DEPENDENCIES) $(EXTRA_he5_sw_subsetF_32_DEPENDENCIES) @rm -f he5_sw_subsetF_32$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_sw_subsetF_32_OBJECTS) $(he5_sw_subsetF_32_LDADD) $(LIBS) he5_sw_subsetF_64$(EXEEXT): $(he5_sw_subsetF_64_OBJECTS) $(he5_sw_subsetF_64_DEPENDENCIES) $(EXTRA_he5_sw_subsetF_64_DEPENDENCIES) @rm -f he5_sw_subsetF_64$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_sw_subsetF_64_OBJECTS) $(he5_sw_subsetF_64_LDADD) $(LIBS) he5_sw_wrextendrd$(EXEEXT): $(he5_sw_wrextendrd_OBJECTS) $(he5_sw_wrextendrd_DEPENDENCIES) $(EXTRA_he5_sw_wrextendrd_DEPENDENCIES) @rm -f he5_sw_wrextendrd$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_sw_wrextendrd_OBJECTS) $(he5_sw_wrextendrd_LDADD) $(LIBS) he5_sw_wrexternaldata$(EXEEXT): $(he5_sw_wrexternaldata_OBJECTS) $(he5_sw_wrexternaldata_DEPENDENCIES) $(EXTRA_he5_sw_wrexternaldata_DEPENDENCIES) @rm -f he5_sw_wrexternaldata$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_sw_wrexternaldata_OBJECTS) $(he5_sw_wrexternaldata_LDADD) $(LIBS) he5_sw_wrexternaldataF_32$(EXEEXT): $(he5_sw_wrexternaldataF_32_OBJECTS) $(he5_sw_wrexternaldataF_32_DEPENDENCIES) $(EXTRA_he5_sw_wrexternaldataF_32_DEPENDENCIES) @rm -f he5_sw_wrexternaldataF_32$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_sw_wrexternaldataF_32_OBJECTS) $(he5_sw_wrexternaldataF_32_LDADD) $(LIBS) he5_sw_wrexternaldataF_64$(EXEEXT): $(he5_sw_wrexternaldataF_64_OBJECTS) $(he5_sw_wrexternaldataF_64_DEPENDENCIES) $(EXTRA_he5_sw_wrexternaldataF_64_DEPENDENCIES) @rm -f he5_sw_wrexternaldataF_64$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_sw_wrexternaldataF_64_OBJECTS) $(he5_sw_wrexternaldataF_64_LDADD) $(LIBS) he5_sw_writedata$(EXEEXT): $(he5_sw_writedata_OBJECTS) $(he5_sw_writedata_DEPENDENCIES) $(EXTRA_he5_sw_writedata_DEPENDENCIES) @rm -f he5_sw_writedata$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_sw_writedata_OBJECTS) $(he5_sw_writedata_LDADD) $(LIBS) he5_sw_writedataF_32$(EXEEXT): $(he5_sw_writedataF_32_OBJECTS) $(he5_sw_writedataF_32_DEPENDENCIES) $(EXTRA_he5_sw_writedataF_32_DEPENDENCIES) @rm -f he5_sw_writedataF_32$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_sw_writedataF_32_OBJECTS) $(he5_sw_writedataF_32_LDADD) $(LIBS) he5_sw_writedataF_64$(EXEEXT): $(he5_sw_writedataF_64_OBJECTS) $(he5_sw_writedataF_64_DEPENDENCIES) $(EXTRA_he5_sw_writedataF_64_DEPENDENCIES) @rm -f he5_sw_writedataF_64$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_sw_writedataF_64_OBJECTS) $(he5_sw_writedataF_64_LDADD) $(LIBS) he5_sw_wrunlimfld$(EXEEXT): $(he5_sw_wrunlimfld_OBJECTS) $(he5_sw_wrunlimfld_DEPENDENCIES) $(EXTRA_he5_sw_wrunlimfld_DEPENDENCIES) @rm -f he5_sw_wrunlimfld$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_sw_wrunlimfld_OBJECTS) $(he5_sw_wrunlimfld_LDADD) $(LIBS) he5_za_datainfo$(EXEEXT): $(he5_za_datainfo_OBJECTS) $(he5_za_datainfo_DEPENDENCIES) $(EXTRA_he5_za_datainfo_DEPENDENCIES) @rm -f he5_za_datainfo$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_za_datainfo_OBJECTS) $(he5_za_datainfo_LDADD) $(LIBS) he5_za_defexternalfld$(EXEEXT): $(he5_za_defexternalfld_OBJECTS) $(he5_za_defexternalfld_DEPENDENCIES) $(EXTRA_he5_za_defexternalfld_DEPENDENCIES) @rm -f he5_za_defexternalfld$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_za_defexternalfld_OBJECTS) $(he5_za_defexternalfld_LDADD) $(LIBS) he5_za_defexternalfldF_32$(EXEEXT): $(he5_za_defexternalfldF_32_OBJECTS) $(he5_za_defexternalfldF_32_DEPENDENCIES) $(EXTRA_he5_za_defexternalfldF_32_DEPENDENCIES) @rm -f he5_za_defexternalfldF_32$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_za_defexternalfldF_32_OBJECTS) $(he5_za_defexternalfldF_32_LDADD) $(LIBS) he5_za_defexternalfldF_64$(EXEEXT): $(he5_za_defexternalfldF_64_OBJECTS) $(he5_za_defexternalfldF_64_DEPENDENCIES) $(EXTRA_he5_za_defexternalfldF_64_DEPENDENCIES) @rm -f he5_za_defexternalfldF_64$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_za_defexternalfldF_64_OBJECTS) $(he5_za_defexternalfldF_64_LDADD) $(LIBS) he5_za_definefields$(EXEEXT): $(he5_za_definefields_OBJECTS) $(he5_za_definefields_DEPENDENCIES) $(EXTRA_he5_za_definefields_DEPENDENCIES) @rm -f he5_za_definefields$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_za_definefields_OBJECTS) $(he5_za_definefields_LDADD) $(LIBS) he5_za_definefieldsF_32$(EXEEXT): $(he5_za_definefieldsF_32_OBJECTS) $(he5_za_definefieldsF_32_DEPENDENCIES) $(EXTRA_he5_za_definefieldsF_32_DEPENDENCIES) @rm -f he5_za_definefieldsF_32$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_za_definefieldsF_32_OBJECTS) $(he5_za_definefieldsF_32_LDADD) $(LIBS) he5_za_definefieldsF_64$(EXEEXT): $(he5_za_definefieldsF_64_OBJECTS) $(he5_za_definefieldsF_64_DEPENDENCIES) $(EXTRA_he5_za_definefieldsF_64_DEPENDENCIES) @rm -f he5_za_definefieldsF_64$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_za_definefieldsF_64_OBJECTS) $(he5_za_definefieldsF_64_LDADD) $(LIBS) he5_za_info$(EXEEXT): $(he5_za_info_OBJECTS) $(he5_za_info_DEPENDENCIES) $(EXTRA_he5_za_info_DEPENDENCIES) @rm -f he5_za_info$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_za_info_OBJECTS) $(he5_za_info_LDADD) $(LIBS) he5_za_infoF_32$(EXEEXT): $(he5_za_infoF_32_OBJECTS) $(he5_za_infoF_32_DEPENDENCIES) $(EXTRA_he5_za_infoF_32_DEPENDENCIES) @rm -f he5_za_infoF_32$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_za_infoF_32_OBJECTS) $(he5_za_infoF_32_LDADD) $(LIBS) he5_za_infoF_64$(EXEEXT): $(he5_za_infoF_64_OBJECTS) $(he5_za_infoF_64_DEPENDENCIES) $(EXTRA_he5_za_infoF_64_DEPENDENCIES) @rm -f he5_za_infoF_64$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_za_infoF_64_OBJECTS) $(he5_za_infoF_64_LDADD) $(LIBS) he5_za_rdexternaldata$(EXEEXT): $(he5_za_rdexternaldata_OBJECTS) $(he5_za_rdexternaldata_DEPENDENCIES) $(EXTRA_he5_za_rdexternaldata_DEPENDENCIES) @rm -f he5_za_rdexternaldata$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_za_rdexternaldata_OBJECTS) $(he5_za_rdexternaldata_LDADD) $(LIBS) he5_za_rdexternaldataF_32$(EXEEXT): $(he5_za_rdexternaldataF_32_OBJECTS) $(he5_za_rdexternaldataF_32_DEPENDENCIES) $(EXTRA_he5_za_rdexternaldataF_32_DEPENDENCIES) @rm -f he5_za_rdexternaldataF_32$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_za_rdexternaldataF_32_OBJECTS) $(he5_za_rdexternaldataF_32_LDADD) $(LIBS) he5_za_rdexternaldataF_64$(EXEEXT): $(he5_za_rdexternaldataF_64_OBJECTS) $(he5_za_rdexternaldataF_64_DEPENDENCIES) $(EXTRA_he5_za_rdexternaldataF_64_DEPENDENCIES) @rm -f he5_za_rdexternaldataF_64$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_za_rdexternaldataF_64_OBJECTS) $(he5_za_rdexternaldataF_64_LDADD) $(LIBS) he5_za_readdata$(EXEEXT): $(he5_za_readdata_OBJECTS) $(he5_za_readdata_DEPENDENCIES) $(EXTRA_he5_za_readdata_DEPENDENCIES) @rm -f he5_za_readdata$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_za_readdata_OBJECTS) $(he5_za_readdata_LDADD) $(LIBS) he5_za_readdataF_32$(EXEEXT): $(he5_za_readdataF_32_OBJECTS) $(he5_za_readdataF_32_DEPENDENCIES) $(EXTRA_he5_za_readdataF_32_DEPENDENCIES) @rm -f he5_za_readdataF_32$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_za_readdataF_32_OBJECTS) $(he5_za_readdataF_32_LDADD) $(LIBS) he5_za_readdataF_64$(EXEEXT): $(he5_za_readdataF_64_OBJECTS) $(he5_za_readdataF_64_DEPENDENCIES) $(EXTRA_he5_za_readdataF_64_DEPENDENCIES) @rm -f he5_za_readdataF_64$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_za_readdataF_64_OBJECTS) $(he5_za_readdataF_64_LDADD) $(LIBS) he5_za_setup$(EXEEXT): $(he5_za_setup_OBJECTS) $(he5_za_setup_DEPENDENCIES) $(EXTRA_he5_za_setup_DEPENDENCIES) @rm -f he5_za_setup$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_za_setup_OBJECTS) $(he5_za_setup_LDADD) $(LIBS) he5_za_setupF_32$(EXEEXT): $(he5_za_setupF_32_OBJECTS) $(he5_za_setupF_32_DEPENDENCIES) $(EXTRA_he5_za_setupF_32_DEPENDENCIES) @rm -f he5_za_setupF_32$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_za_setupF_32_OBJECTS) $(he5_za_setupF_32_LDADD) $(LIBS) he5_za_setupF_64$(EXEEXT): $(he5_za_setupF_64_OBJECTS) $(he5_za_setupF_64_DEPENDENCIES) $(EXTRA_he5_za_setupF_64_DEPENDENCIES) @rm -f he5_za_setupF_64$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_za_setupF_64_OBJECTS) $(he5_za_setupF_64_LDADD) $(LIBS) he5_za_wrexternaldata$(EXEEXT): $(he5_za_wrexternaldata_OBJECTS) $(he5_za_wrexternaldata_DEPENDENCIES) $(EXTRA_he5_za_wrexternaldata_DEPENDENCIES) @rm -f he5_za_wrexternaldata$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_za_wrexternaldata_OBJECTS) $(he5_za_wrexternaldata_LDADD) $(LIBS) he5_za_wrexternaldataF_32$(EXEEXT): $(he5_za_wrexternaldataF_32_OBJECTS) $(he5_za_wrexternaldataF_32_DEPENDENCIES) $(EXTRA_he5_za_wrexternaldataF_32_DEPENDENCIES) @rm -f he5_za_wrexternaldataF_32$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_za_wrexternaldataF_32_OBJECTS) $(he5_za_wrexternaldataF_32_LDADD) $(LIBS) he5_za_wrexternaldataF_64$(EXEEXT): $(he5_za_wrexternaldataF_64_OBJECTS) $(he5_za_wrexternaldataF_64_DEPENDENCIES) $(EXTRA_he5_za_wrexternaldataF_64_DEPENDENCIES) @rm -f he5_za_wrexternaldataF_64$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_za_wrexternaldataF_64_OBJECTS) $(he5_za_wrexternaldataF_64_LDADD) $(LIBS) he5_za_writedata$(EXEEXT): $(he5_za_writedata_OBJECTS) $(he5_za_writedata_DEPENDENCIES) $(EXTRA_he5_za_writedata_DEPENDENCIES) @rm -f he5_za_writedata$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_za_writedata_OBJECTS) $(he5_za_writedata_LDADD) $(LIBS) he5_za_writedataF_32$(EXEEXT): $(he5_za_writedataF_32_OBJECTS) $(he5_za_writedataF_32_DEPENDENCIES) $(EXTRA_he5_za_writedataF_32_DEPENDENCIES) @rm -f he5_za_writedataF_32$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_za_writedataF_32_OBJECTS) $(he5_za_writedataF_32_LDADD) $(LIBS) he5_za_writedataF_64$(EXEEXT): $(he5_za_writedataF_64_OBJECTS) $(he5_za_writedataF_64_DEPENDENCIES) $(EXTRA_he5_za_writedataF_64_DEPENDENCIES) @rm -f he5_za_writedataF_64$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(he5_za_writedataF_64_OBJECTS) $(he5_za_writedataF_64_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_gd_datainfo.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_gd_defexternalfld.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_gd_definefields.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_gd_defunlimfld.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_gd_info.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_gd_rdexternaldata.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_gd_readdata.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_gd_setup.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_gd_subset.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_gd_wrexternaldata.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_gd_writedata.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_gd_wrunlimfld.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_pt_datainfo.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_pt_definelevels.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_pt_readattrs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_pt_readdata.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_pt_setup.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_pt_updatelevels.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_pt_writeattrs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_pt_writedata.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_sw_datainfo.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_sw_defexternalfld.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_sw_definefields.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_sw_defunlimfld.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_sw_info.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_sw_rdexternaldata.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_sw_readdata.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_sw_setup.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_sw_subset.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_sw_wrextendrd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_sw_wrexternaldata.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_sw_writedata.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_sw_wrunlimfld.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_za_datainfo.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_za_defexternalfld.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_za_definefields.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_za_info.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_za_rdexternaldata.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_za_readdata.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_za_setup.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_za_wrexternaldata.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_za_writedata.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< .f.o: $(AM_V_F77)$(F77COMPILE) -c -o $@ $< .f.obj: $(AM_V_F77)$(F77COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .f.lo: $(AM_V_F77)$(LTF77COMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-local check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am check-local clean \ clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \ ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am @F2CFORTRAN_CONDITIONAL_TRUE@ AM_LIBTOOLFLAGS=--tag=FC # 'make check' should run each of the test sequences above check-local: $(TEST_SEQUENCES) # Manually list the tests to be run in order for each test sequence. gd_write_test: $(check_PROGRAMS) ./he5_gd_setup ./he5_gd_definefields ./he5_gd_writedata ./he5_gd_readdata ./he5_gd_info ./he5_gd_datainfo ./he5_gd_subset gd_write_test_32f: $(check_PROGRAMS) ./he5_gd_setupF_32 ./he5_gd_definefieldsF_32 ./he5_gd_writedataF_32 ./he5_gd_readdataF_32 ./he5_gd_infoF_32 ./he5_gd_subsetF_32 gd_write_test_64f: $(check_PROGRAMS) ./he5_gd_setupF_64 ./he5_gd_definefieldsF_64 ./he5_gd_writedataF_64 ./he5_gd_readdataF_64 ./he5_gd_infoF_64 ./he5_gd_subsetF_64 gd_unlim_test: $(check_PROGRAMS) ./he5_gd_setup ./he5_gd_defunlimfld ./he5_gd_wrunlimfld pt_write_test: $(check_PROGRAMS) ./he5_pt_setup ./he5_pt_definelevels srcdir=$(srcdir) ./he5_pt_writedata ./he5_pt_writeattrs ./he5_pt_readdata ./he5_pt_readattrs ./he5_pt_updatelevels ./he5_pt_datainfo pt_write_test_32f: $(check_PROGRAMS) ./he5_pt_setupF_32 ./he5_pt_definelevelsF_32 srcdir=$(srcdir) ./he5_pt_writedataF_32 ./he5_pt_writeattrsF_32 ./he5_pt_readdataF_32 ./he5_pt_readattrsF_32 ./he5_pt_updatelevelsF_32 ./he5_pt_datainfoF_32 pt_write_test_64f: $(check_PROGRAMS) ./he5_pt_setupF_64 ./he5_pt_definelevelsF_64 srcdir=$(srcdir) ./he5_pt_writedataF_64 ./he5_pt_writeattrsF_64 ./he5_pt_readdataF_64 ./he5_pt_readattrsF_64 ./he5_pt_updatelevelsF_64 ./he5_pt_datainfoF_64 sw_write_test: $(check_PROGRAMS) ./he5_sw_setup ./he5_sw_definefields ./he5_sw_writedata ./he5_sw_readdata ./he5_sw_info ./he5_sw_datainfo ./he5_sw_subset sw_write_test_32f: $(check_PROGRAMS) ./he5_sw_setupF_32 ./he5_sw_definefieldsF_32 ./he5_sw_writedataF_32 ./he5_sw_readdataF_32 ./he5_sw_infoF_32 ./he5_sw_subsetF_32 sw_write_test_64f: $(check_PROGRAMS) ./he5_sw_setupF_64 ./he5_sw_definefieldsF_64 ./he5_sw_writedataF_64 ./he5_sw_readdataF_64 ./he5_sw_infoF_64 ./he5_sw_subsetF_64 sw_unlim_test: $(check_PROGRAMS) ./he5_sw_setup ./he5_sw_defunlimfld ./he5_sw_wrunlimfld ./he5_sw_subset sw_extend_test: $(check_PROGRAMS) ./he5_sw_setup ./he5_sw_definefields ./he5_sw_wrextendrd za_write_test: $(check_PROGRAMS) ./he5_za_setup ./he5_za_definefields ./he5_za_writedata ./he5_za_readdata ./he5_za_info ./he5_za_datainfo za_write_test_32f: $(check_PROGRAMS) ./he5_za_setupF_32 ./he5_za_definefieldsF_32 ./he5_za_writedataF_32 ./he5_za_readdataF_32 ./he5_za_infoF_32 za_write_test_64f: $(check_PROGRAMS) ./he5_za_setupF_64 ./he5_za_definefieldsF_64 ./he5_za_writedataF_64 ./he5_za_readdataF_64 ./he5_za_infoF_64 # This avoids any confusion between the names of the sequences and # files with the same names. .PHONY: $(TEST_SEQUENCES) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: hdf-eos5-2.0/samples/README000077500000000000000000000307551507520047200153300ustar00rootroot00000000000000********************************************************************** * This directory provides sample programs for the user to run to * * check if the HDFEOS_5 library installed correctly. Below is a * * description of what routines are available and the order in * * which the routines should be run. * * Updated: 06/20/01 A.M. * * Aug 02 S.Z * ********************************************************************** Swath Demonstration Programs ---------------------------- A. C - programs ~~~~~~~~~~~~~~~ he5_sw_setup --- creates HDFEOS_5 swath file "Swath.h5"; sets a single swath structure "Swath1"; defines dimensions and the geolocation relations between them. he5_sw_definefields --- defines a number of fields within the swath. he5_sw_writedata --- writes data to the "Longitude", "Latitude", and "Spectra" fields; sets up global, group, and local attributes. he5_sw_readdata --- reads data from the "Longitude" field; reads global, group, and local attributes. he5_sw_info --- retrieves and displays information on the swath dimensions, geolocation relations, swath fields, and (global/group/local) attributes. he5_sw_datainfo --- retrieves data type information for a specified object (field, attribute). he5_sw_subset --- demonstrates subsetting on the "Spectra" field. he5_sw_defunlimfld --- same as 'he5_sw_definefields' but defines "Spectra" field as having unlimited dimension. he5_sw_wrunlimfld --- same as 'he5_sw_writedata' but writes data to the "Spectra" field twice. he5_sw_wrextendrd --- demonstrates usage of unlimited dimension for appendible field "Count". Sequence of calls: 1. he5_sw_setup he5_sw_definefields he5_sw_writedata he5_sw_readdata he5_sw_info he5_sw_datainfo he5_sw_subset 2. he5_sw_setup he5_sw_defunlimfld he5_sw_wrunlimfld he5_sw_subset 3. he5_sw_setup he5_sw_definefields he5_sw_wrextendrd Example of working with external data files ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ he5_sw_setup --- creates HDFEOS_5 swath file "Swath.h5"; sets a single swath structure "Swath1"; defines dimensions (including dimension of external data set) and the geolocation relations between them. he5_sw_defexternalfld --- defines external field (data set) he5_sw_rdexternaldata --- reads data from external data file(s) to the external field he5_sw_wrexternaldata --- writes data to external field/data file(s) B. FORTRAN-77 programs ~~~~~~~~~~~~~~~~~~~~~~ he5_sw_setupF_64 --- see 'he5_sw_setup', creates "swath.h5" file. (he5_sw_setupF_32) he5_sw_definefieldsF_64 --- see 'he5_sw_definefields' (he5_sw_definefieldsF_32) he5_sw_writedataF_64 --- see 'he5_sw_writedata' (he5_sw_writedataF_32) he5_sw_readdataF_64 --- see 'he5_sw_readdata' (he5_sw_readdataF_32) he5_sw_infoF_64 --- see 'he5_sw_info' (he5_sw_infoF_32) he5_sw_subsetF_64 --- see 'he5_sw_subset' (he5_sw_subsetF_32) Sequence of calls: he5_sw_setupF_64 (...F_32) he5_sw_definefieldsF_64 (...F_32) he5_sw_writedataF_64 (...F_32) he5_sw_readdataF_64 (...F_32) he5_sw_infoF_64 (...F_32) he5_sw_subsetF_64 (...F_32) =========================================================================== Grid Demonstration Programs --------------------------- A. C - programs ~~~~~~~~~~~~~~~ he5_gd_setup --- creates HDFEOS_5 grid file "Grid.h5"; sets two grid structures. he5_gd_definefields --- defines fields within the two grids. he5_gd_writedata --- writes data to the fields within the two grids; sets up global, group, and local attributes. he5_gd_readdata --- reads data from the fields; reads global, group, and local attributes. he5_gd_info --- retrieves and displays information on the grid dimensions, projections, grid fields, and (global/group/local) attributes. he5_gd_datainfo --- retrieves data type information for a specified object (field, attribute). he5_gd_subset --- demonstrates subsetting on the "Temperature" field in the "PolarGrid" grid. he5_gd_defunlimfld --- defines "Vegetation" field having unlimited dimension. he5_gd_wrunlimfld --- sequentially writes data buffers of different size to the "Vegetation" field. Sequence of calls: 1. he5_gd_setup he5_gd_definefields he5_gd_writedata he5_gd_readdata he5_gd_info he5_gd_datainfo he5_gd_subset 2. he5_gd_setup he5_gd_defunlimfld he5_gd_wrunlimfld Example of working with external data files ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ he5_gd_setup --- creates HDFEOS_5 grid file "Grid.h5"; sets two grid structures; defines dimensions (including dimension of external data set). he5_gd_defexternalfld --- defines external field (data set) he5_gd_rdexternaldata --- reads data from external data file(s) to the external field he5_gd_wrexternaldata --- writes data to external field/data file(s) B. FORTRAN-77 programs ~~~~~~~~~~~~~~~~~~~~~~ he5_gd_setupF_64 --- see 'he5_gd_setup'; creates "grid.h5" file. (he5_gd_setupF_32) he5_gd_definefieldsF_64 --- see 'he5_gd_definefields' (he5_gd_definefieldsF_32) he5_gd_writedataF_64 --- see 'he5_gd_writedata' (he5_gd_writedataF_32) he5_gd_readdataF_64 --- see 'he5_gd_readdata' (he5_gd_readdataF_32) he5_gd_infoF_64 --- see 'he5_gd_info' (he5_gd_infoF_32) he5_gd_subsetF_64 --- see 'he5_gd_subset' (he5_gd_subsetF_32) Sequence of calls: he5_gd_setupF_64 (...F_32) he5_gd_definefieldsF_64 (...F_32) he5_gd_writedataF_64 (...F_32) he5_gd_readdataF_64 (...F_32) he5_gd_infoF_64 (...F_32) he5_gd_subsetF_64 (...F_32) =========================================================================== Point Demonstration Programs ---------------------------- The sample codes described below use the following input data files (make sure these files are in the same directory with the sample codes) : fixedBuoy0.txt fixedBuoy1s.txt floatBuoy1.txt fixedBuoy1.txt floatBuoy0.txt simple.txt A. C - programs ~~~~~~~~~~~~~~~ he5_pt_setup --- creates HDFEOS_5 point file "Point.h5"; he5_pt_definelevels --- defines levels within the point. he5_pt_writedata --- writes data to the specified levels. he5_pt_writeattrs --- writes attributes. he5_pt_readdata --- reads data from a level. he5_pt_readattrs --- reads attributes. he5_pt_updatelevels --- updates level data. he5_pt_datainfo --- retrieves data type information for a specified object within point. Sequence of calls: he5_pt_setup he5_pt_definelevels he5_pt_writedata he5_pt_writeattrs he5_pt_readdata he5_pt_readattrs he5_pt_updatelevels he5_pt_datainfo B. FORTRAN-77 programs ~~~~~~~~~~~~~~~~~~~~~~ he5_pt_setupF_64 --- see 'he5_pt_setup'; creates "point.h5" file. (he5_pt_setupF_32) he5_pt_definelevelsF_64 --- see 'he5_pt_definelevels' (he5_pt_definelevelsF_32) he5_pt_writedataF_64 --- see 'he5_pt_writedata' (he5_pt_writedataF_32) he5_pt_writeattrsF_64 --- see 'he5_pt_writeattrs' (he5_pt_writeattrsF_32) he5_pt_readdataF_64 --- see 'he5_pt_readdata' (he5_pt_readdataF_32) he5_pt_readattrsF_64 --- see 'he5_pt_readattrs' (he5_pt_readattrsF_32) he5_pt_updatelevelsF_64 --- see 'he5_pt_updatelevels' (he5_pt_updatelevelsF_32) he5_pt_datainfoF_64 --- see 'he5_pt_datainfo' (he5_pt_datainfoF_32) Sequence of calls: he5_pt_setupF_64 (...F_32) he5_pt_definelevelsF_64 (...F_32) he5_pt_writedataF_64 (...F_32) he5_pt_writeattrsF_64 (...F_32) he5_pt_readdataF_64 (...F_32) he5_pt_readattrsF_64 (...F_32) he5_pt_updatelevelsF_64 (...F_32) he5_pt_datainfoF_64 (...F_32) ===================================================================== ZA Demonstration Programs ------------------------- A. C - programs ~~~~~~~~~~~~~~ he5_za_setup --- creates HDFEOS_5 za file "ZA.h5"; sets a single za structure "ZA1"; defines dimensions. he5_za_definefields --- defines a number of fields within the za. he5_za_writedata --- writes data to the "Spectra" field; sets up global, group, and local attributes. he5_za_readdata --- reads data from the "Spectra" field; reads global, group, and local attributes. he5_za_info --- retrieves and displays information on the za dimensions, and (global/group/local) attributes. he5_za_datainfo --- retrieves data type information for a specified object (field, attribute). Sequence of calls: he5_za_setup he5_za_definefields he5_za_writedata he5_za_readdata he5_za_info he5_za_datainfo Example of working with external data files ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ he5_za_setup --- creates HDFEOS_5 za file "ZA.h5"; sets a single za structure "ZA1"; defines dimensions (including dimension of external data set). he5_za_defexternalfld --- defines external field (data set) he5_za_rdexternaldata --- reads data from external data file(s) to the external field he5_za_wrexternaldata --- writes data to external field/data file(s) B. FORTRAN-77 programs ~~~~~~~~~~~~~~~~~~~~~ he5_za_setupF_64 --- see 'he5_za_setup', creates "za.he5" file. (he5_za_setupF_32) he5_za_definefieldsF_64 --- see 'he5_za_definefields' (he5_za_definefieldsF_32) he5_za_writedataF_64 --- see 'he5_za_writedata' (he5_za_writedataF_32) he5_za_readdataF_64 --- see 'he5_za_readdata' (he5_za_readdataF_32) he5_za_infoF_64 --- see 'he5_za_info' (he5_za_infoF_32) Sequence of calls: he5_za_setupF_64 (...F_32) he5_za_definefieldsF_64 (...F_32) he5_za_writedataF_64 (...F_32) he5_za_readdataF_64 (...F_32) he5_za_infoF_64 (...F_32) ====================================================================================== hdf-eos5-2.0/samples/fixedBuoy0.txt000077500000000000000000000002071507520047200172140ustar00rootroot00000000000000Pacific -140.2520148 -10.3024294 891218 P Atlantic -54.8270879 43.1362228 900228 A Indian 71.7147412 7.4254709 900912 I hdf-eos5-2.0/samples/fixedBuoy1.txt000077500000000000000000000012501507520047200172140ustar00rootroot00000000000000 83422000.0 1.1 21.63 P 83555918.7 0.7 24.21 A 83726878.2 2.7 23.83 P 83842994.7 4.3 22.63 P 84013712.3 0.7 20.35 A 84063571.3 2.8 20.84 P 84245234.1 1.7 24.52 I 84251741.0 1.4 20.98 I 84412971.8 3.6 20.41 A 84419483.0 1.8 22.01 P 84452408.0 3.4 23.20 P 84623981.3 4.0 23.91 I 84655020.8 3.2 21.79 A 84736992.5 4.6 23.61 P 84835587.2 3.6 20.38 A 84915081.1 5.1 20.10 P 84970587.0 1.1 24.63 P 85058206.4 1.3 22.98 I 85076367.6 2.7 22.62 P 85111729.5 1.0 22.01 P hdf-eos5-2.0/samples/floatBuoy0.txt000077500000000000000000000001211507520047200172150ustar00rootroot00000000000000Pacific 901023 1200 P Atlantic 890419 2550 A Indian 900605 800 I hdf-eos5-2.0/samples/floatBuoy1.txt000077500000000000000000000027341507520047200172320ustar00rootroot00000000000000 34532000.0 -56.795451 46.929101 3.5 22.74 A 34655930.8 -51.144523 39.393151 0.3 22.25 A 34761777.4 73.005232 4.068124 3.9 22.60 I 34924857.4 -51.289537 47.272357 0.6 24.23 A 35010197.1 -137.896588 -10.438813 3.1 23.24 P 35113965.3 70.943919 4.989471 3.7 21.05 I 35146430.0 -141.334164 -8.035026 0.9 23.16 P 35180802.9 -51.291848 47.940175 4.6 21.68 A 35286334.7 -141.921518 -9.133087 1.1 20.25 P 35359789.3 -139.960931 -11.797505 1.8 24.37 P 35510873.5 -56.995840 44.141150 3.7 23.12 A 35583198.0 73.083084 10.349487 3.0 24.63 I 35741969.4 -138.607937 -10.352329 4.3 24.05 P 35811504.6 -52.535794 38.967934 1.1 23.50 A 35890062.6 71.995167 6.438556 1.5 23.14 I 36015258.2 -51.100562 39.280490 1.9 20.31 A 36176650.2 -141.603094 -10.410025 2.9 21.33 P 36292709.9 -53.052534 44.477106 2.1 23.65 A 36307577.3 -53.937608 38.710016 5.0 20.06 A 36384294.9 -55.381183 41.246119 4.0 23.34 A 36576747.4 -141.588561 -9.158308 0.5 20.79 P 36725342.2 -51.199441 38.061798 2.4 20.01 A 36758333.4 -138.998487 -8.706307 0.3 22.07 P 36841499.9 72.256089 8.036737 3.9 24.41 I 37021357.5 -139.961167 -11.094212 0.6 23.02 P hdf-eos5-2.0/samples/hdfeos5.inc000077500000000000000000000351131507520047200164710ustar00rootroot00000000000000! * ========================================================== ! * File: hdfeos5.inc ! * Author: A. Muslimov, Emergent Technology Services, Inc. ! * Date: March 11, 2002 ! * Purpose: Fortran header file for HDFEOS5 routines ! * ========================================================== ! * Contents: ! * HDFEOS5 data type tags ! * HDFEOS5 logical constants ! * HDFEOS5 file access tags ! * HDFEOS5/GCTP library codes ! * ! * =========================================================== ! HDFEOS5 DATA TYPE TAGS ! ======================= integer HE5T_NATIVE_INT integer HE5T_NATIVE_UINT integer HE5T_NATIVE_SHORT integer HE5T_NATIVE_USHORT integer HE5T_NATIVE_SCHAR integer HE5T_NATIVE_UCHAR integer HE5T_NATIVE_LONG integer HE5T_NATIVE_ULONG integer HE5T_NATIVE_LLONG integer HE5T_NATIVE_ULLONG integer HE5T_NATIVE_FLOAT integer HE5T_NATIVE_REAL integer HE5T_NATIVE_DOUBLE integer HE5T_NATIVE_LDOUBLE integer HE5T_NATIVE_INT8 integer HE5T_NATIVE_UINT8 integer HE5T_NATIVE_INT16 integer HE5T_NATIVE_UINT16 integer HE5T_NATIVE_INT32 integer HE5T_NATIVE_UINT32 integer HE5T_NATIVE_INT64 integer HE5T_NATIVE_UINT64 integer HE5T_NATIVE_B8 integer HE5T_NATIVE_B16 integer HE5T_NATIVE_B32 integer HE5T_NATIVE_B64 integer HE5T_NATIVE_HSIZE integer HE5T_NATIVE_HERR integer HE5T_NATIVE_HBOOL integer HE5T_STD_I8BE integer HE5T_STD_I8LE integer HE5T_STD_I16BE integer HE5T_STD_I16LE integer HE5T_STD_I32BE integer HE5T_STD_I32LE integer HE5T_STD_I64BE integer HE5T_STD_I64LE integer HE5T_STD_U8BE integer HE5T_STD_U8LE integer HE5T_STD_U16BE integer HE5T_STD_U16LE integer HE5T_STD_U32BE integer HE5T_STD_U32LE integer HE5T_STD_U64BE integer HE5T_STD_U64LE integer HE5T_STD_B8BE integer HE5T_STD_B8LE integer HE5T_STD_B16BE integer HE5T_STD_B16LE integer HE5T_STD_B32BE integer HE5T_STD_B32LE integer HE5T_STD_B64BE integer HE5T_STD_B64LE integer HE5T_IEEE_F32BE integer HE5T_IEEE_F32LE integer HE5T_IEEE_F64BE integer HE5T_IEEE_F64LE integer HE5T_NATIVE_CHAR integer HE5T_CHARSTRING parameter(HE5T_NATIVE_INT = 0) parameter(HE5T_NATIVE_UINT = 1) parameter(HE5T_NATIVE_SHORT = 2) parameter(HE5T_NATIVE_USHORT = 3) parameter(HE5T_NATIVE_SCHAR = 4) parameter(HE5T_NATIVE_UCHAR = 5) parameter(HE5T_NATIVE_LONG = 6) parameter(HE5T_NATIVE_ULONG = 7) parameter(HE5T_NATIVE_LLONG = 8) parameter(HE5T_NATIVE_ULLONG = 9) parameter(HE5T_NATIVE_FLOAT =10) parameter(HE5T_NATIVE_REAL =10) parameter(HE5T_NATIVE_DOUBLE =11) parameter(HE5T_NATIVE_LDOUBLE =12) parameter(HE5T_NATIVE_INT8 =13) parameter(HE5T_NATIVE_UINT8 =14) parameter(HE5T_NATIVE_INT16 =15) parameter(HE5T_NATIVE_UINT16 =16) parameter(HE5T_NATIVE_INT32 =17) parameter(HE5T_NATIVE_UINT32 =18) parameter(HE5T_NATIVE_INT64 =19) parameter(HE5T_NATIVE_UINT64 =20) parameter(HE5T_NATIVE_B8 =21) parameter(HE5T_NATIVE_B16 =22) parameter(HE5T_NATIVE_B32 =23) parameter(HE5T_NATIVE_B64 =24) parameter(HE5T_NATIVE_HSIZE =25) parameter(HE5T_NATIVE_HERR =26) parameter(HE5T_NATIVE_HBOOL =27) parameter(HE5T_STD_I8BE =28) parameter(HE5T_STD_I8LE =29) parameter(HE5T_STD_I16BE =30) parameter(HE5T_STD_I16LE =31) parameter(HE5T_STD_I32BE =32) parameter(HE5T_STD_I32LE =33) parameter(HE5T_STD_I64BE =34) parameter(HE5T_STD_I64LE =35) parameter(HE5T_STD_U8BE =36) parameter(HE5T_STD_U8LE =37) parameter(HE5T_STD_U16BE =38) parameter(HE5T_STD_U16LE =39) parameter(HE5T_STD_U32BE =40) parameter(HE5T_STD_U32LE =41) parameter(HE5T_STD_U64BE =42) parameter(HE5T_STD_U64LE =43) parameter(HE5T_STD_B8BE =44) parameter(HE5T_STD_B8LE =45) parameter(HE5T_STD_B16BE =46) parameter(HE5T_STD_B16LE =47) parameter(HE5T_STD_B32BE =48) parameter(HE5T_STD_B32LE =49) parameter(HE5T_STD_B64BE =50) parameter(HE5T_STD_B64LE =51) parameter(HE5T_IEEE_F32BE =52) parameter(HE5T_IEEE_F32LE =53) parameter(HE5T_IEEE_F64BE =54) parameter(HE5T_IEEE_F64LE =55) parameter(HE5T_NATIVE_CHAR =56) parameter(HE5T_CHARSTRING =57) integer HE5S_UNLIMITED_F parameter(HE5S_UNLIMITED_F = -1) ! HDFEOS5 FILE ACCESS TAGS ! ======================== integer HE5F_ACC_RDWR integer HE5F_ACC_RDONLY integer HE5F_ACC_TRUNC parameter(HE5F_ACC_RDWR = 100) parameter(HE5F_ACC_RDONLY = 101) parameter(HE5F_ACC_TRUNC = 102) ! TOOLKIT FILE ACCESS TAGS ! ======================== integer HDF4_ACC_RDONLY integer HDF4_ACC_RDWR integer HDF4_ACC_CREATE integer HDF5_ACC_RDONLY integer HDF5_ACC_RDWR integer HDF5_ACC_CREATE parameter(HDF4_ACC_RDONLY = 1) parameter(HDF4_ACC_RDWR = 3) parameter(HDF4_ACC_CREATE = 4) parameter(HDF5_ACC_RDONLY = 11) parameter(HDF5_ACC_RDWR = 13) parameter(HDF5_ACC_CREATE = 14) ! HDFEOS5 MERGE CODES ! ==================== integer HE5_HDFE_NOMERGE integer HE5_HDFE_AUTOMERGE parameter(HE5_HDFE_NOMERGE =0) parameter(HE5_HDFE_AUTOMERGE =1) ! HDFEOS5 XXentries CODES ! ======================= integer HE5_HDFE_NENTDIM integer HE5_HDFE_NENTMAP integer HE5_HDFE_NENTIMAP integer HE5_HDFE_NENTGFLD integer HE5_HDFE_NENTDFLD parameter(HE5_HDFE_NENTDIM =0) parameter(HE5_HDFE_NENTMAP =1) parameter(HE5_HDFE_NENTIMAP =2) parameter(HE5_HDFE_NENTGFLD =3) parameter(HE5_HDFE_NENTDFLD =4) ! HDFEOS5 ANGLE CONVERSION CODES ! ============================== integer HE5_HDFE_RAD_DEG integer HE5_HDFE_DEG_RAD integer HE5_HDFE_DMS_DEG integer HE5_HDFE_DEG_DMS integer HE5_HDFE_RAD_DMS integer HE5_HDFE_DMS_RAD parameter(HE5_HDFE_RAD_DEG =0) parameter(HE5_HDFE_DEG_RAD =1) parameter(HE5_HDFE_DMS_DEG =2) parameter(HE5_HDFE_DEG_DMS =3) parameter(HE5_HDFE_RAD_DMS =4) parameter(HE5_HDFE_DMS_RAD =5) ! HDFEOS5 SWATH SUBSET CODES ! ========================== integer HE5_HDFE_MIDPOINT integer HE5_HDFE_ENDPOINT integer HE5_HDFE_ANYPOINT integer HE5_HDFE_INTERNAL integer HE5_HDFE_EXTERNAL integer HE5_HDFE_NOPREVSUB parameter(HE5_HDFE_MIDPOINT =0) parameter(HE5_HDFE_ENDPOINT =1) parameter(HE5_HDFE_ANYPOINT =2) parameter(HE5_HDFE_INTERNAL =0) parameter(HE5_HDFE_EXTERNAL =1) parameter(HE5_HDFE_NOPREVSUB =-1) ! HDFEOS5 GRID ORIGIN CODES ! ========================= integer HE5_HDFE_GD_UL integer HE5_HDFE_GD_UR integer HE5_HDFE_GD_LL integer HE5_HDFE_GD_LR parameter(HE5_HDFE_GD_UL =0) parameter(HE5_HDFE_GD_UR =1) parameter(HE5_HDFE_GD_LL =2) parameter(HE5_HDFE_GD_LR =3) ! HDFEOS5 PIXEL REGISTRATION CODES ! ================================ integer HE5_HDFE_CENTER integer HE5_HDFE_CORNER parameter(HE5_HDFE_CENTER =0) parameter(HE5_HDFE_CORNER =1) ! HDFEOS5 GCTP PROJECTION CODES ! ============================= integer HE5_GCTP_GEO integer HE5_GCTP_UTM integer HE5_GCTP_SPCS integer HE5_GCTP_ALBERS integer HE5_GCTP_LAMCC integer HE5_GCTP_MERCAT integer HE5_GCTP_PS integer HE5_GCTP_POLYC integer HE5_GCTP_EQUIDC integer HE5_GCTP_TM integer HE5_GCTP_STEREO integer HE5_GCTP_LAMAZ integer HE5_GCTP_AZMEQD integer HE5_GCTP_GNOMON integer HE5_GCTP_ORTHO integer HE5_GCTP_GVNSP integer HE5_GCTP_SNSOID integer HE5_GCTP_EQRECT integer HE5_GCTP_MILLER integer HE5_GCTP_VGRINT integer HE5_GCTP_HOM integer HE5_GCTP_ROBIN integer HE5_GCTP_SOM integer HE5_GCTP_ALASKA integer HE5_GCTP_GOOD integer HE5_GCTP_MOLL integer HE5_GCTP_IMOLL integer HE5_GCTP_HAMMER integer HE5_GCTP_WAGIV integer HE5_GCTP_WAGVII integer HE5_GCTP_OBLEQA integer HE5_GCTP_ISINUS parameter(HE5_GCTP_GEO =0) parameter(HE5_GCTP_UTM =1) parameter(HE5_GCTP_SPCS =2) parameter(HE5_GCTP_ALBERS =3) parameter(HE5_GCTP_LAMCC =4) parameter(HE5_GCTP_MERCAT =5) parameter(HE5_GCTP_PS =6) parameter(HE5_GCTP_POLYC =7) parameter(HE5_GCTP_EQUIDC =8) parameter(HE5_GCTP_TM =9) parameter(HE5_GCTP_STEREO =10) parameter(HE5_GCTP_LAMAZ =11) parameter(HE5_GCTP_AZMEQD =12) parameter(HE5_GCTP_GNOMON =13) parameter(HE5_GCTP_ORTHO =14) parameter(HE5_GCTP_GVNSP =15) parameter(HE5_GCTP_SNSOID =16) parameter(HE5_GCTP_EQRECT =17) parameter(HE5_GCTP_MILLER =18) parameter(HE5_GCTP_VGRINT =19) parameter(HE5_GCTP_HOM =20) parameter(HE5_GCTP_ROBIN =21) parameter(HE5_GCTP_SOM =22) parameter(HE5_GCTP_ALASKA =23) parameter(HE5_GCTP_GOOD =24) parameter(HE5_GCTP_MOLL =25) parameter(HE5_GCTP_IMOLL =26) parameter(HE5_GCTP_HAMMER =27) parameter(HE5_GCTP_WAGIV =28) parameter(HE5_GCTP_WAGVII =29) parameter(HE5_GCTP_OBLEQA =30) parameter(HE5_GCTP_ISINUS =99) ! HDFEOS5 TILIND/COMPRESSION CODES ! ================================ integer HE5_HDFE_NOTILE integer HE5_HDFE_TILE integer HE5_HDFE_COMP_NONE integer HE5_HDFE_COMP_RLE integer HE5_HDFE_COMP_NBIT integer HE5_HDFE_COMP_SKPHUFF integer HE5_HDFE_COMP_DEFLATE integer HE5_HDFE_COMP_SZIP_CHIP integer HE5_HDFE_COMP_SZIP_K13 integer HE5_HDFE_COMP_SZIP_EC integer HE5_HDFE_COMP_SZIP_NN integer HE5_HDFE_COMP_SZIP_K13orEC integer HE5_HDFE_COMP_SZIP_K13orNN integer HE5_HDFE_COMP_SHUF_DEFLATE integer HE5_HDFE_COMP_SHUF_SZIP_CHIP integer HE5_HDFE_COMP_SHUF_SZIP_K13 integer HE5_HDFE_COMP_SHUF_SZIP_EC integer HE5_HDFE_COMP_SHUF_SZIP_NN integer HE5_HDFE_COMP_SHUF_SZIP_K13orEC integer HE5_HDFE_COMP_SHUF_SZIP_K13orNN parameter(HE5_HDFE_NOTILE =0) parameter(HE5_HDFE_TILE =1) parameter(HE5_HDFE_COMP_NONE =0) parameter(HE5_HDFE_COMP_RLE =1) parameter(HE5_HDFE_COMP_NBIT =2) parameter(HE5_HDFE_COMP_SKPHUFF =3) parameter(HE5_HDFE_COMP_DEFLATE =4) parameter(HE5_HDFE_COMP_SZIP_CHIP =5) parameter(HE5_HDFE_COMP_SZIP_K13 =6) parameter(HE5_HDFE_COMP_SZIP_EC =7) parameter(HE5_HDFE_COMP_SZIP_NN =8) parameter(HE5_HDFE_COMP_SZIP_K13orEC =9) parameter(HE5_HDFE_COMP_SZIP_K13orNN =10) parameter(HE5_HDFE_COMP_SHUF_DEFLATE =11) parameter(HE5_HDFE_COMP_SHUF_SZIP_CHIP =12) parameter(HE5_HDFE_COMP_SHUF_SZIP_K13 =13) parameter(HE5_HDFE_COMP_SHUF_SZIP_EC =14) parameter(HE5_HDFE_COMP_SHUF_SZIP_NN =15) parameter(HE5_HDFE_COMP_SHUF_SZIP_K13orEC =16) parameter(HE5_HDFE_COMP_SHUF_SZIP_K13orNN =17) ! HDFEOS5 GROUP CODES ! =================== integer HE5_HDFE_GEOGROUP integer HE5_HDFE_DATAGROUP integer HE5_HDFE_ATTRGROUP integer HE5_HDFE_GRPATTRGROUP integer HE5_HDFE_LOCATTRGROUP integer HE5_HDFE_PROFGROUP integer HE5_HDFE_PROFGRPATTRGROUP integer HE5_HDFE_GEOGRPATTRGROUP parameter(HE5_HDFE_GEOGROUP =0) parameter(HE5_HDFE_DATAGROUP =1) parameter(HE5_HDFE_ATTRGROUP =2) parameter(HE5_HDFE_GRPATTRGROUP =3) parameter(HE5_HDFE_LOCATTRGROUP =4) parameter(HE5_HDFE_PROFGROUP =5) parameter(HE5_HDFE_PROFGRPATTRGROUP =6) parameter(HE5_HDFE_GEOGRPATTRGROUP =7) hdf-eos5-2.0/samples/hdfeos5_64.inc000066400000000000000000000010151507520047200167710ustar00rootroot00000000000000! * ========================================================== ! * File: hdfeos5_64.inc ! * Author: A. Muslimov, Emergent Technology Services, Inc. ! * Date: March 19, 2002 ! * Purpose: Fortran header file for HDFEOS5 routines on 64 ! * bit platforms ! * ========================================================== ! * Contents: ! * ! * ! * =========================================================== integer*8 HE5S_UNLIMITED_F_64 parameter(HE5S_UNLIMITED_F_64 = -1) hdf-eos5-2.0/samples/he5_gd_datainfo.c000077500000000000000000000055511507520047200176100ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include #define FILENAME "Grid.h5" #define OBJECT "UTMGrid" #define FIELDNAME "Vegetation" int main(void) { herr_t status = FAIL; int fieldgroup = FAIL; hid_t fid = FAIL; hid_t GDid = FAIL; hid_t datatype = FAIL; H5T_class_t classid = H5T_NO_CLASS; H5T_order_t order = H5T_ORDER_ERROR; size_t size = 0; fid = HE5_GDopen(FILENAME, H5F_ACC_RDONLY); printf("File ID returned by HE5_GDopen() : %ld \n", (long) fid); GDid = HE5_GDattach(fid, OBJECT); printf("Grid ID returned by HE5_GDattach() : %ld \n", (long) GDid); fieldgroup = HE5_HDFE_DATAGROUP; status = HE5_GDinqdatatype(GDid, FIELDNAME, NULL, fieldgroup, &datatype, &classid, &order, &size); printf("Status returned by HE5_GDinqdatatype() : %d \n", status); if (status != FAIL) { printf("\tdatatype: %d \n", (int)datatype); printf("\tclass ID: %d \n", (int)classid); printf("\torder: %d \n", (int)order); printf("\tsize: %d \n", (int)size); } fieldgroup = HE5_HDFE_ATTRGROUP; status = HE5_GDinqdatatype(GDid, NULL, "GlobalAttribute", fieldgroup, &datatype, &classid, &order, &size); printf("Status returned by HE5_GDinqdatatype() : %d \n", status); if (status != FAIL) { printf("\tdatatype: %d \n", (int)datatype); printf("\tclass ID: %d \n", (int)classid); printf("\torder: %d \n", (int)order); printf("\tsize: %d \n", (int)size); } fieldgroup = HE5_HDFE_GRPATTRGROUP; status = HE5_GDinqdatatype(GDid, NULL, "GroupAttribute", fieldgroup, &datatype, &classid, &order, &size); printf("Status returned by HE5_GDinqdatatype() : %d \n", status); if (status != FAIL) { printf("\tdatatype: %d \n", (int)datatype); printf("\tclass ID: %d \n", (int)classid); printf("\torder: %d \n", (int)order); printf("\tsize: %d \n", (int)size); } fieldgroup = HE5_HDFE_LOCATTRGROUP; status = HE5_GDinqdatatype(GDid, FIELDNAME, "LocalAttribute", fieldgroup, &datatype, &classid, &order, &size); printf("Status returned by HE5_GDinqdatatype() : %d \n", status); if (status != FAIL) { printf("\tdatatype: %d \n", (int)datatype); printf("\tclass ID: %d \n", (int)classid); printf("\torder: %d \n", (int)order); printf("\tsize: %d \n", (int)size); } status = HE5_GDdetach(GDid); printf("Status returned by HE5_GDdetach() : %d \n", status); status = HE5_GDclose(fid); printf("Status returned by HE5_GDclose() : %d \n", status); return(0); } hdf-eos5-2.0/samples/he5_gd_defexternalfld.c000077500000000000000000000041601507520047200210050ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include /* * In this example we will (1) open the "Grid.h5" HDF-EOS file, (2) attach to * the "UTMGrid" grid, and (3) define the external data field "ExtData". */ int main() { herr_t status = FAIL; hid_t gdfid = FAIL; hid_t GDid = FAIL; off_t offset[3]; hsize_t size[3]; /* Open the file, "Grid.h5", using the H5F_ACC_RDWR access code */ /* ------------------------------------------------------------- */ gdfid = HE5_GDopen("Grid.h5", H5F_ACC_RDWR); if (gdfid != FAIL) { /* Attach to the "UTMgrid" grid */ /* ---------------------------- */ GDid = HE5_GDattach(gdfid, "UTMGrid"); if (GDid != FAIL) { /* Set the data sizes and offsets in external files */ /* ------------------------------------------------ */ size[0] = 10 * sizeof(int); offset[0] = 0; size[1] = 20 * sizeof(int); offset[1] = 40; size[2] = 30 * sizeof(int); offset[2] = 80; /* Set external data files first */ /* ----------------------------- */ status = HE5_GDsetextdata(GDid, "external_1g.data,external_2g.data,external_3g.data", offset, size); printf("Status returned by HE5_GDsetextdata(...) : %d\n",status); /* Define field containing external data */ /* ------------------------------------- */ status = HE5_GDdeffield(GDid, "ExtData", "ExtDim", NULL, H5T_NATIVE_INT, 0); printf("Status returned by HE5_GDdeffield(...\"ExtData\",..) : %d\n",status); } } /* Detach from the swath */ /* --------------------- */ status = HE5_GDdetach(GDid); printf("Status returned by HE5_GDdetach(...) : %d\n",status); /* Close the file */ /* -------------- */ status = HE5_GDclose(gdfid); printf("Status returned by HE5_GDclose(...) : %d\n",status); return 0; } hdf-eos5-2.0/samples/he5_gd_definefields.c000077500000000000000000000105601507520047200204400ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include #include /* * In this example we will (1) open the "Grid.h5" HDF-EOS file, (2) attach to * the "Grid1" grid, and (3) define the grid fields. */ int main() { herr_t status = FAIL; hid_t gdfid = FAIL; hid_t GDid1 = FAIL; hid_t GDid2 = FAIL; hid_t GDid3 = FAIL; float fillval1 = -7.; float fillval2 = -9999.; int tilerank, compcode = 16; int compparm[5] = {0, 0, 0, 0, 0}; hsize_t tiledims[8]; /* * We first open the HDF-EOS grid file, "Grid.h5". Because this file * already exist and we wish to write to it, we use the H5F_ACC_RDWR access * code in the open statement. The HE5_GDopen routine returns the grid file * id, gdfid, which is used to identify the file in subsequent routines. */ gdfid = HE5_GDopen("Grid.h5", H5F_ACC_RDWR); /* * If the grid file cannot be found, HE5_GDopen will return -1 for the file * handle (gdfid). We there check that this is not the case before * proceeding with the other routines. * * The HE5_GDattach routine returns the handle to the existing grid "Grid1", * GDid. If the grid is not found, HE5_GDattach returns -1 for the handle. */ if (gdfid != FAIL) { GDid1 = HE5_GDattach(gdfid, "UTMGrid"); status = HE5_GDsetfillvalue(GDid1, "Pollution", H5T_NATIVE_FLOAT, &fillval1); printf("Status returned by HE5_GDsetfillvalue(...,\"Pollusion\",...) : %d \n", status); status = HE5_GDdeffield(GDid1, "Pollution", "Time,YDim,XDim", NULL, H5T_NATIVE_FLOAT, 0); printf("Status returned by HE5_GDdeffield(..., \"Pollution\",...) : %d \n", status); /* Define appendable field "Vegetation" */ tilerank = 2; tiledims[0] = 100; tiledims[1] = 60; compparm[0] = 8; status = HE5_GDdeftile(GDid1,HE5_HDFE_TILE,tilerank,tiledims); printf("Status returned by HE5_GDdeftile(): %d\n", status); #ifdef HAVE_FILTER_SZIP_ENCODER status = HE5_GDdefcomp(GDid1,compcode, compparm); printf("Status returned by HE5_GDdefcomp(): %d\n", status); #else printf("SZIP encoder is not available. The data compression test is skipped.\n"); #endif status = HE5_GDdeffield(GDid1, "Vegetation", "YDim,XDim",NULL,H5T_NATIVE_FLOAT, 0); printf("Status returned by HE5_GDdeffield(\"Vegetation\"): %d\n", status); GDid2 = HE5_GDattach(gdfid, "PolarGrid"); status = HE5_GDdeffield(GDid2, "Temperature", "YDim,XDim", NULL, H5T_NATIVE_FLOAT, 0); printf("Status returned by HE5_GDdeffield(..., \"Temperature\",...) : %d \n", status); status = HE5_GDsetfillvalue(GDid2, "Pressure", H5T_NATIVE_FLOAT, &fillval2); printf("Status returned by HE5_GDsetfillvalue(...,\"Pressure\",...) : %d \n", status); status = HE5_GDdeffield(GDid2, "Pressure", "YDim,XDim", NULL, H5T_NATIVE_INT, 0); printf("Status returned by HE5_GDdeffield(..., \"Pressure\",...) : %d \n", status); status = HE5_GDdeffield(GDid2, "Soil Dryness", "YDim,XDim", NULL, H5T_NATIVE_FLOAT, 0); printf("Status returned by HE5_GDdeffield(..., \"Soil Dryness\",...) : %d \n", status); status = HE5_GDdeffield(GDid2, "Spectra", "Bands,YDim,XDim", NULL, H5T_NATIVE_DOUBLE, 0); printf("Status returned by HE5_GDdeffield(..., \"Spectra\",...) : %d \n", status); status = HE5_GDdetach(GDid1); status = HE5_GDdetach(GDid2); GDid3 = HE5_GDattach(gdfid, "GEOGrid"); if (GDid3 == -1) { printf("\t\tError: Cannot attach to grid \"GEOGrid\"\n"); return -1; } status = HE5_GDsetfillvalue(GDid3, "GeoSpectra", H5T_NATIVE_FLOAT, &fillval2); if (status == -1) { printf("\t\tError: Cannot define fill value for field \"Pressure\"\n"); return -1; } status = HE5_GDdeffield(GDid3, "GeoSpectra", "YDim,XDim", NULL, H5T_NATIVE_FLOAT, 0); if (status == -1) { printf("\t\tError: Cannot define field \"GeoSpectra\"\n"); return -1; } HE5_GDdetach(GDid3); } status = HE5_GDclose(gdfid); return 0; } hdf-eos5-2.0/samples/he5_gd_definefieldsF_32.f000077500000000000000000000065371507520047200210660ustar00rootroot00000000000000 program he5_gd_definefldsF_32 implicit none include 'hdfeos5.inc' integer status integer he5_gdopen integer he5_gddeffld integer he5_gdsetfill integer he5_gddeftle integer he5_gddefcomp integer he5_gdattach integer he5_gddetach integer he5_gdclose integer gdfid, gdid1, gdid2 integer tilecode, tilerank integer*4 tiledims(2) integer compparm(1) real*4 fillval1, fillval2 fillval1 = -7.0 fillval2 = -9999.0 c Open HDF-EOS file "grid.he5" c ---------------------------- gdfid = he5_gdopen("grid.he5",HE5F_ACC_RDWR) write(*,*) 'File ID returned by he5_gdopen(): ',gdfid c Attach to the UTM grid c ---------------------- gdid1 = he5_gdattach(gdfid, "UTMGrid") write(*,*) 'Grid ID returned by he5_gdattach(): ',gdid1 c Define Fields c ------------- status = he5_gdsetfill(gdid1,"Pollution", 1 HE5T_NATIVE_FLOAT,fillval1) write(*,*) 'Status returned by he5_gdsetfill(): ',status status = he5_gddeffld(gdid1,"Pollution", 1 "XDim,YDim,Time"," ", HE5T_NATIVE_FLOAT, 0) write(*,*) 'Status returned by he5_gddeffld(): ',status tilerank = 2 tiledims(1) = 60 tiledims(2) = 100 compparm(1) = 6 status = he5_gddeftle(gdid1,HE5_HDFE_TILE,tilerank,tiledims) write(*,*) 'Status returned by he5_gddeftle(): ',status status = he5_gddefcomp(gdid1,HE5_HDFE_COMP_DEFLATE,compparm) write(*,*) 'Status returned by he5_gddefcomp(): ',status status = he5_gddeffld(gdid1, "Vegetation", "XDim,YDim", 1 " ", HE5T_NATIVE_FLOAT, 0) write(*,*) 'Status returned by he5_gddeffld(): ',status c Attach to the POLAR grid c ------------------------ gdid2 = he5_gdattach(gdfid, "PolarGrid") write(*,*) 'Grid ID returned by he5_gdattach(): ',gdid2 c Define Fields c ------------- status = he5_gddeffld(gdid2, "Temperature", "XDim,YDim", 1 " ", HE5T_NATIVE_FLOAT, 0) write(*,*) 'Status returned by he5_gddeffld(): ',status c Set fill value for "Pressure" field c ----------------------------------- status = he5_gdsetfill(gdid2,"Pressure", 1 HE5T_NATIVE_FLOAT,fillval2) write(*,*) 'Status returned by he5_gdsetfill(): ',status status = he5_gddeffld(gdid2, "Pressure", "XDim,YDim", 1 " ", HE5T_NATIVE_FLOAT, 0) write(*,*) 'Status returned by he5_gddeffld(): ',status c Define Fields c ------------- status = he5_gddeffld(gdid2, "Soil Dryness", "XDim,YDim", 1 " ", HE5T_NATIVE_FLOAT, 0) write(*,*) 'Status returned by he5_gddeffld(): ',status status = he5_gddeffld(gdid2, "Spectra", "XDim,YDim,Bands", 1 " ", HE5T_NATIVE_DOUBLE, 0) write(*,*) 'Status returned by he5_gddeffld(): ',status c Detach from the grids c --------------------- status = he5_gddetach(gdid1) write(*,*) 'Status returned by he5_gddetach(): ',status status = he5_gddetach(gdid2) write(*,*) 'Status returned by he5_gddetach(): ',status c Close the file c -------------- status = he5_gdclose(gdfid) write(*,*) 'Status returned by he5_gdclose(): ',status stop end hdf-eos5-2.0/samples/he5_gd_definefieldsF_64.f000077500000000000000000000063321507520047200210640ustar00rootroot00000000000000 program he5_gd_definefieldsF_64 implicit none include 'hdfeos5.inc' integer status, he5_gddeffld, he5_gdsetfill integer he5_gdattach, he5_gddetach, he5_gdclose integer he5_gddeftle, he5_gddefcomp integer gdfid, gdid1, gdid2, he5_gdopen integer tilecode, tilerank integer*8 tiledims(2) integer compparm(1) real*4 fillval1, fillval2 fillval1 = -7.0 fillval2 = -9999.0 c Open HDF-EOS file "grid.he5" c ---------------------------- gdfid = he5_gdopen("grid.he5",HE5F_ACC_RDWR) write(*,*) 'File ID returned by he5_gdopen(): ',gdfid c Attach to the UTM grid c ---------------------- gdid1 = he5_gdattach(gdfid, "UTMGrid") write(*,*) 'Grid ID returned by he5_gdattach(): ',gdid1 c Define Fields c ------------- status = he5_gdsetfill(gdid1,"Pollution", 1HE5T_NATIVE_FLOAT,fillval1) write(*,*) 'Status returned by he5_gdsetfill(): ',status status = he5_gddeffld(gdid1, "Pollution", 1"XDim,YDim,Time"," ", HE5T_NATIVE_FLOAT, 0) write(*,*) 'Status returned by he5_gddeffld(): ',status tilerank = 2 tiledims(1) = 60 tiledims(2) = 100 compparm(1) = 6 status = he5_gddeftle(gdid1,HE5_HDFE_TILE,tilerank,tiledims) write(*,*) 'Status returned by he5_gddeftle(): ',status status = he5_gddefcomp(gdid1,HE5_HDFE_COMP_DEFLATE,compparm) write(*,*) 'Status returned by he5_gddefcomp(): ',status status = he5_gddeffld(gdid1, "Vegetation", 1"XDim,YDim"," ", HE5T_NATIVE_FLOAT, 0) write(*,*) 'Status returned by he5_gddeffld(): ',status c Attach to the POLAR grid c ------------------------ gdid2 = he5_gdattach(gdfid, "PolarGrid") write(*,*) 'Grid ID returned by he5_gdattach(): ',gdid2 c Define Fields c ------------- status = he5_gddeffld(gdid2, "Temperature", 1"XDim,YDim"," ", HE5T_NATIVE_FLOAT, 0) write(*,*) 'Status returned by he5_gddeffld(): ',status c Set fill value for "Pressure" field c ----------------------------------- status = he5_gdsetfill(gdid2,"Pressure", 1HE5T_NATIVE_FLOAT,fillval2) write(*,*) 'Status returned by he5_gdsetfill(): ',status status = he5_gddeffld(gdid2, "Pressure", 1"XDim,YDim"," ", HE5T_NATIVE_FLOAT, 0) write(*,*) 'Status returned by he5_gddeffld(): ',status c Define Fields c ------------- status = he5_gddeffld(gdid2, "Soil Dryness", 1"XDim,YDim"," ", HE5T_NATIVE_FLOAT, 0) write(*,*) 'Status returned by he5_gddeffld(): ',status status = he5_gddeffld(gdid2, "Spectra", 1"XDim,YDim,Bands"," ", HE5T_NATIVE_DOUBLE, 0) write(*,*) 'Status returned by he5_gddeffld(): ',status c Detach from the grids c --------------------- status = he5_gddetach(gdid1) write(*,*) 'Status returned by he5_gddetach(): ',status status = he5_gddetach(gdid2) write(*,*) 'Status returned by he5_gddetach(): ',status c Close the file c -------------- status = he5_gdclose(gdfid) write(*,*) 'Status returned by he5_gdclose(): ',status stop end hdf-eos5-2.0/samples/he5_gd_defunlimfld.c000077500000000000000000000057301507520047200203130ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include /* * In this example we will (1) open the "Grid.h5" HDF-EOS file, (2) attach to * the "Grid1" grid, and (3) define the grid appendable field. */ int main() { herr_t status = FAIL; int tilerank, compcode = 4; int compparm[5] = {0, 0, 0, 0, 0}; hid_t gdfid = FAIL; hid_t GDid1 = FAIL; hid_t GDid2 = FAIL; hsize_t tiledims[8]; float fillval1 = -7., fillval2 = -9999.; /* * We first open the HDF-EOS grid file, "Grid.h5". Because this file * already exist and we wish to write to it, we use the H5F_ACC_RDWR access * code in the open statement. The HE5_GDopen routine returns the grid file * id, gdfid, which is used to identify the file in subsequent routines. */ gdfid = HE5_GDopen("Grid.h5", H5F_ACC_RDWR); /* * If the grid file cannot be found, HE5_GDopen will return -1 for the file * handle (gdfid). We there check that this is not the case before * proceeding with the other routines. * * The HE5_GDattach routine returns the handle to the existing grid "Grid1", * GDid. If the grid is not found, HE5_GDattach returns -1 for the handle. */ if (gdfid != FAIL) { GDid1 = HE5_GDattach(gdfid, "UTMGrid"); printf("Grid ID returned by HE5_GDattach(,\"UTMGrid\"): %ld\n", (long) GDid1); /* Define appendable field "Vegetation" */ tilerank = 2; tiledims[0] = 100; tiledims[1] = 60; compparm[0] = 6; status = HE5_GDdeftile(GDid1,HE5_HDFE_TILE,tilerank,tiledims); printf("Status returned by HE5_GDdeftile(): %d\n", status); status = HE5_GDdefcomp(GDid1,compcode, compparm); printf("Status returned by HE5_GDdefcomp(): %d\n", status); status = HE5_GDdeffield(GDid1, "Vegetation", "YDim,XDim","Unlim,Unlim",H5T_NATIVE_FLOAT, 0); printf("Status returned by HE5_GDdeffield(\"Vegetation\"): %d\n", status); GDid2 = HE5_GDattach(gdfid, "PolarGrid"); printf("Grid ID returned by HE5_GDattach(\"PolarGrid\"): %ld\n", (long) GDid2); status = HE5_GDdeffield(GDid2, "Temperature", "YDim,XDim", NULL, H5T_NATIVE_FLOAT, 0); printf("Status returned by HE5_GDdeffield(\"Temperature\"): %d\n", status); status = HE5_GDdeffield(GDid2, "Pressure", "YDim,XDim", NULL, H5T_NATIVE_FLOAT, 0); printf("Status returned by HE5_GDdeffield(\"Pressure\"): %d\n", status); status = HE5_GDsetfillvalue(GDid2, "Pressure", H5T_NATIVE_FLOAT, &fillval2); printf("Status returned by HE5_GDsetfillvalue(\"Pressure\'): %d\n", status); status = HE5_GDdetach(GDid1); status = HE5_GDdetach(GDid2); } status = HE5_GDclose(gdfid); return 0; } hdf-eos5-2.0/samples/he5_gd_info.c000077500000000000000000000162551507520047200167610ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include /* * In this example we will retrieve information about (1) dimensions, * (2) dimension mappings (geolocation relations), (3) grid fields, * and (4) (global/group/local) grid attributes. */ int main() { herr_t status = FAIL; int i, rank[32], tilerank; int projcode, zonecode, spherecode, tilecode; int ndim = FAIL, nflds = FAIL; hid_t gdfid = FAIL; hid_t GDid1 = FAIL; hid_t GDid2 = FAIL; hid_t *ntype; hid_t *ntype1; hsize_t Dims[32], dimsize, count = 0, tiledims[8]; long xdimsize, ydimsize, n, strbufsize; double upleftpt[2], lowrightpt[2], projparm[16]; char version[80]; char dimname[1024], fieldlist[1024]; char attrlist[80]; int level[ 5 ] = { 0, 0, 0, 0, 0 }; int code = 0; /* * Open the Grid File for read only access */ gdfid = HE5_GDopen("Grid.h5", H5F_ACC_RDONLY); if (gdfid != FAIL) { HE5_EHgetversion(gdfid,version); printf("Version: \"%s\" \n", version); /* Attach the grid */ GDid1 = HE5_GDattach(gdfid, "UTMGrid"); GDid2 = HE5_GDattach(gdfid, "PolarGrid"); ndim = HE5_GDinqdims(GDid1, dimname, Dims); printf("Dimension list (UTMGrid): %s\n", dimname); for (i = 0; i < ndim; i++) printf("dim size: %li \n", (long)Dims[i]); ndim = HE5_GDinqdims(GDid2, dimname, Dims); printf("Dimension list (PolarGrid): %s\n", dimname); for (i = 0; i < ndim; i++) printf("dim size: %li \n", (long)Dims[i]); dimsize = HE5_GDdiminfo(GDid1, "Time"); printf("Size of \"Time\" Array: %lu\n", (unsigned long)dimsize); dimsize = HE5_GDdiminfo(GDid2, "Bands"); printf("Size of \"Bands\" Array: %lu\n", (unsigned long)dimsize); status = HE5_GDgridinfo(GDid1, &xdimsize, &ydimsize,upleftpt, lowrightpt); printf("X dim size, Y dim size (UTMGrid): %li %li\n", xdimsize, ydimsize); printf("Up left pt (UTMGrid): %lf %lf\n", upleftpt[0], upleftpt[1]); printf("Low right pt (UTMGrid): %lf %lf\n", lowrightpt[0], lowrightpt[1]); status = HE5_GDgridinfo(GDid2, &xdimsize, &ydimsize, upleftpt, lowrightpt); printf("X dim size, Y dim size (PolarGrid): %li %li\n", xdimsize, ydimsize); printf("Up left pt (PolarGrid): %lf %lf\n", upleftpt[0], upleftpt[1]); printf("Low right pt (PolarGrid): %lf %lf\n", lowrightpt[0], lowrightpt[1]); status = HE5_GDprojinfo(GDid1, &projcode, &zonecode, &spherecode, NULL); printf("projcode , zonecode (UTMGrid): %d %d\n", projcode, zonecode); printf("spherecode (UTMGrid): %d\n", spherecode); status = HE5_GDprojinfo(GDid2, &projcode, NULL, &spherecode, projparm); printf("projcode (PolarGrid): %d\n", projcode); printf("spherecode (PolarGrid): %d\n", spherecode); for (i = 0; i < 13; i++) printf("Projection Parameter: %d %lf\n",i,projparm[i]); ntype1 = (hid_t *)calloc(10, sizeof(hid_t)); nflds = HE5_GDinqfields(GDid1, fieldlist, rank, ntype1); if (nflds != FAIL) { printf("Data fields (UTMGrid): %s\n", fieldlist); for (i = 0; i < nflds;i++) printf("Rank: %i Data type: %i\n",rank[i], (int)ntype1[i]); } nflds = HE5_GDinqfields(GDid2, fieldlist, rank, ntype1); if (nflds != FAIL) { printf("Data fields (PolarGrid): %s\n", fieldlist); for (i = 0; i < nflds;i++) printf("Rank: %i Data type: %i\n",rank[i],(int)ntype1[i]); } status = HE5_GDfieldinfo(GDid2, "Spectra", rank, Dims, ntype1, dimname, NULL); printf("Spectra rank: %d\n",rank[0]); printf("Spectra dimensions: \n"); for (i = 0; i < rank[0]; i++) printf(" %lu\n",(unsigned long)Dims[i]); printf("Spectra dimension list: \n"); printf(" %s\n", dimname); ntype = (hid_t *)calloc(10, sizeof(hid_t)); printf(" \n"); printf("Global Attributes \n"); status = HE5_GDattrinfo(GDid1, "GlobalAttribute", ntype, &count); printf("\tNumber of attribute elements: %lu \n", (unsigned long)count); printf("\tData type of attribute: %d \n", (int)*ntype); printf(" \n"); printf("Group Attributes \n"); status = HE5_GDgrpattrinfo(GDid1, "GroupAttribute", ntype, &count); printf("\tNumber of attribute elements: %lu \n", (unsigned long)count); printf("\tData type of attribute: %d \n", (int)*ntype); printf(" \n"); printf("Local Attributes \n"); status = HE5_GDlocattrinfo(GDid1, "Vegetation", "LocalAttribute", ntype, &count); printf("\tNumber of attribute elements: %lu \n", (unsigned long)count); printf("\tData type of attribute: %d \n", (int)*ntype); printf(" \n"); printf("Global Attributes \n"); n = HE5_GDinqattrs(GDid1, NULL, &strbufsize); printf("\tNumber of attributes: %li \n", n); printf("\tSize of attribute list: %li \n", strbufsize); n = HE5_GDinqattrs(GDid1, attrlist, &strbufsize); printf("\tAttribute list: %s \n", attrlist); printf(" \n"); printf("Group Attributes \n"); n = HE5_GDinqgrpattrs(GDid1, NULL, &strbufsize); printf("\tNumber of attributes: %li \n", n); printf("\tSize of attribute list: %li \n", strbufsize); n = HE5_GDinqgrpattrs(GDid1, attrlist, &strbufsize); printf("\tAttribute list: %s \n", attrlist); printf(" \n"); printf("Local Attributes \n"); n = HE5_GDinqlocattrs(GDid1, "Vegetation", NULL, &strbufsize); printf("\tNumber of attributes: %li \n", n); printf("\tSize of attribute list: %li \n", strbufsize); n = HE5_GDinqlocattrs(GDid1, "Vegetation", attrlist, &strbufsize); printf("\tAttribute list: %s \n", attrlist); free(ntype); free(ntype1); n = HE5_GDnentries(GDid1, HE5_HDFE_NENTDIM, &strbufsize); printf("Number of dimension entries (UTMGrid): %li \n", n); printf("Length of Dimension List (UTMGrid): %li \n", strbufsize); n = HE5_GDnentries(GDid1, HE5_HDFE_NENTDFLD, &strbufsize); printf("Number of data fields (UTMGrid): %li \n", n); printf("Length of Field List (UTMGrid): %li \n", strbufsize); status = HE5_GDtileinfo(GDid1,"Vegetation",&tilecode,&tilerank,tiledims); printf("\n"); printf("\t\t Vegetation tile code: %d\n", tilecode); printf("\t\t Vegetation tile rank: %d\n", tilerank); for (i = 0; i < tilerank; i++) printf("\t\t Vegetation tile dimension %d: %lu\n",i+1, (unsigned long)tiledims[i]); status = HE5_GDcompinfo(GDid1,"Vegetation",&code,level); printf("\t\t Compression scheme Compression level\n"); printf("\t\t %d, %d\n", code, level[0]); } status = HE5_GDdetach(GDid1); status = HE5_GDdetach(GDid2); status = HE5_GDclose(gdfid); return 0; } hdf-eos5-2.0/samples/he5_gd_infoF_32.f000077500000000000000000000143461507520047200173750ustar00rootroot00000000000000 program he5_gd_infoF_32 implicit none include 'hdfeos5.inc' integer status integer i integer he5_gdopen integer he5_gdattach integer he5_gdfldinfo integer he5_gdprojinfo integer he5_gdgridinfo integer he5_gdinqflds integer he5_gdtileinfo integer he5_gddetach integer he5_gdclose integer gdfid integer gdid1 integer gdid2 integer nflds integer rk(32) integer nt(32) integer spherecode integer projcode integer zonecode integer*4 he5_gddiminfo integer*4 he5_gdinqdims integer*4 he5_gdnentries integer*4 he5_gdinqgrid integer*4 ndim integer*4 dims(32) integer*4 xdimsize integer*4 ydimsize integer*4 dimsize integer*4 n, strbufsize real*8 upleftpt(2) real*8 lowrightpt(2) real*8 projparm(13) character*256 dimname character*256 mxdimname character*256 fieldlist character*256 gridlist integer tilecode integer tilerank integer*4 tiledims(32) integer FAIL parameter (FAIL=-1) c Open HDF-EOS "grid.he5" file c ---------------------------- gdfid = he5_gdopen('grid.he5',HE5F_ACC_RDWR) write(*,*) 'File ID returned by he5_gdopen(): ',gdfid if (gdfid .ne. FAIL) then c Attach to the UTM and POLAR grids c --------------------------------- gdid1 = he5_gdattach(gdfid, 'UTMGrid') write(*,*) 'Grid ID returned by he5_gdattach(): ',gdid1 gdid2 = he5_gdattach(gdfid, 'PolarGrid') write(*,*) 'Grid ID returned by he5_gdattach(): ',gdid2 c Inquire dimensions c ------------------ ndim = he5_gdinqdims(gdid1, dimname, dims) write(*,*) 'Dimension list (UTMGrid): ', dimname do i=1,ndim write(*,*) 'dim size: ', dims(i) enddo ndim = he5_gdinqdims(gdid2, dimname, dims) write(*,*) 'Dimension list (PolarGrid): ', dimname do i=1,ndim write(*,*) 'dim size: ', dims(i) enddo c Get the sizes of certain dimensions c ----------------------------------- dimsize = he5_gddiminfo(gdid1, 'Time') write(*,*) 'Size of "Time" Array: ', dimsize dimsize = he5_gddiminfo(gdid2, 'Bands') write(*,*) 'Size of "Bands" Array: ', dimsize c Get grid parameters c ------------------- status = he5_gdgridinfo(gdid1,xdimsize,ydimsize, 1 upleftpt,lowrightpt) write(*,*)'X dim size, Y dim size (UTMGrid): ', 2 xdimsize,ydimsize write(*,*) 'Up left pt (UTMGrid): ',upleftpt(1), 1 upleftpt(2) write(*,*) 'Low right pt (UTMGrid): ',lowrightpt(1), 2 lowrightpt(2) status = he5_gdgridinfo(gdid2,xdimsize,ydimsize, 1 upleftpt,lowrightpt) write(*,*) 'X dim size, Y dim size (PolarGrid): ', 2 xdimsize,ydimsize write(*,*) 'Up left pt (PolarGrid): ',upleftpt(1), 1 upleftpt(2) write(*,*) 'Low right pt (PolarGrid): ',lowrightpt(1), 2 lowrightpt(2) c Get projection parameters c ------------------------- status = he5_gdprojinfo(gdid1,projcode,zonecode, 1 spherecode,projparm) write(*,*) 'projcode,zonecode (UTMGrid): ',projcode, 2 zonecode write(*,*) 'spherecode (UTMGrid): ', spherecode status = he5_gdprojinfo(gdid2,projcode,zonecode, 1 spherecode,projparm) write(*,*) 'projcode (PolarGrid): ', projcode write(*,*) 'spherecode (PolarGrid): ', spherecode do i=1,13 write(*,*) 'Projection Parameter: ',i,projparm(i) enddo c Get information about fields c ---------------------------- nflds = he5_gdinqflds(gdid1, fieldlist, rk, nt) if (nflds .ne. 0) then write(*,*) 'Data fields (UTMGrid): ', fieldlist do i=1,nflds write(*,*) 'rank type: ',rk(i),nt(i) enddo endif status = he5_gdtileinfo(gdid1,"Vegetation",tilecode,tilerank, 1 tiledims) write(*,*) 'Vegetation Tile Code: ', tilecode write(*,*) 'Vegetation Tile Rank: ', tilerank do i=1,tilerank write(*,*) 'Tile Dimension ',i,tiledims(i) enddo nflds = he5_gdinqflds(gdid2, fieldlist, rk, nt) if (nflds .ne. 0) then write(*,*) 'Data fields (PolarGrid): ', fieldlist do i=1,nflds write(*,*) 'rank type: ',rk(i),nt(i) enddo endif status = he5_gdfldinfo(gdid2,'Spectra',rk,dims,nt, 1 dimname,mxdimname) write(*,*) 'Spectra rank dims: ',rk(1) write(*,*) 'Spectra dim names: ',dimname write(*,*) 'Spectra max. dim names: ',mxdimname do i=1,rk(1) write(*,*) 'Spectra dims: ',i,dims(i) enddo c Get number of grid dimensions and dim. list length c -------------------------------------------------- n = he5_gdnentries(gdid1, HE5_HDFE_NENTDIM, strbufsize) write(*,*) 'Number of dimension entries (UTMGrid): ', n write(*,*) 'Length of Dimension List (UTMGrid): ',strbufsize c Get number of data fields and field list length c ----------------------------------------------- n = he5_gdnentries(gdid1, HE5_HDFE_NENTDFLD, strbufsize) write(*,*) 'Number of data fields (UTMGrid): ', n write(*,*) 'Length of Field List (UTMGrid): ',strbufsize endif c Detach from the grids c --------------------- status = he5_gddetach(gdid1) write(*,*) 'Status returned by he5_gddetach(): ',status status = he5_gddetach(gdid2) write(*,*) 'Status returned by he5_gddetach(): ',status c Close the file c -------------- status = he5_gdclose(gdfid) write(*,*) 'Status returned by he5_gdclose(): ',status stop end hdf-eos5-2.0/samples/he5_gd_infoF_64.f000077500000000000000000000142151507520047200173750ustar00rootroot00000000000000 program he5_gd_infoF_64 implicit none include 'hdfeos5.inc' integer status integer i,n integer he5_gdopen integer he5_gdattach integer he5_gdfldinfo integer he5_gdprojinfo integer he5_gdgridinfo integer he5_gdinqflds integer he5_gdtileinfo integer he5_gddetach integer he5_gdclose integer gdfid integer gdid1 integer gdid2 integer nflds integer rk(32) integer nt(32) integer spherecode integer projcode integer zonecode integer*8 he5_gddiminfo integer*8 he5_gdinqdims integer*8 he5_gdnentries integer*8 ndim integer*8 dims(32) integer*8 xdimsize integer*8 ydimsize integer*8 dimsize integer*8 strbufsize real*8 upleftpt(2) real*8 lowrightpt(2) real*8 projparm(13) character*72 dimname character*72 mxdimname character*72 fieldlist integer tilecode integer tilerank integer*8 tiledims(32) integer FAIL parameter (FAIL=-1) c Open HDF-EOS "grid.he5" file c ----------------------------- gdfid = he5_gdopen('grid.he5',HE5F_ACC_RDWR) write(*,*) 'File ID returned by he5_gdopen(): ',gdfid if (gdfid .ne. FAIL) then c Attach to the UTM and POLAR grids c --------------------------------- gdid1 = he5_gdattach(gdfid, 'UTMGrid') write(*,*) 'Grid ID returned by he5_gdattach(): ',gdid1 gdid2 = he5_gdattach(gdfid, 'PolarGrid') write(*,*) 'Grid ID returned by he5_gdattach(): ',gdid2 c Inquire dimensions c ------------------ ndim = he5_gdinqdims(gdid1, dimname, dims) write(*,*) 'Dimension list (UTMGrid): ',dimname do i=1,ndim write(*,*) 'dim size: ', dims(i) enddo ndim = he5_gdinqdims(gdid2, dimname, dims) write(*,*) 'Dimension list (PolarGrid): ',dimname do i=1,ndim write(*,*) 'dim size: ', dims(i) enddo c Get the sizes of certain dimensions c ----------------------------------- dimsize = he5_gddiminfo(gdid1, 'Time') write(*,*) 'Size of "Time" Array: ', dimsize dimsize = he5_gddiminfo(gdid2, 'Bands') write(*,*) 'Size of "Bands" Array: ', dimsize c Get grid parameters c ------------------- status = he5_gdgridinfo(gdid1,xdimsize,ydimsize, 1upleftpt,lowrightpt) write(*,*)'X dim size, Y dim size (UTMGrid): ', 1xdimsize,ydimsize write(*,*) 'Up left pt (UTMGrid): ', 1upleftpt(1),upleftpt(2) write(*,*) 'Low right pt (UTMGrid): ', 1lowrightpt(1),lowrightpt(2) status = he5_gdgridinfo(gdid2,xdimsize,ydimsize, 1upleftpt,lowrightpt) write(*,*) 'X dim size, Y dim size (PolarGrid): ', 1xdimsize,ydimsize write(*,*) 'Up left pt (PolarGrid): ', 1upleftpt(1),upleftpt(2) write(*,*) 'Low right pt (PolarGrid): ', 1lowrightpt(1),lowrightpt(2) c Get projection parameters c ------------------------- status = he5_gdprojinfo(gdid1,projcode,zonecode, 1 spherecode,projparm) write(*,*) 'projcode,zonecode (UTMGrid): ', 1 projcode,zonecode write(*,*) 'spherecode (UTMGrid): ', spherecode status = he5_gdprojinfo(gdid2,projcode,zonecode, 1 spherecode,projparm) write(*,*) 'projcode (PolarGrid): ', projcode write(*,*) 'spherecode (PolarGrid): ', spherecode do i=1,13 write(*,*) 'Projection Parameter: ',i,projparm(i) enddo c Get information about fields c ---------------------------- nflds = he5_gdinqflds(gdid1, fieldlist, rk, nt) if (nflds .ne. 0) then write(*,*) 'Data fields (UTMGrid): ', fieldlist do i=1,nflds write(*,*) 'rank type: ',rk(i),nt(i) enddo endif status = he5_gdtileinfo(gdid1,"Vegetation",tilecode,tilerank, 1 tiledims) write(*,*) 'Vegetation Tile Code: ', tilecode write(*,*) 'Vegetation Tile Rank: ', tilerank do i=1,tilerank write(*,*) 'Tile Dimension ',i,tiledims(i) enddo nflds = he5_gdinqflds(gdid2, fieldlist, rk, nt) if (nflds .ne. 0) then write(*,*) 'Data fields (PolarGrid): ',fieldlist do i=1,nflds write(*,*) 'rank type: ',rk(i),nt(i) enddo endif status = he5_gdfldinfo(gdid2,'Spectra',rk,dims,nt, 1 dimname,mxdimname) write(*,*) 'Spectra rank dims: ',rk(1) write(*,*) 'Spectra dim names: ',dimname write(*,*) 'Spectra max. dim names: ',mxdimname do i=1,rk(1) write(*,*) 'Spectra dims: ',i,dims(i) enddo c Get number of grid dimensions and dim. list length c -------------------------------------------------- n = he5_gdnentries(gdid1, HE5_HDFE_NENTDIM, strbufsize) write(*,*) 'Number of dimension entries (UTMGrid): ', n write(*,*) 'Length of Dimension List (UTMGrid): ', 1 strbufsize c Get number of data fields and field list length c ----------------------------------------------- n = he5_gdnentries(gdid1, HE5_HDFE_NENTDFLD, 1 strbufsize) write(*,*) 'Number of data fields (UTMGrid): ', n write(*,*) 'Length of Field List (UTMGrid): ', 1 strbufsize endif c Detach from the grids c --------------------- status = he5_gddetach(gdid1) write(*,*) 'Status returned by he5_gddetach(): ',status status = he5_gddetach(gdid2) write(*,*) 'Status returned by he5_gddetach(): ',status c Close the file c -------------- status = he5_gdclose(gdfid) write(*,*) 'Status returned by he5_gdclose(): ',status stop end hdf-eos5-2.0/samples/he5_gd_rdexternaldata.c000077500000000000000000000066101507520047200210220ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include #define DIMIN 100 #define DIMOUT 60 /* * In this example we will (1) open the "Grid.h5" HDF-EOS file, (2) attach to * the "UTMGrid", (3) read external data */ int main() { FILE *in_1, *in_2, *in_3; herr_t status = FAIL; int i; int data_in_1[DIMIN]; int data_in_2[DIMIN]; int data_in_3[DIMIN]; int data_out[DIMOUT]; int nfiles = FAIL; hid_t gdfid = FAIL; hid_t GDid = FAIL; size_t namelength = 48; off_t offset[3]; char filelist[256]; hssize_t start[2]; hsize_t count[2]; hsize_t size[3]; /* Create the external data sets */ /* ----------------------------- */ for (i = 0; i < DIMIN; i++) { data_in_1[i] = 1000 + i + 1; data_in_2[i] = 2000 + i + 1; data_in_3[i] = 3000 + i + 1; } /* Open the external data files */ /* ---------------------------- */ in_1 = fopen("external_1g.data", "w"); in_2 = fopen("external_2g.data", "w"); in_3 = fopen("external_3g.data", "w"); /* Write data buffers to the external data files */ /* --------------------------------------------- */ fwrite(data_in_1, sizeof(int), DIMIN, in_1); fwrite(data_in_2, sizeof(int), DIMIN, in_2); fwrite(data_in_3, sizeof(int), DIMIN, in_3); /* Close the external data files */ /* ----------------------------- */ fclose(in_1); fclose(in_2); fclose(in_3); /* * Open the HDF grid file, "Grid.h5". */ gdfid = HE5_GDopen("Grid.h5", H5F_ACC_RDWR); if (gdfid != FAIL) { /* * Attach the "UTMGrid". */ GDid = HE5_GDattach(gdfid, "UTMGrid"); if (GDid != FAIL) { /* Read the external data field */ /* ---------------------------- */ start[0] = 0; count[0] = DIMOUT; status = HE5_GDreadfield(GDid, "ExtData", start, NULL, count, data_out); printf("Status returned by HE5_GDreadfield() : %d \n", status); /* Display external data set */ /* ------------------------- */ printf(" \n"); for (i = 0; i < DIMOUT; i++) printf("%d ", data_out[i]); /* Get the number of external files */ /* -------------------------------- */ nfiles = HE5_GDgetextdata(GDid, "ExtData", namelength, filelist, offset, size); printf(" \n"); printf(" \n"); printf("Number of external files returned by HE5_GDgetextdata() : %d \n", nfiles); if (nfiles > 0) { printf(" \n"); printf("External files: \"%s\" \n", filelist); printf(" \n"); printf("offsets: "); for (i = 0; i < nfiles; i++) printf("%d ", (int)offset[i]); printf(" \n"); printf("sizes: "); for (i = 0; i < nfiles; i++) printf("%lu ", (unsigned long)size[i]); printf(" \n"); printf(" \n"); } } } /* Detach from the Grid */ /* -------------------- */ status = HE5_GDdetach(GDid); printf("Status returned by HE5_GDdetach() : %d \n", status); /* Close the file */ /* -------------- */ status = HE5_GDclose(gdfid); printf("Status returned by HE5_GDclose() : %d \n", status); return 0; } hdf-eos5-2.0/samples/he5_gd_readdata.c000077500000000000000000000042761507520047200175730ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include /* * In this example we will (1) open the "Grid.h5" HDF-EOS file, (2) attach to * the "UTMGrid", (3) read data from the "Vegetation" field. and (4) read * global, group, and local attributes. */ int main() { herr_t status = FAIL; int i, j; int grpattr[3] = {-9,-9,-9}; /* group attribute */ hid_t gdfid = FAIL; hid_t GDid = FAIL; float flt = -999.; /* global attribute */ float attr[4] = {-9.9,-9.9,-9.9,-9.9}; /* local attribute */ float veg[200][120]; hssize_t start[2] ={0, 0}; hsize_t edge[2] = {200, 100}; /* * Open the HDF grid file, "Grid.h5". */ gdfid = HE5_GDopen("Grid.h5", H5F_ACC_RDWR); if (gdfid != FAIL) { /* * Attach the "UTMGrid". */ GDid = HE5_GDattach(gdfid, "UTMGrid"); if (GDid != FAIL) { status = HE5_GDreadfield(GDid, "Vegetation", start, NULL, edge, veg); printf("Status returned by HE5_GDreadfield() : %d \n", status ); for (i = 0; i < 5; i++) for (j = 0; j < 10; j++) printf("\t\t %f \n", veg[i][j]); status = HE5_GDreadattr(GDid, "GlobalAttribute", &flt); printf("Status returned by HE5_GDreadattr() : %d \n", status ); printf("\tGlobal attribute reads: \n"); printf("\t\t %f \n", flt); status = HE5_GDreadgrpattr(GDid, "GroupAttribute", grpattr); printf("Status returned by HE5_GDreadgrpattr() : %d \n", status ); printf("\tGroup attribute reads: \n"); for (i = 0; i < 3; i++) printf("\t\t %d \n", grpattr[i]); status = HE5_GDreadlocattr(GDid, "Vegetation","LocalAttribute", attr); printf("Status returned by HE5_GDreadlocattr() : %d \n", status ); printf("\tLocal attribute reads: \n"); for (i = 0; i < 4; i++) printf("\t\t %f \n", attr[i]); } } status = HE5_GDdetach(GDid); status = HE5_GDclose(gdfid); return 0; } hdf-eos5-2.0/samples/he5_gd_readdataF_32.f000077500000000000000000000036001507520047200201760ustar00rootroot00000000000000 program he5_gd_readdataF_32 implicit none include 'hdfeos5.inc' integer status integer gdfid integer gdid integer he5_gdopen integer he5_gdattach integer he5_gdrdfld integer he5_gdrdattr integer he5_gddetach integer he5_gdclose integer*4 start(2) integer*4 stride(2) integer*4 count(2) real*4 f real*4 veg(120,200) integer FAIL parameter (FAIL=-1) c Open HDF-EOS "grid.he5" file c ----------------------------- gdfid = he5_gdopen("grid.he5",HE5F_ACC_RDWR) write(*,*) 'File ID returned by he5_gdopen(): ',gdid if (gdfid .ne. FAIL) then c Attach to the UTM grid c ---------------------- gdid = he5_gdattach(gdfid, "UTMGrid") write(*,*) 'Grid ID returned by he5_gdattach(): ',gdid if (gdid .ne. FAIL) then start(1) = 0 start(2) = 0 stride(1) = 1 stride(2) = 1 count(1) = 120 count(2) = 200 c Read the data from "Vegetation" field c ------------------------------------- status = he5_gdrdfld(gdid,"Vegetation", 1 start,stride,count,veg) write(*,*) 'Status returned by he5_gdrdfld(): ',status c Read global attribute "float" c ----------------------------- status = he5_gdrdattr(gdid, "float", f) write(*,*) 'Status returned by he5_gdrdattr(): ',status write(*,*) 'global attribute value: ', f endif endif c Detach from the grid c -------------------- status = he5_gddetach(gdid) write(*,*) 'Status returned by he5_gddetach(): ',status c Close the file c -------------- status = he5_gdclose(gdfid) write(*,*) 'Status returned by he5_gdclose(): ',status stop end hdf-eos5-2.0/samples/he5_gd_readdataF_64.f000077500000000000000000000035761507520047200202170ustar00rootroot00000000000000 program he5_gd_readdataF_64 implicit none include 'hdfeos5.inc' integer status integer gdfid integer gdid integer he5_gdopen integer he5_gdattach integer he5_gdrdfld integer he5_gdrdattr integer he5_gddetach integer he5_gdclose integer*8 start(2) integer*8 stride(2) integer*8 count(2) real*4 f real*4 veg(120,200) integer FAIL parameter (FAIL=-1) c Open HDF-EOS "grid.he5" file c ----------------------------- gdfid = he5_gdopen("grid.he5",HE5F_ACC_RDWR) write(*,*) 'File ID returned by he5_gdopen(): ',gdid if (gdfid .ne. FAIL) then c Attach to the UTM grid c ---------------------- gdid = he5_gdattach(gdfid, "UTMGrid") write(*,*) 'Grid ID returned by he5_gdattach(): ',gdid if (gdid .ne. FAIL) then start(1) = 0 start(2) = 0 stride(1) = 1 stride(2) = 1 count(1) = 120 count(2) = 200 c Read the data from "Vegetation" field c ------------------------------------- status = he5_gdrdfld(gdid,"Vegetation", 1 start,stride,count,veg) write(*,*) 'Status returned by he5_gdrdfld(): ',status c Read global attribute "float" c ----------------------------- status = he5_gdrdattr(gdid, "float", f) write(*,*) 'Status returned by he5_gdrdattr(): ',status write(*,*) 'global attribute value: ', f endif endif c Detach from the grid c -------------------- status = he5_gddetach(gdid) write(*,*) 'Status returned by he5_gddetach(): ',status c Close the file c -------------- status = he5_gdclose(gdfid) write(*,*) 'Status returned by he5_gdclose(): ',status stop end hdf-eos5-2.0/samples/he5_gd_setup.c000077500000000000000000000114711507520047200171610ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include /* * In this example we will open an HDF-EOS file and create UTM and Polar * Stereographic grid structures within the file. */ int main() { herr_t status = FAIL; hid_t gdfid = FAIL; hid_t GDid = FAIL; hid_t GDid2 = FAIL; hid_t GDid3 = FAIL; int i, j; int zonecode, projcode, spherecode, dummy = 0; long xdim, ydim; double projparm[16], uplft[2], lowrgt[2]; /* * We first open the HDF grid file, "Grid.h5". Because this file * does not already exist, we use the H5F_ACC_TRUNC access code in the * open statement. The GDopen routine returns the grid file id, gdfid, * which is used to identify the file in subsequent routines in the * library. */ gdfid = HE5_GDopen("Grid.h5", H5F_ACC_TRUNC); /* * Create UTM Grid * * Region is bounded by 54 E and 60 E longitude and 20 N and 30 N latitude. * UTM Zone 40 * * Use default spheriod (Clarke 1866 - spherecode = 0) * * Grid into 120 bins along x-axis and 200 bins along y-axis * (approx 3' by 3' bins) */ zonecode = 40; spherecode = 0; /* Upper Left and Lower Right points in meters */ /* ------------------------------------------- */ uplft[0] = 210584.50041; uplft[1] = 3322395.95445; lowrgt[0] = 813931.10959; lowrgt[1] = 2214162.53278; xdim = 120; ydim = 200; GDid = HE5_GDcreate(gdfid, "UTMGrid", xdim, ydim, uplft, lowrgt); printf("Grid ID returned by HE5_GDcreate : %ld \n", (long) GDid); status = HE5_GDdefproj(GDid, HE5_GCTP_UTM, zonecode, spherecode, projparm); printf("status returned by HE5_GDdefproj(...\"HE5_GCTP_UTM\"...) : %d \n", status); /* Define "Time" Dimension */ status = HE5_GDdefdim(GDid, "Time", 10); printf("status returned by HE5_GDdefdim(...\"Time\"...) : %d \n", status); /* Define "External" Dimension */ /* --------------------------- */ status = HE5_GDdefdim(GDid, "ExtDim", 60); printf("status returned by HE5_GDdefdim(...\"ExtDim\"...): %d \n", status); /* Define "Unlim" Dimension */ status = HE5_GDdefdim(GDid, "Unlim", H5S_UNLIMITED); printf("status returned by HE5_GDdefdim(...\"Unlim\"...) : %d \n", status); /* * Create polar stereographic grid * * Northern Hemisphere (True Scale at 90 N, 0 Longitude below pole) * * Use International 1967 spheriod (spherecode = 3) * * Grid into 100 bins along x-axis and y-axis */ spherecode = 3; /* Define GCTP Projection Parameters */ /* --------------------------------- */ for (i = 0; i < 16; i++) projparm[i] = 0; /* Set Longitude below pole & true scale in DDDMMMSSS.SSS format) */ projparm[4] = 0.0; projparm[5] = 90000000.00; xdim = 100; ydim = 100; GDid2 = HE5_GDcreate(gdfid, "PolarGrid", xdim, ydim, NULL, NULL); printf("Grid ID returned by HE5_GDcreate() : %ld \n", (long) GDid2); status = HE5_GDdefproj(GDid2, HE5_GCTP_PS, dummy, spherecode, projparm); printf("status returned by HE5_GDdefproj(...\"HE5_GCTP_PS\"...) : %d \n", status); status = HE5_GDdeforigin(GDid2, HE5_HDFE_GD_LR); printf("status returned by HE5_GDdeforigin() : %d \n", status); /* Define "Bands" Dimension */ status = HE5_GDdefdim(GDid2, "Bands", 3); printf("status returned by HE5_GDdefdim(...\"Bands\"...) : %d \n", status); /* * Create geographic (linear scale) grid * * 0 - 15 degrees longitude, 20 - 30 degrees latitude * */ xdim = 60; ydim = 40; uplft[0] = HE5_EHconvAng(0., HE5_HDFE_DEG_DMS); uplft[1] = HE5_EHconvAng(30., HE5_HDFE_DEG_DMS); lowrgt[0] = HE5_EHconvAng(15., HE5_HDFE_DEG_DMS); lowrgt[1] = HE5_EHconvAng(20., HE5_HDFE_DEG_DMS); GDid3 = HE5_GDcreate(gdfid, "GEOGrid", xdim, ydim, uplft, lowrgt); printf("Grid ID returned by HE5_GDcreate() : %ld \n", (long) GDid3); status = HE5_GDdefproj(GDid3, HE5_GCTP_GEO, dummy, dummy, NULL); printf("status returned by HE5_GDdefproj(...\"HE5_GCTP_GEO\"...) : %d \n", status); /* * We now close the grid interface with the GDdetach routine. This step * is necessary to properly store the grid information within the file * AND SHOULD BE DONE BEFORE WRITING OR READING DATA TO OR FROM THE FIELD. */ status = HE5_GDdetach(GDid); status = HE5_GDdetach(GDid2); status = HE5_GDdetach(GDid3); /* * Finally, we close the grid file using the HE5_GDclose routine. This will * release the grid file handles established by HE5_GDopen. */ status = HE5_GDclose(gdfid); return 0; } hdf-eos5-2.0/samples/he5_gd_setupF_32.f000077500000000000000000000124211507520047200175720ustar00rootroot00000000000000c In this code we open an HDF-EOS file and create UTM, c Polar Stereographic, and Geographic grids in the file c ===================================================== program he5_gd_setupF_32 implicit none include 'hdfeos5.inc' integer status, gdfid, i integer he5_gdcreate, he5_gdopen integer he5_gddefdim, he5_gddefproj integer he5_gddeforigin integer he5_gddetach, he5_gdclose integer gdid, gdid2, gdid3 integer zonecode, spherecode integer*4 xdim, ydim, dim real*8 uplft(2), lowrgt(2) real*8 projparm(16), he5_ehconvang c Open the HDF-EOS grid file, "grid.he5" c -------------------------------------- gdfid = he5_gdopen('grid.he5',HE5F_ACC_TRUNC) write(*,*) 'File ID returned by he5_gdopen(): ',gdfid c Create UTM Grid c --------------- c --------------------------------------------------- c c Region is bounded by 54 E and 60 E longitudes and c c 20 N and 30 N latitudes. UTM Zone: 40. c c Use default spheriod (Clarke 1866: spherecode = 0) c c c c Grid into 120 bins along x-axis and 200 bins c c along y-axis (approx 3' by 3' bins). c c --------------------------------------------------- c zonecode = 40 spherecode = 0 c Upper Left and Lower Right points in meters c ------------------------------------------- uplft(1) = 210584.50041 uplft(2) = 3322395.95445 lowrgt(1) = 813931.10959 lowrgt(2) = 2214162.53278 xdim = 120 ydim = 200 c Define GCTP Projection Parameters c --------------------------------- do i=1,16 projparm(i) = 0.d0 enddo gdid = he5_gdcreate(gdfid, "UTMGrid", 1 xdim, ydim, uplft, lowrgt) write(*,*) 'Grid ID returned by he5_gdcreate(): ',gdid status = he5_gddefproj(gdid,HE5_GCTP_UTM, 1 zonecode,spherecode,projparm) write(*,*) 'Status returned by he5_gddefproj(): ',status c Define "Time" Dimension c ----------------------- dim = 10 status = he5_gddefdim(gdid, "Time", dim) write(*,*) 'Status returned by he5_gddefdim(): ',status c Create polar stereographic grid c ------------------------------- c --------------------------------------------------- c c Northern Hemisphere (True Scale at 90 N, 0 c c Longitude below pole). c c Use International 1967 spheriod (spherecode = 3) c c Grid into 100 bins along x-axis and y-axis. c c --------------------------------------------------- c xdim = 100 ydim = 100 spherecode = 3 c Set Longitude below pole & true scale in DDDMMMSSS.SSS format) c -------------------------------------------------------------- projparm(5) = 0.0 projparm(6) = 90000000.00 c Use default boundaries for Polar Stereographic (hemisphere) c ----------------------------------------------------------- uplft(1) = 0 uplft(2) = 0 lowrgt(1) = 0 lowrgt(2) = 0 zonecode = 0 gdid2 = he5_gdcreate(gdfid,"PolarGrid", 1 xdim,ydim,uplft,lowrgt) write(*,*) 'Grid ID returned by he5_gdcreate(): ',gdid2 status = he5_gddefproj(gdid2,HE5_GCTP_PS,zonecode, 1 spherecode,projparm) write(*,*) 'Status returned by he5_gddefproj(): ',status status = he5_gddeforigin(gdid2, HE5_HDFE_GD_LR) write(*,*) 'Status returned by he5_gddeforigin(): ',status c Define "Bands" Dimension c ------------------------ dim = 3 status = he5_gddefdim(gdid2, "Bands", dim) write(*,*) 'Status returned by he5_gddefdim(): ',status c Create geographic (linear scale) grid c ------------------------------------- c --------------------------------------------------- c c 0-15 degrees longitude, 20-30 degrees latitude c c --------------------------------------------------- c xdim = 60 ydim = 40 uplft(1) = he5_ehconvAng(0.d0, HE5_HDFE_DEG_DMS) uplft(2) = he5_ehconvAng(30.d0, HE5_HDFE_DEG_DMS) lowrgt(1) = he5_ehconvAng(15.d0, HE5_HDFE_DEG_DMS) lowrgt(2) = he5_ehconvAng(20.d0, HE5_HDFE_DEG_DMS) do i=1,16 projparm(i) = 0.d0 enddo zonecode = 0 spherecode = 0 gdid3 =he5_gdcreate(gdfid,"GEOGrid",xdim,ydim,uplft,lowrgt) write(*,*) 'Grid ID returned by he5_gdcreate(): ',gdid3 status=he5_gddefproj(gdid3,HE5_GCTP_GEO,zonecode,spherecode, 1projparm) write(*,*) 'Status returned by he5_gddefproj(): ',status c Detach from the created grids c ----------------------------- status = he5_gddetach(gdid) write(*,*) 'Status returned by he5_gddetach(): ',status status = he5_gddetach(gdid2) write(*,*) 'Status returned by he5_gddetach(): ',status status = he5_gddetach(gdid3) write(*,*) 'Status returned by he5_gddetach(): ',status c Finally, close the grid file c ---------------------------- status = he5_gdclose(gdfid) write(*,*) 'Status returned by he5_gdclose(): ',status stop end hdf-eos5-2.0/samples/he5_gd_setupF_64.f000077500000000000000000000124441507520047200176040ustar00rootroot00000000000000c In this code we open an HDF-EOS file and create UTM, Polar c Stereographic, and Geographic grids within the file c ========================================================= program he5_gd_setupF_64 implicit none include 'hdfeos5.inc' integer status, gdfid, i integer he5_gdcreate, he5_gdopen integer he5_gddefdim, he5_gddefproj integer he5_gddeforigin integer he5_gddetach, he5_gdclose integer gdid, gdid2, gdid3 integer zonecode, spherecode integer*8 xdim, ydim, dim real*8 uplft(2), lowrgt(2) real*8 projparm(16), he5_ehconvang c Open the HDF-EOS grid file, "grid.he5" c ------------------------------------- gdfid = he5_gdopen('grid.he5',HE5F_ACC_TRUNC) write(*,*) 'File ID returned by he5_gdopen(): ',gdfid c Create UTM Grid c --------------- c --------------------------------------------------- c c Region is bounded by 54 E and 60 E longitudes and c c 20 N and 30 N latitudes. UTM Zone: 40. c c Use default spheriod (Clarke 1866: spherecode = 0) c c c c Grid into 120 bins along x-axis and 200 bins c c along y-axis (approx 3' by 3' bins). c c --------------------------------------------------- c zonecode = 40 spherecode = 0 c Upper Left and Lower Right points in meters c ------------------------------------------- uplft(1) = 210584.50041 uplft(2) = 3322395.95445 lowrgt(1) = 813931.10959 lowrgt(2) = 2214162.53278 xdim = 120 ydim = 200 c Define GCTP Projection Parameters c --------------------------------- do i=1,16 projparm(i) = 0.d0 enddo gdid = he5_gdcreate(gdfid, "UTMGrid", 1 xdim, ydim, uplft, lowrgt) write(*,*) 'Grid ID returned by he5_gdcreate(): ',gdid status = he5_gddefproj(gdid,HE5_GCTP_UTM, 1 zonecode,spherecode,projparm) write(*,*) 'Status returned by he5_gddefproj(): ',status c Define "Time" Dimension c ----------------------- dim = 10 status = he5_gddefdim(gdid, "Time", dim) write(*,*) 'Status returned by he5_gddefdim(): ',status c Create polar stereographic grid c ------------------------------- c --------------------------------------------------- c c Northern Hemisphere (True Scale at 90 N, 0 c c Longitude below pole). c c Use International 1967 spheriod (spherecode = 3) c c Grid into 100 bins along x-axis and y-axis. c c --------------------------------------------------- c xdim = 100 ydim = 100 spherecode = 3 c Set Longitude below pole & true scale in DDDMMMSSS.SSS format) c -------------------------------------------------------------- projparm(5) = 0.0 projparm(6) = 90000000.00 c Use default boundaries for Polar Stereographic (hemisphere) c ----------------------------------------------------------- uplft(1) = 0 uplft(2) = 0 lowrgt(1) = 0 lowrgt(2) = 0 zonecode = 0 gdid2 = he5_gdcreate(gdfid,"PolarGrid", 1 xdim,ydim,uplft,lowrgt) write(*,*) 'Grid ID returned by he5_gdcreate(): ',gdid2 status = he5_gddefproj(gdid2,HE5_GCTP_PS, 1 zonecode,spherecode,projparm) write(*,*) 'Status returned by he5_gddefproj(): ',status status = he5_gddeforigin(gdid2, HE5_HDFE_GD_LR) write(*,*) 'Status returned by he5_gddeforigin(): ',status c Define "Bands" Dimension c ------------------------ dim = 3 status = he5_gddefdim(gdid2, "Bands", dim) write(*,*) 'Status returned by he5_gddefdim(): ',status c Create geographic (linear scale) grid c ------------------------------------- c --------------------------------------------------- c c 0-15 degrees longitude, 20-30 degrees latitude c c --------------------------------------------------- c xdim = 60 ydim = 40 uplft(1) = he5_ehconvAng(0.d0, HE5_HDFE_DEG_DMS) uplft(2) = he5_ehconvAng(30.d0,HE5_HDFE_DEG_DMS) lowrgt(1) = he5_ehconvAng(15.d0,HE5_HDFE_DEG_DMS) lowrgt(2) = he5_ehconvAng(20.d0,HE5_HDFE_DEG_DMS) do i=1,16 projparm(i) = 0.d0 enddo zonecode = 0 spherecode = 0 gdid3 =he5_gdcreate(gdfid,"GEOGrid", 1 xdim,ydim,uplft,lowrgt) write(*,*) 'Grid ID returned by he5_gdcreate(): ',gdid3 status=he5_gddefproj(gdid3,HE5_GCTP_GEO, 1 zonecode,spherecode,projparm) write(*,*) 'Status returned by he5_gddefproj(): ',status c Detach from the created grids c ----------------------------- status = he5_gddetach(gdid) write(*,*) 'Status returned by he5_gddetach(): ',status status = he5_gddetach(gdid2) write(*,*) 'Status returned by he5_gddetach(): ',status status = he5_gddetach(gdid3) write(*,*) 'Status returned by he5_gddetach(): ',status c Finally, close the grid file c ---------------------------- status = he5_gdclose(gdfid) write(*,*) 'Status returned by he5_gdclose(): ',status stop end hdf-eos5-2.0/samples/he5_gd_subset.c000077500000000000000000000043641507520047200173310ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include /* * In this example we will (1) open the "Grid.h5" HDF-EOS file, (2) attach to * the "PolarGrid", and (3) subset data from the "Temperature" field. */ int main() { herr_t status = FAIL; int rank = FAIL; int i; hid_t gdfid = FAIL; hid_t GDid = FAIL; hid_t regionID = FAIL; hid_t *ntype; long size; hsize_t dims[8]; float *datbuf; double cornerlon[2], cornerlat[2]; double upleft[2], lowright[2]; /* * Open the HDF-EOS grid file, "Grid.h5". */ gdfid = HE5_GDopen("Grid.h5", H5F_ACC_RDWR); if (gdfid != FAIL) { GDid = HE5_GDattach(gdfid, "PolarGrid"); if (GDid != FAIL) { cornerlon[0] = 57.; cornerlat[0] = 23.; cornerlon[1] = 59.; cornerlat[1] = 35.; cornerlon[0] = 0.; cornerlat[0] = 90.; cornerlon[1] = 90.; cornerlat[1] = 0.; regionID = HE5_GDdefboxregion(GDid, cornerlon, cornerlat); printf("Region ID returned by HE5_GDdefboxregion() : %ld \n", (long) regionID); ntype = (hid_t *)calloc(1, sizeof(hid_t)); status = HE5_GDregioninfo(GDid, regionID, "Temperature", ntype,&rank, dims, &size, upleft, lowright); printf("Status returned by HE5_GDregioninfo() : %d \n", status); printf("Byte size of region data buffer: %d\n",(int)size); datbuf = (float *)malloc(size); status = HE5_GDextractregion(GDid, regionID, "Temperature", datbuf); printf("Status returned by HE5_GDextractregion() : %d \n", status); printf("First 20 values of data buffer: \n"); for (i = 0; i < 20; i++) printf("\t\t %f \n", datbuf[ i ]); free(datbuf); free(ntype); } } status = HE5_GDdetach(GDid); printf("Status returned by HE5_GDdetach() : %d \n", status); status = HE5_GDclose(gdfid); printf("Status returned by HE5_GDclose() : %d \n", status); return 0; } hdf-eos5-2.0/samples/he5_gd_subsetF_32.f000077500000000000000000000050751507520047200177460ustar00rootroot00000000000000c In this example we will (1) open the "grid.he5" HDF-EOS file c (2) attach to the "PolarGrid" grid, and (3) subset data from c the "Temperature" field. c ============================================================ program he5_gd_subsetF_32 implicit none include 'hdfeos5.inc' integer status integer gdfid integer gdid integer rgid integer he5_gdopen integer he5_gdattach integer he5_gdreginfo integer he5_gddefboxreg integer he5_gdextreg integer he5_gddetach integer he5_gdclose integer rk integer nt integer*4 dims(8) integer*4 size real*8 cornerlon(2) real*8 cornerlat(2) real*8 upleft(2) real*8 lowright(2) real*4 datbuf(100*100) integer FAIL parameter (FAIL=-1) c Open the HDF-EOS grid file, "grid.he5" c -------------------------------------- gdfid = he5_gdopen("grid.he5",HE5F_ACC_RDWR) write(*,*) 'File ID returned by he5_gdopen(): ',gdfid if (gdfid .NE. FAIL) then c Attach to the POLAR grid c ------------------------ gdid = he5_gdattach(gdfid, "PolarGrid") write(*,*) 'Grid ID returned by he5_gdattach(): ',gdid if (gdid .NE. FAIL) then cornerlon(1) = 0. cornerlat(1) = 90. cornerlon(2) = 90. cornerlat(2) = 0. c Define box region c ----------------- rgid = he5_gddefboxreg(gdid,cornerlon, 1 cornerlat) write(*,*) 'Region ID returned by he5_gddefboxreg(): ', 1 rgid c Get region information c ---------------------- status = he5_gdreginfo(gdid,rgid,"Temperature", 1 nt,rk, dims, size, upleft, lowright) write(*,*) dims(1), dims(2), rk, nt c Extract region c -------------- status = he5_gdextreg(gdid,rgid,"Temperature", 1 datbuf) write(*,*) 'Status returned by he5_gdextreg(): ',status endif c Detach from the grid c -------------------- status = he5_gddetach(gdid) write(*,*) 'Status returned by he5_gddetach(): ',status c Close the file c -------------- status = he5_gdclose(gdfid) write(*,*) 'Status returned by he5_gdclose(): ',status endif stop end hdf-eos5-2.0/samples/he5_gd_subsetF_64.f000077500000000000000000000047271507520047200177560ustar00rootroot00000000000000c In this example we will (1) open the "grid.he5" HDF-EOS file, (2) attach to c the "PolarGrid" grid, and (3) subset data from the "Temperature" field. program he5_gd_subsetF_64 implicit none include 'hdfeos5.inc' integer status integer gdfid integer gdid integer rgid integer he5_gdopen integer he5_gdattach integer he5_gdreginfo integer he5_gddefboxreg integer he5_gdextreg integer he5_gddetach integer he5_gdclose integer rk,nt integer*8 dims(8) integer*8 size real*8 cornerlon(2) real*8 cornerlat(2) real*8 upleft(2) real*8 lowright(2) real*4 datbuf(100*100) integer FAIL parameter (FAIL=-1) c Open the HDF-EOS grid file, "grid.he5" c --------------------------------------- gdfid = he5_gdopen("grid.he5",HE5F_ACC_RDWR) write(*,*) 'File ID returned by he5_gdopen(): ',gdfid if (gdfid .NE. FAIL) then c Attach to the POLAR grid c ------------------------ gdid = he5_gdattach(gdfid,"PolarGrid") write(*,*) 'Grid ID returned by he5_gdattach(): ',gdid if (gdid .NE. FAIL) then cornerlon(1) = 0. cornerlat(1) = 90. cornerlon(2) = 90. cornerlat(2) = 0. c Define box region c ----------------- rgid = he5_gddefboxreg(gdid, 1 cornerlon,cornerlat) write(*,*) 'Region ID returned by he5_gddefboxreg(): ', 1 rgid c Get region information c ---------------------- status = he5_gdreginfo(gdid,rgid,"Temperature", 1 nt,rk, dims, size, upleft, lowright) write(*,*) dims(1), dims(2), rk, nt c Extract region c -------------- status = he5_gdextreg(gdid,rgid,"Temperature", 1 datbuf) write(*,*) 'Status returned by he5_gdextreg(): ',status endif c Detach from the grid c -------------------- status = he5_gddetach(gdid) write(*,*) 'Status returned by he5_gddetach(): ',status c Close the file c -------------- status = he5_gdclose(gdfid) write(*,*) 'Status returned by he5_gdclose(): ',status endif stop end hdf-eos5-2.0/samples/he5_gd_wrexternaldata.c000077500000000000000000000055001507520047200210420ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include #define DIM 100 #define DIMTOT 60 int main() { FILE *in_1, *in_2, *in_3; herr_t status = FAIL; int i; int data_out_1[DIM]; int data_out_2[DIM]; int data_out_3[DIM]; int data[DIMTOT]; hid_t gdfid = FAIL; hid_t GDid = FAIL; hssize_t start[2]; hsize_t count[2]; /* Create new data buffer */ /* ---------------------- */ for (i = 0; i < DIMTOT; i++) data[ i ] = 9999; /* * Open the HDF grid file, "Grid.h5". */ gdfid = HE5_GDopen("Grid.h5", H5F_ACC_RDWR); if (gdfid != FAIL) { /* * Attach the "UTMGrid". */ GDid = HE5_GDattach(gdfid, "UTMGrid"); if (GDid != FAIL) { /* Write new data to the external files */ /* ------------------------------------ */ start[0] = 0; count[0] = DIMTOT; status = HE5_GDwritefield(GDid, "ExtData", start, NULL, count, data); printf("Status returned by HE5_GDwritefield() : %d \n", status); /* Open the external data files */ /* ---------------------------- */ in_1 = fopen("external_1g.data", "r"); in_2 = fopen("external_2g.data", "r"); in_3 = fopen("external_3g.data", "r"); /* Read data from external data files */ /* ---------------------------------- */ i = fread(data_out_1, sizeof(int), DIM, in_1); i = fread(data_out_2, sizeof(int), DIM, in_2); i = fread(data_out_3, sizeof(int), DIM, in_3); /* Close the external data files */ /* ----------------------------- */ fclose(in_1); fclose(in_2); fclose(in_3); /* Check the contents of external files */ /* ------------------------------------ */ printf(" \n"); printf("Reading data from 1st file: \n"); printf(" \n"); for (i = 0; i < DIM; i++) printf("%d ", data_out_1[i]); printf(" \n"); printf(" \n"); printf("Reading data from 2d file: \n"); printf(" \n"); for (i = 0; i < DIM; i++) printf("%d ", data_out_2[i]); printf(" \n"); printf(" \n"); printf("Reading data from 3d file: \n"); printf(" \n"); for (i = 0; i < DIM; i++) printf("%d ", data_out_3[i]); printf(" \n"); printf(" \n"); } } /* Detach from the grid */ /* --------------------- */ status = HE5_GDdetach(GDid); printf("Status returned by HE5_GDdetach() : %d \n", status); /* Close the file */ /* -------------- */ status = HE5_GDclose(gdfid); printf("Status returned by HE5_GDclose() : %d \n", status); return 0; } hdf-eos5-2.0/samples/he5_gd_writedata.c000077500000000000000000000056411507520047200200070ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include /* * In this example we will (1) open the "Grid.h5" HDF-EOS file, (2) attach to * the "UTMGrid", and (3) write data to the "Vegetation" field. We will * then attach to the "PolarGrid" and write to the "Temperature" field. */ int main() { herr_t status = FAIL; int i, j; int grpattr[3] = {3,7,11}; /* group attr */ hid_t gdfid = FAIL; hid_t GDid = FAIL; float flt = 3.1415; /* global attr */ float attr[4] = {1.1,2.2,3.3,4.4}; /* local attr */ float veg[200][120]; float temp[100][100]; hssize_t start[3]; hsize_t edge[3]; /* Fill veg array */ for (i = 0; i < 200; i++) for (j = 0; j < 120; j++) veg[i][j] = (float)(10+i); /* Fill temp array */ for (i = 0; i < 100; i++) for (j = 0; j < 100; j++) temp[i][j] = (float)(100*i+j); /* * Open the HDF grid file, "Grid.h5". */ gdfid = HE5_GDopen("Grid.h5", H5F_ACC_RDWR); if (gdfid != FAIL) { /* * Attach the "UTMGrid". */ GDid = HE5_GDattach(gdfid, "UTMGrid"); if (GDid != FAIL) { /* Data Field "Vegetation" */ /* ---------------------- */ start[0] = 0; start[1] = 0; edge[0] = 200; edge[1] = 120; status = HE5_GDwritefield(GDid, "Vegetation", start, NULL, edge, veg); printf("Status returned by HE5_GDwritefield() : %d \n", status); /* Global attribute */ /* ---------------- */ edge[0] = 1; status = HE5_GDwriteattr(GDid, "GlobalAttribute", H5T_NATIVE_FLOAT, edge, &flt); printf("Status returned by HE5_GDwriteattr() : %d \n", status); /* Group attribute */ /* --------------- */ edge[0] = 3; status = HE5_GDwritegrpattr(GDid, "GroupAttribute", H5T_NATIVE_INT, edge, grpattr); printf("Status returned by HE5_GDwritegrpattr() : %d \n", status); /* Local attribute */ /* --------------- */ edge[0] = 4; status = HE5_GDwritelocattr(GDid, "Vegetation", "LocalAttribute", H5T_NATIVE_FLOAT, edge, attr); printf("Status returned by HE5_GDwritelocattr() : %d \n", status); } status = HE5_GDdetach(GDid); GDid = HE5_GDattach(gdfid, "PolarGrid"); if (GDid != FAIL) { /* Data field "Temperature" */ /* ----------------------- */ start[0] = 0; start[1] = 0; edge[0] = 100; edge[1] = 100; status = HE5_GDwritefield(GDid, "Temperature", start, NULL, edge, temp); printf("Status returned by HE5_GDwritefield() : %d \n", status); } status = HE5_GDdetach(GDid); } status = HE5_GDclose(gdfid); return 0; } hdf-eos5-2.0/samples/he5_gd_writedataF_32.f000077500000000000000000000102271507520047200204200ustar00rootroot00000000000000 program he5_gd_writedataF_32 implicit none include 'hdfeos5.inc' integer status integer i, j integer he5_gdopen integer he5_gdattach integer he5_gdwrfld integer he5_gdwrattr integer he5_gdwrgattr integer he5_ehwrglatt integer he5_gdwrlattr integer he5_gddetach integer he5_gdclose integer gdfid,gdid integer*4 start(2), stride(2), count(2) real*4 f, veg(120,200), temp(100,100) character*10 attr4 character*100 attr5 integer FAIL parameter (FAIL=-1) c Create data buffers c ------------------- do i=1,200 do j=1,120 veg(j,i) = 10 + i enddo enddo do i=1,100 do j=1,100 temp(j,i) = 100*(i-1) + j enddo enddo c Open HDF-EOS file "grid.he5" c --------------------------- gdfid = he5_gdopen("grid.he5",HE5F_ACC_RDWR) write(*,*) 'File ID returned by he5_gdopen(): ',gdfid if (gdfid .ne. FAIL) then c Attach to the UTM grid c ---------------------- gdid = he5_gdattach(gdfid, "UTMGrid") write(*,*) 'Grid ID returned by he5_gdattach(): ',gdid if (gdid .ne. FAIL) then start(1) = 0 start(2) = 0 stride(1) = 1 stride(2) = 1 count(1) = 120 count(2) = 200 c Write data to the field "Vegetation" c ------------------------------------ status = he5_gdwrfld(gdid,"Vegetation", 1 start,stride,count,veg) write(*,*) 'Status returned by he5_gdwrfld(): ',status f = 1 count(1) = 1 c Write global attribute "float" c ------------------------------ status = he5_gdwrattr(gdid,"float", 1 HE5T_NATIVE_FLOAT,count,f) write(*,*) 'Status returned by he5_gdwrattr(): ',status attr4 = "ABCDEFGH" count(1) = 8 status = he5_gdwrattr(gdid,"GLOBAL_CHAR_ATTR",HE5T_NATIVE_CHAR, 1 count,attr4) write(*,*) 'Status returned by he5_gdwrattr(): ',status attr4 = "111" count(1) = 3 status = he5_gdwrgattr(gdid,"GLOBAL_CHAR_ATTR_1", 1 HE5T_NATIVE_CHAR,count,attr4) write(*,*) 'Status returned by he5_gdwrgattr(): ',status attr4 = "222222" count(1) = 6 status = he5_ehwrglatt(gdfid,"GLOBAL_CHAR_ATTR_2", 1 HE5T_NATIVE_CHAR,count,attr4) write(*,*) 'Status returned by he5_ehwrglatt(): ',status attr5 = "abcdefgh111111111111" count(1) = 20 status = he5_gdwrlattr(gdid,"Vegetation","LocalAttribute_0", 1 HE5T_NATIVE_CHAR,count,attr5) write(*,*) 'Status returned by he5_gdwrlattr(): ',status endif endif c Detach from the grid c -------------------- status = he5_gddetach(gdid) write(*,*) 'Status returned by he5_gddetach(): ',status c Attach to the POLAR grid c ------------------------ gdid = he5_gdattach(gdfid, "PolarGrid") write(*,*) 'Grid ID returned by he5_gdattach(): ',gdid if (gdid .ne. FAIL) then start(1) = 0 start(2) = 0 stride(1) = 1 stride(2) = 1 count(1) = 100 count(2) = 100 c Write data to the "Temperature" field c ------------------------------------- status = he5_gdwrfld(gdid,"Temperature", 1 start,stride,count,temp) write(*,*) 'Status returned by he5_gdwrfld(): ',status endif c Detach from the grid c -------------------- status = he5_gddetach(gdid) write(*,*) 'Status returned by he5_gddetach(): ',status c Close the file c -------------- status = he5_gdclose(gdfid) write(*,*) 'Status returned by he5_gdclose(): ',status stop end hdf-eos5-2.0/samples/he5_gd_writedataF_64.f000077500000000000000000000103071507520047200204240ustar00rootroot00000000000000 program he5_gd_writedataF_64 implicit none include 'hdfeos5.inc' integer i, j, status integer he5_gdopen integer he5_gdattach integer he5_gdwrfld integer he5_gdwrattr integer he5_gdwrgattr integer he5_ehwrglatt integer he5_gdwrlattr integer he5_gddetach integer he5_gdclose integer gdfid, gdid integer*8 start(2),stride(2),count(2) real*4 f,veg(120,200),temp(100,100) character*10 attr4 character*100 attr5 integer FAIL parameter (FAIL=-1) c Create data buffers c ------------------- do i=1,200 do j=1,120 veg(j,i) = 10 + i enddo enddo do i=1,100 do j=1,100 temp(j,i) = 100*(i-1) + j enddo enddo c Open HDF-EOS file "grid.he5" c --------------------------- gdfid = he5_gdopen("grid.he5",HE5F_ACC_RDWR) write(*,*) 'File ID returned by he5_gdopen(): ',gdfid if (gdfid .ne. FAIL) then c Attach to the UTM grid c ---------------------- gdid = he5_gdattach(gdfid, "UTMGrid") write(*,*) 'Grid ID returned by he5_gdattach(): ',gdid if (gdid .ne. FAIL) then start(1) = 0 start(2) = 0 stride(1) = 1 stride(2) = 1 count(1) = 120 count(2) = 200 c Write data to the field "Vegetation" c ------------------------------------ status = he5_gdwrfld(gdid,"Vegetation", 1 start,stride,count,veg) write(*,*) 'Status returned by he5_gdwrfld(): ',status f = 1 count(1) = 1 c Write global attribute "float" c ------------------------------ status = he5_gdwrattr(gdid,"float", 1 HE5T_NATIVE_FLOAT,count,f) write(*,*) 'Status returned by he5_gdwrattr(): ',status attr4 = "ABCDEFGH" count(1) = 8 status = he5_gdwrattr(gdid,"GLOBAL_CHAR_ATTR", 1 HE5T_NATIVE_CHAR,count,attr4) write(*,*) 'Status returned by he5_gdwrattr(): ',status attr4 = "111" count(1) = 3 status = he5_gdwrgattr(gdid,"GLOBAL_CHAR_ATTR_1", 1 HE5T_NATIVE_CHAR,count,attr4) write(*,*) 'Status returned by he5_gdwrgattr(): ',status attr4 = "222222" count(1) = 6 status = he5_ehwrglatt(gdfid,"GLOBAL_CHAR_ATTR_2", 1 HE5T_NATIVE_CHAR,count,attr4) write(*,*) 'Status returned by he5_ehwrglatt(): ',status attr5 = "abcdefgh111111111111" count(1) = 20 status = he5_gdwrlattr(gdid,"Vegetation","LocalAttribute_0", 1 HE5T_NATIVE_CHAR,count,attr5) write(*,*) 'Status returned by he5_gdwrlattr(): ',status endif endif c Detach from the grid c -------------------- status = he5_gddetach(gdid) write(*,*) 'Status returned by he5_gddetach(): ',status c Attach to the POLAR grid c ------------------------ gdid = he5_gdattach(gdfid, "PolarGrid") write(*,*) 'Grid ID returned by he5_gdattach(): ',gdid if (gdid .ne. FAIL) then start(1) = 0 start(2) = 0 stride(1) = 1 stride(2) = 1 count(1) = 100 count(2) = 100 c Write data to the "Temperature" field c ------------------------------------- status = he5_gdwrfld(gdid,"Temperature", 1 start,stride,count,temp) write(*,*) 'Status returned by he5_gdwrfld(): ',status endif c Detach from the grid c -------------------- status = he5_gddetach(gdid) write(*,*) 'Status returned by he5_gddetach(): ',status c Close the file c -------------- status = he5_gdclose(gdfid) write(*,*) 'Status returned by he5_gdclose(): ',status stop end hdf-eos5-2.0/samples/he5_gd_wrunlimfld.c000077500000000000000000000067561507520047200202160ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include /* * In this example we will (1) open the "Grid.h5" HDF-EOS file, (2) attach to * the "UTMGrid", and (3) write data to the appendable "Vegetation" field. */ int main() { herr_t status = FAIL; int i, j; int rank = FAIL; hid_t gdfid = FAIL; hid_t GDid = FAIL; hid_t *ntype; hssize_t start[3]; hsize_t edge[3], dims[8] = {0,0,0,0,0,0,0,0}; float veg[200][120]; char buf1[256], buf2[256]; /* Fill veg array */ /* -------------- */ for (i = 0; i < 200; i++) for (j = 0; j < 120; j++) veg[i][j] = (float)(10+i); /* Open the HDF grid file "Grid.h5" */ /* ------------------------------- */ gdfid = HE5_GDopen("Grid.h5", H5F_ACC_RDWR); if (gdfid != FAIL) { /* Attach the "UTMGrid" */ /* ------------------- */ GDid = HE5_GDattach(gdfid, "UTMGrid"); if (GDid != FAIL) { /* Write data to the appendable field */ /* ---------------------------------- */ start[0] = 0; start[1] = 0; edge[0] = 200; edge[1] = 120; status = HE5_GDwritefield(GDid, "Vegetation", start, NULL, edge, veg); printf("Status returned by HE5_GDwritefield(): %d\n", status); strcpy(buf1, ""); strcpy(buf2, ""); dims[0] = 0; dims[1] = 0; ntype = (hid_t *)calloc(1, sizeof(hid_t)); status = HE5_GDfieldinfo(GDid, "Vegetation", &rank, dims, ntype, buf1, buf2); printf("Status returned by HE5_GDfieldinfo(): %d\n", status); if (status != FAIL) { printf("\tThe dimension list: %s \n", buf1); printf("\tThe maximum dimension list: %s \n", buf2); printf("The sizes of dataset dimensions before appending: \n"); for (i = 0; i < rank; i++) printf("\t %lu \n", (unsigned long)dims[i]); } free(ntype); } /* Detach from "UTMGrid" */ /* -------------------- */ status = HE5_GDdetach(GDid); /* Attach the "UTMGrid" */ /* ------------------- */ GDid = HE5_GDattach(gdfid, "UTMGrid"); if (GDid != FAIL) { /* Write new data to the appendable field */ /* -------------------------------------- */ start[0] = 180; start[1] = 100; edge[0] = 100; edge[1] = 80; status = HE5_GDwritefield(GDid, "Vegetation", start, NULL, edge, veg); printf("Status returned by HE5_GDwritefield(): %d\n", status); strcpy(buf1, ""); strcpy(buf2, ""); dims[0] = 0; dims[1] = 0; ntype = (hid_t *)calloc(1, sizeof(hid_t)); status = HE5_GDfieldinfo(GDid, "Vegetation", &rank, dims, ntype, buf1, buf2); printf("Status returned by HE5_GDfieldinfo(): %d\n", status); if (status != FAIL) { printf("\tThe dimension list: %s \n", buf1); printf("\tThe maximum dimension list: %s \n", buf2); printf("The sizes of dataset dimensions after appending: \n"); for (i = 0; i < rank; i++) printf("\t %lu \n", (unsigned long)dims[i]); } free(ntype); } status = HE5_GDdetach(GDid); } status = HE5_GDclose(gdfid); return 0; } hdf-eos5-2.0/samples/he5_pt_datainfo.c000077500000000000000000000053671507520047200176460ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include #define FILENAME "Point.h5" #define OBJECT "FixedBuoy Point" int main(void) { herr_t status = FAIL; int fieldgroup = FAIL; hid_t fid = FAIL, PTid = FAIL, datatype = FAIL; H5T_class_t classid = H5T_NO_CLASS; H5T_order_t order = H5T_ORDER_ERROR; size_t size = 0; fid = HE5_PTopen(FILENAME, H5F_ACC_RDONLY); printf("File ID returned by HE5_PTopen() : %ld \n", (long) fid); PTid = HE5_PTattach(fid, OBJECT); printf("Point ID returned by HE5_PTattach() : %ld \n", (long) PTid); fieldgroup = HE5_HDFE_DATAGROUP; status = HE5_PTinqdatatype(PTid, "Observations", NULL, fieldgroup, &datatype, &classid, &order, &size); printf("Status returned by HE5_PTinqdatatype() : %d \n", status); if (status != FAIL) { printf("\tdatatype: %d \n", (int)datatype); printf("\tclass ID: %d \n", (int)classid); printf("\tsize: %d \n", (int)size); } fieldgroup = HE5_HDFE_ATTRGROUP; status = HE5_PTinqdatatype(PTid, NULL, "GlobalAttribute_int", fieldgroup, &datatype, &classid, &order, &size); printf("Status returned by HE5_PTinqdatatype() : %d \n", status); if (status != FAIL) { printf("\tdatatype: %d \n", (int)datatype); printf("\tclass ID: %d \n", (int)classid); printf("\torder: %d \n", (int)order); printf("\tsize: %d \n", (int)size); } fieldgroup = HE5_HDFE_GRPATTRGROUP; status = HE5_PTinqdatatype(PTid, NULL, "GroupAttribute", fieldgroup, &datatype, &classid, &order, &size); printf("Status returned by HE5_PTinqdatatype() : %d \n", status); if (status != FAIL) { printf("\tdatatype: %d \n", (int)datatype); printf("\tclass ID: %d \n", (int)classid); printf("\torder: %d \n", (int)order); printf("\tsize: %d \n", (int)size); } fieldgroup = HE5_HDFE_LOCATTRGROUP; status = HE5_PTinqdatatype(PTid, "Observations", "LocalAttribute", fieldgroup, &datatype, &classid, &order, &size); printf("Status returned by HE5_PTinqdatatype() : %d \n", status); if (status != FAIL) { printf("\tdatatype: %d \n", (int)datatype); printf("\tclass ID: %d \n", (int)classid); printf("\torder: %d \n", (int)order); printf("\tsize: %d \n", (int)size); } status = HE5_PTdetach(PTid); printf("Status returned by HE5_PTdetach() : %d \n", status); status = HE5_PTclose(fid); printf("Status returned by HE5_PTclose() : %d \n", status); return(0); } hdf-eos5-2.0/samples/he5_pt_datainfoF_32.f000077500000000000000000000055421507520047200202560ustar00rootroot00000000000000 program he5_pt_datainfoF_32 implicit none include 'hdfeos5.inc' integer status integer ptfid integer ptid integer he5_ptopen integer he5_ptattach integer he5_ptinqdatatype integer he5_ptdetach integer he5_ptclose integer dtype integer classid integer order integer fieldgroup integer*4 size character*1 null_char_0 character*80 fieldname character*80 attrname null_char_0 = '0' c Open the HDF point file, "point.he5" c ------------------------------------ ptfid = he5_ptopen('point.he5',HE5F_ACC_RDONLY) write(*,*) 'File ID returned by he5_ptopen(): ',ptfid c Read Simple Point c ----------------- ptid = he5_ptattach(ptfid, "FixedBuoy Point") write(*,*) 'Point ID returned by he5_ptattach(): ',ptid fieldgroup = HE5_HDFE_DATAGROUP fieldname = 'Observations' status = he5_ptinqdatatype(ptid,fieldname,null_char_0,fieldgroup, 1dtype,classid,order,size) print *,'Status returned from he5_ptinqdatatype(): ',status print *,'datatype: ',dtype print *,'class ID: ',classid print *,'order: ',order print *,'size: ',size fieldgroup = HE5_HDFE_ATTRGROUP attrname = 'GlobalAttribute_int' status = he5_ptinqdatatype(ptid,null_char_0,attrname,fieldgroup, 1dtype,classid,order,size) print *,'Status returned from he5_ptinqdatatype(): ',status print *,'datatype: ',dtype print *,'class ID: ',classid print *,'order: ',order print *,'size: ',size fieldgroup = HE5_HDFE_GRPATTRGROUP attrname = 'GroupAttribute' status = he5_ptinqdatatype(ptid,null_char_0,attrname,fieldgroup, 1dtype,classid,order,size) print *,'Status returned from he5_ptinqdatatype(): ',status print *,'datatype: ',dtype print *,'class ID: ',classid print *,'order: ',order print *,'size: ',size fieldname = 'Observations' fieldgroup = HE5_HDFE_LOCATTRGROUP attrname = 'LocalAttribute' status = he5_ptinqdatatype(ptid,fieldname,attrname,fieldgroup, 1dtype,classid,order,size) print *,'Status returned from he5_ptinqdatatype(): ',status print *,'datatype: ',dtype print *,'class ID: ',classid print *,'order: ',order print *,'size: ',size c Close out the point interface c ----------------------------- status = he5_ptdetach(ptid) write(*,*) 'Status returned by he5_ptdetach(): ',status status = he5_ptclose(ptfid) write(*,*) 'Status returned by he5_ptclose(): ',status stop end hdf-eos5-2.0/samples/he5_pt_datainfoF_64.f000077500000000000000000000055061507520047200202630ustar00rootroot00000000000000 program he5_pt_datainfoF_64 implicit none include 'hdfeos5.inc' integer status integer ptfid integer ptid integer he5_ptopen integer he5_ptattach integer he5_ptinqdatatype integer he5_ptdetach integer he5_ptclose integer dtype integer classid integer order integer fieldgroup integer*8 size character*1 null_char_0 character*80 fieldname character*80 attrname null_char_0 = '0' c Open the HDF-EOS point file, "point.he5" c ---------------------------------------- ptfid = he5_ptopen('point.he5',HE5F_ACC_RDONLY) write(*,*) 'File ID returned by he5_ptopen(): ',ptfid c Read Simple Point c ----------------- ptid = he5_ptattach(ptfid, "FixedBuoy Point") write(*,*) 'Point ID returned by he5_ptattach(): ',ptid fieldgroup = HE5_HDFE_DATAGROUP fieldname = 'Observations' status = he5_ptinqdatatype(ptid,fieldname,null_char_0,fieldgroup, 1dtype,classid,order,size) print *,'Status returned from he5_ptinqdatatype(): ',status print *,'dtype: ',dtype print *,'class ID: ',classid print *,'order: ',order print *,'size: ',size fieldgroup = HE5_HDFE_ATTRGROUP attrname = 'GlobalAttribute_int' status = he5_ptinqdatatype(ptid,null_char_0,attrname,fieldgroup, 1dtype,classid,order,size) print *,'Status returned from he5_ptinqdatatype(): ',status print *,'dtype: ',dtype print *,'class ID: ',classid print *,'order: ',order print *,'size: ',size fieldgroup = HE5_HDFE_GRPATTRGROUP attrname = 'GroupAttribute' status = he5_ptinqdatatype(ptid,null_char_0,attrname,fieldgroup, 1dtype,classid,order,size) print *,'Status returned from he5_ptinqdatatype(): ',status print *,'dtype: ',dtype print *,'class ID: ',classid print *,'order: ',order print *,'size: ',size fieldname = 'Observations' fieldgroup = HE5_HDFE_LOCATTRGROUP attrname = 'LocalAttribute' status = he5_ptinqdatatype(ptid,fieldname,attrname,fieldgroup, 1dtype,classid,order,size) print *,'Status returned from he5_ptinqdatatype(): ',status print *,'dtype: ',dtype print *,'class ID: ',classid print *,'order: ',order print *,'size: ',size c.....Close out the point interface status = he5_ptdetach(ptid) write(*,*) 'Status returned by he5_ptdetach(): ',status status = he5_ptclose(ptfid) write(*,*) 'Status returned by he5_ptclose(): ',status stop end hdf-eos5-2.0/samples/he5_pt_definelevels.c000077500000000000000000000234351507520047200205220ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include /* File name: he5_pt_definelevels.c */ /* -------------------------------- */ /* * In this example we will open the "Point.h5" HDF-EOS file * and define the point levels. */ int main() { herr_t status = FAIL; int i; hid_t ptfid = FAIL, PTid = FAIL; HE5_CmpDTSinfo *dtsinfo; typedef struct { double time; float concentr[4]; char spec[8]; } InputData1; typedef struct { char label[8]; double lon; double lat; int date; char id[8]; } InputData2; typedef struct { double time; float rain; float temp; char id[8]; } InputData3; typedef struct { char label[10]; int date; int weight; char id[8]; } InputData4; typedef struct { double time; double lon; double lat; float rain; float temp; char id[8]; } InputData5; /* * We first open the HDF-EOS point file, "Point.h5". Because this file * already exist and we wish to write to it, we use the H5F_ACC_RDWR access * code in the open statement. The PTopen routine returns the point file * id, ptfid, which is used to identify the file in subsequent routines. */ ptfid = HE5_PTopen("Point.h5", H5F_ACC_RDWR); if (ptfid != FAIL) { /* Simple Point */ /* ------------ */ PTid = HE5_PTattach(ptfid, "Simple Point"); dtsinfo = (HE5_CmpDTSinfo *)calloc(1, sizeof(HE5_CmpDTSinfo)); /* Set up level data structure */ /* --------------------------- */ dtsinfo->nfields = 3; dtsinfo->rank[0] = 1; dtsinfo->rank[1] = 1; dtsinfo->rank[2] = 1; dtsinfo->offset[0] = HOFFSET(InputData1, time); dtsinfo->offset[1] = HOFFSET(InputData1, concentr); dtsinfo->offset[2] = HOFFSET(InputData1, spec); dtsinfo->dtype[0] = H5T_NATIVE_DOUBLE; dtsinfo->dtype[1] = H5T_NATIVE_FLOAT; dtsinfo->dtype[2] = H5T_NATIVE_CHAR; dtsinfo->array[0] = 0; dtsinfo->array[1] = 1; dtsinfo->array[2] = 1; for (i = 0; i < 3; i++) dtsinfo->fieldname[i] = (char *)calloc(64, sizeof(char)); strcpy(dtsinfo->fieldname[0],"Time"); strcpy(dtsinfo->fieldname[1],"Concentration"); strcpy(dtsinfo->fieldname[2],"Species"); dtsinfo->dims[0][0] = 1; dtsinfo->dims[1][0] = 4; dtsinfo->dims[2][0] = 8; dtsinfo->datasize = (size_t)sizeof(InputData1); status = HE5_PTdeflevel(PTid, "Sensor", dtsinfo); printf("Status returned by HE5_PTdeflevel() : %d \n", status); for (i = 0; i < 3; i++) { free(dtsinfo->fieldname[i]); dtsinfo->fieldname[i] = NULL; } free(dtsinfo); HE5_PTdetach(PTid); /* Fixed Buoy Point */ /* ---------------- */ PTid = HE5_PTattach(ptfid, "FixedBuoy Point"); dtsinfo = (HE5_CmpDTSinfo *)calloc(1, sizeof(HE5_CmpDTSinfo)); /* Set up level data struvcture */ /* ---------------------------- */ dtsinfo->nfields = 5; dtsinfo->rank[0] = 1; dtsinfo->rank[1] = 1; dtsinfo->rank[2] = 1; dtsinfo->rank[3] = 1; dtsinfo->rank[4] = 1; dtsinfo->array[0] = 1; dtsinfo->array[1] = 0; dtsinfo->array[2] = 0; dtsinfo->array[3] = 0; dtsinfo->array[4] = 1; dtsinfo->offset[0] = HOFFSET(InputData2, label); dtsinfo->offset[1] = HOFFSET(InputData2, lon); dtsinfo->offset[2] = HOFFSET(InputData2, lat); dtsinfo->offset[3] = HOFFSET(InputData2, date); dtsinfo->offset[4] = HOFFSET(InputData2, id); dtsinfo->dtype[0] = H5T_NATIVE_CHAR; dtsinfo->dtype[1] = H5T_NATIVE_DOUBLE; dtsinfo->dtype[2] = H5T_NATIVE_DOUBLE; dtsinfo->dtype[3] = H5T_NATIVE_INT; dtsinfo->dtype[4] = H5T_NATIVE_CHAR; for (i = 0; i < 5; i++) dtsinfo->fieldname[i] = (char *)calloc(64, sizeof(char)); strcpy(dtsinfo->fieldname[0],"Label"); strcpy(dtsinfo->fieldname[1],"Longitude"); strcpy(dtsinfo->fieldname[2],"Latitude"); strcpy(dtsinfo->fieldname[3],"DeployDate"); strcpy(dtsinfo->fieldname[4],"ID"); dtsinfo->dims[0][0] = 8; dtsinfo->dims[1][0] = 1; dtsinfo->dims[2][0] = 1; dtsinfo->dims[3][0] = 1; dtsinfo->dims[4][0] = 8; dtsinfo->datasize = (size_t)sizeof(InputData2); status = HE5_PTdeflevel(PTid, "Desc-Loc", dtsinfo); printf("Status returned by HE5_PTdeflevel() : %d \n", status); for (i = 0; i < 5; i++) free(dtsinfo->fieldname[i]); free(dtsinfo); dtsinfo = (HE5_CmpDTSinfo *)calloc(1, sizeof(HE5_CmpDTSinfo)); /* Set up level data structure */ /* --------------------------- */ dtsinfo->nfields = 4; dtsinfo->rank[0] = 1; dtsinfo->rank[1] = 1; dtsinfo->rank[2] = 1; dtsinfo->rank[3] = 1; dtsinfo->array[0] = 0; dtsinfo->array[1] = 0; dtsinfo->array[2] = 0; dtsinfo->array[3] = 1; dtsinfo->offset[0] = HOFFSET(InputData3, time); dtsinfo->offset[1] = HOFFSET(InputData3, rain); dtsinfo->offset[2] = HOFFSET(InputData3, temp); dtsinfo->offset[3] = HOFFSET(InputData3, id); dtsinfo->dtype[0] = H5T_NATIVE_DOUBLE; dtsinfo->dtype[1] = H5T_NATIVE_FLOAT; dtsinfo->dtype[2] = H5T_NATIVE_FLOAT; dtsinfo->dtype[3] = H5T_NATIVE_CHAR; for (i = 0; i < 4; i++) dtsinfo->fieldname[i] = (char *)calloc(64, sizeof(char)); strcpy(dtsinfo->fieldname[0],"Time"); strcpy(dtsinfo->fieldname[1],"Rainfall"); strcpy(dtsinfo->fieldname[2],"Temperature"); strcpy(dtsinfo->fieldname[3],"ID"); dtsinfo->dims[0][0] = 1; dtsinfo->dims[1][0] = 1; dtsinfo->dims[2][0] = 1; dtsinfo->dims[3][0] = 8; dtsinfo->datasize = (size_t)sizeof(InputData3); status = HE5_PTdeflevel(PTid, "Observations", dtsinfo); printf("Status returned by HE5_PTdeflevel() : %d \n", status); for (i = 0; i < 4; i++) free(dtsinfo->fieldname[i]); free(dtsinfo); status = HE5_PTdeflinkage(PTid, "Desc-Loc", "Observations", "ID"); printf("Status returned by HE5_PTdeflinkage() : %d \n", status); status = HE5_PTdetach(PTid); printf("Status returned by HE5_PTdetach() : %d\n", status); /* Floating Buoy Point */ /* ------------------- */ PTid = HE5_PTattach(ptfid, "FloatBuoy Point"); dtsinfo = (HE5_CmpDTSinfo *)calloc(1, sizeof(HE5_CmpDTSinfo)); /* Set up level data structure */ /* --------------------------- */ dtsinfo->nfields = 4; dtsinfo->rank[0] = 1; dtsinfo->rank[1] = 1; dtsinfo->rank[2] = 1; dtsinfo->rank[3] = 1; dtsinfo->array[0] = 1; dtsinfo->array[1] = 0; dtsinfo->array[2] = 0; dtsinfo->array[3] = 1; dtsinfo->offset[0] = HOFFSET(InputData4, label); dtsinfo->offset[1] = HOFFSET(InputData4, date); dtsinfo->offset[2] = HOFFSET(InputData4, weight); dtsinfo->offset[3] = HOFFSET(InputData4, id); dtsinfo->dtype[0] = H5T_NATIVE_CHAR; dtsinfo->dtype[1] = H5T_NATIVE_INT; dtsinfo->dtype[2] = H5T_NATIVE_INT; dtsinfo->dtype[3] = H5T_NATIVE_CHAR; for (i = 0; i < 4; i++) dtsinfo->fieldname[i] = (char *)calloc(64, sizeof(char)); strcpy(dtsinfo->fieldname[0],"Label"); strcpy(dtsinfo->fieldname[1],"DeployDate"); strcpy(dtsinfo->fieldname[2],"Weight"); strcpy(dtsinfo->fieldname[3],"ID"); dtsinfo->dims[0][0] = 8; dtsinfo->dims[1][0] = 1; dtsinfo->dims[2][0] = 1; dtsinfo->dims[3][0] = 8; dtsinfo->datasize = (size_t)sizeof(InputData4); status = HE5_PTdeflevel(PTid, "Description",dtsinfo ); printf("Status returned by HE5_PTdeflevel() : %d \n", status); for (i = 0; i < 4; i++) free(dtsinfo->fieldname[i]); free(dtsinfo); /* Define Data Level */ dtsinfo = (HE5_CmpDTSinfo *)calloc(1, sizeof(HE5_CmpDTSinfo)); /* Set up level data structure */ /* --------------------------- */ dtsinfo->nfields = 6; dtsinfo->rank[0] = 1; dtsinfo->rank[1] = 1; dtsinfo->rank[2] = 1; dtsinfo->rank[3] = 1; dtsinfo->rank[4] = 1; dtsinfo->rank[5] = 1; dtsinfo->array[0] = 0; dtsinfo->array[1] = 0; dtsinfo->array[2] = 0; dtsinfo->array[3] = 0; dtsinfo->array[4] = 0; dtsinfo->array[5] = 1; dtsinfo->offset[0] = HOFFSET(InputData5, time); dtsinfo->offset[1] = HOFFSET(InputData5, lon); dtsinfo->offset[2] = HOFFSET(InputData5, lat); dtsinfo->offset[3] = HOFFSET(InputData5, rain); dtsinfo->offset[4] = HOFFSET(InputData5, temp); dtsinfo->offset[5] = HOFFSET(InputData5, id); dtsinfo->dtype[0] = H5T_NATIVE_DOUBLE; dtsinfo->dtype[1] = H5T_NATIVE_DOUBLE; dtsinfo->dtype[2] = H5T_NATIVE_DOUBLE; dtsinfo->dtype[3] = H5T_NATIVE_FLOAT; dtsinfo->dtype[4] = H5T_NATIVE_FLOAT; dtsinfo->dtype[5] = H5T_NATIVE_CHAR; for (i = 0; i < 6; i++) dtsinfo->fieldname[i] = (char *)calloc(64, sizeof(char)); strcpy(dtsinfo->fieldname[0],"Time"); strcpy(dtsinfo->fieldname[1],"Longitude"); strcpy(dtsinfo->fieldname[2],"Latitude"); strcpy(dtsinfo->fieldname[3],"Rainfall"); strcpy(dtsinfo->fieldname[4],"Temperature"); strcpy(dtsinfo->fieldname[5],"ID"); dtsinfo->dims[0][0] = 1; dtsinfo->dims[1][0] = 1; dtsinfo->dims[2][0] = 1; dtsinfo->dims[3][0] = 1; dtsinfo->dims[4][0] = 1; dtsinfo->dims[5][0] = 8; dtsinfo->datasize = (size_t)sizeof(InputData5); status = HE5_PTdeflevel(PTid, "Measurements", dtsinfo); printf("Status returned by HE5_PTdeflevel() : %d \n", status); for (i = 0; i < 6; i++) free(dtsinfo->fieldname[i]); free(dtsinfo); status = HE5_PTdeflinkage(PTid, "Description", "Measurements", "ID"); printf("Status returned by HE5_PTdeflinkage() : %d \n", status); HE5_PTdetach(PTid); HE5_PTclose(ptfid); } else { printf("File ID returned by HE5_PTopen() : %ld \n", (long) ptfid); } return 0; } hdf-eos5-2.0/samples/he5_pt_definelevelsF_32.f000077500000000000000000000160721507520047200211360ustar00rootroot00000000000000 program he5_pt_definelevelsF_32 implicit none include 'hdfeos5.inc' integer status integer ptfid integer ptid integer he5_ptopen integer he5_ptattach integer he5_ptdeflevel integer he5_ptdeflinkage integer he5_ptdetach integer he5_ptclose integer rank_1(3) integer rank_2(5) integer rank_3(4) integer rank_4(4) integer rank_5(6) integer dtype_1(3) integer dtype_2(5) integer dtype_3(4) integer dtype_4(4) integer dtype_5(6) integer array_1(3) integer array_2(5) integer array_3(4) integer array_4(4) integer array_5(6) integer*4 dims_1(3,1) integer*4 dims_2(5,1) integer*4 dims_3(4,1) integer*4 dims_4(4,1) integer*4 dims_5(6,1) character*240 fieldlist1 character*240 fieldlist2 character*240 fieldlist3 character*240 fieldlist4 character*240 fieldlist5 character*80 levelname character*20 parent character*20 child character*20 linkfield c Open the HDF point file, "point.he5" c ----------------------------------- ptfid = he5_ptopen('point.he5',HE5F_ACC_RDWR) write(*,*) 'File ID returned by he5_ptopen(): ',ptfid c Read Simple Point c ----------------- ptid = HE5_PTattach(ptfid, "Simple Point") write(*,*) 'Point ID returned by he5_ptattach(): ',ptid c Populate input information structure c ------------------------------------ levelname = 'Sensor' rank_1(1) = 1 rank_1(2) = 1 rank_1(3) = 1 fieldlist1 = 'Time,Concentration,Species' dtype_1(1) = HE5T_NATIVE_DOUBLE dtype_1(2) = HE5T_NATIVE_FLOAT dtype_1(3) = HE5T_NATIVE_CHAR array_1(1) = 0 array_1(2) = 1 array_1(3) = 1 dims_1(1,1) = 1 dims_1(2,1) = 4 dims_1(3,1) = 8 status = he5_ptdeflevel(ptid, levelname, rank_1, fieldlist1, 1dims_1, dtype_1, array_1) write(*,*) 'Status returned by he5_ptdeflevel(): ',status c Close out the point interface c ----------------------------- status = he5_ptdetach(ptid) write(*,*) 'Status returned by he5_ptdetach(): ',status c Read Fixed Buoy Point c --------------------- ptid = HE5_PTattach(ptfid, "FixedBuoy Point") write(*,*) 'Point ID returned by he5_ptattach(): ',ptid c Populate input information structure c ------------------------------------ levelname = 'Desc-Loc' rank_2(1) = 1 rank_2(2) = 1 rank_2(3) = 1 rank_2(4) = 1 rank_2(5) = 1 fieldlist2 = 'Label,Longitude,Latitude,DeployDate,ID' dtype_2(1) = HE5T_NATIVE_CHAR dtype_2(2) = HE5T_NATIVE_DOUBLE dtype_2(3) = HE5T_NATIVE_DOUBLE dtype_2(4) = HE5T_NATIVE_INT dtype_2(5) = HE5T_NATIVE_CHAR array_2(1) = 1 array_2(2) = 0 array_2(3) = 0 array_2(4) = 0 array_2(5) = 1 dims_2(1,1) = 8 dims_2(2,1) = 1 dims_2(3,1) = 1 dims_2(4,1) = 1 dims_2(5,1) = 8 status = he5_ptdeflevel(ptid, levelname, rank_2, fieldlist2, 1dims_2, dtype_2, array_2) write(*,*) 'Status returned by he5_ptdeflevel(): ',status c Populate input information structure c ------------------------------------ levelname = 'Observations' rank_3(1) = 1 rank_3(2) = 1 rank_3(3) = 1 rank_3(4) = 1 fieldlist3 = 'Time,Rainfall,Temperature,ID' dtype_3(1) = HE5T_NATIVE_DOUBLE dtype_3(2) = HE5T_NATIVE_FLOAT dtype_3(3) = HE5T_NATIVE_FLOAT dtype_3(4) = HE5T_NATIVE_CHAR array_3(1) = 0 array_3(2) = 0 array_3(3) = 0 array_3(4) = 1 dims_3(1,1) = 1 dims_3(2,1) = 1 dims_3(3,1) = 1 dims_3(4,1) = 8 status = he5_ptdeflevel(ptid, levelname, rank_3, fieldlist3, 1dims_3, dtype_3, array_3) write(*,*) 'Status ID returned by he5_ptdeflevel(): ',status parent = 'Desc-Loc' child = 'Observations' linkfield = 'ID' status = he5_ptdeflinkage(ptid, parent, child, linkfield) write(*,*) 'Status ID returned by he5_ptdeflinkage(): ',status c Close out the point interface c ----------------------------- status = he5_ptdetach(ptid) write(*,*) 'Status returned by he5_ptdetach(): ',status c Read Floating Buoy Point c --------------------- ptid = HE5_PTattach(ptfid, "FloatBuoy Point") write(*,*) 'Point ID returned by he5_ptattach(): ',ptid c Populate input information structure c ------------------------------------ levelname = 'Description' rank_4(1) = 1 rank_4(2) = 1 rank_4(3) = 1 rank_4(4) = 1 fieldlist4 = 'Label,DeployDate,Weight,ID' dtype_4(1) = HE5T_NATIVE_CHAR dtype_4(2) = HE5T_NATIVE_INT dtype_4(3) = HE5T_NATIVE_INT dtype_4(4) = HE5T_NATIVE_CHAR array_4(1) = 1 array_4(2) = 0 array_4(3) = 0 array_4(4) = 1 dims_4(1,1) = 8 dims_4(2,1) = 1 dims_4(3,1) = 1 dims_4(4,1) = 8 status = he5_ptdeflevel(ptid, levelname, rank_4, fieldlist4, 1dims_4, dtype_4, array_4) write(*,*) 'Status returned by he5_ptdeflevel(): ',status c Populate input information structure c ------------------------------------ levelname = 'Measurements' rank_5(1) = 1 rank_5(2) = 1 rank_5(3) = 1 rank_5(4) = 1 rank_5(5) = 1 rank_5(6) = 1 fieldlist5 = 'Time,Longitude,Latitude,Rainfall,Temperature,ID' dtype_5(1) = HE5T_NATIVE_DOUBLE dtype_5(2) = HE5T_NATIVE_DOUBLE dtype_5(3) = HE5T_NATIVE_DOUBLE dtype_5(4) = HE5T_NATIVE_FLOAT dtype_5(5) = HE5T_NATIVE_FLOAT dtype_5(6) = HE5T_NATIVE_CHAR array_5(1) = 0 array_5(2) = 0 array_5(3) = 0 array_5(4) = 0 array_5(5) = 0 array_5(6) = 1 dims_5(1,1) = 1 dims_5(2,1) = 1 dims_5(3,1) = 1 dims_5(4,1) = 1 dims_5(5,1) = 1 dims_5(6,1) = 8 status = he5_ptdeflevel(ptid, levelname, rank_5, fieldlist5, 1dims_5, dtype_5, array_5) write(*,*) 'Status returned by he5_ptdeflevel(): ',status parent = 'Description' child = 'Measurements' linkfield = 'ID' status = he5_ptdeflinkage(ptid, parent, child, linkfield) write(*,*) 'Status ID returned by he5_ptdeflinkage(): ',status c Close out the point interface c ----------------------------- status = he5_ptdetach(ptid) write(*,*) 'Status returned by he5_ptdetach(): ',status status = he5_ptclose(ptfid) write(*,*) 'Status returned by he5_ptclose(): ',status stop end hdf-eos5-2.0/samples/he5_pt_definelevelsF_64.f000077500000000000000000000160411507520047200211370ustar00rootroot00000000000000 program he5_pt_definelevelsF_64 implicit none include 'hdfeos5.inc' integer status integer ptfid integer ptid integer he5_ptopen integer he5_ptattach integer he5_ptdeflevel integer he5_ptdeflinkage integer he5_ptdetach integer he5_ptclose integer rank_1(3) integer rank_2(5) integer rank_3(4) integer rank_4(4) integer rank_5(6) integer dtype_1(3) integer dtype_2(5) integer dtype_3(4) integer dtype_4(4) integer dtype_5(6) integer array_1(3) integer array_2(5) integer array_3(4) integer array_4(4) integer array_5(6) integer*8 dims_1(3,1) integer*8 dims_2(5,1) integer*8 dims_3(4,1) integer*8 dims_4(4,1) integer*8 dims_5(6,1) character*240 fieldlist1 character*240 fieldlist2 character*240 fieldlist3 character*240 fieldlist4 character*240 fieldlist5 character*80 levelname character*20 parent character*20 child character*20 linkfield c Open the HDF-EOS point file, "point.he5" c ---------------------------------------- ptfid = he5_ptopen('point.he5',HE5F_ACC_RDWR) write(*,*) 'File ID returned by he5_ptopen(): ',ptfid c Read Simple Point c ----------------- ptid = HE5_PTattach(ptfid, "Simple Point") write(*,*) 'Point ID returned by he5_ptattach(): ',ptid c Populate input information structure c ------------------------------------ levelname = 'Sensor' rank_1(1) = 1 rank_1(2) = 1 rank_1(3) = 1 fieldlist1 = 'Time,Concentration,Species' dtype_1(1) = HE5T_NATIVE_DOUBLE dtype_1(2) = HE5T_NATIVE_FLOAT dtype_1(3) = HE5T_NATIVE_CHAR array_1(1) = 0 array_1(2) = 1 array_1(3) = 1 dims_1(1,1) = 1 dims_1(2,1) = 4 dims_1(3,1) = 8 status = he5_ptdeflevel(ptid, levelname, rank_1, fieldlist1, 1dims_1, dtype_1, array_1) write(*,*) 'Status returned by he5_ptdeflevel(): ',status c.....Close out the point interface status = he5_ptdetach(ptid) write(*,*) 'Status returned by he5_ptdetach(): ',status c Read Fixed Buoy Point c --------------------- ptid = HE5_PTattach(ptfid, "FixedBuoy Point") write(*,*) 'Point ID returned by he5_ptattach(): ',ptid c Populate input information structure c ------------------------------------ levelname = 'Desc-Loc' rank_2(1) = 1 rank_2(2) = 1 rank_2(3) = 1 rank_2(4) = 1 rank_2(5) = 1 fieldlist2 = 'Label,Longitude,Latitude,DeployDate,ID' dtype_2(1) = HE5T_NATIVE_CHAR dtype_2(2) = HE5T_NATIVE_DOUBLE dtype_2(3) = HE5T_NATIVE_DOUBLE dtype_2(4) = HE5T_NATIVE_INT dtype_2(5) = HE5T_NATIVE_CHAR array_2(1) = 1 array_2(2) = 0 array_2(3) = 0 array_2(4) = 0 array_2(5) = 1 dims_2(1,1) = 8 dims_2(2,1) = 1 dims_2(3,1) = 1 dims_2(4,1) = 1 dims_2(5,1) = 8 status = he5_ptdeflevel(ptid, levelname, rank_2, fieldlist2, 1dims_2, dtype_2, array_2) write(*,*) 'Status returned by he5_ptdeflevel(): ',status c Populate input information structure c ------------------------------------ levelname = 'Observations' rank_3(1) = 1 rank_3(2) = 1 rank_3(3) = 1 rank_3(4) = 1 fieldlist3 = 'Time,Rainfall,Temperature,ID' dtype_3(1) = HE5T_NATIVE_DOUBLE dtype_3(2) = HE5T_NATIVE_FLOAT dtype_3(3) = HE5T_NATIVE_FLOAT dtype_3(4) = HE5T_NATIVE_CHAR array_3(1) = 0 array_3(2) = 0 array_3(3) = 0 array_3(4) = 1 dims_3(1,1) = 1 dims_3(2,1) = 1 dims_3(3,1) = 1 dims_3(4,1) = 8 status = he5_ptdeflevel(ptid, levelname, rank_3, fieldlist3, 1dims_3, dtype_3, array_3) write(*,*) 'Status ID returned by he5_ptdeflevel(): ',status parent = 'Desc-Loc' child = 'Observations' linkfield = 'ID' status = he5_ptdeflinkage(ptid, parent, child, linkfield) write(*,*) 'Status ID returned by he5_ptdeflinkage(): ',status c.....Close out the point interface status = he5_ptdetach(ptid) write(*,*) 'Status returned by he5_ptdetach(): ',status c Read Floating Buoy Point c --------------------- ptid = HE5_PTattach(ptfid, "FloatBuoy Point") write(*,*) 'Point ID returned by he5_ptattach(): ',ptid c Populate input information structure c ------------------------------------ levelname = 'Description' rank_4(1) = 1 rank_4(2) = 1 rank_4(3) = 1 rank_4(4) = 1 fieldlist4 = 'Label,DeployDate,Weight,ID' dtype_4(1) = HE5T_NATIVE_CHAR dtype_4(2) = HE5T_NATIVE_INT dtype_4(3) = HE5T_NATIVE_INT dtype_4(4) = HE5T_NATIVE_CHAR array_4(1) = 1 array_4(2) = 0 array_4(3) = 0 array_4(4) = 1 dims_4(1,1) = 8 dims_4(2,1) = 1 dims_4(3,1) = 1 dims_4(4,1) = 8 status = he5_ptdeflevel(ptid, levelname, rank_4, fieldlist4, 1dims_4, dtype_4, array_4) write(*,*) 'Status returned by he5_ptdeflevel(): ',status c Populate input information structure c ------------------------------------ levelname = 'Measurements' rank_5(1) = 1 rank_5(2) = 1 rank_5(3) = 1 rank_5(4) = 1 rank_5(5) = 1 rank_5(6) = 1 fieldlist5 = 'Time,Longitude,Latitude,Rainfall,Temperature,ID' dtype_5(1) = HE5T_NATIVE_DOUBLE dtype_5(2) = HE5T_NATIVE_DOUBLE dtype_5(3) = HE5T_NATIVE_DOUBLE dtype_5(4) = HE5T_NATIVE_FLOAT dtype_5(5) = HE5T_NATIVE_FLOAT dtype_5(6) = HE5T_NATIVE_CHAR array_5(1) = 0 array_5(2) = 0 array_5(3) = 0 array_5(4) = 0 array_5(5) = 0 array_5(6) = 1 dims_5(1,1) = 1 dims_5(2,1) = 1 dims_5(3,1) = 1 dims_5(4,1) = 1 dims_5(5,1) = 1 dims_5(6,1) = 8 status = he5_ptdeflevel(ptid, levelname, rank_5, fieldlist5, 1dims_5, dtype_5, array_5) write(*,*) 'Status returned by he5_ptdeflevel(): ',status parent = 'Description' child = 'Measurements' linkfield = 'ID' status = he5_ptdeflinkage(ptid, parent, child, linkfield) write(*,*) 'Status ID returned by he5_ptdeflinkage(): ',status c.....Close out the point interface status = he5_ptdetach(ptid) write(*,*) 'Status returned by he5_ptdetach(): ',status status = he5_ptclose(ptfid) write(*,*) 'Status returned by he5_ptclose(): ',status stop end hdf-eos5-2.0/samples/he5_pt_readattrs.c000077500000000000000000000072771507520047200200540ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include int main() { herr_t status = FAIL; int i, attr; int attr1[5], attr2[5]; hid_t ptfid = FAIL, PTid = FAIL; hid_t *nt = (hid_t *)NULL; long nattr, strbufsize; hsize_t sz; char attrlist[256] ; /* Open the HDF-EOS file, "Point.h5" */ /* --------------------------------- */ ptfid = HE5_PTopen("Point.h5", H5F_ACC_RDONLY); printf("File ID returned by HE5_PTopen() : %ld \n", (long) ptfid); PTid = HE5_PTattach(ptfid, "FixedBuoy Point"); printf("Point ID returned by HE5_PTattach() : %ld \n", (long) PTid); nt = (hid_t *)calloc(1, sizeof(hid_t)); /* Global attributes */ /* ---------------- */ printf("Global Attribute: \n"); status = HE5_PTreadattr(PTid, "GlobalAttribute_int", &attr); printf("Status returned by HE5_PTreadattr() : %d \n", status); printf("Attribute value: %d\n", attr); nattr = HE5_PTinqattrs(PTid, NULL, &strbufsize); printf("Number of attributes: %li\n", nattr); printf("Size (in bytes) of attribute list: %li\n", strbufsize); nattr = HE5_PTinqattrs(PTid, attrlist, &strbufsize); printf("Attribute list: %s\n", attrlist); status = HE5_PTattrinfo(PTid, "GlobalAttr_Integer", nt, &sz); printf("Data type of attribute: %d\n", (int)*nt); printf("Number of attribute elements: %d\n", (int)sz); /* Group attributes */ /* ---------------- */ printf("\n"); printf("Group Attribute: \n"); status = HE5_PTreadgrpattr(PTid, "GroupAttribute", attr1); printf("Status returned by HE5_PTreadgrpattr() : %d \n", status); printf("Attribute values: \n"); for (i = 0; i < 5; i++) { printf("\t\t %d \n", attr1[i]); } nattr = HE5_PTinqgrpattrs(PTid, NULL, &strbufsize); printf("Number of attributes: %li\n", nattr); printf("Size (in bytes) of attribute list: %li\n", strbufsize); nattr = HE5_PTinqgrpattrs(PTid, attrlist, &strbufsize); printf("Attribute list: %s\n", attrlist); status = HE5_PTgrpattrinfo(PTid, "GroupAttribute", nt, &sz); printf("Data type of attribute: %d\n",(int)*nt); printf("Number of attribute elements: %d\n", (int)sz); /* Local attributes */ /* ---------------- */ printf("\n"); printf("Local Attribute: \n"); status = HE5_PTreadlocattr(PTid, "Observations", "LocalAttribute", attr2); printf("Status returned by HE5_PTreadlocattr() : %d \n", status); printf("Attribute values: \n"); for (i = 0; i < 5; i++) { printf("\t\t %d \n", attr2[i]); } nattr = HE5_PTinqlocattrs(PTid, "Observations", NULL, &strbufsize); printf("Number of attributes: %li\n", nattr); printf("Size (in bytes) of attribute list: %li\n", strbufsize); nattr = HE5_PTinqlocattrs(PTid, "Observations", attrlist, &strbufsize); printf("Attribute list: %s\n", attrlist); status = HE5_PTlocattrinfo(PTid, "Observations", "LocalAttribute", nt, &sz); printf("Data type of attribute: %d\n", (int)*nt); printf("Number of attribute elements: %d\n", (int)sz); free(nt); status = HE5_PTdetach(PTid); printf("Status returned by HE5_PTdetach() : %d \n", status); status = HE5_PTclose(ptfid); printf("Status returned by HE5_PTclose() : %d \n", status); return 0; } hdf-eos5-2.0/samples/he5_pt_readattrsF_32.f000077500000000000000000000112501507520047200204530ustar00rootroot00000000000000 program he5_pt_readattrsF_32 implicit none include 'hdfeos5.inc' integer status integer ptfid integer ptid integer he5_ptopen integer he5_ptattach integer he5_ptinqattrs integer he5_ptinqgrpattrs integer he5_ptinqlocattrs integer he5_ptattrinfo integer he5_ptgrpattrinfo integer he5_ptlocattrinfo integer he5_ptreadattr integer he5_ptreadgrpattr integer he5_ptreadlocattr integer he5_ptdetach integer he5_ptclose integer attr integer attr1(5) integer attr2(5) integer ntype integer*4 sz integer*4 strbufsize integer*4 nattr real*4 flt character*1 null_char_0 character*80 attrname character*80 levelname character*240 attrlist null_char_0 = '0' c Open the HDF-EOS point file, "point.he5" c ---------------------------------------- ptfid = he5_ptopen('point.he5',HE5F_ACC_RDONLY) write(*,*) 'File ID returned by he5_ptopen(): ',ptfid c Read FixedBuoy Point c -------------------- ptid = he5_ptattach(ptfid, "FixedBuoy Point") write(*,*) 'Point ID returned by he5_ptattach(): ',ptid c Global Attributes c ----------------- attrname = 'GlobalAttribute_int' print *,'Global Attribute: ' status = he5_ptreadattr(ptid,attrname,attr) write(*,*) 'Status returned by he5_ptreadattr(): ',status print *,'Attribute value: ',attr nattr = he5_ptinqattrs(ptid,null_char_0,strbufsize) print *,'Number of attributes: ',nattr print *,'Size (in bytes) of attribute list: ',strbufsize nattr = he5_ptinqattrs(ptid,attrlist,strbufsize) print *,'Number of attributes: ',nattr print *,'Attribute list: ',attrlist attrname = 'GlobalAttribute_int' status = he5_ptattrinfo(ptid,attrname,ntype,sz) write(*,*) 'Status returned by he5_ptattrinfo(): ',status print *,'Data type of attribute: ',ntype print *,'Number of attribute elements: ',sz print *,' ' attrname = 'GlobalAttribute_float' print *,'attrname: ',attrname status = he5_ptattrinfo(ptid,attrname,ntype,sz) write(*,*) 'Status returned by he5_ptattrinfo(): ',status print *,'Data type of attribute: ',ntype print *,'Number of attribute elements: ',sz status = he5_ptreadattr(ptid,attrname,flt) write(*,*) 'Status returned by he5_ptreadattr(): ',status print *,'Attribute value: ',flt attrname = 'GroupAttribute' c Global Attributes c ----------------- print *, 'Group Attribute:' status = he5_ptreadgrpattr(ptid,attrname,attr1) print *,'Status returned by he5_ptreadgrpattr(): ',status print *,'Attribute values: ',attr1 nattr = he5_ptinqgrpattrs(ptid,null_char_0,strbufsize) print *,'Number of attributes: ',nattr print *,'Size (in bytes) of attribute list: ',strbufsize nattr = he5_ptinqgrpattrs(ptid,attrlist,strbufsize) print *,'Attribute list: ',attrlist attrname = 'GroupAttribute' status = he5_ptgrpattrinfo(ptid,attrname,ntype,sz) write(*,*) 'Status returned by he5_ptgrpattrinfo(): ',status print *,'Data type of attribute: ',ntype print *,'Number of attribute elements: ',sz c Local Attributes c ---------------- print *, 'Local Attribute:' attrname = 'LocalAttribute' levelname = 'Observations' status = he5_ptreadlocattr(ptid,levelname,attrname,attr2) print *,'Status returned by he5_ptreadlocattr(): ',status print *,'Attribute values: ',attr2 nattr = he5_ptinqlocattrs(ptid,levelname,null_char_0,strbufsize) print *,'Status returned by he5_ptinqlocattrs(): ',status print *,'Number of attributes: ',nattr print *,'Size (in bytes) of attribute list: ',strbufsize nattr = he5_ptinqlocattrs(ptid,levelname,attrlist,strbufsize) print *,'Attribute list: ',attrlist status = he5_ptlocattrinfo(ptid,levelname,attrname,ntype,sz) print *,'Data type of attribute: ',ntype print *,'Number of attribute elements: ',sz c.....Close out the point interface status = he5_ptdetach(ptid) write(*,*) 'Status returned by he5_ptdetach(): ',status status = he5_ptclose(ptfid) write(*,*) 'Status returned by he5_ptclose(): ',status stop end hdf-eos5-2.0/samples/he5_pt_readattrsF_64.f000077500000000000000000000112521507520047200204620ustar00rootroot00000000000000 program he5_pt_readattrsF_64 implicit none include 'hdfeos5.inc' integer status integer ptfid integer ptid integer he5_ptopen integer he5_ptattach integer he5_ptinqattrs integer he5_ptinqgrpattrs integer he5_ptinqlocattrs integer he5_ptattrinfo integer he5_ptgrpattrinfo integer he5_ptlocattrinfo integer he5_ptreadattr integer he5_ptreadgrpattr integer he5_ptreadlocattr integer he5_ptdetach integer he5_ptclose integer attr integer attr1(5) integer attr2(5) integer ntype integer*8 sz integer*8 strbufsize integer*8 nattr real*4 flt character*1 null_char_0 character*80 attrname character*80 levelname character*240 attrlist null_char_0 = '0' c Open the HDF-EOS point file, "point.he5" c ---------------------------------------- ptfid = he5_ptopen('point.he5',HE5F_ACC_RDONLY) write(*,*) 'File ID returned by he5_ptopen(): ',ptfid c Read FixedBuoy Point c -------------------- ptid = he5_ptattach(ptfid, "FixedBuoy Point") write(*,*) 'Point ID returned by he5_ptattach(): ',ptid c Global Attributes c ----------------- attrname = 'GlobalAttribute_int' print *,'Global Attribute: ' status = he5_ptreadattr(ptid,attrname,attr) write(*,*) 'Status returned by he5_ptreadattr(): ',status print *,'Attribute value: ',attr nattr = he5_ptinqattrs(ptid,null_char_0,strbufsize) print *,'Number of attributes: ',nattr print *,'Size (in bytes) of attribute list: ',strbufsize nattr = he5_ptinqattrs(ptid,attrlist,strbufsize) print *,'Number of attributes: ',nattr print *,'Attribute list: ',attrlist attrname = 'GlobalAttribute_int' status = he5_ptattrinfo(ptid,attrname,ntype,sz) write(*,*) 'Status returned by he5_ptattrinfo(): ',status print *,'Data type of attribute: ',ntype print *,'Number of attribute elements: ',sz print *,' ' attrname = 'GlobalAttribute_float' print *,'attrname: ',attrname status = he5_ptattrinfo(ptid,attrname,ntype,sz) write(*,*) 'Status returned by he5_ptattrinfo(): ',status print *,'Data type of attribute: ',ntype print *,'Number of attribute elements: ',sz status = he5_ptreadattr(ptid,attrname,flt) write(*,*) 'Status returned by he5_ptreadattr(): ',status print *,'Attribute value: ',flt attrname = 'GroupAttribute' c Global Attributes c ----------------- print *, 'Group Attribute:' status = he5_ptreadgrpattr(ptid,attrname,attr1) print *,'Status returned by he5_ptreadgrpattr(): ',status print *,'Attribute values: ',attr1 nattr = he5_ptinqgrpattrs(ptid,null_char_0,strbufsize) print *,'Number of attributes: ',nattr print *,'Size (in bytes) of attribute list: ',strbufsize nattr = he5_ptinqgrpattrs(ptid,attrlist,strbufsize) print *,'Attribute list: ',attrlist attrname = 'GroupAttribute' status = he5_ptgrpattrinfo(ptid,attrname,ntype,sz) write(*,*) 'Status returned by he5_ptgrpattrinfo(): ',status print *,'Data type of attribute: ',ntype print *,'Number of attribute elements: ',sz c Local Attributes c ---------------- print *, 'Local Attribute:' attrname = 'LocalAttribute' levelname = 'Observations' status = he5_ptreadlocattr(ptid,levelname,attrname,attr2) print *,'Status returned by he5_ptreadlocattr(): ',status print *,'Attribute values: ',attr2 nattr = he5_ptinqlocattrs(ptid,levelname,null_char_0,strbufsize) print *,'Status returned by he5_ptinqlocattrs(): ',status print *,'Number of attributes: ',nattr print *,'Size (in bytes) of attribute list: ',strbufsize nattr = he5_ptinqlocattrs(ptid,levelname,attrlist,strbufsize) print *,'Attribute list: ',attrlist status = he5_ptlocattrinfo(ptid,levelname,attrname,ntype,sz) print *,'Data type of attribute: ',ntype print *,'Number of attribute elements: ',sz c.....Close out the point interface status = he5_ptdetach(ptid) write(*,*) 'Status returned by he5_ptdetach(): ',status status = he5_ptclose(ptfid) write(*,*) 'Status returned by he5_ptclose(): ',status stop end hdf-eos5-2.0/samples/he5_pt_readdata.c000077500000000000000000000135521507520047200176210ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include int main() { herr_t status = FAIL;/* return status variable */ hid_t ptfid = FAIL; /* HDFEOS Point file ID */ hid_t PTid = FAIL; /* Point structure ID */ int i, j; /* Loop indices */ int nflds = FAIL;/* Number of level fields */ int IntAttr; /* Integer attribute value */ long nattr; /* Number of attributes */ long strbufsize; /* Size of attribute list buffer */ hsize_t nrecs = 0; /* Number of records in a level */ size_t datasize = 0;/* Size (in bytes) of data to read */ HE5_CmpDTSinfo level; /* Level information data structure */ HE5_CmpDTSinfo inInfo; /* Input information data structure */ HE5_CmpDTSinfo inInfo2; /* Input information data structure */ /* User-defined structure to read level data to */ /* -------------------------------------------- */ typedef struct { double time; float con[4]; char spec[8]; } Sensor; Sensor s[50]; double s1[50]; /* Open the HDF-EOS file, "Point.h5" */ /* --------------------------------- */ ptfid = HE5_PTopen("Point.h5", H5F_ACC_RDONLY); printf("File ID returned by HE5_PTopen() : %ld \n", (long) ptfid); /* Read Simple Point */ /* ----------------- */ PTid = HE5_PTattach(ptfid, "Simple Point"); printf("Point ID returned by HE5_PTattach() : %ld \n", (long) PTid); /* Get level information */ /* --------------------- */ status = HE5_PTlevelinfo(PTid, 0, &level); printf("Status returned by HE5_PTlevelinfo() : %d \n", status); nflds = level.nfields; printf("Number of fields in level: %d \n", nflds); for (i = 0; i < nflds; i++) { printf("Field name: %s \n", level.fieldname[i]); printf("Field rank: %d \n", level.rank[i]); printf("Field type ID: %ld \n", (long) level.dtype[i]); for (j = 0; j < level.rank[i]; j++) printf("Field dims: %d \n", (int)level.dims[i][j]); printf("Field class: %d \n", level.dclass[i]); } /* Get the number of records in level */ /* ---------------------------------- */ nrecs = HE5_PTnrecs(PTid, 0); printf("Number of records in level: %lu \n", (unsigned long)nrecs); /* Set the data size */ /* ----------------- */ datasize = (size_t)sizeof(Sensor); /* Populate input information structure */ /* ------------------------------------ */ inInfo.nfields = nflds; inInfo.datasize = (size_t)sizeof(Sensor); inInfo.rank[0] = 1; inInfo.rank[1] = 1; inInfo.rank[2] = 1; inInfo.offset[0] = HOFFSET(Sensor, time); inInfo.offset[1] = HOFFSET(Sensor, con); inInfo.offset[2] = HOFFSET(Sensor, spec); inInfo.dtype[0] = H5T_NATIVE_DOUBLE; inInfo.dtype[1] = H5T_NATIVE_FLOAT; inInfo.dtype[2] = H5T_NATIVE_CHAR; inInfo.dclass[0] = H5T_NO_CLASS; inInfo.dclass[1] = H5T_NO_CLASS; inInfo.dclass[2] = H5T_NO_CLASS; inInfo.dims[0][0] = 1; inInfo.dims[1][0] = 4; inInfo.dims[2][0] = 8; inInfo.array[0] = 0; inInfo.array[1] = 1; inInfo.array[2] = 1; for( i = 0; i < nflds; i++) { inInfo.fieldname[i] = (char *)calloc(64, sizeof(char)); strcpy(inInfo.fieldname[i], level.fieldname[i]); } /* Read the level data */ /* ------------------- */ status = HE5_PTreadlevel(PTid, 0, &inInfo, &datasize, s); printf("Status returned by HE5_PTreadlevel() : %d \n", status); for (i = 0; i < nrecs; i++) printf("%lf %f %f %f %f %s\n", s[i].time, s[i].con[0], s[i].con[1], s[i].con[2], s[i].con[3], s[i].spec); /* Release memory */ /* -------------- */ for (i = 0; i < nflds; i++) if (inInfo.fieldname[i] != NULL) free(inInfo.fieldname[i]); /* Set the data size */ /* ----------------- */ datasize = (size_t)sizeof(double); /* Populate input information structure */ /* ------------------------------------ */ inInfo2.nfields = 1; inInfo2.datasize = (size_t)sizeof(double); inInfo2.rank[0] = 1; inInfo2.offset[0] = 0; inInfo2.dtype[0] = H5T_NATIVE_DOUBLE; inInfo2.dclass[0] = H5T_FLOAT; inInfo2.dims[0][0] = 1; inInfo2.array[0] = 0; inInfo2.fieldname[0] = (char *)calloc(64, sizeof(char)); strcpy(inInfo2.fieldname[0], level.fieldname[0]); /* Read the level data */ /* ------------------- */ status = HE5_PTreadlevel(PTid, 0, &inInfo2, &datasize, s1); printf("Status returned by HE5_PTreadlevel() : %d \n", status); for (i = 0; i < nrecs; i++) printf("%lf \n", s1[i]); /* Release memory */ /* -------------- */ if (inInfo2.fieldname[0] != NULL) free(inInfo2.fieldname[0]); for (i = 0; i < nflds; i++) if(level.fieldname[i] != NULL) H5free_memory(level.fieldname[i]); status = HE5_PTdetach(PTid); printf("Status returned by HE5_PTdetach() : %d \n", status); PTid = HE5_PTattach(ptfid, "FixedBuoy Point"); printf("Point ID returned by HE5_PTattach() : %ld \n", (long) PTid); /* Read Fixed Buoy Point Attributes */ /* -------------------------------- */ nattr = HE5_PTinqattrs(PTid, NULL, &strbufsize); status = HE5_PTreadattr(PTid, "GlobalAttr_Integer", &IntAttr); printf("Status returned by HE5_PTreadattr() : %d \n", status); printf(" \n"); printf("Integer attribute value: %d\n", IntAttr); status = HE5_PTdetach(PTid); printf("Status returned by HE5_PTdetach() : %d \n", status); status = HE5_PTclose(ptfid); printf("Status returned by HE5_PTclose() : %d \n", status); return 0; } hdf-eos5-2.0/samples/he5_pt_readdataF_32.f000077500000000000000000000115371507520047200202370ustar00rootroot00000000000000 program he5_pt_readdataF_32 implicit none include 'hdfeos5.inc' integer status integer ptfid integer ptid integer he5_ptopen integer he5_ptattach integer he5_ptreadlevel integer he5_ptlevelinfo integer he5_ptnrecs integer he5_ptnlevels integer he5_ptnfields integer he5_ptc2fort integer he5_ptinqattrs integer he5_ptreadattr integer he5_ptdetach integer he5_ptclose integer i integer nflds integer level integer arr_rank integer datatype integer dtype(3) integer attr integer nrecs integer nlevels integer*4 dimens(2) integer*4 datasize integer*4 rank_tt(3) integer*4 offset_tt(3) integer*4 dtype_tt(3) integer*4 dim_sizes_tt(3) integer*4 nattr integer*4 strbufsize character*80 levelname character*80 fieldname(3) character*80 attrname character*240 fieldlist character*240 attrlist character*8 spec(15) real*4 con(4,15) real*4 outcon(15,4) real*8 time(15) c Open the HDF-EOS point file, "point.he5" c ---------------------------------------- ptfid = he5_ptopen('point.he5',HE5F_ACC_RDONLY) write(*,*) 'File ID returned by he5_ptopen(): ',ptfid c Read Simple Point c ----------------- ptid = he5_ptattach(ptfid, "Simple Point") write(*,*) 'Point ID returned by he5_ptattach(): ',ptid c Get level information c --------------------- level = 0 status = he5_ptlevelinfo(ptid, level, levelname, rank_tt, 1fieldlist, dim_sizes_tt, datasize, offset_tt, dtype_tt) write(*,*) 'Status returned by he5_ptlevelinfo(): ',status c Get the number of records in level c ---------------------------------- level = 0 nrecs = he5_ptnrecs(ptid, level) print *,'Number of records in level: ', nrecs nlevels = he5_ptnlevels(ptid) print *,'Number of levels in Point data set: ', nlevels nflds = he5_ptnfields(ptid, level, fieldlist, strbufsize) print *,'Number of fields in level: ', nflds c Populate input information structure c ------------------------------------ dtype(1) = HE5T_NATIVE_DOUBLE dtype(2) = HE5T_NATIVE_FLOAT dtype(3) = HE5T_NATIVE_CHAR c Read the level data and print out c --------------------------------- fieldname(1) = 'Time' status = he5_ptreadlevel(ptid, 0, fieldname(1), 1dtype(1), time) write(*,*) 'Status returned by he5_ptreadlevel(): ',status write(*,*) 'time array: ' do i = 1,nrecs print *,time(i) end do fieldname(2) = 'Concentration' status = he5_ptreadlevel(ptid, 0, fieldname(2), 1dtype(2), con) write(*,*) 'Status returned by he5_ptreadlevel(): ',status c Convert 'C' array to Fortran order c ---------------------------------- dimens(1) = 15 dimens(2) = 4 arr_rank = 2 datatype = HE5T_NATIVE_FLOAT status = he5_ptc2fort(dimens, arr_rank, datatype, con, 1outcon) write(*,*) 'Status returned by he5_ptc2fort(): ',status write(*,*) 'outcon array: ' do i = 1,nrecs print *,outcon(i,1),outcon(i,2),outcon(i,3),outcon(i,4) end do fieldname(3) = 'Species' status = he5_ptreadlevel(ptid, 0, fieldname(3), 1dtype(3), spec) write(*,*) 'Status returned by he5_ptreadlevel(): ',status write(*,*) 'spec array: ' do i = 1,nrecs print *,spec(i) end do c.....Close out the point interface status = he5_ptdetach(ptid) write(*,*) 'Status returned by he5_ptdetach(): ',status c Read FixedBuoy Point c -------------------- ptid = he5_ptattach(ptfid, "FixedBuoy Point") write(*,*) 'Point ID returned by he5_ptattach(): ',ptid c Global Attributes c ----------------- attrname = 'GlobalAttribute_int' print *,' ' print *,'Global Attribute: ' nattr = he5_ptinqattrs(ptid,attrlist,strbufsize) print *,'Number of attributes: ',nattr print *,'Attribute list: ',attrlist print *,'Size (in bytes) of attribute list: ',strbufsize status = he5_ptreadattr(ptid,attrname,attr) write(*,*) 'Status returned by he5_ptreadattr(): ',status print *,'Attribute value: ',attr c.....Close out the point interface status = he5_ptdetach(ptid) write(*,*) 'Status returned by he5_ptdetach(): ',status status = he5_ptclose(ptfid) write(*,*) 'Status returned by he5_ptclose(): ',status stop end hdf-eos5-2.0/samples/he5_pt_readdataF_64.f000077500000000000000000000115411507520047200202370ustar00rootroot00000000000000 program he5_pt_readdataF_64 implicit none include 'hdfeos5.inc' integer status integer ptfid integer ptid integer he5_ptopen integer he5_ptattach integer he5_ptreadlevel integer he5_ptlevelinfo integer he5_ptnrecs integer he5_ptnlevels integer he5_ptnfields integer he5_ptc2fort integer he5_ptinqattrs integer he5_ptreadattr integer he5_ptdetach integer he5_ptclose integer i integer nflds integer level integer arr_rank integer datatype integer dtype(3) integer attr integer rank_tt(3) integer dtype_tt(3) integer nrecs integer nlevels integer*8 dimens(2) integer*8 datasize integer*8 offset_tt(3) integer*8 dim_sizes_tt(3) integer*8 nattr integer*8 strbufsize character*80 levelname character*80 fieldname(3) character*80 attrname character*240 fieldlist character*240 attrlist character*8 spec(15) real*4 con(4,15) real*4 outcon(15,4) real*8 time(15) c Open the HDF-EOS point file, "point.he5" c ---------------------------------------- ptfid = he5_ptopen('point.he5',HE5F_ACC_RDONLY) write(*,*) 'File ID returned by he5_ptopen(): ',ptfid c Read Simple Point c ----------------- ptid = he5_ptattach(ptfid, "Simple Point") write(*,*) 'Point ID returned by he5_ptattach(): ',ptid c Get level information c --------------------- level = 0 status = he5_ptlevelinfo(ptid, level, levelname, rank_tt, 1fieldlist, dim_sizes_tt, datasize, offset_tt, dtype_tt) write(*,*) 'Status returned by he5_ptlevelinfo(): ',status c Get the number of records in level c ---------------------------------- level = 0 nrecs = he5_ptnrecs(ptid, level) print *,'Number of records in level: ', nrecs nlevels = he5_ptnlevels(ptid) print *,'Number of levels in Point data set: ', nlevels nflds = he5_ptnfields(ptid, level, fieldlist, strbufsize) print *,'Number of fields in level: ', nflds c Populate input information structure c ------------------------------------ dtype(1) = HE5T_NATIVE_DOUBLE dtype(2) = HE5T_NATIVE_FLOAT dtype(3) = HE5T_NATIVE_CHAR c Read the level data and print out c --------------------------------- fieldname(1) = 'Time' status = he5_ptreadlevel(ptid, 0, fieldname(1), 1dtype(1), time) write(*,*) 'Status returned by he5_ptreadlevel(): ',status write(*,*) 'time array: ' do i = 1,nrecs print *,time(i) end do fieldname(2) = 'Concentration' status = he5_ptreadlevel(ptid, 0, fieldname(2), 1dtype(2), con) write(*,*) 'Status returned by he5_ptreadlevel(): ',status c Convert 'C' array to Fortran order c ---------------------------------- dimens(1) = 15 dimens(2) = 4 arr_rank = 2 datatype = HE5T_NATIVE_FLOAT status = he5_ptc2fort(dimens, arr_rank, datatype, con, 1outcon) write(*,*) 'Status returned by he5_ptc2fort(): ',status write(*,*) 'outcon array: ' do i = 1,nrecs print *,outcon(i,1),outcon(i,2),outcon(i,3),outcon(i,4) end do fieldname(3) = 'Species' status = he5_ptreadlevel(ptid, 0, fieldname(3), 1dtype(3), spec) write(*,*) 'Status returned by he5_ptreadlevel(): ',status write(*,*) 'spec array: ' do i = 1,nrecs print *,spec(i) end do c.....Close out the point interface status = he5_ptdetach(ptid) write(*,*) 'Status returned by he5_ptdetach(): ',status c Read FixedBuoy Point c -------------------- ptid = he5_ptattach(ptfid, "FixedBuoy Point") write(*,*) 'Point ID returned by he5_ptattach(): ',ptid c Global Attributes c ----------------- attrname = 'GlobalAttribute_int' print *,' ' print *,'Global Attribute: ' nattr = he5_ptinqattrs(ptid,attrlist,strbufsize) print *,'Number of attributes: ',nattr print *,'Attribute list: ',attrlist print *,'Size (in bytes) of attribute list: ',strbufsize status = he5_ptreadattr(ptid,attrname,attr) write(*,*) 'Status returned by he5_ptreadattr(): ',status print *,'Attribute value: ',attr c.....Close out the point interface status = he5_ptdetach(ptid) write(*,*) 'Status returned by he5_ptdetach(): ',status status = he5_ptclose(ptfid) write(*,*) 'Status returned by he5_ptclose(): ',status stop end hdf-eos5-2.0/samples/he5_pt_setup.c000077500000000000000000000026601507520047200172120ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ /* File name: he5_pt_setup.c */ /* -------------------------- */ #include int main() { herr_t status = FAIL; hid_t ptfid = FAIL; hid_t PTid1 = FAIL; hid_t PTid2 = FAIL; hid_t PTid3 = FAIL; /* * We first open the HDF-EOS point file, "Point.h5". Because this file * does not already exist, we use the H5F_ACC_TRUNC access code in the * open statement. The PTopen routine returns the point file id, ptfid, * which is used to identify the file in subsequent routines in the * library. */ ptfid = HE5_PTopen("Point.h5", H5F_ACC_TRUNC); PTid1 = HE5_PTcreate(ptfid, "Simple Point"); PTid2 = HE5_PTcreate(ptfid, "FixedBuoy Point"); PTid3 = HE5_PTcreate(ptfid, "FloatBuoy Point"); /* * We now close the point interface with the HE5_PTdetach routine. This step * is necessary to properly store the point information within the file. */ status = HE5_PTdetach(PTid1); status = HE5_PTdetach(PTid2); status = HE5_PTdetach(PTid3); /* * Finally, we close the swath file using the PTclose routine. This will * release the point file handles established by PTopen. */ status = HE5_PTclose(ptfid); return 0; } hdf-eos5-2.0/samples/he5_pt_setupF_32.f000077500000000000000000000043161507520047200176270ustar00rootroot00000000000000 program he5_pt_setupF_32 implicit none include 'hdfeos5.inc' integer status integer ptfid integer ptid1, ptid2, ptid3 integer he5_ptopen integer he5_ptcreate integer he5_ptdetach integer he5_ptclose c --------------------------------------------------------------------------- c c We first open the HDF-EOS point file, "point.he5". Because this file c c does not already exist, we use the "TRUNC" file access code in the c c open statement. The PTopen routine returns the point file id, ptfid, c c which is used to identify the file in subsequent routines in the c c library. c c --------------------------------------------------------------------------- c c Open the HDF point file, "point.he5" c ----------------------------------- ptfid = he5_ptopen('point.he5',HE5F_ACC_TRUNC) write(*,*) 'File ID returned by he5_ptopen(): ',ptfid ptid1 = he5_ptcreate(ptfid, "Simple Point") write(*,*) 'Point ID returned by he5_ptcreate(): ',ptid1 ptid2 = he5_ptcreate(ptfid, "FixedBuoy Point") write(*,*) 'Point ID returned by he5_ptcreate(): ',ptid2 ptid3 = he5_ptcreate(ptfid, "FloatBuoy Point") write(*,*) 'Point ID returned by he5_ptcreate(): ',ptid3 c --------------------------------------------------------------------------- c c We now close the point interface with the he5_ptdetach routine. c c This step is necessary to properly store the point information within c c the file. c c --------------------------------------------------------------------------- c status = he5_ptdetach(ptid1) write(*,*) 'Status returned by he5_ptdetach(): ',status status = he5_ptdetach(ptid2) write(*,*) 'Status returned by he5_ptdetach(): ',status status = he5_ptdetach(ptid3) write(*,*) 'Status returned by he5_ptdetach(): ',status status = he5_ptclose(ptfid) write(*,*) 'Status returned by he5_ptclose(): ',status stop end hdf-eos5-2.0/samples/he5_pt_setupF_64.f000077500000000000000000000043601507520047200176330ustar00rootroot00000000000000 program he5_pt_setupF_64 implicit none include 'hdfeos5.inc' integer status integer ptfid integer ptid1 integer ptid2 integer ptid3 integer he5_ptopen integer he5_ptcreate integer he5_ptdetach integer he5_ptclose c --------------------------------------------------------------------------- c c We first open the HDF-EOS point file, "point.he5". Because this file c c does not already exist, we use the "TRUNC" file access code in the c c open statement. The PTopen routine returns the point file id, ptfid, c c which is used to identify the file in subsequent routines in the c c library. c c --------------------------------------------------------------------------- c c Open the HDF-EOS point file, "point.he5" c ---------------------------------------- ptfid = he5_ptopen('point.he5',HE5F_ACC_TRUNC) write(*,*) 'File ID returned by he5_ptopen(): ',ptfid ptid1 = he5_ptcreate(ptfid, "Simple Point") write(*,*) 'Point ID returned by he5_ptcreate(): ',ptid1 ptid2 = he5_ptcreate(ptfid, "FixedBuoy Point") write(*,*) 'Point ID returned by he5_ptcreate(): ',ptid2 ptid3 = he5_ptcreate(ptfid, "FloatBuoy Point") write(*,*) 'Point ID returned by he5_ptcreate(): ',ptid3 c --------------------------------------------------------------------------- c c We now close the point interface with the he5_ptdetach routine. c c This step is necessary to properly store the point information within c c the file. c c --------------------------------------------------------------------------- c status = he5_ptdetach(ptid1) write(*,*) 'Status returned by he5_ptdetach(): ',status status = he5_ptdetach(ptid2) write(*,*) 'Status returned by he5_ptdetach(): ',status status = he5_ptdetach(ptid3) write(*,*) 'Status returned by he5_ptdetach(): ',status status = he5_ptclose(ptfid) write(*,*) 'Status returned by he5_ptclose(): ',status stop end hdf-eos5-2.0/samples/he5_pt_updatelevels.c000077500000000000000000000030721507520047200205450ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include int main() { herr_t status = FAIL; hid_t ptfid = FAIL; hid_t PTid1 = FAIL; hssize_t recs[32]; hsize_t nrec; typedef struct { double Time; float Conc[4]; char Spc[8]; } CmpData_1; CmpData_1 buf_1; buf_1.Time = 13131313.0; buf_1.Conc[0] = 1.11; buf_1.Conc[1] = 2.22; buf_1.Conc[2] = 3.33; buf_1.Conc[3] = 4.44; strcpy(buf_1.Spc,"AM"); /* -------------------------------------------------------------- */ /* NOTE: To update all records, set "nrec" => 0 or "recs" => NULL */ /* the data buffer should be properly populated */ /* -------------------------------------------------------------- */ /* Open the HDF-EOS file, "Point.h5" */ /* --------------------------------- */ ptfid = HE5_PTopen("Point.h5", H5F_ACC_RDWR); if (ptfid != FAIL) { PTid1 = HE5_PTattach(ptfid, "Simple Point"); if (PTid1 != FAIL) { nrec = 1; recs[0] = 0; status = HE5_PTupdatelevel(PTid1, 0, "Concentration", nrec, recs, &buf_1); printf("Status returned by HE5_PTupdatelevel() : %d \n", status); } status = HE5_PTdetach(PTid1); printf("Status returned by HE5_PTdetach() : %d \n", status); } status = HE5_PTclose(ptfid); return 0; } hdf-eos5-2.0/samples/he5_pt_updatelevelsF_32.f000077500000000000000000000041311507520047200211570ustar00rootroot00000000000000 program he5_pt_updatelevelsF_32 implicit none include 'hdfeos5.inc' integer status integer ptfid integer ptid integer level integer he5_ptopen integer he5_ptattach integer he5_ptupdatelevel integer he5_ptdetach integer he5_ptclose integer dtype(3) integer*4 recs(32) integer*4 nrec real*4 conc_tt(4) real*8 time_tt character*8 spc_tt character*80 fieldname c Open the HDF point file, "point.he5" c ------------------------------------ ptfid = he5_ptopen('point.he5',HE5F_ACC_RDWR) write(*,*) 'File ID returned by he5_ptopen(): ',ptfid c Read Simple Point c ----------------- ptid = HE5_PTattach(ptfid, "Simple Point") write(*,*) 'Point ID returned by he5_ptattach(): ',ptid dtype(1) = HE5T_NATIVE_DOUBLE dtype(2) = HE5T_NATIVE_FLOAT dtype(3) = HE5T_NATIVE_CHAR nrec = 1 recs(1) = 0 level = 0 fieldname = 'Concentration' conc_tt(1) = 1.11 conc_tt(2) = 2.22 conc_tt(3) = 3.33 conc_tt(4) = 4.44 status = he5_ptupdatelevel(ptid, level, fieldname, nrec, 1recs, dtype(2), conc_tt) write(*,*) 'Status returned by he5_ptupdatelevel(): ',status fieldname = 'Time' time_tt = 13131313.0 status = he5_ptupdatelevel(ptid, level, fieldname, nrec, 1recs, dtype(1), time_tt) write(*,*) 'Status returned by he5_ptupdatelevel(): ',status fieldname = 'Species' spc_tt = 'AM' status = he5_ptupdatelevel(ptid, level, fieldname, nrec, 1recs, dtype(3), spc_tt) write(*,*) 'Status returned by he5_ptupdatelevel(): ',status c.....Close out the point interface status = he5_ptdetach(ptid) write(*,*) 'Status returned by he5_ptdetach(): ',status status = he5_ptclose(ptfid) write(*,*) 'Status returned by he5_ptclose(): ',status stop end hdf-eos5-2.0/samples/he5_pt_updatelevelsF_64.f000077500000000000000000000041561507520047200211730ustar00rootroot00000000000000 program he5_pt_updatelevelsF_64 implicit none include 'hdfeos5.inc' integer status integer ptfid integer ptid integer level integer he5_ptopen integer he5_ptattach integer he5_ptupdatelevel integer he5_ptdetach integer he5_ptclose integer dtype(3) integer*8 recs(32) integer*8 nrec real*4 conc_tt(4) real*8 time_tt character*8 spc_tt character*80 fieldname c Open the HDF-EOS point file, "point.he5" c ---------------------------------------- ptfid = he5_ptopen('point.he5',HE5F_ACC_RDWR) write(*,*) 'File ID returned by he5_ptopen(): ',ptfid c Read Simple Point c ----------------- ptid = HE5_PTattach(ptfid, "Simple Point") write(*,*) 'Point ID returned by he5_ptattach(): ',ptid dtype(1) = HE5T_NATIVE_DOUBLE dtype(2) = HE5T_NATIVE_FLOAT dtype(3) = HE5T_NATIVE_CHAR nrec = 1 recs(1) = 0 level = 0 fieldname = 'Concentration' conc_tt(1) = 1.11 conc_tt(2) = 2.22 conc_tt(3) = 3.33 conc_tt(4) = 4.44 status = he5_ptupdatelevel(ptid, level, fieldname, nrec, 1recs, dtype(2), conc_tt) write(*,*) 'Status returned by he5_ptupdatelevel(): ',status fieldname = 'Time' time_tt = 13131313.0 status = he5_ptupdatelevel(ptid, level, fieldname, nrec, 1recs, dtype(1), time_tt) write(*,*) 'Status returned by he5_ptupdatelevel(): ',status fieldname = 'Species' spc_tt = 'AM' status = he5_ptupdatelevel(ptid, level, fieldname, nrec, 1recs, dtype(3), spc_tt) write(*,*) 'Status returned by he5_ptupdatelevel(): ',status c.....Close out the point interface status = he5_ptdetach(ptid) write(*,*) 'Status returned by he5_ptdetach(): ',status status = he5_ptclose(ptfid) write(*,*) 'Status returned by he5_ptclose(): ',status stop end hdf-eos5-2.0/samples/he5_pt_writeattrs.c000077500000000000000000000045121507520047200202600ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include int main() { herr_t status = FAIL; int attr = 9999; /* Global attribute */ int attr1[ 5 ] = { 1, 2, 3, 4, 5}; /* Group attribute */ int attr2[ 5 ] = { 10, 20, 30, 40, 50}; /* Local attribute */ hid_t ptfid = FAIL, PTid = FAIL; hsize_t count[8]; float flt = -7.5; /* Global attribute */ /* Open the HDF-EOS file, "Point.h5" */ /* --------------------------------- */ ptfid = HE5_PTopen("Point.h5", H5F_ACC_RDWR); printf("File ID returned by HE5_PTopen() : %ld \n", (long) ptfid); /* Write attribute to "Fixed Buoy Point" */ /* ------------------------------------- */ PTid = HE5_PTattach(ptfid, "FixedBuoy Point"); printf("Point ID returned by HE5_PTattach() : %ld \n", (long) PTid); count[0] = 1; status = HE5_PTwriteattr(PTid, "GlobalAttribute_int", H5T_NATIVE_INT, count, &attr); printf("Status returned by HE5_PTwriteattr() : %d \n", status); count[0] = 5; status = HE5_PTwritegrpattr(PTid, "GroupAttribute", H5T_NATIVE_INT, count, attr1); printf("Status returned by HE5_PTwritegrpattr() : %d \n", status); status = HE5_PTwritelocattr(PTid, "Observations", "LocalAttribute", H5T_NATIVE_INT, count, attr2); printf("Status returned by HE5_PTwritelocattr() : %d \n", status); status = HE5_PTdetach(PTid); printf("Status returned by HE5_PTdetach() : %d \n", status); /* Write attributes to "Floating Buoy Point" */ /* ----------------------------------------- */ PTid = HE5_PTattach(ptfid, "FloatBuoy Point"); printf("Point ID returned by HE5_PTattach() : %ld \n", (long) PTid); count[0] = 1; status = HE5_PTwriteattr(PTid, "GlobalAttribute_float", H5T_NATIVE_FLOAT, count, &flt); printf("Status returned by HE5_PTwriteattr() : %d \n", status); status = HE5_PTdetach(PTid); printf("Status returned by HE5_PTdetach() : %d \n", status); status = HE5_PTclose(ptfid); printf("Status returned by HE5_PTclose() : %d \n", status); return 0; } hdf-eos5-2.0/samples/he5_pt_writeattrsF_32.f000077500000000000000000000057741507520047200207100ustar00rootroot00000000000000 program he5_pt_writeattrsF_32 implicit none include 'hdfeos5.inc' integer status integer ptfid integer ptid integer he5_ptopen integer he5_ptattach integer he5_ptwriteattr integer he5_ptwritegrpattr integer he5_ptwritelocattr integer he5_ptdetach integer he5_ptclose integer attr,attr1(5) integer attr2(5) integer ntype integer*4 fortcount(8) real*4 flt character*80 attrname,levelname c Open the HDF point file, "point.he5" c ----------------------------------- ptfid = he5_ptopen('point.he5',HE5F_ACC_RDWR) write(*,*) 'File ID returned by he5_ptopen(): ',ptfid c Read Simple Point c ----------------- ptid = he5_ptattach(ptfid, "FixedBuoy Point") write(*,*) 'Point ID returned by he5_ptattach(): ',ptid c Write attributes to "Fixed Buoy Point" c -------------------------------------- attrname = 'GlobalAttribute_int' ntype = HE5T_NATIVE_INT fortcount(1) = 1 attr = 9999 status = he5_ptwriteattr(ptid,attrname,ntype,fortcount, 1attr) write(*,*) 'Status returned by he5_ptwriteattr(): ',status attrname = 'GroupAttribute' ntype = HE5T_NATIVE_INT fortcount(1) = 5 attr1(1) = 1 attr1(2) = 2 attr1(3) = 3 attr1(4) = 4 attr1(5) = 5 status = he5_ptwritegrpattr(ptid,attrname,ntype,fortcount, 1attr1) write(*,*) 'Status returned by he5_ptwritegrpattr(): ',status levelname = 'Observations' attrname = 'LocalAttribute' ntype = HE5T_NATIVE_INT fortcount(1) = 5 attr2(1) = 10 attr2(2) = 20 attr2(3) = 30 attr2(4) = 40 attr2(5) = 50 status = he5_ptwritelocattr(ptid,levelname,attrname, 1ntype,fortcount,attr2) write(*,*) 'Status returned by he5_ptwritelocattr(): ',status c.....Close out the point interface status = he5_ptdetach(ptid) write(*,*) 'Status returned by he5_ptdetach(): ',status c Write attributes to "Fixed Buoy Point" c -------------------------------------- ptid = he5_ptattach(ptfid, "FixedBuoy Point") write(*,*) 'Point ID returned by he5_ptattach(): ',ptid attrname = 'GlobalAttribute_float' ntype = HE5T_NATIVE_FLOAT fortcount(1) = 1 flt = -7.5 status = he5_ptwriteattr(ptid,attrname, 1ntype,fortcount,flt) write(*,*) 'Status returned by he5_ptwriteattr(): ',status c.....Close out the point interface status = he5_ptdetach(ptid) write(*,*) 'Status returned by he5_ptdetach(): ',status status = he5_ptclose(ptfid) write(*,*) 'Status returned by he5_ptclose(): ',status stop end hdf-eos5-2.0/samples/he5_pt_writeattrsF_64.f000077500000000000000000000060301507520047200206770ustar00rootroot00000000000000 program he5_pt_writeattrsF_64 implicit none include 'hdfeos5.inc' integer status integer ptfid integer ptid integer he5_ptopen integer he5_ptattach integer he5_ptwriteattr integer he5_ptwritegrpattr integer he5_ptwritelocattr integer he5_ptdetach integer he5_ptclose integer attr,attr1(5) integer attr2(5) integer ntype integer*8 fortcount(8) real*4 flt character*80 attrname character*80 levelname c Open the HDF-EOS point file, "point.he5" c ---------------------------------------- ptfid = he5_ptopen('point.he5',HE5F_ACC_RDWR) write(*,*) 'File ID returned by he5_ptopen(): ',ptfid c Read Simple Point c ----------------- ptid = he5_ptattach(ptfid, "FixedBuoy Point") write(*,*) 'Point ID returned by he5_ptattach(): ',ptid c Write attributes to "Fixed Buoy Point" c -------------------------------------- attrname = 'GlobalAttribute_int' ntype = HE5T_NATIVE_INT fortcount(1) = 1 attr = 9999 status = he5_ptwriteattr(ptid,attrname,ntype,fortcount, 1attr) write(*,*) 'Status returned by he5_ptwriteattr(): ',status attrname = 'GroupAttribute' ntype = HE5T_NATIVE_INT fortcount(1) = 5 attr1(1) = 1 attr1(2) = 2 attr1(3) = 3 attr1(4) = 4 attr1(5) = 5 status = he5_ptwritegrpattr(ptid,attrname,ntype,fortcount, 1attr1) write(*,*) 'Status returned by he5_ptwritegrpattr(): ',status levelname = 'Observations' attrname = 'LocalAttribute' ntype = HE5T_NATIVE_INT fortcount(1) = 5 attr2(1) = 10 attr2(2) = 20 attr2(3) = 30 attr2(4) = 40 attr2(5) = 50 status = he5_ptwritelocattr(ptid,levelname,attrname, 1ntype,fortcount,attr2) write(*,*) 'Status returned by he5_ptwritelocattr(): ',status c.....Close out the point interface status = he5_ptdetach(ptid) write(*,*) 'Status returned by he5_ptdetach(): ',status c Write attributes to "Fixed Buoy Point" c -------------------------------------- ptid = he5_ptattach(ptfid, "FixedBuoy Point") write(*,*) 'Point ID returned by he5_ptattach(): ',ptid attrname = 'GlobalAttribute_float' ntype = HE5T_NATIVE_FLOAT fortcount(1) = 1 flt = -7.5 status = he5_ptwriteattr(ptid,attrname, 1ntype,fortcount,flt) write(*,*) 'Status returned by he5_ptwriteattr(): ',status c.....Close out the point interface status = he5_ptdetach(ptid) write(*,*) 'Status returned by he5_ptdetach(): ',status status = he5_ptclose(ptfid) write(*,*) 'Status returned by he5_ptclose(): ',status stop end hdf-eos5-2.0/samples/he5_pt_writedata.c000077500000000000000000000164551507520047200200450ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include typedef struct { double Time; float Conc[4]; char Spc[8]; } CmpData_1; typedef struct { char Label[16]; double Lon; double Lat; int Date; char Id[8]; } CmpData_2; typedef struct { double Time; float Rain; float Temp; char Id[8]; } CmpData_3; typedef struct { char Label[10]; int Date; int Weight; char Id[8]; } CmpData_4; typedef struct { double Time; double Lon; double Lat; float Rain; float Temp; char Id[8]; } CmpData_5; #define NAMEBUF_SIZE 100 int main() { FILE *fp; herr_t status = FAIL; int n, date, wgt, IntAttr = 9999; hid_t ptfid = FAIL, PTid = FAIL; hsize_t count[1]; size_t datasize = 0; float conc[4], rain, temp, flt = -7.5; double time, lon, lat; char spc[8], desc[16], id[ 6 ]; char namebuf[NAMEBUF_SIZE]; char *srcdir; CmpData_1 datbuf_1[20]; CmpData_2 datbuf_2[5]; CmpData_3 datbuf_3[25]; CmpData_4 datbuf_4[5]; CmpData_5 datbuf_5[30]; /* Open the HDF-EOS file, "Point.h5" */ /* --------------------------------- */ ptfid = HE5_PTopen("Point.h5", H5F_ACC_RDWR); /* Write to Simple Point */ /* --------------------- */ PTid = HE5_PTattach(ptfid, "Simple Point"); /* Open input data file */ /* -------------------- */ /* Set up path if the input file is in another directory */ srcdir = getenv("srcdir"); if(srcdir != NULL && (strlen(srcdir) + strlen("simple.txt") + 2) <= NAMEBUF_SIZE) { strcpy(namebuf, srcdir); strcat(namebuf, "/simple.txt"); } else { strcpy(namebuf, "simple.txt"); } fp = fopen(namebuf, "rb"); n = 0; while(fscanf(fp, "%lf %f %f %f %f %s", &time, &conc[0], &conc[1], &conc[2], &conc[3], spc) != -1) { datbuf_1[n].Time = time; datbuf_1[n].Conc[0] = conc[0]; datbuf_1[n].Conc[1] = conc[1]; datbuf_1[n].Conc[2] = conc[2]; datbuf_1[n].Conc[3] = conc[3]; memmove(datbuf_1[n].Spc, spc, sizeof(char)*strlen(spc)); datbuf_1[n].Spc[strlen(spc)] = 0; n++; } fclose(fp); datasize = (size_t)sizeof(CmpData_1); count[0] = n; status = HE5_PTwritelevel(PTid, 0, count, &datasize, datbuf_1); printf("Status returned by HE5_PTwritelevel() : %d \n", status); status = HE5_PTdetach(PTid); printf("Status returned by HE5_PTdetach() : %d \n", status); /* Write to Fixed Buoy Point */ /* ------------------------- */ PTid = HE5_PTattach(ptfid, "FixedBuoy Point"); /* Write First (0th) Level */ /* ----------------------- */ /* Set up path if the input file is in another directory */ srcdir = getenv("srcdir"); if(srcdir != NULL && (strlen(srcdir) + strlen("simple.txt") + 2) <= NAMEBUF_SIZE) { strcpy(namebuf, srcdir); strcat(namebuf, "/fixedBuoy0.txt"); } else { strcpy(namebuf, "fixedBuoy0.txt"); } fp = fopen(namebuf, "r"); n = 0; while(fscanf(fp, "%s %lf %lf %d %s", desc, &lon, &lat, &date, id) != -1) { strcpy(datbuf_2[n].Label, desc); datbuf_2[n].Lon = lon; datbuf_2[n].Lat = lat; datbuf_2[n].Date = date; memmove(datbuf_2[n].Id, id, sizeof(char)*strlen(id)); datbuf_2[n].Id[strlen(id)] = 0; n++; } fclose(fp); datasize = (size_t)sizeof(CmpData_2); count[0] = n; status = HE5_PTwritelevel(PTid, 0, count, &datasize, datbuf_2); printf("Status returned by HE5_PTwritelevel() : %d \n", status); /* Write Second (1th) Level */ /* ------------------------ */ /* Set up path if the input file is in another directory */ srcdir = getenv("srcdir"); if(srcdir != NULL && (strlen(srcdir) + strlen("simple.txt") + 2) <= NAMEBUF_SIZE) { strcpy(namebuf, srcdir); strcat(namebuf, "/fixedBuoy1.txt"); } else { strcpy(namebuf, "fixedBuoy1.txt"); } fp = fopen(namebuf, "r"); n = 0; while(fscanf(fp, "%lf %f %f %s", &time, &rain, &temp, id) != -1) { datbuf_3[n].Time = time; datbuf_3[n].Rain = rain; datbuf_3[n].Temp = temp; memmove(datbuf_3[n].Id, id, sizeof(char)*strlen(id)); datbuf_3[n].Id[strlen(id)] = 0; n++; } fclose(fp); datasize = (size_t)sizeof(CmpData_3); count[0] = n; status = HE5_PTwritelevel(PTid, 1, count, &datasize, datbuf_3); printf("Status returned by HE5_PTwritelevel() : %d \n", status); count[0] = 1; status = HE5_PTwriteattr(PTid, "GlobalAttr_Integer", H5T_NATIVE_INT, count, &IntAttr); printf("Status returned by HE5_PTwriteattr() : %d \n", status); status = HE5_PTdetach(PTid); printf("Status returned by HE5_PTdetach() : %d \n", status); /* Write to Floating Buoy Point */ /* ---------------------------- */ PTid = HE5_PTattach(ptfid, "FloatBuoy Point"); /* Write First (0th) Level */ /* ----------------------- */ /* Set up path if the input file is in another directory */ srcdir = getenv("srcdir"); if(srcdir != NULL && (strlen(srcdir) + strlen("simple.txt") + 2) <= NAMEBUF_SIZE) { strcpy(namebuf, srcdir); strcat(namebuf, "/floatBuoy0.txt"); } else { strcpy(namebuf, "floatBuoy0.txt"); } fp = fopen(namebuf, "r"); n = 0; while(fscanf(fp, "%s %d %d %s", desc, &date, &wgt, id) != -1) { strcpy(datbuf_4[n].Label, desc); datbuf_4[n].Date = date; datbuf_4[n].Weight = wgt; memmove(datbuf_4[n].Id, id, sizeof(char)*strlen(id)); datbuf_4[n].Id[strlen(id)] = 0; n++; } fclose(fp); datasize = (size_t)sizeof(CmpData_4); count[0] = n; status = HE5_PTwritelevel(PTid, 0, count, &datasize, datbuf_4); printf("Status returned by HE5_PTwritelevel() : %d \n", status); /* Write Second (1th) Level */ /* ------------------------ */ /* Set up path if the input file is in another directory */ srcdir = getenv("srcdir"); if(srcdir != NULL && (strlen(srcdir) + strlen("simple.txt") + 2) <= NAMEBUF_SIZE) { strcpy(namebuf, srcdir); strcat(namebuf, "/floatBuoy1.txt"); } else { strcpy(namebuf, "floatBuoy1.txt"); } fp = fopen(namebuf, "r"); n = 0; while(fscanf(fp, "%lf %lf %lf %f %f %s", &time, &lon, &lat, &rain, &temp, id) != -1) { datbuf_5[n].Time = time; datbuf_5[n].Lon = lon; datbuf_5[n].Lat = lat; datbuf_5[n].Rain = rain; datbuf_5[n].Temp = temp; memmove(datbuf_5[n].Id, id,sizeof(char)*strlen(id)); datbuf_5[n].Id[strlen(id)] = 0; n++; } fclose(fp); datasize = (size_t)sizeof(CmpData_5); count[0] = n; status = HE5_PTwritelevel(PTid, 1, count, &datasize, datbuf_5); printf("Status returned by HE5_PTwritelevel() : %d \n", status); count[0] = 1; status = HE5_PTwriteattr(PTid, "GlobalAttr", H5T_NATIVE_FLOAT, count, &flt); printf("Status returned by HE5_PTwriteattr() : %d \n", status); status = HE5_PTdetach(PTid); printf("Status returned by HE5_PTdetach() : %d \n", status); status = HE5_PTclose(ptfid); printf("Status returned by HE5_PTclose() : %d \n", status); return 0; } hdf-eos5-2.0/samples/he5_pt_writedataF_32.f000077500000000000000000000306031507520047200204510ustar00rootroot00000000000000 program he5_pt_writedataF_32 implicit none include 'hdfeos5.inc' integer status integer ptfid integer ptid integer he5_ptopen integer he5_ptattach integer he5_ptwritelevel integer he5_ptfort2c integer he5_ptwrbckptr integer he5_ptwrfwdptr integer he5_ptwriteattr integer he5_ptdetach integer he5_ptclose integer i integer rank, datatype integer attr integer*4 n integer*4 count(1) integer*4 dimens(2) integer*4 fortcount(8),ntype real*4 flt character*80 fieldname,attrname c.....used by Simple Point real*8 time_tt real*8 time(15) real*4 concentration_tt(4) real*4 conc(15,4) real*4 outconc(4,15) character*8 spc_tt character*8 spc(15) c.....used by FixedBuoy Point - Level 0 character*8 desc_tt character*8 desc(3) real*8 lon_tt real*8 lon(3) real*8 lat_tt real*8 lat(3) integer*4 date_tt integer*4 date(3) character*8 id_tt character*8 id(3) c.....used by FixedBuoy Point - Level 1 real*8 time3_tt real*8 time3(20) real*4 rain_tt real*4 rain(20) real*4 temp_tt real*4 temp(20) character*8 id3_tt character*8 id3(20) c.....used by FloatBuoy Point - Level 0 character*8 desc4_tt character*8 desc4(3) integer*4 date4_tt integer*4 date4(3) integer*4 wgt_tt integer*4 wgt(3) character*8 id4_tt character*8 id4(3) c.....used by FloatBuoy Point - Level 1 real*8 time5_tt real*8 time5(25) real*8 lon5_tt real*8 lon5(25) real*8 lat5_tt real*8 lat5(25) real*4 rain5_tt real*4 rain5(25) real*4 temp5_tt real*4 temp5(25) character*8 id5_tt character*8 id5(25) c Open the HDF point file, "point.he5" c ----------------------------------- ptfid = he5_ptopen('point.he5',HE5F_ACC_RDWR) write(*,*) 'File ID returned by he5_ptopen(): ',ptfid c Do Simple Point c --------------- ptid = HE5_PTattach(ptfid, "Simple Point") write(*,*) 'Point ID returned by he5_ptattach(): ',ptid c Read Simple Point c ----------------- open(unit=1, file='simple.txt', status='OLD') n = 0 do 10 i=1,1000 read(1, 110, end=100) time_tt, concentration_tt(1), 1 concentration_tt(2), 2 concentration_tt(3), 3 concentration_tt(4), 4 spc_tt time(i) = time_tt conc(i,1) = concentration_tt(1) conc(i,2) = concentration_tt(2) conc(i,3) = concentration_tt(3) conc(i,4) = concentration_tt(4) spc(i) = spc_tt n = n + 1 10 continue 100 close(unit=1) 110 format(F13.1,F6.2,F6.2,F6.2,F6.2,2X,A8) count(1) = n fieldname = 'Time' datatype = HE5T_NATIVE_DOUBLE status = he5_ptwritelevel(ptid, 0, count, fieldname, 1datatype, time) write(*,*) 'Status returned by he5_ptwritelevel(): ',status c.....Convert array to 'C' order dimens(1) = 15 dimens(2) = 4 rank = 2 datatype = HE5T_NATIVE_FLOAT status = he5_ptfort2c(dimens, rank, datatype, conc, 1outconc) write(*,*) 'Status returned by he5_ptfort2c(): ',status fieldname = 'Concentration' status = he5_ptwritelevel(ptid, 0, count, fieldname, 1datatype, outconc) write(*,*) 'Status returned by he5_ptwritelevel(): ',status fieldname = 'Species' datatype = HE5T_NATIVE_CHAR status = he5_ptwritelevel(ptid, 0, count, fieldname, 1datatype, spc) write(*,*) 'Status returned by he5_ptwritelevel(): ',status c.....Close out the point interface status = he5_ptdetach(ptid) write(*,*) 'Status returned by he5_ptdetach(): ',status c Do FixedBuoy Point c ------------------ ptid = HE5_PTattach(ptfid, "FixedBuoy Point") write(*,*) 'Point ID returned by he5_ptattach(): ',ptid c Read FixedBuoy Point c -------------------- open(unit=1, file='fixedBuoy0.txt', status='OLD') n = 0 do 20 i=1,1000 read(1, 210, end=200) desc_tt, lon_tt, lat_tt, date_tt, 1id_tt desc(i) = desc_tt lon(i) = lon_tt lat(i) = lat_tt date(i) = date_tt id(i) = id_tt n = n + 1 20 continue 200 close(unit=1) 210 format(A8,F13.7,F13.7,I7,1X,A8) count(1) = n fieldname = 'Label' datatype = HE5T_NATIVE_CHAR status = he5_ptwritelevel(ptid, 0, count, fieldname, 1datatype, desc) write(*,*) 'Status returned by he5_ptwritelevel(): ',status fieldname = 'Longitude' datatype = HE5T_NATIVE_DOUBLE status = he5_ptwritelevel(ptid, 0, count, fieldname, 1datatype, lon) write(*,*) 'Status returned by he5_ptwritelevel(): ',status fieldname = 'Latitude' datatype = HE5T_NATIVE_DOUBLE status = he5_ptwritelevel(ptid, 0, count, fieldname, 1datatype, lat) write(*,*) 'Status returned by he5_ptwritelevel(): ',status fieldname = 'DeployDate' datatype = HE5T_NATIVE_INT status = he5_ptwritelevel(ptid, 0, count, fieldname, 1datatype, date) write(*,*) 'Status returned by he5_ptwritelevel(): ',status fieldname = 'ID' datatype = HE5T_NATIVE_CHAR status = he5_ptwritelevel(ptid, 0, count, fieldname, 1datatype, id) write(*,*) 'Status returned by he5_ptwritelevel(): ',status c Read FixedBuoy Point - Level 1 c ------------------------------ open(unit=1, file='fixedBuoy1.txt', status='OLD') n = 0 do 30 i=1,1000 read(1, 310, end=300) time3_tt, rain_tt, temp_tt, id3_tt time3(i) = time3_tt rain(i) = rain_tt temp(i) = temp_tt id3(i) = id3_tt n = n + 1 30 continue 300 close(unit=1) 310 format(F13.2,F8.1,F8.2,3X,A8) count(1) = n fieldname = 'Time' datatype = HE5T_NATIVE_DOUBLE status = he5_ptwritelevel(ptid, 1, count, fieldname, 1datatype, time3) write(*,*) 'Status returned by he5_ptwritelevel(): ',status fieldname = 'Rainfall' datatype = HE5T_NATIVE_FLOAT status = he5_ptwritelevel(ptid, 1, count, fieldname, 1datatype, rain) write(*,*) 'Status returned by he5_ptwritelevel(): ',status fieldname = 'Temperature' datatype = HE5T_NATIVE_FLOAT status = he5_ptwritelevel(ptid, 1, count, fieldname, 1datatype, temp) write(*,*) 'Status returned by he5_ptwritelevel(): ',status fieldname = 'ID' datatype = HE5T_NATIVE_CHAR status = he5_ptwritelevel(ptid, 1, count, fieldname, 1datatype, id3) write(*,*) 'Status returned by he5_ptwritelevel(): ',status c.....Write forward and backward pointers status = he5_ptwrbckptr(ptid,1) write(*,*) 'Status returned by he5_ptwrbckptr(): ',status status = he5_ptwrfwdptr(ptid,1) write(*,*) 'Status returned by he5_ptwrfwdptr(): ',status c Write attributes to "Fixed Buoy Point" c -------------------------------------- attrname = 'GlobalAttribute_int' ntype = HE5T_NATIVE_INT fortcount(1) = 1 attr = 9999 status = he5_ptwriteattr(ptid,attrname,ntype,fortcount, 1attr) write(*,*) 'Status returned by he5_ptwriteattr(): ',status c.....Close out the point interface status = he5_ptdetach(ptid) write(*,*) 'Status returned by he5_ptdetach(): ',status c Do FloatBuoy Point c ------------------ ptid = HE5_PTattach(ptfid, "FloatBuoy Point") write(*,*) 'Point ID returned by he5_ptattach(): ',ptid c Read FloatBuoy Point - Level 0 c ------------------------------ open(unit=1, file='floatBuoy0.txt', status='OLD') n = 0 do 40 i=1,1000 read(1, 410, end=400) desc4_tt, date4_tt, wgt_tt, id4_tt desc4(i) = desc4_tt date4(i) = date4_tt wgt(i) = wgt_tt id4(i) = id4_tt n = n + 1 40 continue 400 close(unit=1) 410 format(A8,I8,I7,2X,A8) count(1) = n fieldname = 'Label' datatype = HE5T_NATIVE_CHAR status = he5_ptwritelevel(ptid, 0, count, fieldname, 1datatype, desc4) write(*,*) 'Status returned by he5_ptwritelevel(): ',status fieldname = 'DeployDate' datatype = HE5T_NATIVE_INT status = he5_ptwritelevel(ptid, 0, count, fieldname, 1datatype, date4) write(*,*) 'Status returned by he5_ptwritelevel(): ',status fieldname = 'Weight' datatype = HE5T_NATIVE_INT status = he5_ptwritelevel(ptid, 0, count, fieldname, 1datatype, wgt) write(*,*) 'Status returned by he5_ptwritelevel(): ',status fieldname = 'ID' datatype = HE5T_NATIVE_CHAR status = he5_ptwritelevel(ptid, 0, count, fieldname, 1datatype, id4) write(*,*) 'Status returned by he5_ptwritelevel(): ',status c Read FixedBuoy Point - Level 1 c ------------------------------ open(unit=1, file='floatBuoy1.txt', status='OLD') n = 0 do 50 i=1,1000 read(1, 510, end=500) time5_tt, lon5_tt, lat5_tt, 1rain5_tt,temp5_tt,id5_tt time5(i) = time5_tt lon5(i) = lon5_tt lat5(i) = lat5_tt rain5(i) = rain5_tt temp5(i) = temp5_tt id5(i) = id5_tt n = n + 1 50 continue 500 close(unit=1) 510 format(F13.1,F13.6,F13.6,F8.1,F8.2,3X,A8) count(1) = n fieldname = 'Time' datatype = HE5T_NATIVE_DOUBLE status = he5_ptwritelevel(ptid, 1, count, fieldname, 1datatype, time5) write(*,*) 'Status returned by he5_ptwritelevel(): ',status fieldname = 'Longitude' datatype = HE5T_NATIVE_DOUBLE status = he5_ptwritelevel(ptid, 1, count, fieldname, 1datatype, lon5) write(*,*) 'Status returned by he5_ptwritelevel(): ',status fieldname = 'Latitude' datatype = HE5T_NATIVE_DOUBLE status = he5_ptwritelevel(ptid, 1, count, fieldname, 1datatype, lat5) write(*,*) 'Status returned by he5_ptwritelevel(): ',status fieldname = 'Rainfall' datatype = HE5T_NATIVE_FLOAT status = he5_ptwritelevel(ptid, 1, count, fieldname, 1datatype, rain5) write(*,*) 'Status returned by he5_ptwritelevel(): ',status fieldname = 'Temperature' datatype = HE5T_NATIVE_FLOAT status = he5_ptwritelevel(ptid, 1, count, fieldname, 1datatype, temp5) write(*,*) 'Status returned by he5_ptwritelevel(): ',status fieldname = 'ID' datatype = HE5T_NATIVE_CHAR status = he5_ptwritelevel(ptid, 1, count, fieldname, 1datatype, id5) write(*,*) 'Status returned by he5_ptwritelevel(): ',status c.....Write forward and backward pointers status = he5_ptwrbckptr(ptid,1) write(*,*) 'Status returned by he5_ptwrbckptr(): ',status status = he5_ptwrfwdptr(ptid,1) write(*,*) 'Status returned by he5_ptwrfwdptr(): ',status c Write attributes to "Float Buoy Point" c -------------------------------------- attrname = 'GlobalAttribute_float' ntype = HE5T_NATIVE_FLOAT fortcount(1) = 1 flt = -7.5 status = he5_ptwriteattr(ptid,attrname, 1ntype,fortcount,flt) write(*,*) 'Status returned by he5_ptwriteattr(): ',status c.....Close out the point interface status = he5_ptdetach(ptid) write(*,*) 'Status returned by he5_ptdetach(): ',status status = he5_ptclose(ptfid) write(*,*) 'Status returned by he5_ptclose(): ',status stop end hdf-eos5-2.0/samples/he5_pt_writedataF_64.f000077500000000000000000000305051507520047200204570ustar00rootroot00000000000000 program he5_pt_writedataF_64 implicit none include 'hdfeos5.inc' integer status integer ptfid integer ptid integer he5_ptopen integer he5_ptattach integer he5_ptwritelevel integer he5_ptfort2c integer he5_ptwrbckptr integer he5_ptwrfwdptr integer he5_ptwriteattr integer he5_ptdetach integer he5_ptclose integer i integer rank integer dtype integer attr integer ntype integer*8 n integer*8 count(1) integer*8 dimens(2) integer*8 fortcount(8) real*4 flt character*80 fieldname character*80 attrname c.....used by Simple Point real*8 time_tt real*8 time(15) real*4 concentration_tt(4) real*4 conc(15,4) real*4 outconc(4,15) character*8 spc_tt character*8 spc(15) c.....used by FixedBuoy Point - Level 0 character*8 desc_tt character*8 desc(3) real*8 lon_tt real*8 lon(3) real*8 lat_tt real*8 lat(3) integer*4 date_tt integer*4 date(3) character*8 id_tt character*8 id(3) c.....used by FixedBuoy Point - Level 1 real*8 time3_tt real*8 time3(20) real*4 rain_tt real*4 rain(20) real*4 temp_tt real*4 temp(20) character*8 id3_tt character*8 id3(20) c.....used by FloatBuoy Point - Level 0 character*8 desc4_tt character*8 desc4(3) integer*4 date4_tt integer*4 date4(3) integer*4 wgt_tt integer*4 wgt(3) character*8 id4_tt character*8 id4(3) c.....used by FloatBuoy Point - Level 1 real*8 time5_tt real*8 time5(25) real*8 lon5_tt real*8 lon5(25) real*8 lat5_tt real*8 lat5(25) real*4 rain5_tt real*4 rain5(25) real*4 temp5_tt real*4 temp5(25) character*8 id5_tt character*8 id5(25) c Open the HDF-EOS point file, "point.he5" c ---------------------------------------- ptfid = he5_ptopen('point.he5',HE5F_ACC_RDWR) write(*,*) 'File ID returned by he5_ptopen(): ',ptfid c Do Simple Point c --------------- ptid = HE5_PTattach(ptfid, "Simple Point") write(*,*) 'Point ID returned by he5_ptattach(): ',ptid c Read Simple Point c ----------------- open(unit=1, file='simple.txt', status='OLD') n = 0 do 10 i=1,1000 read(1, 110, end=100) time_tt, concentration_tt(1), 1 concentration_tt(2), 2 concentration_tt(3), 3 concentration_tt(4), 4 spc_tt time(i) = time_tt conc(i,1) = concentration_tt(1) conc(i,2) = concentration_tt(2) conc(i,3) = concentration_tt(3) conc(i,4) = concentration_tt(4) spc(i) = spc_tt n = n + 1 10 continue 100 close(unit=1) 110 format(F13.1,F6.2,F6.2,F6.2,F6.2,2X,A8) count(1) = n fieldname = 'Time' dtype = HE5T_NATIVE_DOUBLE status = he5_ptwritelevel(ptid, 0, count, fieldname, 1dtype, time) write(*,*) 'Status returned by he5_ptwritelevel(): ',status c.....Convert array to 'C' order dimens(1) = 15 dimens(2) = 4 rank = 2 dtype = HE5T_NATIVE_FLOAT status = he5_ptfort2c(dimens, rank, dtype, conc, 1outconc) write(*,*) 'Status returned by he5_ptfort2c(): ',status fieldname = 'Concentration' status = he5_ptwritelevel(ptid, 0, count, fieldname, 1dtype, outconc) write(*,*) 'Status returned by he5_ptwritelevel(): ',status fieldname = 'Species' dtype = HE5T_NATIVE_CHAR status = he5_ptwritelevel(ptid, 0, count, fieldname, 1dtype, spc) write(*,*) 'Status returned by he5_ptwritelevel(): ',status c.....Close out the point interface status = he5_ptdetach(ptid) write(*,*) 'Status returned by he5_ptdetach(): ',status c Do FixedBuoy Point c ------------------ ptid = HE5_PTattach(ptfid, "FixedBuoy Point") write(*,*) 'Point ID returned by he5_ptattach(): ',ptid c Read FixedBuoy Point c -------------------- open(unit=1, file='fixedBuoy0.txt', status='OLD') n = 0 do 20 i=1,1000 read(1, 210, end=200) desc_tt, lon_tt, lat_tt, date_tt, 1id_tt desc(i) = desc_tt lon(i) = lon_tt lat(i) = lat_tt date(i) = date_tt id(i) = id_tt n = n + 1 20 continue 200 close(unit=1) 210 format(A8,F13.7,F13.7,I7,1X,A8) count(1) = n fieldname = 'Label' dtype = HE5T_NATIVE_CHAR status = he5_ptwritelevel(ptid, 0, count, fieldname, 1dtype, desc) write(*,*) 'Status returned by he5_ptwritelevel(): ',status fieldname = 'Longitude' dtype = HE5T_NATIVE_DOUBLE status = he5_ptwritelevel(ptid, 0, count, fieldname, 1dtype, lon) write(*,*) 'Status returned by he5_ptwritelevel(): ',status fieldname = 'Latitude' dtype = HE5T_NATIVE_DOUBLE status = he5_ptwritelevel(ptid, 0, count, fieldname, 1dtype, lat) write(*,*) 'Status returned by he5_ptwritelevel(): ',status fieldname = 'DeployDate' dtype = HE5T_NATIVE_INT status = he5_ptwritelevel(ptid, 0, count, fieldname, 1dtype, date) write(*,*) 'Status returned by he5_ptwritelevel(): ',status fieldname = 'ID' dtype = HE5T_NATIVE_CHAR status = he5_ptwritelevel(ptid, 0, count, fieldname, 1dtype, id) write(*,*) 'Status returned by he5_ptwritelevel(): ',status c Read FixedBuoy Point - Level 1 c ------------------------------ open(unit=1, file='fixedBuoy1.txt', status='OLD') n = 0 do 30 i=1,1000 read(1, 310, end=300) time3_tt, rain_tt, temp_tt, id3_tt time3(i) = time3_tt rain(i) = rain_tt temp(i) = temp_tt id3(i) = id3_tt n = n + 1 30 continue 300 close(unit=1) 310 format(F13.2,F8.1,F8.2,3X,A8) count(1) = n fieldname = 'Time' dtype = HE5T_NATIVE_DOUBLE status = he5_ptwritelevel(ptid, 1, count, fieldname, 1dtype, time3) write(*,*) 'Status returned by he5_ptwritelevel(): ',status fieldname = 'Rainfall' dtype = HE5T_NATIVE_FLOAT status = he5_ptwritelevel(ptid, 1, count, fieldname, 1dtype, rain) write(*,*) 'Status returned by he5_ptwritelevel(): ',status fieldname = 'Temperature' dtype = HE5T_NATIVE_FLOAT status = he5_ptwritelevel(ptid, 1, count, fieldname, 1dtype, temp) write(*,*) 'Status returned by he5_ptwritelevel(): ',status fieldname = 'ID' dtype = HE5T_NATIVE_CHAR status = he5_ptwritelevel(ptid, 1, count, fieldname, 1dtype, id3) write(*,*) 'Status returned by he5_ptwritelevel(): ',status c.....Write forward and backward pointers status = he5_ptwrbckptr(ptid,1) write(*,*) 'Status returned by he5_ptwrbckptr(): ',status status = he5_ptwrfwdptr(ptid,1) write(*,*) 'Status returned by he5_ptwrfwdptr(): ',status c Write attributes to "Fixed Buoy Point" c -------------------------------------- attrname = 'GlobalAttribute_int' ntype = HE5T_NATIVE_INT fortcount(1) = 1 attr = 9999 status = he5_ptwriteattr(ptid,attrname,ntype,fortcount, 1attr) write(*,*) 'Status returned by he5_ptwriteattr(): ',status c.....Close out the point interface status = he5_ptdetach(ptid) write(*,*) 'Status returned by he5_ptdetach(): ',status c Do FloatBuoy Point c ------------------ ptid = HE5_PTattach(ptfid, "FloatBuoy Point") write(*,*) 'Point ID returned by he5_ptattach(): ',ptid c Read FloatBuoy Point - Level 0 c ------------------------------ open(unit=1, file='floatBuoy0.txt', status='OLD') n = 0 do 40 i=1,1000 read(1, 410, end=400) desc4_tt, date4_tt, wgt_tt, id4_tt desc4(i) = desc4_tt date4(i) = date4_tt wgt(i) = wgt_tt id4(i) = id4_tt n = n + 1 40 continue 400 close(unit=1) 410 format(A8,I8,I7,2X,A8) count(1) = n fieldname = 'Label' dtype = HE5T_NATIVE_CHAR status = he5_ptwritelevel(ptid, 0, count, fieldname, 1dtype, desc4) write(*,*) 'Status returned by he5_ptwritelevel(): ',status fieldname = 'DeployDate' dtype = HE5T_NATIVE_INT status = he5_ptwritelevel(ptid, 0, count, fieldname, 1dtype, date4) write(*,*) 'Status returned by he5_ptwritelevel(): ',status fieldname = 'Weight' dtype = HE5T_NATIVE_INT status = he5_ptwritelevel(ptid, 0, count, fieldname, 1dtype, wgt) write(*,*) 'Status returned by he5_ptwritelevel(): ',status fieldname = 'ID' dtype = HE5T_NATIVE_CHAR status = he5_ptwritelevel(ptid, 0, count, fieldname, 1dtype, id4) write(*,*) 'Status returned by he5_ptwritelevel(): ',status c Read FixedBuoy Point - Level 1 c ------------------------------ open(unit=1, file='floatBuoy1.txt', status='OLD') n = 0 do 50 i=1,1000 read(1, 510, end=500) time5_tt, lon5_tt, lat5_tt, 1rain5_tt,temp5_tt,id5_tt time5(i) = time5_tt lon5(i) = lon5_tt lat5(i) = lat5_tt rain5(i) = rain5_tt temp5(i) = temp5_tt id5(i) = id5_tt n = n + 1 50 continue 500 close(unit=1) 510 format(F13.1,F13.6,F13.6,F8.1,F8.2,3X,A8) count(1) = n fieldname = 'Time' dtype = HE5T_NATIVE_DOUBLE status = he5_ptwritelevel(ptid, 1, count, fieldname, 1dtype, time5) write(*,*) 'Status returned by he5_ptwritelevel(): ',status fieldname = 'Longitude' dtype = HE5T_NATIVE_DOUBLE status = he5_ptwritelevel(ptid, 1, count, fieldname, 1dtype, lon5) write(*,*) 'Status returned by he5_ptwritelevel(): ',status fieldname = 'Latitude' dtype = HE5T_NATIVE_DOUBLE status = he5_ptwritelevel(ptid, 1, count, fieldname, 1dtype, lat5) write(*,*) 'Status returned by he5_ptwritelevel(): ',status fieldname = 'Rainfall' dtype = HE5T_NATIVE_FLOAT status = he5_ptwritelevel(ptid, 1, count, fieldname, 1dtype, rain5) write(*,*) 'Status returned by he5_ptwritelevel(): ',status fieldname = 'Temperature' dtype = HE5T_NATIVE_FLOAT status = he5_ptwritelevel(ptid, 1, count, fieldname, 1dtype, temp5) write(*,*) 'Status returned by he5_ptwritelevel(): ',status fieldname = 'ID' dtype = HE5T_NATIVE_CHAR status = he5_ptwritelevel(ptid, 1, count, fieldname, 1dtype, id5) write(*,*) 'Status returned by he5_ptwritelevel(): ',status c.....Write forward and backward pointers status = he5_ptwrbckptr(ptid,1) write(*,*) 'Status returned by he5_ptwrbckptr(): ',status status = he5_ptwrfwdptr(ptid,1) write(*,*) 'Status returned by he5_ptwrfwdptr(): ',status c Write attributes to "Float Buoy Point" c -------------------------------------- attrname = 'GlobalAttribute_float' ntype = HE5T_NATIVE_FLOAT fortcount(1) = 1 flt = -7.5 status = he5_ptwriteattr(ptid,attrname, 1ntype,fortcount,flt) write(*,*) 'Status returned by he5_ptwriteattr(): ',status c.....Close out the point interface status = he5_ptdetach(ptid) write(*,*) 'Status returned by he5_ptdetach(): ',status status = he5_ptclose(ptfid) write(*,*) 'Status returned by he5_ptclose(): ',status stop end hdf-eos5-2.0/samples/he5_sw_datainfo.c000077500000000000000000000137621507520047200176520ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include #define FILENAME "Swath.h5" #define OBJECT "Swath1" int main(void) { herr_t status = FAIL; int fieldgroup = FAIL; hid_t fid = FAIL; hid_t SWid = FAIL; hid_t datatype = FAIL; H5T_class_t classid = H5T_NO_CLASS; H5T_order_t order = H5T_ORDER_ERROR; size_t size = 0; /* Open the HDF-EOS swath file */ /* --------------------------- */ fid = HE5_SWopen(FILENAME, H5F_ACC_RDONLY); printf("File ID returned by HE5_SWopen() : %ld \n", (long) fid); /* Attach to the "Swath1" swath */ /* ---------------------------- */ SWid = HE5_SWattach(fid, OBJECT); printf("Swath ID returned by HE5_SWattach() : %ld \n", (long) SWid); /* Inquire data type information for the "Spectra" field */ /* ----------------------------------------------------- */ fieldgroup = HE5_HDFE_DATAGROUP; status = HE5_SWinqdatatype(SWid, "Spectra", NULL, fieldgroup, &datatype, &classid, &order, &size); printf("Status returned by HE5_SWinqdatatype() : %d \n", status); if (status != FAIL) { printf("\tdatatype: %ld \n", (long) datatype); printf("\tclass ID: %d \n", classid); printf("\torder: %d \n", order); printf("\tsize: %d \n", (int)size); } /* Inquire data type information for the profile */ /* --------------------------------------------- */ fieldgroup = HE5_HDFE_PROFGROUP; status = HE5_SWinqdatatype(SWid, "Profile-2000", NULL, fieldgroup, &datatype, &classid, &order, &size); printf("Status returned by HE5_SWinqdatatype() : %d \n", status); if (status != FAIL) { printf("\tdatatype: %ld \n", (long) datatype); printf("\tclass ID: %d \n", classid); printf("\torder: %d \n", order); printf("\tsize: %d \n", (int)size); } /* Inquire data type information for the attributes */ /* ------------------------------------------------ */ status = HE5_EHinqglbdatatype(fid, "GlobalAttribute_1", &datatype, &classid, &order, &size); printf("Status returned by HE5_EHinqglbdatatype() : %d \n", status); if (status != FAIL) { printf("\tdatatype: %ld \n", (long) datatype); printf("\tclass ID: %d \n", classid); printf("\torder: %d \n", order); printf("\tsize: %d \n", (int)size); } status = HE5_EHinqglbdatatype(fid, "GLOBAL_DOUBLE_ATTR_1", &datatype, &classid, &order, &size); printf("Status returned by HE5_EHinqglbdatatype()->GLOBAL_DOUBLE_ATTR_1 : %d \n", status); if (status != FAIL) { printf("\tdatatype: %ld \n", (long) datatype); printf("\tclass ID: %d \n", classid); printf("\torder: %d \n", order); printf("\tsize: %d \n", (int)size); } fieldgroup = HE5_HDFE_ATTRGROUP; status = HE5_SWinqdatatype(SWid, NULL, "GlobalAttribute", fieldgroup, &datatype, &classid, &order, &size); printf("Status returned by HE5_SWinqdatatype() : %d \n", status); if (status != FAIL) { printf("\tdatatype: %ld \n", (long) datatype); printf("\tclass ID: %d \n", classid); printf("\torder: %d \n", order); printf("\tsize: %d \n", (int)size); } status = HE5_SWinqdatatype(SWid, NULL, "GLOBAL_CHAR_ATTR_11", fieldgroup, &datatype, &classid, &order, &size); printf("Status returned by HE5_SWinqdatatype()->GLOBAL_CHAR_ATTR_11 : %d \n", status); if (status != FAIL) { printf("\tdatatype: %ld \n", (long) datatype); printf("\tclass ID: %d \n", classid); printf("\torder: %d \n", order); printf("\tsize: %d \n", (int)size); } status = HE5_SWinqdatatype(SWid, NULL, "GLOBAL_CHAR_ATTR", fieldgroup, &datatype, &classid, &order, &size); printf("Status returned by HE5_SWinqdatatype()->GLOBAL_CHAR_ATTR : %d \n", status); if (status != FAIL) { printf("\tdatatype: %ld \n", (long) datatype); printf("\tclass ID: %d \n", classid); printf("\torder: %d \n", order); printf("\tsize: %d \n", (int)size); } fieldgroup = HE5_HDFE_GRPATTRGROUP; status = HE5_SWinqdatatype(SWid, NULL, "GroupAttribute", fieldgroup, &datatype, &classid, &order, &size); printf("Status returned by HE5_SWinqdatatype() : %d \n", status); if (status != FAIL) { printf("\tdatatype: %ld \n", (long) datatype); printf("\tclass ID: %d \n", classid); printf("\torder: %d \n", order); printf("\tsize: %d \n", (int)size); } fieldgroup = HE5_HDFE_LOCATTRGROUP; status = HE5_SWinqdatatype(SWid, "Density", "LocalAttribute_1", fieldgroup, &datatype, &classid, &order, &size); printf("Status returned by HE5_SWinqdatatype() : %d \n", status); if (status != FAIL) { printf("\tdatatype: %ld \n", (long) datatype); printf("\tclass ID: %d \n", classid); printf("\torder: %d \n", order); printf("\tsize: %d \n", (int)size); } fieldgroup = HE5_HDFE_LOCATTRGROUP; status = HE5_SWinqdatatype(SWid, "Longitude", "LocalAttribute_2", fieldgroup, &datatype, &classid, &order, &size); printf("Status returned by HE5_SWinqdatatype() : %d \n", status); if (status != FAIL) { printf("\tdatatype: %ld \n", (long) datatype); printf("\tclass ID: %d \n", classid); printf("\torder: %d \n", order); printf("\tsize: %d \n", (int)size); } /* Detach from the swath */ /* --------------------- */ status = HE5_SWdetach(SWid); printf("Status returned by HE5_SWdetach() : %d \n", status); /* Close the file */ /* -------------- */ status = HE5_SWclose(fid); printf("Status returned by HE5_SWclose() : %d \n", status); return(0); } hdf-eos5-2.0/samples/he5_sw_defexternalfld.c000077500000000000000000000044451507520047200210520ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include /* ----------------------------------------------------------- */ /* In this program we (1) open the "Swath.h5" HDF-EOS file, */ /* (2) attach to the "Swath1" swath, and (3) define the */ /* external data field "ExtData". */ /* ----------------------------------------------------------- */ int main() { herr_t status = FAIL; hid_t swfid = FAIL; hid_t SWid = FAIL; off_t offset[3]; hsize_t size[3]; /* Open the file, "Swath.h5", using the H5F_ACC_RDWR access code */ /* ------------------------------------------------------------- */ swfid = HE5_SWopen("Swath.h5", H5F_ACC_RDWR); if (swfid != FAIL) { /* Attach to the "Swath1" swath */ /* ---------------------------- */ SWid = HE5_SWattach(swfid, "Swath1"); if (SWid != FAIL) { /* Set the data sizes and offsets in external files */ /* ------------------------------------------------ */ size[0] = 10 * sizeof(int); offset[0] = 0; size[1] = 20 * sizeof(int); offset[1] = 40; size[2] = 30 * sizeof(int); offset[2] = 80; /* Set external data files first */ /* ----------------------------- */ status = HE5_SWsetextdata(SWid, "external_1.data,external_2.data,external_3.data", offset, size); printf("Status returned by HE5_SWsetextdata(...) : %d\n",status); /* Define field containing external data */ /* ------------------------------------- */ status = HE5_SWdefdatafield(SWid, "ExtData", "ExtDim", NULL, H5T_NATIVE_INT, 0); printf("Status returned by HE5_SWdefdatafield(...\"ExtData\",...) : %d\n",status); } } /* Detach from the swath */ /* --------------------- */ status = HE5_SWdetach(SWid); printf("Status returned by HE5_SWdetach(...) : %d\n",status); /* Close the file */ /* -------------- */ status = HE5_SWclose(swfid); printf("Status returned by HE5_SWclose(...) : %d\n",status); return 0; } hdf-eos5-2.0/samples/he5_sw_defexternalfldF_32.f000077500000000000000000000034401507520047200214610ustar00rootroot00000000000000c c In this program we (1) open the "swath.he5" HDF-EOS file, c (2) attach to the "Swath1" swath, and (3) define the c external data field "ExtData". c program he5_sw_defexternalfldF_32 implicit none include 'hdfeos5.inc' integer status integer he5_swopen integer he5_swattach integer he5_swdefdfld integer he5_swdetach integer he5_swclose integer he5_swsetxdat integer swfid, swid integer*4 offset(3), size(3) integer FAIL parameter (FAIL=-1) c Open the HDF-EOS file, "swath.he5" using "READ/WRITE" access code c ---------------------------------------------------------------- swfid = he5_swopen("swath.he5", HE5F_ACC_RDWR) write(*,*) 'File ID returned by he5_swopen(): ',swfid if (swfid .NE. FAIL) then swid = he5_swattach(swfid, "Swath1") write(*,*) 'Swath ID returned by he5_swattach(): ',swid if (swid .NE. FAIL) then offset(1) = 0 size(1) = 40 offset(2) = 40 size(2) = 80 offset(3) = 80 size(3) = 120 status = he5_swsetxdat(swid, "extf1.dat,extf2.dat,extf3.dat", 1offset, size) write(*,*) 'Status returned by he5_swsetxdat(): ',status status = he5_swdefdfld(swid, "ExtData", "ExtDim", 1" ", HE5T_NATIVE_INT, 0) write(*,*) 'Status returned by he5_swdefdfld(): ',status endif endif c Detach from the swath c --------------------- status = he5_swdetach(swid) write(*,*) 'Status returned by he5_swdetach(): ',status c Close the file c -------------- status = he5_swclose(swfid) write(*,*) 'Status returned by he5_swclose(): ',status stop end hdf-eos5-2.0/samples/he5_sw_defexternalfldF_64.f000077500000000000000000000034351507520047200214720ustar00rootroot00000000000000c c In this program we (1) open the "swath.he5" HDF-EOS file, (2) c attach to the "Swath1" swath, and (3) define the external c data field "ExtData". c program he5_sw_defexternalfldF_64 implicit none include 'hdfeos5.inc' integer status integer he5_swopen integer he5_swattach integer he5_swdefdfld integer he5_swdetach integer he5_swclose integer he5_swsetxdat integer swfid, swid integer*8 offset(3), size(3) integer FAIL parameter (FAIL=-1) c Open the HDF-EOS file, "swath.he5" using "READ/WRITE" access code c ----------------------------------------------------------------- swfid = he5_swopen("swath.he5", HE5F_ACC_RDWR) write(*,*) 'File ID returned by he5_swopen(): ',swfid if (swfid .NE. FAIL) then swid = he5_swattach(swfid, "Swath1") write(*,*) 'Swath ID returned by he5_swattach(): ',swid if (swid .NE. FAIL) then offset(1) = 0 size(1) = 40 offset(2) = 40 size(2) = 80 offset(3) = 80 size(3) = 120 status = he5_swsetxdat(swid, "extf1.dat,extf2.dat,extf3.dat", 1offset, size) write(*,*) 'Status returned by he5_swsetxdat(): ',status status = he5_swdefdfld(swid, "ExtData", "ExtDim", 1" ", HE5T_NATIVE_INT, 0) write(*,*) 'Status returned by he5_swdefdfld(): ',status endif endif c Detach from the swath c --------------------- status = he5_swdetach(swid) write(*,*) 'Status returned by he5_swdetach(): ',status c Close the file c -------------- status = he5_swclose(swfid) write(*,*) 'Status returned by he5_swclose(): ',status stop end hdf-eos5-2.0/samples/he5_sw_definefields.c000077500000000000000000000216371507520047200205060ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include #include #define RANK 3 #define rank 1 /* In this program we (1) open the "Swath.h5" HDF-EOS file, */ /* (2) attach to the "Swath1" swath, and (3) define the fields */ /* ----------------------------------------------------------- */ int main() { herr_t status = FAIL; int comp_level[ 5 ] = {0,0,0,0,0}; int comp_code; int i, j; hid_t swfid = FAIL; hid_t SWid = FAIL; hsize_t chunk_dims[ 3 ]; char fillvalue[100] = "charname"; double fillvalue1 = -1.11111; int fillvalue2 = 6; /* Open the file, "Swath.h5", using the H5F_ACC_RDWR access code */ /* ------------------------------------------------------------- */ swfid = HE5_SWopen("Swath.h5", H5F_ACC_RDWR); if (swfid != FAIL) { SWid = HE5_SWattach(swfid, "Swath1"); if (SWid != FAIL) { /* * We define seven fields. The first three, "Time", "Longitude" * and "Latitude" are geolocation fields and thus we use the * geolocation dimensions "GeoTrack" and "GeoXtrack" in the field * definitions. * * The next four fields are data fields. Note that either * geolocation or data dimensions can be used. */ status = HE5_SWsetfillvalue(SWid,"Time",H5T_NATIVE_DOUBLE, &fillvalue1); printf("Status returned by HE5_SWsetfillvalue(...\"Time\",...) : %d\n",status); status = HE5_SWdefgeofield(SWid, "Time", "GeoTrack", NULL, H5T_NATIVE_DOUBLE, 0); printf("Status returned by HE5_SWdefgeofield(...\"Time\",...) : %d\n",status); status = HE5_SWdefgeofield(SWid, "Longitude", "GeoTrack,GeoXtrack", NULL, H5T_NATIVE_FLOAT, 0); printf("Status returned by HE5_SWdefgeofield(...\"Longitude\",...) : %d\n",status); status = HE5_SWdefgeofield(SWid, "Latitude", "GeoTrack,GeoXtrack", NULL, H5T_NATIVE_FLOAT, 0); printf("Status returned by HE5_SWdefgeofield(...\"Latitude\",...) : %d\n",status); status = HE5_SWsetfillvalue(SWid, "Test_string", HE5T_CHARSTRING, fillvalue); printf("Status returned by HE5_SWsetfillvalue(...\"Test_string\",...) : %d\n",status); status = HE5_SWdefdatafield(SWid, "Test_string", "GeoXtrack", NULL, HE5T_CHARSTRING, 0); printf("Status returned by HE5_SWdefdatafield(...\"Test_string\",...) : %d\n",status); status = HE5_SWsetfillvalue(SWid,"Density",H5T_NATIVE_INT8, &fillvalue2); printf("Status returned by HE5_SWsetfillvalue(...\"Density\",...) : %d\n",status); status = HE5_SWdefdatafield(SWid, "Density", "GeoTrack", NULL, H5T_NATIVE_INT8, 0); printf("Status returned by HE5_SWdefdatafield(...\"Density\",...) : %d\n",status); status = HE5_SWdefdatafield(SWid, "Temperature", "GeoTrack,GeoXtrack",NULL, H5T_NATIVE_FLOAT, 0); printf("Status returned by HE5_SWdefdatafield(...\"Temperature\",...) : %d\n",status); comp_level[0] =0; chunk_dims[0] = 40; status = HE5_SWdefchunk(SWid, rank, chunk_dims); printf("\tStatus returned by HE5_SWdefchunk() : %d\n",status); status = HE5_SWdefcomp(SWid,HE5_HDFE_COMP_NONE,comp_level); status = HE5_SWdefdatafield(SWid, "Pressure", "Res2tr", NULL, H5T_NATIVE_FLOAT, 0); printf("Status returned by HE5_SWdefdatafield(...\"Pressure\",...): %d\n",status); /* Define Appendable Field */ /* ----------------------- */ /* First, define chunking */ /* (the appendable dataset must be chunked) */ /* ---------------------------------------- */ chunk_dims[0] = 15; chunk_dims[1] = 40; chunk_dims[2] = 20; status = HE5_SWdefchunk(SWid, RANK, chunk_dims); printf("\tStatus returned by HE5_SWdefchunk() : %d\n",status); /* Second, define compression scheme */ /* --------------------------------- */ /* set the value of compression code: */ /* HDFE_COMP_NONE 0 */ /* HDFE_COMP_RLE 1 */ /* HDFE_COMP_NBIT 2 */ /* HDFE_COMP_SKPHUFF 3 */ /* HDFE_COMP_DEFLATE 4 */ /* HDFE_COMP_SZIP_CHIP 5 */ /* HDFE_COMP_SZIP_K13 6 */ /* HDFE_COMP_SZIP_EC 7 */ /* HDFE_COMP_SZIP_NN 8 */ /* HDFE_COMP_SZIP_K13orEC 9 */ /* HDFE_COMP_SZIP_K13orNN 10 */ /* HDFE_COMP_SHUF_DEFLATE 11 */ /* HDFE_COMP_SHUF_SZIP_CHIP 12 */ /* HDFE_COMP_SHUF_SZIP_K13 13 */ /* HDFE_COMP_SHUF_SZIP_EC 14 */ /* HDFE_COMP_SHUF_SZIP_NN 15 */ /* HDFE_COMP_SHUF_SZIP_K13orEC 16 */ /* HDFE_COMP_SHUF_SZIP_K13orNN 17 */ comp_code = 16; /*comp_code = 0;*/ /* Set compression level: value 0,1,2,3,4,5,6,7,8,9,10,16, or 32 */ /* ------------------------------------------------------------- */ comp_level[0] = 8; /*comp_level[0] = 0;*/ #ifdef HAVE_FILTER_SZIP_ENCODER status = HE5_SWdefcomp(SWid,comp_code, comp_level); printf("\tStatus returned by HE5_SWdefcomp() : %d\n",status); #else printf("SZIP encoder is not available. The data compression test is skipped.\n"); #endif status = HE5_SWdefdatafield(SWid, "Spectra", "Bands,Res2tr,Res2xtr", NULL, H5T_NATIVE_FLOAT, 0); printf("Status returned by HE5_SWdefdatafield(...\"Spectra\",...) : %d\n",status); /* Define Appendable Field */ /* ----------------------- */ /* First, define chunking */ /* (the appendable dataset must be chunked) */ /* ---------------------------------------- */ chunk_dims[0] = 20; status = HE5_SWdefchunk(SWid, rank, chunk_dims); printf("\tStatus returned by HE5_SWdefchunk() : %d\n",status); /* Second, define compression scheme */ /* --------------------------------- */ /* set the value of compression code: */ /* HDFE_COMP_NONE 0 */ /* HDFE_COMP_RLE 1 */ /* HDFE_COMP_NBIT 2 */ /* HDFE_COMP_SKPHUFF 3 */ /* HDFE_COMP_DEFLATE 4 */ /* HDFE_COMP_SZIP_CHIP 5 */ /* HDFE_COMP_SZIP_K13 6 */ /* HDFE_COMP_SZIP_EC 7 */ /* HDFE_COMP_SZIP_NN 8 */ /* HDFE_COMP_SZIP_K13orEC 9 */ /* HDFE_COMP_SZIP_K13orNN 10 */ /* HDFE_COMP_SHUF_DEFLATE 11 */ /* HDFE_COMP_SHUF_SZIP_CHIP 12 */ /* HDFE_COMP_SHUF_SZIP_K13 13 */ /* HDFE_COMP_SHUF_SZIP_EC 14 */ /* HDFE_COMP_SHUF_SZIP_NN 15 */ /* HDFE_COMP_SHUF_SZIP_K13orEC 16 */ /* HDFE_COMP_SHUF_SZIP_K13orNN 17 */ comp_code = 10; /*comp_code = 0;*/ /* Set compression level: value 0,1,2,3,4,5,6,7,8,9,10,16, or 32 */ /* ------------------------------------------------------------- */ comp_level[0] = 8; /*comp_level[0] = 0;*/ #ifdef HAVE_FILTER_SZIP_ENCODER status = HE5_SWdefcomp(SWid,comp_code, comp_level); printf("\tStatus returned by HE5_SWdefcomp() : %d\n",status); #else printf("SZIP encoder is not available. The data compression test is skipped.\n"); #endif status = HE5_SWdefdatafield(SWid, "Count", "GeoTrack", "Unlim", H5T_NATIVE_INT, 0); printf("Status returned by HE5_SWdefdatafield(...\"Count\",...) : %d\n",status); /* Define Profile field */ /* -------------------- */ status = HE5_PRdefine(SWid, "Profile-2000", "ProfDim", NULL, H5T_NATIVE_UINT); printf("Status returned by HE5_PRdefine(...\"Profile-2000\",...) : %d\n",status); } } status = HE5_SWdetach(SWid); status = HE5_SWclose(swfid); return 0; } hdf-eos5-2.0/samples/he5_sw_definefieldsF_32.f000077500000000000000000000111061507520047200211110ustar00rootroot00000000000000c In this program we (1) open the "swath.he5" HDF-EOS file, (2) c attach to the "Swath1" swath, and (3) define the swath fields c ============================================================= program he5_sw_definefieldsF_32 implicit none include 'hdfeos5.inc' integer status integer he5_swopen integer he5_swattach integer he5_swsetfill integer he5_swdefgfld integer he5_swdefdfld integer he5_prdefine integer he5_swdefchunk integer he5_swdefcomp integer he5_swdetach integer he5_swclose integer swfid, swid integer chunkrank integer*4 chunkdims(3) integer compparm(1) integer FAIL parameter (FAIL=-1) c Open the HDF-EOS file, "swath.he5" using "READ/WRITE" access code c ----------------------------------------------------------------- swfid = he5_swopen("swath.he5",HE5F_ACC_RDWR) write(*,*) 'File ID returned by he5_swopen(): ',swfid if (swfid .NE. FAIL) then swid = he5_swattach(swfid, "Swath1") write(*,*) 'Swath ID returned by he5_swattach(): ',swid if (swid .NE. FAIL) then c Define Geolocation and Data fields c ---------------------------------- c --------------------------------------------------------------- c We define six fields. The first three, "Time", "Longitude" c and "Latitude" are geolocation fields and thus we use the c geolocation dimensions "GeoTrack" and "GeoXtrack" in the field c definitions. We also must specify the data type using the c standard HDF data type codes. In this example the geolocation c are 4-byte (32 bit) floating point numbers. c c The next three fields are data fields. Note that either c geolocation or data dimensions can be used. c --------------------------------------------------------------- status = he5_swdefgfld(swid, "Time", "GeoTrack", 1 " ",HE5T_NATIVE_DOUBLE, 0) write(*,*) 'Status returned by he5_swdefgfld(): ',status status = he5_swdefgfld(swid, "Longitude", 1 "GeoXtrack,GeoTrack", 2 " ", HE5T_NATIVE_FLOAT, 0) write(*,*) 'Status returned by he5_swdefgfld(): ',status status = he5_swdefgfld(swid, "Latitude", 1 "GeoXtrack,GeoTrack", 2 " ", HE5T_NATIVE_FLOAT, 0) write(*,*) 'Status returned by he5_swdefgfld(): ',status status = he5_swdefdfld(swid, "Density", 1 "GeoTrack"," ", HE5T_NATIVE_FLOAT, 0) write(*,*) 'Status returned by he5_swdefdfld(): ',status status = he5_swdefdfld(swid, "Temperature", 1 "GeoXtrack,GeoTrack", 2 " ", HE5T_NATIVE_FLOAT, 0) write(*,*) 'Status returned by he5_swdefdfld(): ',status status = he5_swdefdfld(swid, "Pressure", 1 "Res2xtr,Res2tr", 2 " ", HE5T_NATIVE_FLOAT, 0) write(*,*) 'Status returned by he5_swdefdfld(): ',status chunkrank = 3 chunkdims(1) = 20 chunkdims(2) = 40 chunkdims(3) = 15 compparm(1) = 6 status = he5_swdefchunk(swid,chunkrank,chunkdims) write(*,*) 'Status returned by he5_swdefchunk(): ',status status = he5_swdefcomp(swid, 1 HE5_HDFE_COMP_DEFLATE,compparm) write(*,*) 'Status returned by he5_swdefcomp(): ', 1 status status = he5_swdefdfld(swid, "Spectra", 1 "Res2xtr,Res2tr,Bands", 2 " ", HE5T_NATIVE_DOUBLE, 0) write(*,*) 'Status returned by he5_swdefdfld(): ',status c Define Profile Field c ----------------------- status = he5_prdefine(swid, "Profile-2000", 1 "ProfDim", " ", HE5T_NATIVE_INT) write(*,*) 'Status returned by he5_prdefine(): ',status c Define Appendable Field c ----------------------- c status = he5_swdefdfld(swid, "Count", "GeoTrack", c 1"Unlim", HE5T_NATIVE_INT, 0) endif endif c Detach from the swath c --------------------- status = he5_swdetach(swid) write(*,*) 'Status returned by he5_swdetach(): ',status c Close the file c -------------- status = he5_swclose(swfid) write(*,*) 'Status returned by he5_swclose(): ',status stop end hdf-eos5-2.0/samples/he5_sw_definefieldsF_64.f000077500000000000000000000115001507520047200211140ustar00rootroot00000000000000c In this program we (1) open the "swath.he5" HDF-EOS file, (2) c attach to the "Swath1" swath, and (3) define the swath fields c ============================================================= program he5_sw_definefieldsF_64 implicit none include 'hdfeos5.inc' integer status integer he5_swopen integer he5_swattach integer he5_swsetfill integer he5_swdefgfld integer he5_prdefine integer he5_swdefdfld integer he5_swdefchunk integer he5_swdefcomp integer he5_swdetach integer he5_swclose integer swfid, swid integer chunkrank integer*8 chunkdims(3) integer compparm(1) integer FAIL parameter (FAIL=-1) c Open the HDF-EOS file, "swath.he5" using "READ/WRITE" access code c ----------------------------------------------------------------- swfid = he5_swopen("swath.he5",HE5F_ACC_RDWR) write(*,*) 'File ID returned by he5_swopen(): ',swfid if (swfid .NE. FAIL) then swid = he5_swattach(swfid, "Swath1") write(*,*) 'Swath ID returned by he5_swattach(): ',swid if (swid .NE. FAIL) then c Define Geolocation and Data fields c ---------------------------------- c --------------------------------------------------------------- c We define six fields. The first three, "Time", "Longitude" c and "Latitude" are geolocation fields and thus we use the c geolocation dimensions "GeoTrack" and "GeoXtrack" in the field c definitions. We also must specify the data type using the c standard HDF data type codes. In this example the geolocation c are 4-byte (32 bit) floating point numbers. c c The next three fields are data fields. Note that either c geolocation or data dimensions can be used. c --------------------------------------------------------------- status = he5_swdefgfld(swid, "Time", "GeoTrack", " ", 1 HE5T_NATIVE_DOUBLE, 0) write(*,*) 'Status returned by he5_swdefgfld(): ',status status = he5_swdefgfld(swid, "Longitude", 1 "GeoXtrack,GeoTrack"," ",HE5T_NATIVE_FLOAT,0) write(*,*) 'Status returned by he5_swdefgfld(): ',status status = he5_swdefgfld(swid,"Latitude", 1 "GeoXtrack,GeoTrack"," ",HE5T_NATIVE_FLOAT,0) write(*,*) 'Status returned by he5_swdefgfld(): ',status status = he5_swsetfill(swid,"test_string",HE5T_NATIVE_CHAR, 1 'missing') write(*,*) 'Status returned by he5_swsetfill(): ',status status = he5_swdefdfld(swid,"test_string","GeoXtrack", 1 " ",HE5T_NATIVE_CHAR,0) write(*,*) 'Status returned by he5_swdefdfld(): ',status status = he5_swdefdfld(swid,"Density","GeoTrack", 1 " ",HE5T_NATIVE_FLOAT,0) write(*,*) 'Status returned by he5_swdefdfld(): ',status status = he5_swdefdfld(swid,"Temperature", 1 "GeoXtrack,GeoTrack"," ",HE5T_NATIVE_FLOAT,0) write(*,*) 'Status returned by he5_swdefdfld(): ',status status = he5_swdefdfld(swid,"Pressure","Res2xtr,Res2tr", 1 " ", HE5T_NATIVE_FLOAT, 0) write(*,*) 'Status returned by he5_swdefdfld(): ',status chunkrank = 3 chunkdims(1) = 20 chunkdims(2) = 40 chunkdims(3) = 15 compparm(1) = 6 status = he5_swdefchunk(swid,chunkrank,chunkdims) write(*,*) 'Status returned by he5_swdefchunk(): ',status status = he5_swdefcomp(swid,HE5_HDFE_COMP_DEFLATE,compparm) write(*,*) 'Status returned by he5_swdefcomp(): ',status status = he5_swdefdfld(swid, "Spectra", 1 "Res2xtr,Res2tr,Bands"," ", 2 HE5T_NATIVE_DOUBLE,0) write(*,*) 'Status returned by he5_swdefdfld(): ',status c Define Profile Field c ----------------------- status = he5_prdefine(swid, "Profile-2000", 1 "ProfDim", " ", HE5T_NATIVE_INT) write(*,*) 'Status returned by he5_prdefine(): ',status c Define Appendable Field c ----------------------- c status = he5_swdefdfld(swid, "Count", "GeoTrack", c 1 "Unlim", HE5T_NATIVE_INT, 0) endif endif c Detach from the swath c --------------------- status = he5_swdetach(swid) write(*,*) 'Status returned by he5_swdetach(): ',status c Close the file c -------------- status = he5_swclose(swfid) write(*,*) 'Status returned by he5_swclose(): ',status stop end hdf-eos5-2.0/samples/he5_sw_definefields_szipF_32.f000066400000000000000000000116201507520047200221540ustar00rootroot00000000000000c In this program we (1) open the "swath.he5" HDF-EOS file, (2) c attach to the "Swath1" swath, and (3) define the swath fields c ============================================================= program he5_sw_definefieldsF_32 implicit none include 'hdfeos5.inc' integer status integer he5_swopen integer he5_swattach integer he5_swsetfill integer he5_swdefgfld integer he5_swdefdfld integer he5_prdefine integer he5_swdefchunk integer he5_swdefcomp integer he5_swdetach integer he5_swclose integer he5_szip_can_encode integer swfid, swid integer chunkrank integer canenc integer*4 chunkdims(3) integer compparm(1) integer FAIL parameter (FAIL=-1) c Open the HDF-EOS file, "swath.he5" using "READ/WRITE" access code c ----------------------------------------------------------------- swfid = he5_swopen("swath.he5",HE5F_ACC_RDWR) write(*,*) 'File ID returned by he5_swopen(): ',swfid if (swfid .NE. FAIL) then swid = he5_swattach(swfid, "Swath1") write(*,*) 'Swath ID returned by he5_swattach(): ',swid if (swid .NE. FAIL) then c Define Geolocation and Data fields c ---------------------------------- c --------------------------------------------------------------- c We define six fields. The first three, "Time", "Longitude" c and "Latitude" are geolocation fields and thus we use the c geolocation dimensions "GeoTrack" and "GeoXtrack" in the field c definitions. We also must specify the data type using the c standard HDF data type codes. In this example the geolocation c are 4-byte (32 bit) floating point numbers. c c The next three fields are data fields. Note that either c geolocation or data dimensions can be used. c --------------------------------------------------------------- status = he5_swdefgfld(swid, "Time", "GeoTrack", 1 " ",HE5T_NATIVE_DOUBLE, 0) write(*,*) 'Status returned by he5_swdefgfld(): ',status status = he5_swdefgfld(swid, "Longitude", 1 "GeoXtrack,GeoTrack", 2 " ", HE5T_NATIVE_FLOAT, 0) write(*,*) 'Status returned by he5_swdefgfld(): ',status status = he5_swdefgfld(swid, "Latitude", 1 "GeoXtrack,GeoTrack", 2 " ", HE5T_NATIVE_FLOAT, 0) write(*,*) 'Status returned by he5_swdefgfld(): ',status status = he5_swdefdfld(swid, "Density", 1 "GeoTrack"," ", HE5T_NATIVE_FLOAT, 0) write(*,*) 'Status returned by he5_swdefdfld(): ',status status = he5_swdefdfld(swid, "Temperature", 1 "GeoXtrack,GeoTrack", 2 " ", HE5T_NATIVE_FLOAT, 0) write(*,*) 'Status returned by he5_swdefdfld(): ',status status = he5_swdefdfld(swid, "Pressure", 1 "Res2xtr,Res2tr", 2 " ", HE5T_NATIVE_FLOAT, 0) write(*,*) 'Status returned by he5_swdefdfld(): ',status chunkrank = 3 chunkdims(1) = 20 chunkdims(2) = 40 chunkdims(3) = 15 compparm(1) = 6 status = he5_swdefchunk(swid,chunkrank,chunkdims) write(*,*) 'Status returned by he5_swdefchunk(): ',status canenc = he5_szip_can_encode() if (canenc .ne. 0) then status = he5_swdefcomp(swid, 1 HE5_HDFE_COMP_SHUF_SZIP_K13orEC,compparm) write(*,*) 'Status returned by he5_swdefcomp(): ', 1 status else write(*,*) 'SZIP encoder is not available.' write(*,*) 'The data compression test is skipped.' endif status = he5_swdefdfld(swid, "Spectra", 1 "Res2xtr,Res2tr,Bands", 2 " ", HE5T_NATIVE_DOUBLE, 0) write(*,*) 'Status returned by he5_swdefdfld(): ',status c Define Profile Field c ----------------------- status = he5_prdefine(swid, "Profile-2000", 1 "ProfDim", " ", HE5T_NATIVE_INT) write(*,*) 'Status returned by he5_prdefine(): ',status c Define Appendable Field c ----------------------- c status = he5_swdefdfld(swid, "Count", "GeoTrack", c 1"Unlim", HE5T_NATIVE_INT, 0) endif endif c Detach from the swath c --------------------- status = he5_swdetach(swid) write(*,*) 'Status returned by he5_swdetach(): ',status c Close the file c -------------- status = he5_swclose(swfid) write(*,*) 'Status returned by he5_swclose(): ',status stop end hdf-eos5-2.0/samples/he5_sw_definefields_szipF_64.f000066400000000000000000000122711507520047200221640ustar00rootroot00000000000000c In this program we (1) open the "swath.he5" HDF-EOS file, (2) c attach to the "Swath1" swath, and (3) define the swath fields c ============================================================= program he5_sw_definefieldsF_64 implicit none include 'hdfeos5.inc' integer status integer he5_swopen integer he5_swattach integer he5_swsetfill integer he5_swdefgfld integer he5_prdefine integer he5_swdefdfld integer he5_swdefchunk integer he5_swdefcomp integer he5_swdetach integer he5_swclose integer he5_szip_can_encode integer swfid, swid integer chunkrank integer canenc integer*8 chunkdims(3) integer compparm(1) integer FAIL parameter (FAIL=-1) c Open the HDF-EOS file, "swath.he5" using "READ/WRITE" access code c ----------------------------------------------------------------- swfid = he5_swopen("swath.he5",HE5F_ACC_RDWR) write(*,*) 'File ID returned by he5_swopen(): ',swfid if (swfid .NE. FAIL) then swid = he5_swattach(swfid, "Swath1") write(*,*) 'Swath ID returned by he5_swattach(): ',swid if (swid .NE. FAIL) then c Define Geolocation and Data fields c ---------------------------------- c --------------------------------------------------------------- c We define six fields. The first three, "Time", "Longitude" c and "Latitude" are geolocation fields and thus we use the c geolocation dimensions "GeoTrack" and "GeoXtrack" in the field c definitions. We also must specify the data type using the c standard HDF data type codes. In this example the geolocation c are 4-byte (32 bit) floating point numbers. c c The next three fields are data fields. Note that either c geolocation or data dimensions can be used. c --------------------------------------------------------------- status = he5_swdefgfld(swid, "Time", "GeoTrack", " ", 1 HE5T_NATIVE_DOUBLE, 0) write(*,*) 'Status returned by he5_swdefgfld(): ',status status = he5_swdefgfld(swid, "Longitude", 1 "GeoXtrack,GeoTrack"," ",HE5T_NATIVE_FLOAT,0) write(*,*) 'Status returned by he5_swdefgfld(): ',status status = he5_swdefgfld(swid,"Latitude", 1 "GeoXtrack,GeoTrack"," ",HE5T_NATIVE_FLOAT,0) write(*,*) 'Status returned by he5_swdefgfld(): ',status status = he5_swsetfill(swid,"test_string",HE5T_NATIVE_CHAR, 1 'missing') write(*,*) 'Status returned by he5_swsetfill(): ',status status = he5_swdefdfld(swid,"test_string","GeoXtrack", 1 " ",HE5T_NATIVE_CHAR,0) write(*,*) 'Status returned by he5_swdefdfld(): ',status status = he5_swdefdfld(swid,"Density","GeoTrack", 1 " ",HE5T_NATIVE_FLOAT,0) write(*,*) 'Status returned by he5_swdefdfld(): ',status status = he5_swdefdfld(swid,"Temperature", 1 "GeoXtrack,GeoTrack"," ",HE5T_NATIVE_FLOAT,0) write(*,*) 'Status returned by he5_swdefdfld(): ',status status = he5_swdefdfld(swid,"Pressure","Res2xtr,Res2tr", 1 " ", HE5T_NATIVE_FLOAT, 0) write(*,*) 'Status returned by he5_swdefdfld(): ',status chunkrank = 3 chunkdims(1) = 20 chunkdims(2) = 40 chunkdims(3) = 15 compparm(1) = 6 status = he5_swdefchunk(swid,chunkrank,chunkdims) write(*,*) 'Status returned by he5_swdefchunk(): ',status canenc = he5_szip_can_encode() if (canenc .ne. 0) then status = he5_swdefcomp(swid, 1 HE5_HDFE_COMP_SHUF_SZIP_K13orEC,compparm) write(*,*) 'Status returned by he5_swdefcomp(): ', 1 status else write(*,*) 'SZIP encoder is not available.' write(*,*) 'The data compression test is skipped.' endif status = he5_swdefdfld(swid, "Spectra", 1 "Res2xtr,Res2tr,Bands"," ", 2 HE5T_NATIVE_DOUBLE,0) write(*,*) 'Status returned by he5_swdefdfld(): ',status c Define Profile Field c ----------------------- status = he5_prdefine(swid, "Profile-2000", 1 "ProfDim", " ", HE5T_NATIVE_INT) write(*,*) 'Status returned by he5_prdefine(): ',status c Define Appendable Field c ----------------------- c status = he5_swdefdfld(swid, "Count", "GeoTrack", c 1 "Unlim", HE5T_NATIVE_INT, 0) endif endif c Detach from the swath c --------------------- status = he5_swdetach(swid) write(*,*) 'Status returned by he5_swdetach(): ',status c Close the file c -------------- status = he5_swclose(swfid) write(*,*) 'Status returned by he5_swclose(): ',status stop end hdf-eos5-2.0/samples/he5_sw_defunlimfld.c000077500000000000000000000075451507520047200203600ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include /* In this program we (1) open the "Swath.h5" HDF-EOS file, */ /* (2) attach to the "Swath1" swath, and (3) define the swath */ /* fields, including appendable field "Spectra". */ /* ------------------------------------------------------------ */ #define RANK 3 int main() { herr_t status = FAIL; hid_t swfid = FAIL; hid_t SWid = FAIL; int comp_level[ 5 ] = { 0, 0, 0, 0, 0 }; int comp_code; hsize_t chunk_dims[ 3 ]; /* Open the file, "Swath.h5", using the H5F_ACC_RDWR access code */ /* ------------------------------------------------------------- */ swfid = HE5_SWopen("Swath.h5", H5F_ACC_RDWR); if (swfid != FAIL) { SWid = HE5_SWattach(swfid, "Swath1"); if (SWid != FAIL) { /* * We define seven fields. The first three, "Time", "Longitude" * and "Latitude" are geolocation fields and thus we use the * geolocation dimensions "GeoTrack" and "GeoXtrack" in the field * definitions. * * The next four fields are data fields. Note that either * geolocation or data dimensions can be used. */ status = HE5_SWdefgeofield(SWid, "Time", "GeoTrack", NULL, H5T_NATIVE_DOUBLE, 0); printf("Status returned by HE5_SWdefgeofield(...\"Time\",...) : %d\n",status); status = HE5_SWdefgeofield(SWid, "Longitude", "GeoTrack,GeoXtrack", NULL, H5T_NATIVE_FLOAT, 0); printf("Status returned by HE5_SWdefgeofield(...\"Longitude\",...) : %d\n",status); status = HE5_SWdefgeofield(SWid, "Latitude", "GeoTrack,GeoXtrack", NULL, H5T_NATIVE_FLOAT, 0); printf("Status returned by HE5_SWdefgeofield(...\"Latitude\",...) : %d\n",status); status = HE5_SWdefdatafield(SWid, "Density", "GeoTrack", NULL, H5T_NATIVE_FLOAT, 0); printf("Status returned by HE5_SWdefdatafield(...\"Density\",...) : %d\n",status); status = HE5_SWdefdatafield(SWid, "Temperature", "GeoTrack,GeoXtrack",NULL, H5T_NATIVE_FLOAT, 0); printf("Status returned by HE5_SWdefdatafield(...\"Temperature\",...) : %d\n",status); status = HE5_SWdefdatafield(SWid, "Pressure", "Res2tr,Res2xtr", NULL, H5T_NATIVE_DOUBLE, 0); printf("Status returned by HE5_SWdefdatafield(...\"Pressure\",...) : %d\n",status); /* Define Appendable Field */ /* ------------------------ */ /* ---------------------------------------- */ /* First, define chunking */ /* (the appendable dataset must be chunked) */ /* ---------------------------------------- */ chunk_dims[0] = 15; chunk_dims[1] = 40; chunk_dims[2] = 20; status = HE5_SWdefchunk(SWid, RANK, chunk_dims); printf("\tStatus returned by HE5_SWdefchunk() : %d\n",status); comp_code = 4; /*comp_code = 0;*/ comp_level[0] = 6; /*comp_level[0] = 0;*/ status = HE5_SWdefcomp(SWid,comp_code, comp_level); printf("\tStatus returned by HE5_SWdefcomp() : %d\n",status); status = HE5_SWdefdatafield(SWid, "Spectra", "Bands,Res2tr,Res2xtr", "Unlim,Unlim,Unlim", H5T_NATIVE_FLOAT, 0); printf("Status returned by HE5_SWdefdatafield(...\"Spectra\",...) : %d\n",status); /* Define Profile field */ /* -------------------- */ status = HE5_PRdefine(SWid, "Profile-2000", "ProfDim", NULL, H5T_NATIVE_UINT); printf("Status returned by HE5_PRdefine(...\"Profile-2000\",...) : %d\n",status); } } status = HE5_SWdetach(SWid); status = HE5_SWclose(swfid); return 0; } hdf-eos5-2.0/samples/he5_sw_info.c000077500000000000000000000246761507520047200170260ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include /* In this program we retrieve information about (1) dimensions, (2) */ /* dimension mappings (geolocation relations), (3) swath fields, */ /* and (4) the global/group/local attributes */ /* ------------------------------------------------------------------- */ int main() { herr_t status = FAIL; int i, rk, *rank, rk1, chunk_rank; hid_t swfid = FAIL, SWid = FAIL; hid_t ntype[10]; hid_t dtype = FAIL; hid_t dtype_char = FAIL; hid_t dtype1 = FAIL; long ndims, strbufsize, nmaps, nflds, nattr; long *off, *inc, *indx, offset, incr; hsize_t *sizes, dimsize; hsize_t dim[8], *dims, dim1[8], chunk_dim[8]; hsize_t n, nelem = 0; char version[80] = {0}; char *dimname, *dimmap, *fieldlist; char dimlist[80], attrlist[80], dimlist1[80]; int level[ 5 ] = { 0, 0, 0, 0, 0 }; int code = 0; /* Open the Swath HDF-EOS File "Swath.h5" for reading only */ /* ------------------------------------------------------- */ swfid = HE5_SWopen("Swath.h5", H5F_ACC_RDONLY); if (swfid != FAIL) { HE5_EHgetversion(swfid, version); printf("HDF-EOS library version: \"%s\" \n", version); /* Attach the swath "Swath1" */ /* ------------------------ */ SWid = HE5_SWattach(swfid, "Swath1"); if (SWid != FAIL) { /* Inquire Dimensions */ /* ------------------ */ ndims = HE5_SWnentries(SWid, HE5_HDFE_NENTDIM, &strbufsize); dims = (hsize_t *) calloc(ndims, sizeof(hsize_t)); dimname = (char *) calloc(strbufsize + 1, 1); ndims = HE5_SWinqdims(SWid, dimname, dims); printf("Dimension list: %s\n", dimname); for (i = 0; i < ndims; i++) printf("dim size: %li\n", (long)dims[i]); free(dims); free(dimname); /* Inquire Dimension Mappings */ /* -------------------------- */ nmaps = HE5_SWnentries(SWid, HE5_HDFE_NENTMAP, &strbufsize); off = (long *)calloc(nmaps, sizeof(long)); inc = (long *)calloc(nmaps, sizeof(long)); dimmap = (char *)calloc(strbufsize + 1, 1); nmaps = HE5_SWinqmaps(SWid, dimmap, off, inc); printf("Dimension map: %s\n", dimmap); for (i = 0; i < nmaps; i++) printf("offset increment: %li %li\n", off[i], inc[i]); free(off); free(inc); free(dimmap); /* Inquire Indexed Dimension Mappings */ /* ---------------------------------- */ nmaps = HE5_SWnentries(SWid, HE5_HDFE_NENTIMAP, &strbufsize); sizes = (hsize_t *) calloc(nmaps, sizeof(hsize_t)); dimmap = (char *) calloc(strbufsize + 1, 1); nmaps = HE5_SWinqidxmaps(SWid, dimmap, sizes); printf("Index Dimension map: %s\n", dimmap); for (i = 0; i < nmaps; i++) printf("sizes: %lu\n", (unsigned long)sizes[i]); free(sizes); free(dimmap); /* Inquire Geolocation Fields */ /* -------------------------- */ nflds = HE5_SWnentries(SWid, HE5_HDFE_NENTGFLD, &strbufsize); rank = (int *)calloc(nflds, sizeof(int)); fieldlist = (char *) calloc(strbufsize + 1, 1); nflds = HE5_SWinqgeofields(SWid, fieldlist, rank, ntype); printf("geo fields: %s\n", fieldlist); for (i = 0; i < nflds; i++) printf("Rank: %d Data type: %ld\n", rank[i], (long) ntype[i]); free(rank); free(fieldlist); /* Inquire Data Fields */ /* ------------------- */ nflds = HE5_SWnentries(SWid, HE5_HDFE_NENTDFLD, &strbufsize); rank = (int *) calloc(nflds, sizeof(int)); fieldlist = (char *) calloc(strbufsize + 1, 1); nflds = HE5_SWinqdatafields(SWid, fieldlist, rank, ntype); printf("data fields: %s\n", fieldlist); for (i = 0; i < nflds; i++) printf("Rank: %d Data type: %ld\n", rank[i], (long) ntype[i]); free(rank); free(fieldlist); /* Get info on "GeoTrack" dim */ /* -------------------------- */ dimsize = HE5_SWdiminfo(SWid, "GeoTrack"); printf("Size of GeoTrack: %lu\n", (unsigned long)dimsize); dimsize = HE5_SWdiminfo(SWid, "Unlim"); printf("Size of Unlim: %li\n", (long)dimsize); /* Get info on "GeoTrack/Res2tr" mapping */ /* ------------------------------------- */ status = HE5_SWmapinfo(SWid, "GeoTrack", "Res2tr", &offset, &incr); printf("Mapping Offset: %li\n", offset); printf("Mapping Increment: %li\n", incr); /* Get info on "IndxTrack/Res2tr" indexed mapping */ /* ---------------------------------------------- */ dimsize = HE5_SWdiminfo(SWid, "IndxTrack"); indx = (long *) calloc(dimsize, sizeof(long)); n = HE5_SWidxmapinfo(SWid, "IndxTrack", "Res2tr", indx); for (i = 0; i < n; i++) printf("Index Mapping Entry %d: %li\n", i+1, indx[i]); free(indx); /* Get info on "Longitude" Field */ /* ----------------------------- */ status = HE5_SWfieldinfo(SWid, "Longitude", &rk, dim, &dtype, dimlist, NULL); printf("Longitude Rank: %d\n", rk); printf("Longitude NumberType: %ld\n", (long) dtype); printf("Longitude Dimension List: %s\n", dimlist); for (i = 0; i < rk; i++) printf("Dimension %d: %lu\n",i+1,(unsigned long)dim[i]); status = HE5_SWfieldinfo(SWid, "Test_string", &rk1, dim1, &dtype_char, dimlist1, NULL); printf("Test_string Rank: %d\n", rk1); printf("Test_string NumberType: %ld\n", (long) dtype_char); printf("Test_string Dimension List: %s\n", dimlist1); for (i = 0; i < rk1; i++) printf("Dimension %d: %lu\n",i+1,(unsigned long)dim1[i]); dtype1 = FAIL; /* Get info about Global Attributes */ /* -------------------------------- */ printf("Global Attribute:\n"); status = HE5_SWattrinfo(SWid,"GlobalAttribute",&dtype1, &nelem); printf("\t\t Data type: %ld\n", (long) dtype1); printf("\t\t Number of elements: %lu \n", (unsigned long)nelem); nelem = 0; status = HE5_SWattrinfo(SWid,"GLOBAL_CHAR_ATTR",&dtype1, &nelem); printf("\t\t Data type: %ld\n", (long) dtype1); printf("\t\t The size of string: %lu \n", (unsigned long)nelem); nelem = 0; status = HE5_SWattrinfo(SWid,"GLOBAL_DOUBLE_ATTR",&dtype1, &nelem); printf("\t\t Data type: %ld\n", (long) dtype1); printf("\t\t Number of elements: %lu \n", (unsigned long)nelem); nelem = 0; dtype1 = FAIL; /* Get info about Group Attributes */ /* ------------------------------- */ printf("Group Attribute:\n"); status = HE5_SWgrpattrinfo(SWid,"GroupAttribute",&dtype1,&nelem); printf("\t\t Data type: %ld\n", (long) dtype1); printf("\t\t Number of elements: %lu \n", (unsigned long)nelem); nelem = 777; dtype1 = FAIL; /* Get info about Local Attributes */ /* ------------------------------- */ printf("Local Attribute:\n"); status = HE5_SWlocattrinfo(SWid,"Density", "LocalAttribute_1",&dtype1,&nelem); printf("\t\t Data type: %ld\n", (long) dtype1); printf("\t\t Number of elements: %lu \n", (unsigned long)nelem); printf("Local Attribute:\n"); status = HE5_SWlocattrinfo(SWid,"Longitude", "LocalAttribute_2",&dtype1,&nelem); printf("\t\t Data type: %ld\n", (long) dtype1); printf("\t\t Number of elements: %lu \n", (unsigned long)nelem); nelem = 0; status = HE5_SWlocattrinfo(SWid,"Time", "LOCAL_CHAR_ATTR",&dtype1,&nelem); printf("\t\t Data type: %ld\n", (long) dtype1); printf("\t\t The size of string: %lu \n", (unsigned long)nelem); /* Inquire Global Attributes */ /* ------------------------- */ printf("Global Attributes:\n"); nattr = HE5_SWinqattrs(SWid, NULL, &strbufsize); printf("\t\t Number of attributes: %li \n", nattr); printf("\t\t String length of attribute list: %li \n", strbufsize); n = HE5_SWinqattrs(SWid, attrlist, &strbufsize); printf("\t\t Attribute list: %s \n", attrlist); /* Inquire Group Attributes */ /* ------------------------ */ strbufsize = 0; printf("\n"); printf("Group Attributes:\n"); nattr = HE5_SWinqgrpattrs(SWid, NULL, &strbufsize); printf("\t\t Number of attributes: %li \n", nattr); printf("\t\t String length of attribute list: %li \n", strbufsize); strcpy(attrlist,""); nattr = HE5_SWinqgrpattrs(SWid, attrlist, &strbufsize); printf("\t\t Attribute list: %s \n", attrlist); /* Inquire Local Attributes */ /* ------------------------ */ strbufsize = 0; printf("\n"); printf("Local Attributes:\n"); nattr = HE5_SWinqlocattrs(SWid, "Density", NULL, &strbufsize); printf("\t\t Number of attributes: %li \n", nattr); printf("\t\t String length of attribute list: %li \n", strbufsize); strcpy(attrlist,""); nattr = HE5_SWinqlocattrs(SWid, "Density", attrlist, &strbufsize); printf("\t\t Attribute list: %s \n", attrlist); nattr = HE5_SWinqlocattrs(SWid, "Longitude", NULL, &strbufsize); printf("\t\t Number of attributes: %li \n", nattr); printf("\t\t String length of attribute list: %li \n", strbufsize); strcpy(attrlist,""); nattr = HE5_SWinqlocattrs(SWid, "Longitude", attrlist, &strbufsize); printf("\t\t Attribute list: %s \n", attrlist); status = HE5_SWcompinfo(SWid,"Spectra",&code,level); printf("\n"); printf("\t\t Compression scheme Compression level\n"); printf("\t\t %d, %d\n", code, level[0]); status = HE5_SWchunkinfo(SWid,"Spectra",&chunk_rank,chunk_dim); printf("\n"); printf("\t\t Spectra chunk rank: %d\n", chunk_rank); for (i = 0; i < chunk_rank; i++) printf("\t\t Spectra chunk dimension %d: %lu\n",i+1, (unsigned long)chunk_dim[i]); } } status = HE5_SWdetach(SWid); status = HE5_SWclose(swfid); return 0; } hdf-eos5-2.0/samples/he5_sw_infoF_32.f000077500000000000000000000134171507520047200174320ustar00rootroot00000000000000c In this program we retrieve (1) information about the c dimensions, (2) the dimension mappings c (geolocation relations), and (3) the swath fields program he5_sw_infoF_32 implicit none include 'hdfeos5.inc' integer i integer status integer swfid, swid integer he5_swopen integer he5_swattach integer he5_swfldinfo integer he5_swattrinfo integer he5_swmapinfo integer he5_swinqgfldalias integer he5_swinqdfldalias integer he5_swchunkinfo integer he5_swdetach integer he5_swclose integer rank(32) integer ntype(32) integer rk integer nt integer*4 he5_swinqdims integer*4 he5_swinqmaps integer*4 he5_swinqgflds integer*4 he5_swinqdflds integer*4 he5_swdiminfo integer*4 he5_swimapinfo integer*4 he5_swinqimaps integer*4 n integer*4 offset integer*4 incr integer*4 ndims integer*4 nmaps integer*4 nflds integer*4 dims(32) integer*4 off(32) integer*4 inc(32) integer*4 sizes(8) integer*4 indx(32) integer*4 dimsize integer*4 count character*72 dimname character*72 dimmap character*72 dimlist character*72 maxdimlst character*72 fieldlist integer*4 nfldalias integer*4 strbufsize character*72 fldaliases integer chunkrank integer*4 chunkdims(32) integer FAIL parameter (FAIL=-1) c Open the "swath.he5" file for "read only" access c ------------------------------------------------ swfid = he5_swopen("swath.he5", HE5F_ACC_RDONLY) write(*,*) 'File ID returned by he5_swopen(): ',swfid if (swfid .NE. FAIL) then c Attach the swath c ---------------- swid = he5_swattach(swfid, "Swath1") write(*,*) 'Swath ID returned by he5_swattach(): ',swid if (swid .NE. FAIL) then c Inquire Dimensions c ------------------ ndims = he5_swinqdims(swid, dimname, dims) write(*,*) 'Dimension list: ', dimname do i = 1,ndims write(*,*) 'dim size: ', dims(i) enddo write(*,*) c Inquire Dimension Mappings c -------------------------- nmaps = he5_swinqmaps(swid, dimmap, off, inc) write(*,*) 'Dimension map: ', dimmap do i = 1,nmaps write(*,*) 'offset increment: ', off(i), inc(i) enddo write(*,*) c Inquire Indexed Dimension Mappings c ---------------------------------- nmaps = he5_swinqimaps(swid, dimmap, sizes) write(*,*) 'Index Dimension map: ', dimmap do i=1,nmaps write(*,*) 'sizes: ', sizes(i) enddo write(*,*) c Inquire Geolocation Fields c -------------------------- nflds = he5_swinqgflds(swid, fieldlist, rank, ntype) write(*,*) 'Geolocation fieldlist: ', fieldlist do i=1,nflds write(*,*) 'field rank & datatype: ',rank(i),ntype(i) enddo write(*,*) nfldalias = he5_swinqgfldalias(swid,fldaliases,strbufsize) write(*,*) 'Fields & aliases list: ',fldaliases write(*,*) 'Length of list is ',strbufsize c Inquire Data Fields c ------------------- nflds = he5_swinqdflds(swid, fieldlist, rank, ntype) write(*,*) 'Data Fieldlist: ', fieldlist do i=1,nflds write(*,*) 'field rank & datatype: ',rank(i),ntype(i) enddo write(*,*) nfldalias = he5_swinqdfldalias(swid,fldaliases,strbufsize) write(*,*) 'Fields & aliases list: ',fldaliases write(*,*) 'Length of list is ',strbufsize c Get info on "GeoTrack" dim c -------------------------- dimsize = he5_swdiminfo(swid, "GeoTrack") write(*,*) 'Size of GeoTrack: ', dimsize write(*,*) c Get info on "GeoTrack/Res2tr" mapping c ------------------------------------- status = he5_swmapinfo(swid,"GeoTrack","Res2tr", 1 offset,incr) write(*,*) 'Mapping Offset: ', offset write(*,*) 'Mapping Increment: ', incr write(*,*) c Get info on "IndxTrack/Res2tr" indexed mapping c ---------------------------------------------- n = he5_swimapinfo(swid, "IndxTrack", "Res2tr", indx) do i=1,n write(*,*) 'Index Mapping Entry ', i, indx(i) enddo write(*,*) c Get info on "Longitude" Field c ----------------------------- status = he5_swfldinfo(swid,"Longitude",rk,dims,nt, 1 dimlist,maxdimlst) write(*,*) 'Longitude Rank: ', rk write(*,*) 'Longitude NumberType: ', nt write(*,*) 'Longitude Dimlist: ', dimlist write(*,*) 'Longitude Max Dimlist: ', maxdimlst do i=1,rk write(*,*) 'Dimension ',i,dims(i) enddo status = he5_swattrinfo(swid,"GLOBAL_CHAR_ATTR",nt,count) write(*,*) 'GLOBAL_CHAR_ATTR NumberType: ', nt write(*,*) 'GLOBAL_CHAR_ATTR size: ', count status = he5_swchunkinfo(swid,"Spectra",chunkrank, 1 chunkdims) write(*,*) 'Spectra Chunking Rank: ', chunkrank do i=1,chunkrank write(*,*) 'Chunking Dimension ',i,chunkdims(i) enddo endif endif c Detach from swath c ----------------- status = he5_swdetach(swid) write(*,*) 'Status returned by he5_swdetach(): ',status c Close the file c -------------- status = he5_swclose(swfid) write(*,*) 'Status returned by he5_swclose(): ',status stop end hdf-eos5-2.0/samples/he5_sw_infoF_64.f000077500000000000000000000137201507520047200174340ustar00rootroot00000000000000c In this program we retrieve (1) information about the c dimensions, (2) the dimension mappings (geolocation relations), c and (3) the swath fields program he5_sw_infoF_64 implicit none include 'hdfeos5.inc' integer i integer status integer swfid, swid integer he5_swopen integer he5_swattach integer he5_swfldinfo integer he5_swattrinfo integer he5_swmapinfo integer he5_swchunkinfo integer he5_swdetach integer he5_swclose integer rank(32) integer ntype(32) integer rk integer nt integer*8 he5_swinqdims integer*8 he5_swinqmaps integer*8 he5_swinqgflds integer*8 he5_swinqdflds integer*8 he5_swdiminfo integer*8 he5_swimapinfo integer*8 he5_swinqimaps integer*8 he5_swinqgfldalias integer*8 offset integer*8 incr integer*8 ndims integer*8 nmaps integer*8 nflds integer*8 dims(32) integer*8 off(32) integer*8 inc(32) integer*8 sizes(8) integer*8 indx(32) integer*8 dimsize integer*8 n integer*8 count character*72 dimname character*72 dimmap character*72 dimlist character*72 maxdimlst character*72 fieldlist integer*8 nfldalias integer*8 strbufsize character*72 fldaliases integer chunkrank integer*8 chunkdims(32) integer FAIL parameter (FAIL=-1) c Open the "swath.he5" file for "read only" access c ------------------------------------------------ swfid = he5_swopen("swath.he5",HE5F_ACC_RDONLY) write(*,*) 'File ID returned by he5_swopen(): ',swfid if (swfid .NE. FAIL) then c Attach the swath c ---------------- swid = he5_swattach(swfid, "Swath1") write(*,*) 'Swath ID returned by he5_swattach(): ',swid if (swid .NE. FAIL) then c Inquire Dimensions c ------------------ ndims = he5_swinqdims(swid, dimname, dims) write(*,*) 'Dimension list: ', dimname do i = 1,ndims write(*,*) 'dim size: ', dims(i) enddo write(*,*) c Inquire Dimension Mappings c -------------------------- nmaps = he5_swinqmaps(swid, dimmap, off, inc) write(*,*) 'Dimension map: ', dimmap do i = 1,nmaps write(*,*) 'offset increment: ', off(i), inc(i) enddo write(*,*) c Inquire Indexed Dimension Mappings c ---------------------------------- nmaps = he5_swinqimaps(swid, dimmap, sizes) write(*,*) 'Index Dimension map: ', dimmap do i=1,nmaps write(*,*) 'sizes: ', sizes(i) enddo write(*,*) c Inquire Geolocation Fields c -------------------------- nflds = he5_swinqgflds(swid, fieldlist, rank, ntype) write(*,*) 'Geolocation fieldlist: ', fieldlist do i=1,nflds write(*,*) 'field rank & datatype: ',rank(i),ntype(i) enddo write(*,*) c Inquire Data Fields c ------------------- nflds = he5_swinqdflds(swid, fieldlist, rank, ntype) write(*,*) 'Data Fieldlist: ', fieldlist do i=1,nflds write(*,*) 'field rank & datatype: ',rank(i),ntype(i) enddo write(*,*) nfldalias = he5_swinqgfldalias(swid,fldaliases,strbufsize) write(*,*) 'Fields & aliases list: ',fldaliases write(*,*) 'Length of list is ',strbufsize c Get info on "GeoTrack" dim c -------------------------- dimsize = he5_swdiminfo(swid, "GeoTrack") write(*,*) 'Size of GeoTrack: ', dimsize write(*,*) c Get info on "GeoTrack/Res2tr" mapping c ------------------------------------- status = he5_swmapinfo(swid,"GeoTrack","Res2tr", 1 offset,incr) write(*,*) 'Mapping Offset: ', offset write(*,*) 'Mapping Increment: ', incr write(*,*) c Get info on "IndxTrack/Res2tr" indexed mapping c ---------------------------------------------- n = he5_swimapinfo(swid, "IndxTrack", "Res2tr", indx) do i=1,n write(*,*) 'Index Mapping Entry ', i, indx(i) enddo write(*,*) c Get info on "Longitude" Field c ----------------------------- status = he5_swfldinfo(swid,"Longitude",rk,dims,nt, 1 dimlist,maxdimlst) write(*,*) 'Longitude Rank: ', rk write(*,*) 'Longitude NumberType: ', nt write(*,*) 'Longitude Dimlist: ', dimlist write(*,*) 'Longitude Max Dimlist: ', maxdimlst do i=1,rk write(*,*) 'Dimension ',i,dims(i) enddo status = he5_swfldinfo(swid,"test_string",rk,dims,nt, 1 dimlist,maxdimlst) write(*,*) 'test_string: Rank: ', rk write(*,*) 'test_string: NumberType: ', nt write(*,*) 'test_string: Dimlist: ', dimlist write(*,*) 'test_string: Max Dimlist: ', maxdimlst do i=1,rk write(*,*) 'Dimension ',i,dims(i) enddo status = he5_swattrinfo(swid,"GLOBAL_CHAR_ATTR",nt,count) write(*,*) 'GLOBAL_CHAR_ATTR NumberType: ', nt write(*,*) 'GLOBAL_CHAR_ATTR size: ', count status = he5_swchunkinfo(swid,"Spectra",chunkrank, 1 chunkdims) write(*,*) 'Spectra Chunking Rank: ', chunkrank do i=1,chunkrank write(*,*) 'Chunking Dimension ',i,chunkdims(i) enddo endif endif c Detach from swath c ----------------- status = he5_swdetach(swid) write(*,*) 'Status returned by he5_swdetach(): ',status c Close the file c -------------- status = he5_swclose(swfid) write(*,*) 'Status returned by he5_swclose(): ',status stop end hdf-eos5-2.0/samples/he5_sw_rdexternaldata.c000077500000000000000000000065201507520047200210610ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include #define DIMIN 100 #define DIMOUT 60 int main() { FILE *in_1, *in_2, *in_3; herr_t status = FAIL; int i; int data_in_1[DIMIN]; int data_in_2[DIMIN]; int data_in_3[DIMIN]; int data_out[DIMOUT]; int nfiles = FAIL; hid_t swfid = FAIL; hid_t SWid = FAIL; size_t namelength = 48; off_t offset[3]; char filelist[256]; hssize_t start[2]; hsize_t count[2]; hsize_t size[3]; /* Create the external data sets */ /* ----------------------------- */ for (i = 0; i < DIMIN; i++) { data_in_1[i] = 1000 + i + 1; data_in_2[i] = 2000 + i + 1; data_in_3[i] = 3000 + i + 1; } /* Open the external data files */ /* ---------------------------- */ in_1 = fopen("external_1.data", "w"); in_2 = fopen("external_2.data", "w"); in_3 = fopen("external_3.data", "w"); /* Write data buffers to the external data files */ /* --------------------------------------------- */ fwrite(data_in_1, sizeof(int), DIMIN, in_1); fwrite(data_in_2, sizeof(int), DIMIN, in_2); fwrite(data_in_3, sizeof(int), DIMIN, in_3); /* Close the external data files */ /* ----------------------------- */ fclose(in_1); fclose(in_2); fclose(in_3); /* Open the HDF-EOS swath file, "Swath.h5" */ /* --------------------------------------- */ swfid = HE5_SWopen("Swath.h5", H5F_ACC_RDWR); if (swfid != FAIL) { /* Attach the "Swath1" swath */ /* ------------------------- */ SWid = HE5_SWattach(swfid, "Swath1"); if (SWid != FAIL) { /* Read the external data field */ /* ---------------------------- */ start[0] = 0; count[0] = DIMOUT; status = HE5_SWreadfield(SWid, "ExtData", start, NULL, count, data_out); printf("Status returned by HE5_SWreadfield() : %d \n", status); /* Display external data set */ /* ------------------------- */ printf(" \n"); for (i = 0; i < DIMOUT; i++) printf("%d ", data_out[i]); /* Get the number of external files */ /* -------------------------------- */ nfiles = HE5_SWgetextdata(SWid, "ExtData", namelength, filelist, offset, size); printf(" \n"); printf(" \n"); printf("Number of external files returned by HE5_SWgetextdata() : %d \n", nfiles); if (nfiles > 0) { printf(" \n"); printf("External files: \"%s\" \n", filelist); printf(" \n"); printf("offsets: "); for (i = 0; i < nfiles; i++) printf("%d ", (int)offset[i]); printf(" \n"); printf("sizes: "); for (i = 0; i < nfiles; i++) printf("%lu ", (unsigned long)size[i]); printf(" \n"); printf(" \n"); } } } /* Detach from the swath */ /* --------------------- */ status = HE5_SWdetach(SWid); printf("Status returned by HE5_SWdetach() : %d \n", status); /* Close the file */ /* -------------- */ status = HE5_SWclose(swfid); printf("Status returned by HE5_SWclose() : %d \n", status); return 0; } hdf-eos5-2.0/samples/he5_sw_rdexternaldataF_32.f000077500000000000000000000074771507520047200215120ustar00rootroot00000000000000c c ---------------------------------------------------------------------------- c | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | c ---------------------------------------------------------------------------- c program he5_sw_rdexternaldataF_32 implicit none include 'hdfeos5.inc' integer i integer status integer he5_swopen integer he5_swattach integer he5_swrdfld integer he5_swgetxdat integer he5_ehrdwrfile integer he5_swdetach integer he5_swclose integer swfid, swid integer nfiles integer datain1(100) integer datain2(100) integer datain3(100) integer dataout(60) integer*4 start(2) integer*4 stride(2) integer*4 count(2) integer*4 offset(3) integer*4 size(3) integer*4 nmlgth integer*4 num_elements character filelist*256 integer FAIL parameter (FAIL=-1) c.....Use this for writing (only) to an existing file integer WRITE_EXISTING_ONLY parameter (WRITE_EXISTING_ONLY=0) c.....Use this for reading (only) from an existing file integer READ_ONLY parameter (READ_ONLY=1) c.....Use this for creating and writing to a file integer WRITE_NEW parameter (WRITE_NEW=2) c Create the external data sets c ----------------------------- do 10 i=1,100 datain1(i) = 1000+i datain2(i) = 2000+i datain3(i) = 3000+i 10 continue num_elements = 100 status = he5_ehrdwrfile("extf1.dat",WRITE_NEW, 1HE5T_NATIVE_INT,num_elements,datain1) write(*,*) 'Status returned from he5_ehrdwrfile: ',status status = he5_ehrdwrfile("extf2.dat",WRITE_NEW, 1HE5T_NATIVE_INT,num_elements,datain2) write(*,*) 'Status returned from he5_ehrdwrfile: ',status status = he5_ehrdwrfile("extf3.dat",WRITE_NEW, 1HE5T_NATIVE_INT,num_elements,datain3) write(*,*) 'Status returned from he5_ehrdwrfile: ',status c Open HDF-EOS swath file, "swath.he5" c ----------------------------------- swfid = he5_swopen("swath.he5", HE5F_ACC_RDWR) write(*,*) 'File ID returned from he5_swopen(): ',swfid if (swfid .NE. FAIL) then swid = he5_swattach(swfid, "Swath1") write(*,*) 'Swath ID returned from he5_swattach(): ',swid if (swid .NE. FAIL) then c Read the external data field c ---------------------------- start(1) = 0 stride(1) = 1 count(1) = 60 status = he5_swrdfld(swid,"ExtData", 1 start,stride,count,dataout) write(*,*) 'Status returned from he5_swrdfld(): ',status c Display the data c ---------------- do i=1,60 write(*,*)'External data',dataout(i) enddo nmlgth = 48 c Get the number of external files c -------------------------------- nfiles = he5_swgetxdat(swid,"ExtData",nmlgth, 1 filelist,offset,size) write(*,*) 'Number of external files',nfiles write(*,*) 'External files:',filelist do i=1,nfiles write(*,*) 'offsets:',offset(i) write(*,*) 'sizes:',size(i) enddo endif endif c Detach from swath c ----------------- status = he5_swdetach(swid) write(*,*) 'Status returned from he5_swdetach(): ',status c Close the file c -------------- status = he5_swclose(swfid) write(*,*) 'Status returned from he5_swclose(): ',status stop end hdf-eos5-2.0/samples/he5_sw_rdexternaldataF_64.f000077500000000000000000000075011507520047200215030ustar00rootroot00000000000000c c ---------------------------------------------------------------------------- c | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | c ---------------------------------------------------------------------------- c program he5_sw_rdexternaldataF_64 implicit none include 'hdfeos5.inc' integer i integer status integer he5_swopen integer he5_swattach integer he5_swrdfld integer he5_swgetxdat integer he5_ehrdwrfile integer he5_swdetach integer he5_swclose integer swfid, swid integer nfiles integer datain1(100) integer datain2(100) integer datain3(100) integer dataout(60) integer*8 start(2) integer*8 stride(2) integer*8 count(2) integer*8 offset(3) integer*8 size(3) integer*8 nmlgth integer*8 num_elements character filelist*256 integer FAIL parameter (FAIL=-1) c.....Use this for writing (only) to an existing file integer WRITE_EXISTING_ONLY parameter (WRITE_EXISTING_ONLY=0) c.....Use this for reading (only) from an existing file integer READ_ONLY parameter (READ_ONLY=1) c.....Use this for creating and writing to a file integer WRITE_NEW parameter (WRITE_NEW=2) c Create the external data sets c ----------------------------- do 10 i=1,100 datain1(i) = 1000+i datain2(i) = 2000+i datain3(i) = 3000+i 10 continue num_elements = 100 status = he5_ehrdwrfile("extf1.dat",WRITE_NEW, 1HE5T_NATIVE_INT,num_elements,datain1) write(*,*) 'Status returned from he5_ehrdwrfile: ',status status = he5_ehrdwrfile("extf2.dat",WRITE_NEW, 1HE5T_NATIVE_INT,num_elements,datain2) write(*,*) 'Status returned from he5_ehrdwrfile: ',status status = he5_ehrdwrfile("extf3.dat",WRITE_NEW, 1HE5T_NATIVE_INT,num_elements,datain3) write(*,*) 'Status returned from he5_ehrdwrfile: ',status c Open HDF-EOS swath file, "swath.he5" c ------------------------------------ swfid = he5_swopen("swath.he5", HE5F_ACC_RDWR) write(*,*) 'File ID returned from he5_swopen(): ',swfid if (swfid .NE. FAIL) then swid = he5_swattach(swfid, "Swath1") write(*,*) 'Swath ID returned from he5_swattach(): ',swid if (swid .NE. FAIL) then c Read the external data field c ---------------------------- start(1) = 0 stride(1) = 1 count(1) = 60 status = he5_swrdfld(swid,"ExtData", 1 start,stride,count,dataout) write(*,*) 'Status returned from he5_swrdfld(): ',status c Display the data c ---------------- do i=1,60 write(*,*)'External data',dataout(i) enddo nmlgth = 48 c Get the number of external files c -------------------------------- nfiles = he5_swgetxdat(swid,"ExtData",nmlgth, 1 filelist,offset,size) write(*,*) 'Number of external files',nfiles write(*,*) 'External files:',filelist do i=1,nfiles write(*,*) 'offsets:',offset(i) write(*,*) 'sizes:',size(i) enddo endif endif c Detach from swath c ----------------- status = he5_swdetach(swid) write(*,*) 'Status returned from he5_swdetach(): ',status c Close the file c -------------- status = he5_swclose(swfid) write(*,*) 'Status returned from he5_swclose(): ',status stop end hdf-eos5-2.0/samples/he5_sw_readdata.c000077500000000000000000000143111507520047200176210ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include /* In this program we (1) open the "Swath.h5" HDF-EOS file, (2) attach to */ /* the "Swath1" swath, and (3) read data from the "Longitude" field. Also, */ /* we read the global/group/local attributes */ /* ----------------------------------------------------------------------- */ int main() { herr_t status = FAIL; int i, j, k; int attr1[4]; /* data buffer for global attribute */ int attr2[4]; /* .... for group attribute */ int attr3[4]; /* .... for local attribute */ hid_t swfid = FAIL; hid_t SWid = FAIL; char attr4[20] = {0}; /* ... for global 'char' attribute */ long attr5[4]; /* ... for global 'long' attribute */ double attr6[4]; /* ... for global 'double' attribute */ float attr7[4]; /* ... for local 'float' attribute */ char attr8[20] = {0}; /* ... for local 'char' attribute */ hssize_t start[2]; hsize_t count[2]; float lng[20][10]; hvl_t buffer_out[4];/* Buffer to read out data from profile */ char *charname[10] = {0}; /* Open the HDF-EOS swath file, "Swath.h5" */ /* --------------------------------------- */ swfid = HE5_SWopen("Swath.h5", H5F_ACC_RDONLY); if (swfid != FAIL) { /* Attach the "Swath1" swath */ /* ------------------------- */ SWid = HE5_SWattach(swfid, "Swath1"); if (SWid != FAIL) { /* Read the entire longitude field */ /* ------------------------------- */ start[0] = 0; start[1] = 0; count[0] = 20; count[1] = 10; status = HE5_SWreadfield(SWid, "Longitude", start, NULL, count, lng); printf("Status returned by HE5_SWreadfield() : %d \n", status); /* Display longitude data */ /* ---------------------- */ for (i = 0; i < 20; i++) for (j = 0; j < 10; j++) printf("i j Longitude: %d %d %f\n", i, j, lng[i][j]); start[0] = 0; count[0] = 10; for (i = 0; i < 10; i++) charname[i] = (char *)malloc(95*sizeof(char)); status = HE5_SWreadfield(SWid, "Test_string", start, NULL, count, charname); printf("Status returned by HE5_SWreadfield() : %d \n", status); /* Display Test_string data */ /* ---------------------- */ for (i = 0; i < 10; i++) printf("i = %d string = %s\n", i, charname[i]); for (i = 0; i < 10; i++) free(charname[i]); /* Read data from the Profile */ /* -------------------------- */ start[0] = 0; count[0] = 4; status = HE5_PRread(SWid, "Profile-2000", start, NULL, count, buffer_out); printf("Status returned by HE5_PRread() : %d \n", status); /* Display the profile data */ /* ------------------------ */ for (i = 0; i < 4; i++) { printf("\tThe %d-th element length is %d \n", i, (unsigned)buffer_out[i].len); for (j = 0; j < buffer_out[i].len; j++) printf("\t\t %d \n", ((unsigned int *)buffer_out[i].p)[j]); } /* Release IDs and memory */ /* ---------------------- */ status = HE5_PRreclaimspace(SWid, "Profile-2000", buffer_out); printf("Status returned by HE5_PRreclaimspace() : %d \n", status); /* Read Global 'int' Attribute */ /* --------------------------- */ status = HE5_SWreadattr(SWid, "GlobalAttribute", attr1); printf("Status returned by HE5_SWreadattr() : %d \n", status); printf("Global attribute values:\n"); for (i = 0; i < 4; i++) printf("\t\t %d \n",attr1[i]); /* Read Group Attribute */ /* -------------------- */ status = HE5_SWreadgrpattr(SWid, "GroupAttribute", attr2); printf("Status returned by HE5_SWreadgrpattr() : %d \n", status); printf("Group attribute values:\n"); for (i = 0; i < 4; i++) printf("\t\t %d \n",attr2[i]); /* Read Local Attribute */ /* -------------------- */ status = HE5_SWreadlocattr(SWid, "Density", "LocalAttribute_1", attr3); printf("Status returned by HE5_SWreadlocattr() : %d \n", status); printf("Local attribute values:\n"); for (i = 0; i < 4; i++) printf("\t\t %d \n",attr3[i]); /* Read Local Attribute */ /* -------------------- */ status = HE5_SWreadlocattr(SWid, "Longitude", "LocalAttribute_2", attr7); printf("Status returned by HE5_SWreadlocattr() : %d \n", status); printf("Local attribute values:\n"); for (i = 0; i < 4; i++) printf("\t\t %f \n",attr7[i]); status = HE5_SWreadlocattr(SWid, "Time", "LOCAL_CHAR_ATTR", attr8); printf("Status returned by HE5_SWreadlocattr() : %d \n", status); printf("Local attribute values:\n"); printf("\t\t %s \n",attr8); /* Read Global 'char' Attribute */ /* ---------------------------- */ status = HE5_SWreadattr(SWid, "GLOBAL_CHAR_ATTR", attr4); printf("Status returned by HE5_SWreadattr() : %d \n", status); printf("Global attribute values:\n"); printf("\t\t %s \n",attr4); /* Read Global 'long' Attribute */ /* ---------------------------- */ status = HE5_SWreadattr(SWid, "GLOBAL_LONG_ATTR", attr5); printf("Status returned by HE5_SWreadattr() : %d \n", status); printf("Global attribute values:\n"); for (i = 0; i < 4; i++) printf("\t\t %li \n",attr5[i]); /* Read Global 'double' Attribute */ /* ------------------------------ */ status = HE5_SWreadattr(SWid, "GLOBAL_DOUBLE_ATTR", attr6); printf("Status returned by HE5_SWreadattr() : %d \n", status); printf("Global attribute values:\n"); for (i = 0; i < 4; i++) printf("\t\t %f \n",attr6[i]); } } status = HE5_SWdetach(SWid); status = HE5_SWclose(swfid); return 0; } hdf-eos5-2.0/samples/he5_sw_readdataF_32.f000077500000000000000000000103611507520047200202370ustar00rootroot00000000000000c In this program we (1) open the "swath.he5" file, (2) attach to c the "Swath1" swath, and (3) read data from the "Longitude" field c ================================================================ program he5_sw_readdataF_32 implicit none include 'hdfeos5.inc' integer status integer he5_swopen integer he5_swattach integer he5_swrdfld integer he5_swrdattr integer he5_prread integer he5_swdetach integer he5_swclose integer swfid, swid integer buffer_out(250) integer i,j,j1 integer element1(25) integer element2(50) integer element3(75) integer element4(100) real*4 lng(10,20) real*4 temp(10,20) integer*4 attr(4) integer*4 start(2) integer*4 stride(2) integer*4 count(2) integer*4 len(4) integer FAIL parameter (FAIL=-1) c Open HDF-EOS swath file, "swath.he5" c ----------------------------------- swfid = he5_swopen("swath.he5",HE5F_ACC_RDONLY) write(*,*) 'File ID returned by he5_swopen(): ',swfid if (swfid .NE. FAIL) then swid = he5_swattach(swfid, "Swath1") write(*,*) 'Swath ID returned by he5_swattach(): ',swid if (swid .NE. FAIL) then c Read the entire Longitude field c ------------------------------- start(1) = 0 start(2) = 0 stride(1) = 1 stride(2) = 1 count(1) = 10 count(2) = 20 status = he5_swrdfld(swid,"Longitude", 1 start,stride,count,lng) do i=1,20 do j=1,10 write(*,*)'i j Longitude ',i,j,lng(j,i) enddo enddo start(1) = 0 start(2) = 0 stride(1) = 1 stride(2) = 1 count(1) = 10 count(2) = 20 status = he5_swrdfld(swid,"L2gpValue", 1 start,stride,count,temp) do i=1,20 do j=1,10 write(*,*)'i j L2gpValue ',i,j,temp(j,i) enddo enddo c Read data from the Profile c -------------------------- start(1) = 0 stride(1) = 1 count(1) = 4 status = he5_prread(swid,"Profile-2000",start,stride,count, 1len,buffer_out) write(*,*) ' ' write(*,*) 'Status returned from he5_prread: ',status c Display the Profile data c ------------------------ do i=1,4 write(*,*) 'len(',i,'): ',len(i) enddo write(*,*) ' ' write(*,*) 'buffer_out: ' write(*,*) buffer_out write(*,*) ' ' j = 0 do i=1,25 element1(i) = buffer_out(i) j = j + 1 enddo write(*,*) '1st element: ' write(*,*) element1 write(*,*) ' ' j1 = j do i=1,50 element2(i) = buffer_out(j1 + i) j = j + 1 enddo write(*,*) '2nd element: ' write(*,*) element2 write(*,*) ' ' j1 = j do i=1,75 element3(i) = buffer_out(j1 + i) j = j + 1 enddo write(*,*) '3rd element: ' write(*,*) element3 write(*,*) ' ' j1 = j do i=1,100 element4(i) = buffer_out(j1 + i) j = j + 1 enddo write(*,*) '4th element: ' write(*,*) element4 write(*,*) ' ' c Read Attribute c -------------- status = he5_swrdattr(swid, "TestAttr", attr) do i=1,4 write(*,*) 'Attribute Element', i, ':', attr(i) enddo endif endif c Detach from swath c ----------------- status = he5_swdetach(swid) write(*,*) 'Status returned from he5_swdetach: ',status c Close the file c -------------- status = he5_swclose(swfid) write(*,*) 'Status returned from he5_swclose: ',status stop end hdf-eos5-2.0/samples/he5_sw_readdataF_64.f000077500000000000000000000100541507520047200202430ustar00rootroot00000000000000c In this program we (1) open the "swath.he5" file, (2) attach to c the "Swath1" swath, and (3) read data from the "Longitude" field c ================================================================ program he5_sw_readdataF_64 implicit none include 'hdfeos5.inc' integer status integer he5_swopen integer he5_swattach integer he5_swrdfld integer he5_swrdattr integer he5_prread integer he5_swdetach integer he5_swclose integer swfid, swid integer buffer_out(250) integer i,j,j1 integer element1(25) integer element2(50) integer element3(75) integer element4(100) real*4 lng(10,20) integer*4 attr(4) integer*8 start(2) integer*8 stride(2) integer*8 count(2) integer*8 len(4) character*4 charfield(10) integer FAIL parameter (FAIL=-1) c Open HDF-EOS swath file, "swath.he5" c ------------------------------------ swfid = he5_swopen("swath.he5",HE5F_ACC_RDONLY) write(*,*) 'File ID returned by he5_swopen(): ',swfid if (swfid .NE. FAIL) then swid = he5_swattach(swfid, "Swath1") write(*,*) 'Swath ID returned by he5_swattach(): ',swid if (swid .NE. FAIL) then c Read the entire Longitude field c ------------------------------- start(1) = 0 start(2) = 0 stride(1) = 1 stride(2) = 1 count(1) = 10 count(2) = 20 status = he5_swrdfld(swid,"Longitude", 1 start,stride,count,lng) do i=1,20 do j=1,10 write(*,*)'i j Longitude ',i,j,lng(j,i) enddo enddo start(1) = 0 stride(1) = 1 count(1) = 10 status = he5_swrdfld(swid,"test_string", 1 start,stride,count,charfield) do i=1,10 write(*,*)'i = ',i,charfield(i) enddo c Read data from the Profile c -------------------------- start(1) = 0 stride(1) = 1 count(1) = 4 status = he5_prread(swid,"Profile-2000",start,stride,count, 1len,buffer_out) write(*,*) ' ' write(*,*) 'Status returned from he5_prread: ',status c Display the Profile data c ------------------------ do i=1,4 write(*,*) 'len(',i,'): ',len(i) enddo write(*,*) ' ' write(*,*) 'buffer_out: ' write(*,*) buffer_out write(*,*) ' ' j = 0 do i=1,25 element1(i) = buffer_out(i) j = j + 1 enddo write(*,*) '1st element: ' write(*,*) element1 write(*,*) ' ' j1 = j do i=1,50 element2(i) = buffer_out(j1 + i) j = j + 1 enddo write(*,*) '2nd element: ' write(*,*) element2 write(*,*) ' ' j1 = j do i=1,75 element3(i) = buffer_out(j1 + i) j = j + 1 enddo write(*,*) '3rd element: ' write(*,*) element3 write(*,*) ' ' j1 = j do i=1,100 element4(i) = buffer_out(j1 + i) j = j + 1 enddo write(*,*) '4th element: ' write(*,*) element4 write(*,*) ' ' c Read Attribute c -------------- status = he5_swrdattr(swid, "TestAttr", attr) do i=1,4 write(*,*) 'Attribute Element', i, ':', attr(i) enddo endif endif c Detach from swath c ----------------- status = he5_swdetach(swid) write(*,*) 'Status returned from he5_swdetach: ',status c Close the file c -------------- status = he5_swclose(swfid) write(*,*) 'Status returned from he5_swclose: ',status stop end hdf-eos5-2.0/samples/he5_sw_setup.c000077500000000000000000000101371507520047200172160ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include /* In this program we (1) open an HDF-EOS file, (2) create the swath */ /* interface within the file, and (3) define the swath field dimensions */ /* -------------------------------------------------------------------- */ int main() { herr_t status = FAIL; int i, j; hid_t swfid = FAIL; hid_t SWid = FAIL; long indx[12] = {0,1,3,6,7,8,11,12,14,24,32,39}; /* Open a new HDF-EOS swath file, "Swath.h5" */ /* ----------------------------------------- */ swfid = HE5_SWopen("Swath.h5", H5F_ACC_TRUNC); printf("File ID returned by HE5_SWopen(): %ld \n", (long) swfid); /* Create the swath, "Swath1", within the file */ /* ------------------------------------------- */ SWid = HE5_SWcreate(swfid, "Swath1"); printf("Swath ID returned by HE5_SWcreate(): %ld \n", (long) SWid); /* Define dimensions and specify their sizes */ /* ----------------------------------------- */ status = HE5_SWdefdim(SWid, "GeoTrack", 20); printf("Status returned by HE5_SWdefdim(): %d \n", status); status = HE5_SWdefdim(SWid, "GeoXtrack", 10); printf("Status returned by HE5_SWdefdim(): %d \n", status); status = HE5_SWdefdim(SWid, "Res2tr", 40); printf("Status returned by HE5_SWdefdim(): %d \n", status); status = HE5_SWdefdim(SWid, "Res2xtr", 20); printf("Status returned by HE5_SWdefdim(): %d \n", status); status = HE5_SWdefdim(SWid, "Bands", 15); printf("Status returned by HE5_SWdefdim(): %d \n", status); status = HE5_SWdefdim(SWid, "IndxTrack", 12); printf("Status returned by HE5_SWdefdim(): %d \n", status); status = HE5_SWdefdim(SWid, "ProfDim", 4); printf("Status returned by HE5_SWdefdim(): %d \n", status); /* Define "External" Dimension */ /* --------------------------- */ status = HE5_SWdefdim(SWid, "ExtDim", 60); printf("Status returned by HE5_SWdefdim(): %d \n", status); /* Define Unlimited Dimension */ /* -------------------------- */ status = HE5_SWdefdim(SWid, "Unlim", H5S_UNLIMITED); printf("Status returned by HE5_SWdefdim(): %d \n", status); /* * Once the dimensions are defined, the relationship (mapping) between the * geolocation dimensions, such as track and cross track, and the data * dimensions, must be established. This is done through the HE5_SWdefdimmap * routine. It takes as input the swath id, the names of the dimensions * designating the geolocation and data dimensions, respectively, and the * offset and increment defining the relation. * * In the first example we relate the "GeoTrack" and "Res2tr" dimensions * with an offset of 0 and an increment of 2. Thus the ith element of * "Geotrack" corresponds to the 2 * ith element of "Res2tr". * * In the second example, the ith element of "GeoXtrack" corresponds to the * 2 * ith + 1 element of "Res2xtr". * * Note that there is no relationship between the geolocation dimensions * and the "Bands" dimension. */ /* Define Dimension Mapping */ /* ------------------------ */ status = HE5_SWdefdimmap(SWid, "GeoTrack", "Res2tr", 0, 2); printf("Status returned by HE5_SWdefdimmap(): %d \n", status); status = HE5_SWdefdimmap(SWid, "GeoXtrack", "Res2xtr", 1, 2); printf("Status returned by HE5_SWdefdimmap(): %d \n", status); /* Define Indexed Mapping */ /* ---------------------- */ status = HE5_SWdefidxmap(SWid, "IndxTrack", "Res2tr", indx); printf("Status returned by HE5_SWdefidxmap(): %d \n", status); /* Close the swath interface */ /* ------------------------- */ status = HE5_SWdetach(SWid); printf("Status returned by HE5_SWdetach(): %d \n", status); /* Close the swath file */ /* -------------------- */ status = HE5_SWclose(swfid); printf("Status returned by HE5_SWclose(): %d \n", status); return 0; } hdf-eos5-2.0/samples/he5_sw_setupF_32.f000077500000000000000000000122561507520047200176370ustar00rootroot00000000000000c In this program we (1) open an HDF-EOS file, (2) create the c swath interface, and (3) define the swath field dimensions c =========================================================== program he5_sw_setupF_32 implicit none include 'hdfeos5.inc' integer status integer he5_swopen integer he5_swcreate integer he5_swdefdim integer he5_swdefmap integer he5_swdefimap integer he5_swdetach integer he5_swclose integer swfid, swid integer*4 dtrack, extdata integer*4 offset, incr integer*4 indx(12) data indx /0,1,3,6,7,8,11,12,14,24,32,39/ c Open the HDF-EOS file, "swath.he5" using "TRUNC" file access code c ----------------------------------------------------------------- swfid = he5_swopen('swath.he5',HE5F_ACC_TRUNC) write(*,*) 'File ID returned by he5_swopen(): ',swfid c Create the swath, "Swath1", within the file c ------------------------------------------- swid = he5_swcreate(swfid, "Swath1") write(*,*) 'Swath ID returned by he5_swcreate(): ',swid c Define Geolocation and Data dimensions c -------------------------------------- c ---------------------------------------------------------------------- c Typically, many fields within a swath share the same dimension. The c swath interface therefore provides a way of defining dimensions that c will then be used to define swath fields. A dimension is defined with c a name and a size and is connected to the particular swath through the c swath id. In this example, we define the geo- location track and c cross track dimensions with size 20 and 10 respectively and two c dimensions corresponding to these but with twice the resolution. c Also, we define "Bands" and "unlimited" dimensions. c ---------------------------------------------------------------------- dtrack = 20 status = he5_swdefdim(swid, "GeoTrack", dtrack) write(*,*) 'Status returned by he5_swdefdim(): ',status dtrack = 10 status = he5_swdefdim(swid, "GeoXtrack", dtrack) write(*,*) 'Status returned by he5_swdefdim(): ',status dtrack = 40 status = he5_swdefdim(swid, "Res2tr", dtrack) write(*,*) 'Status returned by he5_swdefdim(): ',status dtrack = 20 status = he5_swdefdim(swid, "Res2xtr", dtrack) write(*,*) 'Status returned by he5_swdefdim(): ',status dtrack = 15 status = he5_swdefdim(swid, "Bands", dtrack) write(*,*) 'Status returned by he5_swdefdim(): ',status dtrack = 12 status = he5_swdefdim(swid, "IndxTrack", dtrack) write(*,*) 'Status returned by he5_swdefdim(): ',status dtrack = 4 status = he5_swdefdim(swid, "ProfDim", dtrack) write(*,*) 'Status returned by he5_swdefdim(): ',status c Define "External" dimension c --------------------------- extdata = 60 status = he5_swdefdim(swid, "ExtDim", extdata) write(*,*) 'Status returned by he5_swdefdim(): ',status c Define Unlimited (appendable) dimension c --------------------------------------- status = he5_swdefdim(swid, "Unlim", HE5S_UNLIMITED_F) write(*,*) 'Status returned by he5_swdefdim(): ',status c ---------------------------------------------------------------------- c Once the dimensions are defined, the relationship (mapping)between the c geolocation dimensions, such as track and cross track, and the data c dimensions, must be established. This is done through the SWdefdimmap c routine. It takes as input the swath id, the names of the dimensions c designating the geolocation and data dimensions, respectively, and the c offset and increment defining the relation. c c In the first example we relate the "GeoTrack" and "Res2tr" dimensions c with an offset of 0 and an increment of 2. Thus the ith element of c "Geotrack" corresponds to the 2 * ith element of "Res2tr". c c In the second example, the ith element of "GeoXtrack" corresponds to c the 2 * ith + 1 element of "Res2xtr". c ----------------------------------------------------------------------- c Define dimension mappings c ------------------------- offset = 0 incr = 2 status = he5_swdefmap(swid, "GeoTrack", 1 "Res2tr", offset, incr) write(*,*) 'Status returned by he5_swdefmap(): ',status offset = 1 status = he5_swdefmap(swid, "GeoXtrack", 1 "Res2xtr", offset, incr) write(*,*) 'Status returned by he5_swdefmap(): ',status c Define indexed dimension mapping c -------------------------------- status = he5_swdefimap(swid, "IndxTrack", 1 "Res2tr", indx) write(*,*) 'Status returned by he5_swdefimap(): ',status c Detach from the swath c --------------------- status = he5_swdetach(swid) write(*,*) 'Status returned by he5_swdetach(): ',status c Close the swath file c -------------------- status = he5_swclose(swfid) write(*,*) 'Status returned by he5_swclose(): ',status stop end hdf-eos5-2.0/samples/he5_sw_setupF_64.f000077500000000000000000000124451507520047200176440ustar00rootroot00000000000000c In this program we (1) open an HDF-EOS file, (2) create the c swath interface, and (3) define the swath field dimensions c =========================================================== program he5_sw_setupF_64 implicit none include 'hdfeos5.inc' include 'hdfeos5_64.inc' integer status integer he5_swopen integer he5_swcreate integer he5_swdefdim integer he5_swdefmap integer he5_swdefimap integer he5_swdetach integer he5_swclose integer swfid, swid integer*8 dtrack, extdata integer*8 offset, incr integer*8 indx(12) data indx /0,1,3,6,7,8,11,12,14,24,32,39/ c Open the HDF-EOS file, "swath.he5" using "TRUNC" file access code c ----------------------------------------------------------------- swfid = he5_swopen("swath.he5",HE5F_ACC_TRUNC) write(*,*) 'File ID returned by he5_swopen(): ',swfid c Create the swath, "Swath1", within the file c ------------------------------------------- swid = he5_swcreate(swfid, "Swath1") write(*,*) 'Swath ID returned by he5_swcreate(): ',swid c Define Geolocation and Data dimensions c -------------------------------------- c ---------------------------------------------------------------------- c Typically, many fields within a swath share the same dimension. The c swath interface therefore provides a way of defining dimensions that c will then be used to define swath fields. A dimension is defined with c a name and a size and is connected to the particular swath through the c swath id. In this example, we define the geo- location track and c cross track dimensions with size 20 and 10 respectively and two c dimensions corresponding to these but with twice the resolution. c Also, we define "Bands" and "unlimited" dimensions. c ---------------------------------------------------------------------- dtrack = 20 status = he5_swdefdim(swid, "GeoTrack", dtrack) write(*,*) 'Status returned by he5_swdefdim(): ',status dtrack = 10 status = he5_swdefdim(swid, "GeoXtrack", dtrack) write(*,*) 'Status returned by he5_swdefdim(): ',status dtrack = 40 status = he5_swdefdim(swid, "Res2tr", dtrack) write(*,*) 'Status returned by he5_swdefdim(): ',status dtrack = 20 status = he5_swdefdim(swid, "Res2xtr", dtrack) write(*,*) 'Status returned by he5_swdefdim(): ',status dtrack = 15 status = he5_swdefdim(swid, "Bands", dtrack) write(*,*) 'Status returned by he5_swdefdim(): ',status dtrack = 12 status = he5_swdefdim(swid, "IndxTrack", dtrack) write(*,*) 'Status returned by he5_swdefdim(): ',status dtrack = 4 status = he5_swdefdim(swid, "ProfDim", dtrack) write(*,*) 'Status returned by he5_swdefdim(): ',status c Define "External" dimension c --------------------------- extdata = 60 status = he5_swdefdim(swid, "ExtDim", extdata) write(*,*) 'Status returned by he5_swdefdim(): ',status c Define Unlimited (appendable) dimension c --------------------------------------- status = he5_swdefdim(swid, "Unlim", HE5S_UNLIMITED_F_64) write(*,*) 'Status returned by he5_swdefdim(): ',status c ---------------------------------------------------------------------- c Once the dimensions are defined, the relationship (mapping)between the c geolocation dimensions, such as track and cross track, and the data c dimensions, must be established. This is done through the SWdefdimmap c routine. It takes as input the swath id, the names of the dimensions c designating the geolocation and data dimensions, respectively, and the c offset and increment defining the relation. c c In the first example we relate the "GeoTrack" and "Res2tr" dimensions c with an offset of 0 and an increment of 2. Thus the ith element of c "Geotrack" corresponds to the 2 * ith element of "Res2tr". c c In the second example, the ith element of "GeoXtrack" corresponds to c the 2 * ith + 1 element of "Res2xtr". c ----------------------------------------------------------------------- c Define dimension mappings c ------------------------- offset = 0 incr = 2 status = he5_swdefmap(swid, "GeoTrack", "Res2tr", 1offset, incr) write(*,*) 'Status returned by he5_swdefmap(): ',status offset = 1 status = he5_swdefmap(swid, "GeoXtrack", "Res2xtr", 1offset, incr) write(*,*) 'Status returned by he5_swdefmap(): ',status c Define indexed dimension mapping c -------------------------------- status = he5_swdefimap(swid, "IndxTrack", "Res2tr", 1indx) write(*,*) 'Status returned by he5_swdefimap(): ',status c Detach from the swath c --------------------- status = he5_swdetach(swid) write(*,*) 'Status returned by he5_swdetach(): ',status c Close the swath file c -------------------- status = he5_swclose(swfid) write(*,*) 'Status returned by he5_swclose(): ',status stop end hdf-eos5-2.0/samples/he5_sw_subset.c000077500000000000000000000064141507520047200173660ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include /* In this program we (1) open the "Swath.h5" HDF-EOS file, (2) attach to */ /* the "Swath1", and (3) read data from the "Spectra" and "Time" fields */ /* ----------------------------------------------------------------------- */ int main() { herr_t status = FAIL; int i, j, rank = 0; hid_t swfid = FAIL, SWid = FAIL; hid_t regionID = FAIL, periodID = FAIL; hid_t *ntype; size_t size = 0; hsize_t dims[8]; double cornerlon[2], cornerlat[2]; double *datbuf, start_time, stop_time; /* Open the HDF-EOS swath file, "Swath.h5" */ /* --------------------------------------- */ swfid = HE5_SWopen("Swath.h5", H5F_ACC_RDWR); if (swfid != FAIL) { /* Attach to the "Swath1" swath */ /* ---------------------------- */ SWid = HE5_SWattach(swfid, "Swath1"); if (SWid != FAIL) { cornerlon[0] = 3. ; cornerlat[0] = 5. ; cornerlon[1] = 7. ; cornerlat[1] = 12.; regionID = HE5_SWdefboxregion(SWid, cornerlon, cornerlat, HE5_HDFE_MIDPOINT); printf("\n"); printf("Region ID returned by HE5_SWdefboxregion() : %ld \n", (long) regionID); ntype = (hid_t *)calloc(1, sizeof(hid_t) ); status = HE5_SWregioninfo(SWid, regionID, "Longitude", ntype, &rank, dims, &size); printf("Status returned by HE5_SWregioninfo(\"Longitude\") : %d \n", status); status = HE5_SWregioninfo(SWid, regionID, "Spectra", ntype, &rank, dims, &size); printf("Status returned by HE5_SWregioninfo(\"Spectra\") : %d \n", status); datbuf = (double *) malloc(size); status = HE5_SWextractregion(SWid, regionID, "Spectra", HE5_HDFE_INTERNAL, datbuf); printf("Status returned by HE5_SWextractregion() : %d \n", status); printf("\n"); printf("==================== DATA ===================== \n"); printf("\n"); for (i = 0; i < size / sizeof(double); i++) printf("\t %lf \n", datbuf[i]); free(datbuf); /* Time Subsetting */ /* --------------- */ start_time = 35232487.2; stop_time = 36609898.1; periodID = HE5_SWdeftimeperiod(SWid, start_time, stop_time, HE5_HDFE_MIDPOINT); printf("\n"); printf("Period ID returned by HE5_SWdeftimeperiod() : %ld \n", (long) periodID); status = HE5_SWperiodinfo(SWid, periodID, "Time", ntype, &rank, dims, &size); printf("Status returned by HE5_SWperiodinfo() : %d \n", status); datbuf = (double *) malloc(size); status = HE5_SWextractperiod(SWid, periodID, "Time", HE5_HDFE_INTERNAL, datbuf); printf("Status returned by HE5_SWextractperiod() : %d \n", status); printf("\n"); printf("==================== DATA ===================== \n"); printf("\n"); for (i = 0; i < size / sizeof(double); i++) printf("\t\t %lf \n", datbuf[i]); free(datbuf); free(ntype); } } status = HE5_SWdetach(SWid); status = HE5_SWclose(swfid); return 0; } hdf-eos5-2.0/samples/he5_sw_subsetF_32.f000077500000000000000000000067271507520047200200120ustar00rootroot00000000000000c In this program we (1) open the "swath.he5" HDF-EOS file, c (2) attach to the "Swath1" swath, and (3) subset data from c the "Spectra" field c ========================================================== program he5_sw_subsetF_32 implicit none include 'hdfeos5.inc' integer status integer i integer he5_swopen integer he5_swattach integer he5_swextper integer he5_swperinfo integer he5_swreginfo integer he5_swdefboxreg integer he5_swdeftmeper integer he5_swextreg integer he5_swdetach integer he5_swclose integer swfid integer swid integer rank integer ntype integer regionid integer periodid integer*4 dims(8) integer*4 size real*8 cornerlon(2) real*8 cornerlat(2) real*8 datbuf(40,20,15) real*8 tmebuf(20) real*8 t1 real*8 t2 integer FAIL parameter (FAIL=-1) c Open HDF-EOS swath file, "swath.he5" c ------------------------------------ swfid = he5_swopen("swath.he5",HE5F_ACC_RDONLY) write(*,*) 'File ID returned by he5_swopen(): ',swfid if (swfid .NE. FAIL) then swid = he5_swattach(swfid, "Swath1") write(*,*) 'Swath ID returned by he5_swattach(): ',swid if (swid .NE. FAIL) then cornerlon(1) = 3. cornerlat(1) = 5. cornerlon(2) = 7. cornerlat(2) = 12. c Define box region c ----------------- regionid = he5_swdefboxreg(swid,cornerlon, 1 cornerlat,HE5_HDFE_MIDPOINT) write(*,*) 'Region ID returned by he5_swdefboxreg(): ', 1 regionid write(*,*) regionid,swid status = he5_swreginfo(swid,regionid,"Spectra",ntype, 1 rank,dims,size) write(*,*) 'Status returned by he5_swreginfo(): ', 1 status write(*,*) dims(1), dims(2), dims(3), rank, ntype, size c Extract region data c ------------------- status = he5_swextreg(swid,regionid,"Spectra", 1 HE5_HDFE_INTERNAL,datbuf) write(*,*) 'Status returned by he5_swextreg(): ', 1 status c Time Subsetting c --------------- t1 = 35232487.2d0 t2 = 36609898.1d0 periodid = he5_swdeftmeper(swid,t1,t2,HE5_HDFE_MIDPOINT) write(*,*) 'Period ID returned by he5_swdeftmeper(): ', 1 periodid write(*,*) 'Time Subset: ', periodid,swid status = he5_swperinfo(swid,periodid,"Time",ntype,rank, 1 dims,size) write(*,*) 'Status returned by he5_swperinfo(): ', 1 status write(*,*) 'Time Subset: ', rank, dims(1), size c Extract Time data c ----------------- status = he5_swextper(swid,periodid,"Time", 1 HE5_HDFE_INTERNAL,tmebuf) write(*,*) 'Status returned by he5_swextper(): ', 1 status do 10 i=1,size/8 write(*,*) i, tmebuf(i) 10 continue endif c Detach from swath c ----------------- status = he5_swdetach(swid) write(*,*) 'Status returned by he5_swdetach(): ',status c Close the file c -------------- status = he5_swclose(swfid) write(*,*) 'Status returned by he5_swclose(): ',status endif stop end hdf-eos5-2.0/samples/he5_sw_subsetF_64.f000077500000000000000000000066611507520047200200140ustar00rootroot00000000000000c In this program we (1) open the "swath.he5" HDF-EOS file c (2) attach to the "Swath1" swath, and (3) subset data from c the "Spectra" field c ========================================================== program he5_sw_subsetF_64 implicit none include 'hdfeos5.inc' integer status integer i integer he5_swopen integer he5_swattach integer he5_swextper integer he5_swperinfo integer he5_swreginfo integer he5_swdefboxreg integer he5_swdeftmeper integer he5_swextreg integer he5_swdetach integer he5_swclose integer swfid integer swid integer rank integer ntype integer regionid integer periodid integer*8 dims(8) integer*8 size real*8 cornerlon(2) real*8 cornerlat(2) real*8 datbuf(40,20,15) real*8 tmebuf(20) real*8 t1 real*8 t2 integer FAIL parameter (FAIL=-1) c Open HDF-EOS swath file, "swath.he5" c ------------------------------------ swfid = he5_swopen("swath.he5",HE5F_ACC_RDONLY) write(*,*) 'File ID returned by he5_swopen(): ',swfid if (swfid .NE. FAIL) then swid = he5_swattach(swfid, "Swath1") write(*,*) 'Swath ID returned by he5_swattach(): ',swid if (swid .NE. FAIL) then cornerlon(1) = 3. cornerlat(1) = 5. cornerlon(2) = 7. cornerlat(2) = 12. c Define box region c ----------------- regionid = he5_swdefboxreg(swid,cornerlon, 1 cornerlat,HE5_HDFE_MIDPOINT) write(*,*) 'Region ID returned by he5_swdefboxreg(): ', 1 regionid write(*,*) regionid,swid status = he5_swreginfo(swid,regionid,"Spectra",ntype, 1 rank,dims,size) write(*,*) 'Status returned by he5_swreginfo(): ', 1 status write(*,*) dims(1), dims(2), dims(3), rank, ntype, size c Extract region data c ------------------- status = he5_swextreg(swid,regionid,"Spectra", 1 HE5_HDFE_INTERNAL,datbuf) write(*,*) 'Status returned by he5_swextreg(): ', 1 status c Time Subsetting c --------------- t1 = 352324870.2d0 t2 = 366098980.1d0 periodid = he5_swdeftmeper(swid,t1,t2,HE5_HDFE_MIDPOINT) write(*,*) 'Period ID returned by he5_swdeftmeper(): ', 1 periodid write(*,*) 'Time Subset: ', periodid,swid status = he5_swperinfo(swid,periodid,"Time",ntype,rank, 1 dims,size) write(*,*) 'Status returned by he5_swperinfo(): ', 1 status write(*,*) 'Time Subset: ', rank, dims(1), size c Extract Time data c ----------------- status = he5_swextper(swid,periodid,"Time", 1 HE5_HDFE_INTERNAL,tmebuf) write(*,*) 'Status returned by he5_swextper(): ', 1 status do 10 i=1,size/8 write(*,*) i, tmebuf(i) 10 continue endif c Detach from swath c ----------------- status = he5_swdetach(swid) write(*,*) 'Status returned by he5_swdetach(): ',status c Close the file c -------------- status = he5_swclose(swfid) write(*,*) 'Status returned by he5_swclose(): ',status endif stop end hdf-eos5-2.0/samples/he5_sw_wrextendrd.c000077500000000000000000000070121507520047200202420ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include /* This program demonstrates the use of the unlimited dimension */ /* in creating an appendable field */ /* -------------------------------------------------------------- */ int main() { herr_t status = FAIL; int i, rank = FAIL; int inarray[20] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20}; int outarray[40]; hid_t swfid = FAIL; hid_t SWid = FAIL; hid_t *ntype; hssize_t start[1]; hsize_t count[1], dims[1]; char dimlist[100]; char maxdimlist[100]; /* Open the swath file */ /* ------------------- */ swfid = HE5_SWopen("Swath.h5", H5F_ACC_RDWR); if (swfid != FAIL) { /* Attach to the swath "Swath1" */ /* ---------------------------- */ SWid = HE5_SWattach(swfid, "Swath1"); if (SWid != 0) { /* Inquire information about "Count" field */ /* --------------------------------------- */ ntype = (hid_t *)calloc(1,sizeof(hid_t)); status = HE5_SWfieldinfo(SWid, "Count", &rank, dims, ntype, dimlist, maxdimlist); if (status != FAIL) { printf("No. of elements in \"Count\": %lu\n", (unsigned long)dims[0]); printf("\"DimList\" : %s \n", dimlist); printf("\"MaxdimList\" : %s \n", maxdimlist); } /* Write 20 records to the "Count" field */ /* ------------------------------------- */ start[0] = 0; count[0] = 20; status = HE5_SWwritefield(SWid, "Count", start, NULL, count, inarray); printf("Status returned by HE5_SWwritefield: %d \n", status); /* Inquire information about "Count" field again */ /* --------------------------------------------- */ dims[0] = 0; status = HE5_SWfieldinfo(SWid, "Count", &rank, dims, ntype, dimlist, maxdimlist); if (status != FAIL) { printf("No. of records written: %lu \n",(unsigned long)dims[0]); printf("\"DimList\" : %s \n", dimlist); printf("\"MaxdimList\" : %s \n", maxdimlist); } /* Append 10 records to the "Count" field */ /* -------------------------------------- */ start[0] = 22; count[0] = 10; status = HE5_SWwritefield(SWid, "Count", start, NULL, count, inarray); printf("Status returned by HE5_SWwritefield: %d \n", status); /* Inquire information about "Count" field one more time */ /* ----------------------------------------------------- */ dims[0] = 0; status = HE5_SWfieldinfo(SWid, "Count", &rank, dims, ntype, dimlist, maxdimlist); if (status != FAIL) { printf("No. of records written: %lu\n",(unsigned long)dims[0]); printf("\"DimList\" : %s \n", dimlist); printf("\"MaxdimList\" : %s \n", maxdimlist); free(ntype); } /* Display the "Count" field data */ /* ------------------------------ */ start[0] = 0; status = HE5_SWreadfield(SWid, "Count", start, NULL, dims, outarray); if (status != FAIL ) { for (i = 0; i < (unsigned long)dims[0]; i++) printf("\t\t element #%d: value: %d \n", i+1, outarray[i]); } } } status = HE5_SWdetach(SWid); status = HE5_SWclose(swfid); return 0; } hdf-eos5-2.0/samples/he5_sw_wrexternaldata.c000077500000000000000000000056021507520047200211040ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include #define DIM 100 #define DIMTOT 60 int main() { FILE *in_1, *in_2, *in_3; herr_t status = FAIL; int i; int data_out_1[DIM]; int data_out_2[DIM]; int data_out_3[DIM]; int data[DIMTOT]; hid_t swfid = FAIL; hid_t SWid = FAIL; hssize_t start[2]; hsize_t count[2]; /* Create new data buffer */ /* ---------------------- */ for (i = 0; i < DIMTOT; i++) data[ i ] = 9999; /* Open the HDF-EOS swath file, "Swath.h5" */ /* --------------------------------------- */ swfid = HE5_SWopen("Swath.h5", H5F_ACC_RDWR); if (swfid != FAIL) { /* Attach the "Swath1" swath */ /* ------------------------- */ SWid = HE5_SWattach(swfid, "Swath1"); if (SWid != FAIL) { /* Write new data to the external files */ /* ------------------------------------ */ start[0] = 0; count[0] = DIMTOT; status = HE5_SWwritefield(SWid, "ExtData", start, NULL, count, data); printf("Status returned by HE5_SWwritefield() : %d \n", status); /* Open the external data files */ /* ---------------------------- */ in_1 = fopen("external_1.data", "r"); in_2 = fopen("external_2.data", "r"); in_3 = fopen("external_3.data", "r"); /* Read data from external data files */ /* ---------------------------------- */ i = fread(data_out_1, sizeof(int), DIM, in_1); i = fread(data_out_2, sizeof(int), DIM, in_2); i = fread(data_out_3, sizeof(int), DIM, in_3); /* Close the external data files */ /* ----------------------------- */ fclose(in_1); fclose(in_2); fclose(in_3); /* Check the contents of external files */ /* ------------------------------------ */ printf(" \n"); printf("Reading data from 1st file: \n"); printf(" \n"); for (i = 0; i < DIM; i++) printf("%d ", data_out_1[i]); printf(" \n"); printf(" \n"); printf("Reading data from 2d file: \n"); printf(" \n"); for (i = 0; i < DIM; i++) printf("%d ", data_out_2[i]); printf(" \n"); printf(" \n"); printf("Reading data from 3d file: \n"); printf(" \n"); for (i = 0; i < DIM; i++) printf("%d ", data_out_3[i]); printf(" \n"); printf(" \n"); } } /* Detach from the swath */ /* --------------------- */ status = HE5_SWdetach(SWid); printf("Status returned by HE5_SWdetach() : %d \n", status); /* Close the file */ /* -------------- */ status = HE5_SWclose(swfid); printf("Status returned by HE5_SWclose() : %d \n", status); return 0; } hdf-eos5-2.0/samples/he5_sw_wrexternaldataF_32.f000077500000000000000000000065051507520047200215240ustar00rootroot00000000000000c c ---------------------------------------------------------------------------- c | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | c ---------------------------------------------------------------------------- c program he5_sw_wrexternaldataF_32 implicit none include 'hdfeos5.inc' integer i integer status integer he5_swopen integer he5_swattach integer he5_swwrfld integer he5_ehrdwrfile integer he5_swdetach integer he5_swclose integer swfid, swid integer data_out_1(100) integer data_out_2(100) integer data_out_3(100) integer data(60) integer*4 start(2) integer*4 stride(2) integer*4 count(2) integer*4 num_elements integer FAIL parameter (FAIL=-1) c.....Use this for writing (only) to an existing file integer WRITE_EXISTING_ONLY parameter (WRITE_EXISTING_ONLY=0) c.....Use this for reading (only) from an existing file integer READ_ONLY parameter (READ_ONLY=1) c.....Use this for creating and writing to a file integer WRITE_NEW parameter (WRITE_NEW=2) c Create the new data buffer c -------------------------- do 10 i=1,60 data(i) = 9999 10 continue c Open HDF-EOS swath file, "swath.he5" c ------------------------------------ swfid = he5_swopen("swath.he5", HE5F_ACC_RDWR) write(*,*) 'File ID returned from he5_swopen(): ',swfid if (swfid .NE. FAIL) then swid = he5_swattach(swfid, "Swath1") write(*,*) 'Swath ID returned from he5_swattach(): ',swid if (swid .NE. FAIL) then c Write new data to the external files c ------------------------------------ start(1) = 0 stride(1) = 1 count(1) = 60 status = he5_swwrfld(swid,"ExtData", 1 start,stride,count,data) write(*,*) 'Status returned from he5_swrdfld(): ',status num_elements = 100 status = he5_ehrdwrfile("extf1.dat",READ_ONLY, 1HE5T_NATIVE_INT,num_elements,data_out_1) write(*,*) 'Status returned from he5_ehrdwrfile: ',status status = he5_ehrdwrfile("extf2.dat",READ_ONLY, 1HE5T_NATIVE_INT,num_elements,data_out_2) write(*,*) 'Status returned from he5_ehrdwrfile: ',status status = he5_ehrdwrfile("extf3.dat",READ_ONLY, 1HE5T_NATIVE_INT,num_elements,data_out_3) write(*,*) 'Status returned from he5_ehrdwrfile: ',status write(*,*)'External file extf1.dat:' write(*,*) data_out_1 write(*,*) ' ' write(*,*)'External file extf2.dat:' write(*,*) data_out_2 write(*,*) ' ' write(*,*)'External file extf3.dat:' write(*,*) data_out_3 write(*,*) ' ' endif endif c Detach from swath c ----------------- status = he5_swdetach(swid) write(*,*) 'Status returned from he5_swdetach(): ',status c Close the file c -------------- status = he5_swclose(swfid) write(*,*) 'Status returned from he5_swclose(): ',status stop end hdf-eos5-2.0/samples/he5_sw_wrexternaldataF_64.f000077500000000000000000000065051507520047200215310ustar00rootroot00000000000000c c ---------------------------------------------------------------------------- c | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | c ---------------------------------------------------------------------------- c program he5_sw_wrexternaldataF_64 implicit none include 'hdfeos5.inc' integer i integer status integer he5_swopen integer he5_swattach integer he5_swwrfld integer he5_ehrdwrfile integer he5_swdetach integer he5_swclose integer swfid, swid integer data_out_1(100) integer data_out_2(100) integer data_out_3(100) integer data(60) integer*8 start(2) integer*8 stride(2) integer*8 count(2) integer*8 num_elements integer FAIL parameter (FAIL=-1) c.....Use this for writing (only) to an existing file integer WRITE_EXISTING_ONLY parameter (WRITE_EXISTING_ONLY=0) c.....Use this for reading (only) from an existing file integer READ_ONLY parameter (READ_ONLY=1) c.....Use this for creating and writing to a file integer WRITE_NEW parameter (WRITE_NEW=2) c Create the new data buffer c -------------------------- do 10 i=1,60 data(i) = 9999 10 continue c Open HDF-EOS swath file, "swath.he5" c ------------------------------------ swfid = he5_swopen("swath.he5", HE5F_ACC_RDWR) write(*,*) 'File ID returned from he5_swopen(): ',swfid if (swfid .NE. FAIL) then swid = he5_swattach(swfid, "Swath1") write(*,*) 'Swath ID returned from he5_swattach(): ',swid if (swid .NE. FAIL) then c Write new data to the external files c ------------------------------------ start(1) = 0 stride(1) = 1 count(1) = 60 status = he5_swwrfld(swid,"ExtData", 1 start,stride,count,data) write(*,*) 'Status returned from he5_swrdfld(): ',status num_elements = 100 status = he5_ehrdwrfile("extf1.dat",READ_ONLY, 1HE5T_NATIVE_INT,num_elements,data_out_1) write(*,*) 'Status returned from he5_ehrdwrfile: ',status status = he5_ehrdwrfile("extf2.dat",READ_ONLY, 1HE5T_NATIVE_INT,num_elements,data_out_2) write(*,*) 'Status returned from he5_ehrdwrfile: ',status status = he5_ehrdwrfile("extf3.dat",READ_ONLY, 1HE5T_NATIVE_INT,num_elements,data_out_3) write(*,*) 'Status returned from he5_ehrdwrfile: ',status write(*,*)'External file extf1.dat:' write(*,*) data_out_1 write(*,*) ' ' write(*,*)'External file extf2.dat:' write(*,*) data_out_2 write(*,*) ' ' write(*,*)'External file extf3.dat:' write(*,*) data_out_3 write(*,*) ' ' endif endif c Detach from swath c ----------------- status = he5_swdetach(swid) write(*,*) 'Status returned from he5_swdetach(): ',status c Close the file c -------------- status = he5_swclose(swfid) write(*,*) 'Status returned from he5_swclose(): ',status stop end hdf-eos5-2.0/samples/he5_sw_writedata.c000077500000000000000000000206031507520047200200410ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include /* In this program we (1) open the "Swath.h5" file, (2) attach to the */ /* "Swath1" swath, and (3) write data to the "Longitude", "Latitude", and */ /* "Spectra" fields. Also, set up the global, group, and local attributes */ /* ----------------------------------------------------------------------- */ int main() { herr_t status = FAIL; int i, j, k; int track, xtrack; int attr1[4] = {1, 2, 3, 4}; /* global attribute */ int attr2[4] = {10, 20, 30, 40}; /* group attribute */ int attr3[4] = {100, 200, 300, 400}; /* local attribute */ hid_t swfid = FAIL; hid_t SWid = FAIL; char attr4[20]; /* Global 'char' attribute */ char attr8[20]; /* Global 'char' attribute */ char attr9[20]; /* Global 'char' attribute */ long attr5[4] = {1111111L,2222222L,3333333L,4444444L};/* Global 'long' attribute */ double attr6[4] = {1.111111,2.222222,3.333333,4.444444};/* Global 'double' attribute */ float attr7[4] = {1.111111,2.222222,3.333333,4.444444};/* Local 'float' attribute */ hssize_t start[3]; hsize_t count[3]; size_t datasize; float lng[20][10], latcnt; float lat[20][10], loncnt; double plane[15][40][20], tme[20]; hvl_t buffer[4];/* Data buffer for the profile */ const char *charname[10] = { "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "BBBBBBBBBBBBBBBB", "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC", "DDDDDDDDDDDDDDDDDDDD", "EEEEEEEE", "FFFFFFFFFFFFF", "GGGGGGGGGGGGG", "HHHHHHHHHH", "IIIIIII", "JJJJJJJJJJJJJ" }; /* Populate lon/lat data arrays */ /* ---------------------------- */ latcnt = 1.; loncnt = 1.; track = 0 ; xtrack = 0 ; while(track < 20) { while(xtrack < 10) { lat[track][xtrack] = latcnt; lng[track][xtrack] = loncnt; loncnt = loncnt + 1.; xtrack++; } latcnt = latcnt + 1.; loncnt = 1.; track++; xtrack = 0; } /* Popolate spectra data array. Value = 100*(track index)+(band index) */ /* ------------------------------------------------------------------- */ for (i = 0; i < 15; i++) { for (j = 0; j < 40; j++) for (k = 0; k < 20; k++) plane[i][j][k] = (double)(j*100 + i); } /* Allocate memory for and populate data buffer */ /* -------------------------------------------- */ datasize = 0; for (i = 0; i < 4; i++) { buffer[i].p = (hvl_t *)calloc( 25 *(i+1), sizeof(unsigned int)); buffer[i].len = 25 * (i+1); /* calculate the data buffer size (bytes) */ datasize += buffer[i].len * sizeof(unsigned int); for ( j = 0; j < 25 * (i+1); j++) ((unsigned int *)buffer[i].p)[j] = (i+1)*1000 + j; } /* Open the HDF swath file, "Swath.h5" */ /* ----------------------------------- */ swfid = HE5_SWopen("Swath.h5", H5F_ACC_RDWR); if (swfid != FAIL) { /* Attach the "Swath1" swath */ /* ------------------------- */ SWid = HE5_SWattach(swfid, "Swath1"); if (SWid != FAIL) { start[0] = 0; start[1] = 0; count[0] = 20; count[1] = 10; /* Write longitute field */ /* ---------------------- */ status = HE5_SWwritefield(SWid, "Longitude", start, NULL, count, lng); printf("status returned by HE5_SWwritefield(\"Longitude\"): %d\n", status); /* Write latitude field */ /* --------------------- */ status = HE5_SWwritefield(SWid, "Latitude", start, NULL, count, lat); printf("status returned by HE5_SWwritefield(\"Latitude\"): %d\n", status); /* Write Time Field */ /* ---------------- */ for (i = 0; i < 20; i++) tme[i] = 34574087.3 + 84893.2*i; start[0] = 0; count[0] = 20; status = HE5_SWwritefield(SWid, "Time", start, NULL, count, tme); printf("status returned by HE5_SWwritefield(\"Time\"): %d\n", status); start[0] = 0; count[0] = 10; status = HE5_SWwritefield(SWid, "Test_string", start, NULL, count, charname); printf("status returned by HE5_SWwritefield(\"Test_string\"): %d\n", status); /* Write Spectra Field */ /* ------------------- */ start[0] = 0; count[0] = 15; start[1] = 0; count[1] = 40; start[2] = 0; count[2] = 20; status = HE5_SWwritefield(SWid, "Spectra", start, NULL, count, plane); printf("status returned by HE5_SWwritefield(\"Spectra\"): %d\n", status); /* Write data to the profile */ /* ------------------------- */ start[0] = 0; count[0] = 4; status = HE5_PRwrite(SWid, "Profile-2000", start, NULL, count, datasize, buffer); printf("Status returned by HE5_PRwrite(\"Profile-2000\"): %d \n", status); /* Write Global 'int' Attribute */ /* ---------------------------- */ count[0] = 4; status = HE5_SWwriteattr(SWid, "GlobalAttribute", H5T_NATIVE_INT, count, attr1); printf("status returned by HE5_SWwriteattr(\"GlobalAttribute\"): %d\n", status); status = HE5_EHwriteglbattr(swfid, "GlobalAttribute_1", H5T_NATIVE_FLOAT, count, attr7); printf("status returned by HE5_EHwriteglbattr(\"GlobalAttribute_1\"): %d\n", status); strcpy(attr8,"AAAAAA"); count[0] = 6; status = HE5_EHwriteglbattr(swfid, "GlobalAttribute_2222", H5T_NATIVE_CHAR, count, attr8); printf("status returned by HE5_EHwriteglbattr(\"GlobalAttribute_2222\"): %d\n", status); /* Write Global 'char' Attribute */ /* ----------------------------- */ strcpy(attr4,"ABCDEFGH"); count[0] = 8; status = HE5_SWwriteattr(SWid, "GLOBAL_CHAR_ATTR", H5T_NATIVE_CHAR, count, attr4); printf("status returned by HE5_SWwriteattr(\"GLOBAL_CHAR_ATTR\"): %d\n", status); strcpy(attr9,"abc"); count[0] = 3; status = HE5_SWwriteattr(SWid, "GLOBAL_CHAR_ATTR_11", H5T_NATIVE_CHAR, count, attr9); printf("status returned by HE5_SWwriteattr(\"GLOBAL_CHAR_ATTR_11\"): %d\n", status); /* Write Global 'long' Attribute */ /* ----------------------------- */ count[0] = 4; status = HE5_SWwriteattr(SWid, "GLOBAL_LONG_ATTR", H5T_NATIVE_LONG, count, attr5); printf("status returned by HE5_SWwriteattr(\"GLOBAL_LONG_ATTR\"): %d\n", status); /* Write Global 'double' Attribute */ /* ------------------------------- */ count[0] = 4; status = HE5_SWwriteattr(SWid, "GLOBAL_DOUBLE_ATTR", H5T_NATIVE_DOUBLE, count, attr6); printf("status returned by HE5_SWwriteattr(\"GLOBAL_DOUBLE_ATTR\"): %d\n", status); status = HE5_EHwriteglbattr(swfid, "GLOBAL_DOUBLE_ATTR_1", H5T_NATIVE_DOUBLE, count, attr6); printf("status returned by HE5_EHwriteglbattr(\"GLOBAL_DOUBLE_ATTR_1\"): %d\n", status); /* Write Group Attribute */ /* --------------------- */ status = HE5_SWwritegrpattr(SWid, "GroupAttribute", H5T_NATIVE_INT, count, attr2); printf("status returned by HE5_SWwritegrpattr(\"GroupAttribute\"): %d\n", status); /* Write Local Attribute */ /* --------------------- */ strcpy(attr4,"ababababababababab"); count[0] = 18; status = HE5_SWwritelocattr(SWid, "Time", "LOCAL_CHAR_ATTR", H5T_NATIVE_CHAR, count, attr4); printf("status returned by HE5_SWwritelocattr(\"LOCAL_CHAR_ATTR\"): %d\n", status); count[0] = 4; status = HE5_SWwritelocattr(SWid, "Density", "LocalAttribute_1", H5T_NATIVE_INT, count, attr3); printf("status returned by HE5_SWwritelocattr(\"LocalAttribute_1\"):%d\n", status); /* Write Local Attribute */ /* --------------------- */ status = HE5_SWwritelocattr(SWid, "Longitude", "LocalAttribute_2", H5T_NATIVE_FLOAT, count, attr7); printf("status returned by HE5_SWwritelocattr(\"LocalAttribute_2\"):%d\n", status); } } status = HE5_SWdetach(SWid); status = HE5_SWclose(swfid); return 0; } hdf-eos5-2.0/samples/he5_sw_writedataF_32.f000077500000000000000000000164771507520047200204740ustar00rootroot00000000000000c In this program we (1) open the "swath.he5" file, (2) attach to c the "Swath1" swath, and (3) write data to the "Longitude", c "Longitude" and "Spectra" fields program he5_sw_writedataF_32 implicit none include 'hdfeos5.inc' integer status integer he5_swopen integer he5_swattach integer he5_swwrfld integer he5_swwrattr integer he5_swwrlattr integer he5_swwrgattr integer he5_ehwrglatt integer he5_swsetalias integer he5_swdetach integer he5_swclose integer he5_prwrite integer swfid, swid integer buffer(250) integer counter integer i, j, k integer itrack integer*4 attr(4) integer*4 attr0(4) integer*4 track integer*4 start(3) integer*4 stride(3) integer*4 count(3) integer*4 len(4) integer*4 datasize real attr1(4) character*10 attr4 character*100 attr5 real lng(10) real lat(10) real*8 plane(800) real*8 tme(20) integer FAIL parameter (FAIL=-1) c Set longitude values along the cross track c ------------------------------------------ do i=1,10 lng(i) = i-1.0 enddo c Open HDF-EOS file, "swath.he5" c ------------------------------ swfid = he5_swopen("swath.he5", HE5F_ACC_RDWR) write(*,*) 'File ID returned by he5_swopen(): ',swfid if (swfid .NE. FAIL) then swid = he5_swattach(swfid, "Swath1") write(*,*) 'Swath ID returned by he5_swattach(): ',swid if (swid .NE. FAIL) then c Write data starting at the beginning of each cross track c -------------------------------------------------------- start(1) = 0 stride(1) = 1 stride(2) = 1 count(1) = 10 count(2) = 1 c Loop through all the tracks, incrementing the track starting c position by one each time c ------------------------------------------------------------ do track = 1,20 start(2) = track - 1 status = he5_swwrfld(swid,"Longitude",start, 1 stride,count,lng) do itrack = 1,10 lat(itrack) = track enddo status = he5_swwrfld(swid,"Latitude",start, 1 stride,count,lat) enddo do i = 1,20 tme(i) = 34574087.3 + 84893.2*(i-1) enddo start(1) = 0 stride(1) = 1 count(1) = 20 status = he5_swwrfld(swid, "Time", start, stride, 1 count, tme) start(1) = 0 stride(1) = 1 stride(2) = 1 count(1) = 10 count(2) = 1 do track = 1,20 start(2) = track - 1 status = he5_swwrfld(swid,"Temperature",start, 1 stride,count,lng) enddo status = he5_swsetalias(swid,"Temperature","L2gpValue") status = he5_swsetalias(swid,"Latitude","Lat,L") c Write Spectra one plane at a time c Value is 100 * track index + band index (0-based) c ------------------------------------------------- start(1) = 0 start(2) = 0 count(1) = 20 count(2) = 40 count(3) = 1 stride(3) = 1 do i=1,15 start(3) = i - 1 do j=1,40 do k=1,20 plane((j-1)*20+k) = (j-1)*100 + i-1 enddo enddo status = he5_swwrfld(swid,"Spectra",start, 1 stride,count,plane) enddo c Populate data buffer and write data to the Profile Field c -------------------------------------------------------- datasize = 0 counter = 0 do i=1,4 len(i) = i*25 datasize = datasize + len(i) do j=1,(25*i) counter = counter + 1 buffer(counter) = (i)*1000 + j - 1 enddo enddo start(1) = 0 count(1) = 4 stride(1) = 1 status = he5_prwrite(swid,"Profile-2000",start,stride,count, 1 datasize,len,buffer) write(*,*) 'Status returned by he5_prwrite(): ',status c Write User defined Attribute c ---------------------------- attr(1) = 3 attr(2) = 5 attr(3) = 7 attr(4) = 11 count(1) = 4 status = he5_swwrattr(swid,"TestAttr",HE5T_NATIVE_INT, 1 count,attr) write(*,*) 'Status returned by he5_swwrattr(): ',status c Write Global Attribute c ---------------------- attr4 = "ABCDEFGH" count(1) = 8 status = he5_swwrattr(swid,"GLOBAL_CHAR_ATTR", 1 HE5T_NATIVE_CHAR,count,attr4) write(*,*) 'Status returned by he5_swwrattr(): ',status attr4 = "111" count(1) = 3 status = he5_swwrgattr(swid,"GLOBAL_CHAR_ATTR_1", 1 HE5T_NATIVE_CHAR,count,attr4) write(*,*) 'Status returned by he5_swwrgattr(): ',status attr4 = "222222" count(1) = 6 status = he5_ehwrglatt(swfid,"GLOBAL_CHAR_ATTR_2", 1 HE5T_NATIVE_CHAR,count,attr4) write(*,*) 'Status returned by he5_ehwrglatt(): ',status c Write Local Attribute c --------------------- attr0(1) = 100 attr0(2) = 200 attr0(3) = 300 attr0(4) = 400 count(1) = 4 status = he5_swwrlattr(swid,"Density","LocalAttribute_1", 1 HE5T_NATIVE_INT,count,attr0) write(*,*) 'Status returned by he5_swwrlattr(): ',status attr5 = "abababababababababab" count(1) = 20 status = he5_swwrlattr(swid,"Density","LocalAttribute_0", 1 HE5T_NATIVE_CHAR,count,attr5) write(*,*) 'Status returned by he5_swwrlattr(): ',status attr1(1) = 1.111111 attr1(2) = 2.222222 attr1(3) = 3.333333 attr1(4) = 4.444444 count(1) = 4 status = he5_swwrlattr(swid,"Longitude","LocalAttribute_2", 1 HE5T_NATIVE_REAL,count,attr1) write(*,*) 'Status returned by he5_swwrlattr(): ',status endif endif c Detach from the swath c --------------------- status = he5_swdetach(swid) write(*,*) 'Status returned by he5_swdetach(): ',status c Close the file c -------------- status = he5_swclose(swfid) write(*,*) 'Status returned by he5_swclose(): ',status stop end hdf-eos5-2.0/samples/he5_sw_writedataF_64.f000077500000000000000000000140351507520047200204650ustar00rootroot00000000000000c In this program we (1) open the "swath.he5" file, (2) attach to c the "Swath1" swath, and (3) write data to the "Longitude", c "Longitude" and "Spectra" fields program he5_sw_writedataF_64 implicit none include 'hdfeos5.inc' integer status integer he5_swopen integer he5_swattach integer he5_swwrfld integer he5_swwrattr integer he5_swwrlattr integer he5_swwrgattr integer he5_ehwrglatt integer he5_swdetach integer he5_swclose integer he5_prwrite integer swfid, SWid integer buffer(250) integer counter integer i, j , k integer itrack integer*4 attr(4) integer*8 track integer*8 start(3) integer*8 stride(3) integer*8 count(3) integer*8 len(4) integer*8 datasize character*10 attr4 character*100 attr5 character*4 charfield(10) real lng(10) real lat(10) real*8 plane(800) real*8 tme(20) integer FAIL parameter (FAIL=-1) c Set longitude values along the cross track c ------------------------------------------ do i=1,10 lng(i) = i-1.0 enddo data charfield/'aaaa','b b','cc ','dddd','ee e','ffff', 1 'gggg','hh ','i ','jjjj'/ c Open HDF-EOS file, "swath.he5" c ------------------------------ swfid = he5_swopen("swath.he5", HE5F_ACC_RDWR) write(*,*) 'File ID returned by he5_swopen(): ',swfid if (swfid .NE. FAIL) then SWid = he5_swattach(swfid, "Swath1") write(*,*) 'Swath ID returned by he5_swattach(): ',swid if (swid .NE. FAIL) then c Write data starting at the beginning of each cross track c -------------------------------------------------------- start(1) = 0 stride(1) = 1 stride(2) = 1 count(1) = 10 count(2) = 1 c Loop through all the tracks, incrementing the track starting c position by one each time c ------------------------------------------------------------ do track = 1,20 start(2) = track - 1 status = he5_swwrfld(swid,"Longitude",start, 1 stride,count,lng) do itrack = 1,10 lat(itrack) = track enddo status = he5_swwrfld(swid,"Latitude",start, 1 stride,count,lat) enddo do i = 1,20 tme(i) = 345740878.3 + 848936.2*(i-1) enddo start(1) = 0 stride(1) = 1 count(1) = 20 status = he5_swwrfld(swid, "Time", start, stride, 1 count, tme) start(1) = 0 stride(1) = 1 count(1) = 10 status = he5_swwrfld(swid, "test_string", start, 1 stride, count, charfield) c Write Spectra one plane at a time c Value is 100 * track index + band index (0-based) c ------------------------------------------------- start(1) = 0 start(2) = 0 count(1) = 20 count(2) = 40 count(3) = 1 stride(3) = 1 do i=1,15 start(3) = i - 1 do j=1,40 do k=1,20 plane((j-1)*20+k) = (j-1)*100 + i-1 enddo enddo status = he5_swwrfld(swid,"Spectra",start, 1 stride,count,plane) enddo c Populate data buffer and write data to the Profile Field c -------------------------------------------------------- datasize = 0 counter = 0 do i=1,4 len(i) = i*25 datasize = datasize + len(i) do j=1,(25*i) counter = counter + 1 buffer(counter) = (i)*1000 + j - 1 enddo enddo start(1) = 0 count(1) = 4 stride(1) = 1 status = he5_prwrite(swid,"Profile-2000", 1 start,stride,count,datasize,len,buffer) write(*,*) 'Status returned by he5_prwrite(): ',status c Write User defined Attribute c ---------------------------- attr(1) = 3 attr(2) = 5 attr(3) = 7 attr(4) = 11 count(1) = 4 status = he5_swwrattr(swid,"TestAttr",HE5T_NATIVE_INT, 1 count,attr) c Write Global Attribute c ---------------------- attr4 = "ABCDEFGH" count(1) = 8 status = he5_swwrattr(swid,"GLOBAL_CHAR_ATTR", 1 HE5T_NATIVE_CHAR,count,attr4) attr4 = "111" count(1) = 3 status = he5_swwrgattr(swid,"GLOBAL_CHAR_ATTR_1", 1 HE5T_NATIVE_CHAR,count,attr4) attr4 = "222222" count(1) = 6 status = he5_ehwrglatt(swfid,"GLOBAL_CHAR_ATTR_2", 1 HE5T_NATIVE_CHAR,count,attr4) c Write Local Attribute c --------------------- attr5 = "abababababababababab" count(1) = 20 status = he5_swwrlattr(swid,"Density","LocalAttribute_0", 1 HE5T_NATIVE_CHAR,count,attr5) endif endif c Detach from the swath c --------------------- status = he5_swdetach(swid) write(*,*) 'Status returned by he5_swdetach(): ',status c Close the file c -------------- status = he5_swclose(swfid) write(*,*) 'Status returned by he5_swclose(): ',status stop end hdf-eos5-2.0/samples/he5_sw_wrunlimfld.c000077500000000000000000000131331507520047200202400ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include /* In this program we (1) open the "Swath.h5" HDF-EOS file, (2) attach to */ /* the "Swath1" swath, and (3) write data to the "Longitude", "Latitude", */ /* and (appendable) "Spectra" fields */ /* ----------------------------------------------------------------------- */ int main() { herr_t status = FAIL; int i, j, k; int track, xtrack; int rank = FAIL; hid_t swfid = FAIL; hid_t SWid = FAIL; hid_t *ntype; hssize_t start[3] = {0, 0, 0}; hsize_t count[3]; hsize_t dims[8] = {0, 0, 0, 0, 0, 0, 0, 0}; long attr[4] = {3, 5, 7, 11}; float lng[20][10], latcnt; float lat[20][10], loncnt; double plane[15][40][20]; double tme[20]; char dimlist[80]; char maxdimlist[80]; hvl_t buffer[4]; size_t datasize; /* Populate lon/lat data arrays */ /* ---------------------------- */ latcnt = 1.; loncnt = 1.; track = 0; xtrack = 0; while(track < 20) { while(xtrack < 10) { lat[track][xtrack] = latcnt; lng[track][xtrack] = loncnt; loncnt = loncnt + 1.; xtrack++; } latcnt = latcnt + 1.; loncnt = 1.; track++; xtrack = 0; } /* Popolate spectra data arrays */ /* ---------------------------- */ for (i = 0; i < 15; i++){ for (j = 0; j < 40; j++) for (k = 0; k < 20; k++) plane[i][j][k] = (double)(j*100 + i); } /* Allocate memory for and populate data buffer */ /* -------------------------------------------- */ datasize = 0; for (i = 0; i < 4; i++) { buffer[i].p = (hvl_t *)calloc( 25 *(i+1), sizeof(unsigned int)); buffer[i].len = 25 * (i+1); /* calculate the data buffer size (bytes) */ datasize += buffer[i].len * sizeof(unsigned int); for ( j = 0; j < 25 * (i+1); j++) ((unsigned int *)buffer[i].p)[j] = (i+1)*1000 + j; } /* Open the HDF swath file, "Swath.h5" */ /* ----------------------------------- */ swfid = HE5_SWopen("Swath.h5", H5F_ACC_RDWR); if (swfid != FAIL) { /* Attach the "Swath1" swath */ /* ------------------------- */ SWid = HE5_SWattach(swfid, "Swath1"); if (SWid != FAIL) { count[0] = 20; count[1] = 10; /* Write "Longitute" field */ /* ----------------------- */ status = HE5_SWwritefield(SWid, "Longitude", start, NULL, count, lng); printf("status returned by HE5_SWwritefield(\"Longitude\"): %d\n", status); /* Write "Latitude" field */ /* ---------------------- */ status = HE5_SWwritefield(SWid, "Latitude", start, NULL, count, lat); printf("status returned by HE5_SWwritefield(\"Latitude\"): %d\n", status); /* Write "Time" field */ /* ------------------- */ for (i = 0; i < 20; i++) tme[i] = 34574087.3 + 84893.2*i; count[0] = 20; status = HE5_SWwritefield(SWid, "Time", start, NULL, count, tme); printf("status returned by HE5_SWwritefield(\"Time\"): %d\n", status); /* Write "Spectra" field 1st time */ /* -------------------------------- */ count[0] = 15; count[1] = 40; count[2] = 20; status = HE5_SWwritefield(SWid, "Spectra", start, NULL, count, plane); printf("status returned by HE5_SWwritefield(\"Spectra\"): %d\n", status); /* Retrieve information about "Spectra" field */ /* ------------------------------------------ */ ntype = (hid_t *)calloc(3,sizeof(hid_t)); status = HE5_SWfieldinfo(SWid, "Spectra", &rank, dims, ntype, dimlist, maxdimlist); printf("Number of elements after first write: \n"); for ( i = 0; i < rank; i++) printf("\t\t %lu\n",(unsigned long)dims[i]); printf("DimList string: %s \n", dimlist); printf("MaxdimList string: %s \n", maxdimlist); /* Write Spectra Field 2d time */ /* ----------------------------- */ start[0] = 10; start[1] = 50; start[2] = 30; count[0] = 15; count[1] = 40; count[2] = 20; status = HE5_SWwritefield(SWid, "Spectra", start, NULL, count, plane); printf("status returned by HE5_SWwritefield(\"Spectra\"): %d\n", status); /* Retrieve information about "Spectra" field */ /* ------------------------------------------ */ dims[0] = 0; dims[1] = 0; dims[2] = 0; status = HE5_SWfieldinfo(SWid, "Spectra", &rank, dims, ntype, dimlist, maxdimlist); printf("Number of elements after second write: \n"); for ( i = 0; i < rank; i++) { printf("\t\t %lu\n",(unsigned long)dims[i]); } printf("DimList string: %s \n", dimlist); printf("MaxdimList string: %s \n", maxdimlist); free(ntype); /* Write data to the profile */ /* ------------------------- */ start[0] = 0; count[0] = 4; status = HE5_PRwrite(SWid, "Profile-2000", start, NULL, count, datasize, buffer); printf("Status returned by HE5_PRwrite(\"Profile-2000\"): %d \n", status); /* Write User-defined Attribute */ /* ---------------------------- */ count[0] = 4; status = HE5_SWwriteattr(SWid, "TestAttr", H5T_NATIVE_INT, count, attr); printf("status returned by HE5_SWwriteattr(\"TestAttr\"): %d\n", status); } } status = HE5_SWdetach(SWid); status = HE5_SWclose(swfid); return 0; } hdf-eos5-2.0/samples/he5_za_datainfo.c000077500000000000000000000063601507520047200176270ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 2002 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include #define FILENAME "ZA.he5" #define OBJECT "ZA1" int main(void) { herr_t status = FAIL; int fieldgroup = FAIL; hid_t fid = FAIL; hid_t ZAid = FAIL; hid_t datatype = FAIL; H5T_class_t classid = H5T_NO_CLASS; H5T_order_t order = H5T_ORDER_ERROR; size_t size = 0; /* Open the HDF-EOS ZA file */ /* ------------------------ */ fid = HE5_ZAopen(FILENAME, H5F_ACC_RDONLY); printf("File ID returned by HE5_ZAopen() : %ld \n", (long) fid); /* Attach to the "ZA1" za */ /* ---------------------- */ ZAid = HE5_ZAattach(fid, OBJECT); printf("ZA ID returned by HE5_ZAattach() : %ld \n", (long) ZAid); /* Inquire data type information for the "Spectra" field */ /* ----------------------------------------------------- */ fieldgroup = HE5_HDFE_DATAGROUP; status = HE5_ZAinqdatatype(ZAid, "Spectra", NULL, fieldgroup, &datatype, &classid, &order, &size); printf("Status returned by HE5_ZAinqdatatype() : %d \n", status); if (status != FAIL) { printf("\tdatatype: %ld \n", (long) datatype); printf("\tclass ID: %d \n", classid); printf("\torder: %d \n", order); printf("\tsize: %d \n", (int)size); } /* Inquire data type information for the attributes */ /* ------------------------------------------------ */ fieldgroup = HE5_HDFE_ATTRGROUP; status = HE5_ZAinqdatatype(ZAid, NULL, "GlobalAttribute", fieldgroup, &datatype, &classid, &order, &size); printf("Status returned by HE5_ZAinqdatatype() : %d \n", status); if (status != FAIL) { printf("\tdatatype: %ld \n", (long) datatype); printf("\tclass ID: %d \n", classid); printf("\torder: %d \n", order); printf("\tsize: %d \n", (int)size); } fieldgroup = HE5_HDFE_GRPATTRGROUP; status = HE5_ZAinqdatatype(ZAid, NULL, "GroupAttribute", fieldgroup, &datatype, &classid, &order, &size); printf("Status returned by HE5_ZAinqdatatype() : %d \n", status); if (status != FAIL) { printf("\tdatatype: %ld \n", (long) datatype); printf("\tclass ID: %d \n", classid); printf("\torder: %d \n", order); printf("\tsize: %d \n", (int)size); } fieldgroup = HE5_HDFE_LOCATTRGROUP; status = HE5_ZAinqdatatype(ZAid, "Density", "LocalAttribute", fieldgroup, &datatype, &classid, &order, &size); printf("Status returned by HE5_ZAinqdatatype() : %d \n", status); if (status != FAIL) { printf("\tdatatype: %ld \n", (long) datatype); printf("\tclass ID: %d \n", classid); printf("\torder: %d \n", order); printf("\tsize: %d \n", (int)size); } /* Detach from the za */ /* ------------------ */ status = HE5_ZAdetach(ZAid); printf("Status returned by HE5_ZAdetach() : %d \n", status); /* Close the file */ /* -------------- */ status = HE5_ZAclose(fid); printf("Status returned by HE5_ZAclose() : %d \n", status); return(0); } hdf-eos5-2.0/samples/he5_za_defexternalfld.c000077500000000000000000000043611507520047200210300ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 2002 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include /* --------------------------------------------------------- */ /* In this program we (1) open the "ZA.he5" HDF-EOS file, */ /* (2) attach to the "ZA1" za, and (3) define the external */ /* data field "ExtData". */ /* --------------------------------------------------------- */ int main() { herr_t status = FAIL; hid_t zafid = FAIL; hid_t ZAid = FAIL; off_t offset[3]; hsize_t size[3]; /* Open the file, "ZA.he5", using the H5F_ACC_RDWR access code */ /* ---------------------------------------------------------- */ zafid = HE5_ZAopen("ZA.he5", H5F_ACC_RDWR); if (zafid != FAIL) { /* Attach to the "ZA1" za */ /* ---------------------- */ ZAid = HE5_ZAattach(zafid, "ZA1"); if (ZAid != FAIL) { /* Set the data sizes and offsets in external files */ /* ------------------------------------------------ */ size[0] = 10 * sizeof(int); offset[0] = 0; size[1] = 20 * sizeof(int); offset[1] = 40; size[2] = 30 * sizeof(int); offset[2] = 80; /* Set external data files first */ /* ----------------------------- */ status = HE5_ZAsetextdata(ZAid, "external_1.data,external_2.data,external_3.data", offset, size); printf("Status returned by HE5_ZAsetextdata(...) : %d\n",status); /* Define field containing external data */ /* ------------------------------------- */ status = HE5_ZAdefine(ZAid, "ExtData", "ExtDim", NULL, H5T_NATIVE_INT); printf("Status returned by HE5_ZAdefine(...\"ExtData\",...) : %d\n",status); } } /* Detach from the za */ /* ------------------ */ status = HE5_ZAdetach(ZAid); printf("Status returned by HE5_ZAdetach(...) : %d\n",status); /* Close the file */ /* -------------- */ status = HE5_ZAclose(zafid); printf("Status returned by HE5_ZAclose(...) : %d\n",status); return 0; } hdf-eos5-2.0/samples/he5_za_defexternalfldF_32.f000077500000000000000000000033771507520047200214530ustar00rootroot00000000000000! ! In this program we (1) open the "za.he5" HDF-EOS file, ! (2) attach to the "ZA1" za, and (3) define the ! external data field "ExtData". ! program he5_za_defexternalfldF_32 implicit none include 'hdfeos5.inc' integer status integer he5_zaopen integer he5_zaattach integer he5_zadefine integer he5_zadetach integer he5_zaclose integer he5_zasetxdat integer zafid, zaid integer*4 offset(3), size(3) integer FAIL parameter (FAIL=-1) ! Open the HDF-EOS file, "za.he5" using "READ/WRITE" access code ! -------------------------------------------------------------- zafid = he5_zaopen("za.he5", HE5F_ACC_RDWR) write(*,*) 'File ID returned by he5_zaopen(): ',zafid if (zafid .NE. FAIL) then zaid = he5_zaattach(zafid, "ZA1") write(*,*) 'ZA ID returned by he5_zaattach(): ',zaid if (zaid .NE. FAIL) then offset(1) = 0 size(1) = 40 offset(2) = 40 size(2) = 80 offset(3) = 80 size(3) = 120 status = he5_zasetxdat(zaid, "extf1.dat,extf2.dat,extf3.dat", 1offset, size) write(*,*) 'Status returned by he5_zasetxdat(): ',status status = he5_zadefine(zaid, "ExtData", "ExtDim", 1" ", HE5T_NATIVE_INT) write(*,*) 'Status returned by he5_zadefine(): ',status endif endif ! Detach from the za ! ------------------ status = he5_zadetach(zaid) write(*,*) 'Status returned by he5_zadetach(): ',status ! Close the file ! -------------- status = he5_zaclose(zafid) write(*,*) 'Status returned by he5_zaclose(): ',status stop end hdf-eos5-2.0/samples/he5_za_defexternalfldF_64.f000077500000000000000000000033751507520047200214560ustar00rootroot00000000000000! ! In this program we (1) open the "za.he5" HDF-EOS file, (2) ! attach to the "ZA1" za, and (3) define the external data ! field "ExtData". ! program he5_za_defexternalfldF_64 implicit none include 'hdfeos5.inc' integer status integer he5_zaopen integer he5_zaattach integer he5_zadefine integer he5_zadetach integer he5_zaclose integer he5_zasetxdat integer zafid, zaid integer*8 offset(3), size(3) integer FAIL parameter (FAIL=-1) ! Open the HDF-EOS file, "za.he5" using "READ/WRITE" access code ! -------------------------------------------------------------- zafid = he5_zaopen("za.he5", HE5F_ACC_RDWR) write(*,*) 'File ID returned by he5_zaopen(): ',zafid if (zafid .NE. FAIL) then zaid = he5_zaattach(zafid, "ZA1") write(*,*) 'ZA ID returned by he5_zaattach(): ',zaid if (zaid .NE. FAIL) then offset(1) = 0 size(1) = 40 offset(2) = 40 size(2) = 80 offset(3) = 80 size(3) = 120 status = he5_zasetxdat(zaid, "extf1.dat,extf2.dat,extf3.dat", 1offset, size) write(*,*) 'Status returned by he5_zasetxdat(): ',status status = he5_zadefine(zaid, "ExtData", "ExtDim", 1" ", HE5T_NATIVE_INT) write(*,*) 'Status returned by he5_zadefine(): ',status endif endif ! Detach from the za ! ------------------ status = he5_zadetach(zaid) write(*,*) 'Status returned by he5_zadetach(): ',status ! Close the file ! -------------- status = he5_zaclose(zafid) write(*,*) 'Status returned by he5_zaclose(): ',status stop end hdf-eos5-2.0/samples/he5_za_definefields.c000077500000000000000000000154521507520047200204650ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 2002 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include #include #define RANK 3 #define rank 1 /* In this program we (1) open the "ZA.he5" HDF-EOS file, */ /* (2) attach to the "ZA1" za, and (3) define the fields */ /* ----------------------------------------------------- */ int main() { herr_t status = FAIL; int comp_level[ 5 ] = {0,0,0,0,0}; int comp_code; hid_t zafid = FAIL; hid_t ZAid = FAIL; hsize_t chunk_dims[ 3 ]; char fillvalue[100] = "charname"; /* Open the file, "ZA.he5", using the H5F_ACC_RDWR access code */ /* ---------------------------------------------------------- */ zafid = HE5_ZAopen("ZA.he5", H5F_ACC_RDWR); if (zafid != FAIL) { ZAid = HE5_ZAattach(zafid, "ZA1"); if (ZAid != FAIL) { status = HE5_ZAdefine(ZAid, "Density", "MyTrack1", NULL, H5T_NATIVE_FLOAT); printf("Status returned by HE5_ZAdefine(...\"Density\",...) : %d\n",status); status = HE5_ZAdefine(ZAid, "Temperature", "MyTrack1,MyTrack2",NULL, H5T_NATIVE_FLOAT); printf("Status returned by HE5_ZAdefine(...\"Temperature\",...) : %d\n",status); status = HE5_ZAdefine(ZAid, "Presure", "Res2tr,Res2xtr", NULL, H5T_NATIVE_DOUBLE); printf("Status returned by HE5_ZAdefine(...\"Presure\",...) : %d\n",status); status = HE5_ZAsetfillvalue(ZAid, "Test_string", HE5T_CHARSTRING, fillvalue); printf("Status returned by HE5_ZAsetfillvalue(...\"Test_string\",...) : %d\n",status); status = HE5_ZAdefine(ZAid, "Test_string", "MyTrack2", NULL, HE5T_CHARSTRING); printf("Status returned by HE5_ZAdefine(...\"Test_string\",...) : %d\n",status); /* Define Appendable Field */ /* ----------------------- */ /* First, define chunking */ /* (the appendable dataset must be chunked) */ /* ---------------------------------------- */ chunk_dims[0] = 15; chunk_dims[1] = 40; chunk_dims[2] = 20; status = HE5_ZAdefchunk(ZAid, RANK, chunk_dims); printf("\tStatus returned by HE5_ZAdefchunk() : %d\n",status); /* Second, define compression scheme */ /* --------------------------------- */ /* set the value of compression code: */ /* HDFE_COMP_NONE 0 */ /* HDFE_COMP_RLE 1 */ /* HDFE_COMP_NBIT 2 */ /* HDFE_COMP_SKPHUFF 3 */ /* HDFE_COMP_DEFLATE 4 */ /* HDFE_COMP_SZIP_CHIP 5 */ /* HDFE_COMP_SZIP_K13 6 */ /* HDFE_COMP_SZIP_EC 7 */ /* HDFE_COMP_SZIP_NN 8 */ /* HDFE_COMP_SZIP_K13orEC 9 */ /* HDFE_COMP_SZIP_K13orNN 10 */ /* HDFE_COMP_SHUF_DEFLATE 11 */ /* HDFE_COMP_SHUF_SZIP_CHIP 12 */ /* HDFE_COMP_SHUF_SZIP_K13 13 */ /* HDFE_COMP_SHUF_SZIP_EC 14 */ /* HDFE_COMP_SHUF_SZIP_NN 15 */ /* HDFE_COMP_SHUF_SZIP_K13orEC 16 */ /* HDFE_COMP_SHUF_SZIP_K13orNN 17 */ comp_code = 9; /*comp_code = 0;*/ /* Set compression level: value 0,1,2,3,4,5,6,7,8,9,10,16, or 32 */ /* ------------------------------------------------------------- */ comp_level[0] = 16; /*comp_level[0] = 0;*/ #ifdef HAVE_FILTER_SZIP_ENCODER status = HE5_ZAdefcomp(ZAid,comp_code, comp_level); printf("\tStatus returned by HE5_ZAdefcomp() : %d\n",status); #else printf("SZIP encoder is not available. The data compression test is skipped.\n"); #endif status = HE5_ZAdefine(ZAid, "Spectra", "Bands,Res2tr,Res2xtr", NULL, H5T_NATIVE_FLOAT); printf("Status returned by HE5_ZAdefine(...\"Spectra\",...) : %d\n",status); /* Define Appendable Field */ /* ----------------------- */ /* First, define chunking */ /* (the appendable dataset must be chunked) */ /* ---------------------------------------- */ chunk_dims[0] = 20; status = HE5_ZAdefchunk(ZAid, rank, chunk_dims); printf("\tStatus returned by HE5_ZAdefchunk() : %d\n",status); /* Second, define compression scheme */ /* --------------------------------- */ /* set the value of compression code: */ /* HDFE_COMP_NONE 0 */ /* HDFE_COMP_RLE 1 */ /* HDFE_COMP_NBIT 2 */ /* HDFE_COMP_SKPHUFF 3 */ /* HDFE_COMP_DEFLATE 4 */ /* HDFE_COMP_SZIP_CHIP 5 */ /* HDFE_COMP_SZIP_K13 6 */ /* HDFE_COMP_SZIP_EC 7 */ /* HDFE_COMP_SZIP_NN 8 */ /* HDFE_COMP_SZIP_K13orEC 9 */ /* HDFE_COMP_SZIP_K13orNN 10 */ /* HDFE_COMP_SHUF_DEFLATE 11 */ /* HDFE_COMP_SHUF_SZIP_CHIP 12 */ /* HDFE_COMP_SHUF_SZIP_K13 13 */ /* HDFE_COMP_SHUF_SZIP_EC 14 */ /* HDFE_COMP_SHUF_SZIP_NN 15 */ /* HDFE_COMP_SHUF_SZIP_K13orEC 16 */ /* HDFE_COMP_SHUF_SZIP_K13orNN 17 */ comp_code = 16; /*comp_code = 0;*/ /* Set compression level: value 0,1,2,3,4,5,6,7,8,9,10,16, or 32 */ /* ------------------------------------------------------------- */ comp_level[0] = 2; /*comp_level[0] = 0;*/ #ifdef HAVE_FILTER_SZIP_ENCODER status = HE5_ZAdefcomp(ZAid,comp_code, comp_level); printf("\tStatus returned by HE5_ZAdefcomp() : %d\n",status); #else printf("SZIP encoder is not available. The data compression test is skipped.\n"); #endif status = HE5_ZAdefine(ZAid, "Count", "MyTrack1", "Unlim", H5T_NATIVE_INT); printf("Status returned by HE5_ZAdefine(...\"Count\",...) : %d\n",status); } } status = HE5_ZAdetach(ZAid); status = HE5_ZAclose(zafid); return 0; } hdf-eos5-2.0/samples/he5_za_definefieldsF_32.f000077500000000000000000000054161507520047200211010ustar00rootroot00000000000000! In this program we (1) open the "za.he5" HDF-EOS file, ! (2) attach to the "ZA1" za, and (3) define the za fields ! ======================================================== program he5_za_definefieldsF_32 implicit none include 'hdfeos5.inc' integer status integer he5_zaopen integer he5_zaattach integer he5_zadefine integer he5_zadefchunk integer he5_zadefcomp integer he5_zadetach integer he5_zaclose integer zafid, zaid integer chunkrank integer*4 chunkdims(3) integer compparm(1) integer FAIL parameter (FAIL=-1) ! Open the HDF-EOS file, "za.he5" using "READ/WRITE" access code ! -------------------------------------------------------------- zafid = he5_zaopen("za.he5",HE5F_ACC_RDWR) write(*,*) 'File ID returned by he5_zaopen(): ',zafid if (zafid .NE. FAIL) then zaid = he5_zaattach(zafid, "ZA1") write(*,*) 'ZA ID returned by he5_zaattach(): ',zaid if (zaid .NE. FAIL) then ! Define Data fields ! ------------------ status = he5_zadefine(zaid, "Density", 1 "MyTrack1"," ", HE5T_NATIVE_FLOAT) write(*,*) 'Status returned by he5_zadefine(): ',status status = he5_zadefine(zaid, "Temperature", 1 "MyTrack2,MyTrack1", 2 " ", HE5T_NATIVE_FLOAT) write(*,*) 'Status returned by he5_zadefine(): ',status status = he5_zadefine(zaid, "Pressure", 1 "Res2xtr,Res2tr", 2 " ", HE5T_NATIVE_FLOAT) write(*,*) 'Status returned by he5_zadefine(): ',status chunkrank = 3 chunkdims(1) = 20 chunkdims(2) = 40 chunkdims(3) = 15 compparm(1) = 6 status = he5_zadefchunk(zaid,chunkrank,chunkdims) write(*,*) 'Status returned by he5_zadefchunk(): ',status status = he5_zadefcomp(zaid,HE5_HDFE_COMP_DEFLATE,compparm) write(*,*) 'Status returned by he5_zadefcomp(): ',status status = he5_zadefine(zaid, "Spectra", 1 "Res2xtr,Res2tr,Bands", 2 " ", HE5T_NATIVE_DOUBLE) write(*,*) 'Status returned by he5_zadefine(): ',status endif endif ! Detach from the za ! ------------------ status = he5_zadetach(zaid) write(*,*) 'Status returned by he5_zadetach(): ',status ! Close the file ! -------------- status = he5_zaclose(zafid) write(*,*) 'Status returned by he5_zaclose(): ',status stop end hdf-eos5-2.0/samples/he5_za_definefieldsF_64.f000077500000000000000000000053521507520047200211050ustar00rootroot00000000000000! In this program we (1) open the "za.he5" HDF-EOS file, ! (2) attach to the "ZA1" za, and (3) define the za fields ! ======================================================== program he5_za_definefieldsF_64 implicit none include 'hdfeos5.inc' integer status integer he5_zaopen integer he5_zaattach integer he5_zadefine integer he5_zadefchunk integer he5_zadefcomp integer he5_zadetach integer he5_zaclose integer zafid, zaid integer chunkrank integer*8 chunkdims(3) integer compparm(1) integer FAIL parameter (FAIL=-1) ! Open the HDF-EOS file, "za.he5" using "READ/WRITE" access code ! -------------------------------------------------------------- zafid = he5_zaopen("za.he5",HE5F_ACC_RDWR) write(*,*) 'File ID returned by he5_zaopen(): ',zafid if (zafid .NE. FAIL) then zaid = he5_zaattach(zafid, "ZA1") write(*,*) 'ZA ID returned by he5_zaattach(): ',zaid if (zaid .NE. FAIL) then ! Define Data fields ! ------------------ status = he5_zadefine(zaid,"Density","MyTrack1", 1 " ",HE5T_NATIVE_FLOAT) write(*,*) 'Status returned by he5_zadefine(): ',status status = he5_zadefine(zaid,"Temperature", 1 "MyTrack2,MyTrack1"," ",HE5T_NATIVE_FLOAT) write(*,*) 'Status returned by he5_zadefine(): ',status status = he5_zadefine(zaid,"Pressure","Res2xtr,Res2tr", 1 " ", HE5T_NATIVE_FLOAT) write(*,*) 'Status returned by he5_zadefine(): ',status chunkrank = 3 chunkdims(1) = 20 chunkdims(2) = 40 chunkdims(3) = 15 compparm(1) = 6 status = he5_zadefchunk(zaid,chunkrank,chunkdims) write(*,*) 'Status returned by he5_zadefchunk(): ',status status = he5_zadefcomp(zaid,HE5_HDFE_COMP_DEFLATE,compparm) write(*,*) 'Status returned by he5_zadefcomp(): ',status status = he5_zadefine(zaid, "Spectra", 1 "Res2xtr,Res2tr,Bands"," ", 2 HE5T_NATIVE_DOUBLE) write(*,*) 'Status returned by he5_zadefine(): ',status endif endif ! Detach from the za ! ------------------ status = he5_zadetach(zaid) write(*,*) 'Status returned by he5_zadetach(): ',status ! Close the file ! -------------- status = he5_zaclose(zafid) write(*,*) 'Status returned by he5_zaclose(): ',status stop end hdf-eos5-2.0/samples/he5_za_info.c000077500000000000000000000126551507520047200170010ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 2002 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include /* ------------------------------------------------------------------- */ /* In this program we retrieve information about (1) dimensions, (2) */ /* za fields, and (3) the global/group/local attributes */ /* ------------------------------------------------------------------- */ int main() { herr_t status = FAIL; int i, *rank, chunk_rank; hid_t zafid = FAIL, ZAid = FAIL; hid_t ntype[10]; hid_t dtype = FAIL; long ndims, strbufsize, nflds, nattr; hsize_t dimsize; hsize_t *dims, chunk_dim[8]; hsize_t n, nelem = 0; char version[80] = {0}; char *dimname, *fieldlist; char attrlist[80]; /* Open the ZA HDF-EOS File "ZA.he5" for reading only */ /* ------------------------------------------------- */ zafid = HE5_ZAopen("ZA.he5", H5F_ACC_RDONLY); if (zafid != FAIL) { HE5_EHgetversion(zafid, version); printf("HDF-EOS library version: \"%s\" \n", version); /* Attach the ZA "ZA1" */ /* ------------------- */ ZAid = HE5_ZAattach(zafid, "ZA1"); if (ZAid != FAIL) { /* Inquire Dimensions */ /* ------------------ */ ndims = HE5_ZAnentries(ZAid, HE5_HDFE_NENTDIM, &strbufsize); dims = (hsize_t *) calloc(ndims, sizeof(hsize_t)); dimname = (char *) calloc(strbufsize + 1, 1); ndims = HE5_ZAinqdims(ZAid, dimname, dims); printf("Dimension list: %s\n", dimname); for (i = 0; i < ndims; i++) printf("dim size: %li \n", (long)dims[i]); free(dims); free(dimname); /* Inquire Data Fields */ /* ------------------- */ nflds = HE5_ZAnentries(ZAid, HE5_HDFE_NENTDFLD, &strbufsize); rank = (int *) calloc(nflds, sizeof(int)); fieldlist = (char *) calloc(strbufsize + 1, 1); nflds = HE5_ZAinquire(ZAid, fieldlist, rank, ntype); printf("data fields: %s\n", fieldlist); for (i = 0; i < nflds; i++) printf("Rank: %d Data type: %ld\n", rank[i], (long) ntype[i]); free(rank); free(fieldlist); /* Get info on "MyTrack1" dim */ /* -------------------------- */ dimsize = HE5_ZAdiminfo(ZAid, "MyTrack1"); printf("Size of MyTrack1: %lu\n", (unsigned long)dimsize); dtype = FAIL; /* Get info about Global Attributes */ /* -------------------------------- */ printf("Global Attribute:\n"); status = HE5_ZAattrinfo(ZAid,"GlobalAttribute",&dtype, &nelem); printf("\t\t Data type: %ld\n", (long) dtype); printf("\t\t Number of elements: %lu \n", (unsigned long)nelem); nelem = 0; dtype = FAIL; /* Get info about Group Attributes */ /* ------------------------------- */ printf("Group Attribute:\n"); status = HE5_ZAgrpattrinfo(ZAid,"GroupAttribute",&dtype,&nelem); printf("\t\t Data type: %ld\n", (long) dtype); printf("\t\t Number of elements: %lu \n", (unsigned long)nelem); nelem = 777; dtype = FAIL; /* Get info about Local Attributes */ /* ------------------------------- */ printf("Local Attribute:\n"); status = HE5_ZAlocattrinfo(ZAid,"Density", "LocalAttribute",&dtype,&nelem); printf("\t\t Data type: %ld\n", (long) dtype); printf("\t\t Number of elements: %lu \n", (unsigned long)nelem); /* Inquire Global Attributes */ /* ------------------------- */ printf("Global Attributes:\n"); nattr = HE5_ZAinqattrs(ZAid, NULL, &strbufsize); printf("\t\t Number of attributes: %li \n", nattr); printf("\t\t String length of attribute list: %li \n", strbufsize); n = HE5_ZAinqattrs(ZAid, attrlist, &strbufsize); printf("\t\t Attribute list: %s \n", attrlist); /* Inquire Group Attributes */ /* ------------------------ */ strbufsize = 0; printf("\n"); printf("Group Attributes:\n"); nattr = HE5_ZAinqgrpattrs(ZAid, NULL, &strbufsize); printf("\t\t Number of attributes: %li \n", nattr); printf("\t\t String length of attribute list: %li \n", strbufsize); strcpy(attrlist,""); nattr = HE5_ZAinqgrpattrs(ZAid, attrlist, &strbufsize); printf("\t\t Attribute list: %s \n", attrlist); /* Inquire Local Attributes */ /* ------------------------ */ strbufsize = 0; printf("\n"); printf("Local Attributes:\n"); nattr = HE5_ZAinqlocattrs(ZAid, "Density", NULL, &strbufsize); printf("\t\t Number of attributes: %li \n", nattr); printf("\t\t String length of attribute list: %li \n", strbufsize); strcpy(attrlist,""); nattr = HE5_ZAinqlocattrs(ZAid, "Density", attrlist, &strbufsize); printf("\t\t Attribute list: %s \n", attrlist); status = HE5_ZAchunkinfo(ZAid,"Spectra",&chunk_rank,chunk_dim); printf("\n"); printf("\t\t Spectra chunk_rank: %d\n", chunk_rank); for (i = 0; i < chunk_rank; i++) printf("\t\t Spectra chunk_dim dimension %d: %lu\n",i+1, (unsigned long)chunk_dim[i]); } } status = HE5_ZAdetach(ZAid); status = HE5_ZAclose(zafid); return 0; } hdf-eos5-2.0/samples/he5_za_infoF_32.f000077500000000000000000000062301507520047200174060ustar00rootroot00000000000000! In this program we retrieve (1) information about the ! dimensions, (2) the za fields program he5_za_infoF_32 implicit none include 'hdfeos5.inc' integer i integer status integer zafid, zaid integer he5_zaopen integer he5_zaattach integer he5_zainfo integer he5_zachunkinfo integer he5_zadetach integer he5_zaclose integer rank(32) integer ntype(32) integer rk integer nt integer*4 he5_zainqdims integer*4 he5_zainquire integer*4 he5_zadiminfo integer*4 ndims integer*4 nflds integer*4 dims(32) integer*4 dimsize character*72 dimname character*72 dimlist character*72 maxdimlst character*72 fieldlist integer chunkrank integer*4 chunkdims(32) integer FAIL parameter (FAIL=-1) ! Open the "za.he5" file for "read only" access ! --------------------------------------------- zafid = he5_zaopen("za.he5", HE5F_ACC_RDONLY) write(*,*) 'File ID returned by he5_zaopen(): ',zafid if (zafid .NE. FAIL) then ! Attach the za ! ------------- zaid = he5_zaattach(zafid, "ZA1") write(*,*) 'ZA ID returned by he5_zaattach(): ',zaid if (zaid .NE. FAIL) then ! Inquire Dimensions ! ------------------ ndims = he5_zainqdims(zaid, dimname, dims) write(*,*) 'Dimension list: ', dimname do i = 1,ndims write(*,*) 'dim size: ', dims(i) enddo write(*,*) ! Inquire Data Fields ! ------------------- nflds = he5_zainquire(zaid, fieldlist, rank, ntype) write(*,*) 'Data Fieldlist: ', fieldlist do i=1,nflds write(*,*) 'field rank & datatype: ',rank(i),ntype(i) enddo write(*,*) ! Get info on "MyTrack1" dim ! -------------------------- dimsize = he5_zadiminfo(zaid, "MyTrack1") write(*,*) 'Size of MyTrack1: ', dimsize write(*,*) ! Get info on "Spectra" Field ! --------------------------- status = he5_zainfo(zaid,"Spectra",rk,dims,nt, 1 dimlist,maxdimlst) write(*,*) 'Spectra Rank: ', rk write(*,*) 'Spectra NumberType: ', nt write(*,*) 'Spectra Dimlist: ', dimlist write(*,*) 'Spectra Max Dimlist: ', maxdimlst do i=1,rk write(*,*) 'Dimension ',i,dims(i) enddo status = he5_zachunkinfo(zaid,"Spectra",chunkrank, 1 chunkdims) write(*,*) 'Spectra Chunking Rank: ', chunkrank do i=1,chunkrank write(*,*) 'Chunking Dimension ',i,chunkdims(i) enddo endif endif ! Detach from the za ! ------------------ status = he5_zadetach(zaid) write(*,*) 'Status returned by he5_zadetach(): ',status ! Close the file ! -------------- status = he5_zaclose(zafid) write(*,*) 'Status returned by he5_zaclose(): ',status stop end hdf-eos5-2.0/samples/he5_za_infoF_64.f000077500000000000000000000062311507520047200174140ustar00rootroot00000000000000! In this program we retrieve (1) information about the ! dimensions, (2) the za fields program he5_za_infoF_64 implicit none include 'hdfeos5.inc' integer i integer status integer zafid, zaid integer he5_zaopen integer he5_zaattach integer he5_zainfo integer he5_zachunkinfo integer he5_zadetach integer he5_zaclose integer rank(32) integer ntype(32) integer rk integer nt integer*8 he5_zainqdims integer*8 he5_zainquire integer*8 he5_zadiminfo integer*8 ndims integer*8 nflds integer*8 dims(32) integer*8 dimsize character*72 dimname character*72 dimlist character*72 maxdimlst character*72 fieldlist integer chunkrank integer*8 chunkdims(32) integer FAIL parameter (FAIL=-1) ! Open the "za.he5" file for "read only" access ! --------------------------------------------- zafid = he5_zaopen("za.he5",HE5F_ACC_RDONLY) write(*,*) 'File ID returned by he5_zaopen(): ',zafid if (zafid .NE. FAIL) then ! Attach the za ! ------------- zaid = he5_zaattach(zafid, "ZA1") write(*,*) 'ZA ID returned by he5_zaattach(): ',zaid if (zaid .NE. FAIL) then ! Inquire Dimensions ! ------------------ ndims = he5_zainqdims(zaid, dimname, dims) write(*,*) 'Dimension list: ', dimname do i = 1,ndims write(*,*) 'dim size: ', dims(i) enddo write(*,*) ! Inquire Data Fields ! ------------------- nflds = he5_zainquire(zaid, fieldlist, rank, ntype) write(*,*) 'Data Fieldlist: ', fieldlist do i=1,nflds write(*,*) 'field rank & datatype: ',rank(i),ntype(i) enddo write(*,*) ! Get info on "MyTrack1" dim ! -------------------------- dimsize = he5_zadiminfo(zaid, "MyTrack1") write(*,*) 'Size of MyTrack1: ', dimsize write(*,*) ! Get info on "Spectra" Field ! --------------------------- status = he5_zainfo(zaid,"Spectra",rk,dims,nt, 1 dimlist,maxdimlst) write(*,*) 'Spectra Rank: ', rk write(*,*) 'Spectra NumberType: ', nt write(*,*) 'Spectra Dimlist: ', dimlist write(*,*) 'Spectra Max Dimlist: ', maxdimlst do i=1,rk write(*,*) 'Dimension ',i,dims(i) enddo status = he5_zachunkinfo(zaid,"Spectra",chunkrank, 1 chunkdims) write(*,*) 'Spectra Chunking Rank: ', chunkrank do i=1,chunkrank write(*,*) 'Chunking Dimension ',i,chunkdims(i) enddo endif endif ! Detach from the za ! ------------------ status = he5_zadetach(zaid) write(*,*) 'Status returned by he5_zadetach(): ',status ! Close the file ! -------------- status = he5_zaclose(zafid) write(*,*) 'Status returned by he5_zaclose(): ',status stop end hdf-eos5-2.0/samples/he5_za_rdexternaldata.c000077500000000000000000000064441507520047200210470ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 2002 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include #define DIMIN 100 #define DIMOUT 60 int main() { FILE *in_1, *in_2, *in_3; herr_t status = FAIL; int i; int data_in_1[DIMIN]; int data_in_2[DIMIN]; int data_in_3[DIMIN]; int data_out[DIMOUT]; int nfiles = FAIL; hid_t zafid = FAIL; hid_t ZAid = FAIL; size_t namelength = 48; off_t offset[3]; char filelist[256]; hssize_t start[2]; hsize_t count[2]; hsize_t size[3]; /* Create the external data sets */ /* ----------------------------- */ for (i = 0; i < DIMIN; i++) { data_in_1[i] = 1000 + i + 1; data_in_2[i] = 2000 + i + 1; data_in_3[i] = 3000 + i + 1; } /* Open the external data files */ /* ---------------------------- */ in_1 = fopen("external_1.data", "w"); in_2 = fopen("external_2.data", "w"); in_3 = fopen("external_3.data", "w"); /* Write data buffers to the external data files */ /* --------------------------------------------- */ fwrite(data_in_1, sizeof(int), DIMIN, in_1); fwrite(data_in_2, sizeof(int), DIMIN, in_2); fwrite(data_in_3, sizeof(int), DIMIN, in_3); /* Close the external data files */ /* ----------------------------- */ fclose(in_1); fclose(in_2); fclose(in_3); /* Open the HDF-EOS za file, "ZA.he5" */ /* --------------------------------- */ zafid = HE5_ZAopen("ZA.he5", H5F_ACC_RDWR); if (zafid != FAIL) { /* Attach the "ZA1" za */ /* ------------------- */ ZAid = HE5_ZAattach(zafid, "ZA1"); if (ZAid != FAIL) { /* Read the external data field */ /* ---------------------------- */ start[0] = 0; count[0] = DIMOUT; status = HE5_ZAread(ZAid, "ExtData", start, NULL, count, data_out); printf("Status returned by HE5_ZAread() : %d \n", status); /* Display external data set */ /* ------------------------- */ printf(" \n"); for (i = 0; i < DIMOUT; i++) printf("%d ", data_out[i]); /* Get the number of external files */ /* -------------------------------- */ nfiles = HE5_ZAgetextdata(ZAid, "ExtData", namelength, filelist, offset, size); printf(" \n"); printf(" \n"); printf("Number of external files returned by HE5_ZAgetextdata() : %d \n", nfiles); if (nfiles > 0) { printf(" \n"); printf("External files: \"%s\" \n", filelist); printf(" \n"); printf("offsets: "); for (i = 0; i < nfiles; i++) printf("%d ", (int)offset[i]); printf(" \n"); printf("sizes: "); for (i = 0; i < nfiles; i++) printf("%lu ", (unsigned long)size[i]); printf(" \n"); printf(" \n"); } } } /* Detach from the za */ /* ------------------ */ status = HE5_ZAdetach(ZAid); printf("Status returned by HE5_ZAdetach() : %d \n", status); /* Close the file */ /* -------------- */ status = HE5_ZAclose(zafid); printf("Status returned by HE5_ZAclose() : %d \n", status); return 0; } hdf-eos5-2.0/samples/he5_za_rdexternaldataF_32.f000077500000000000000000000074421507520047200214630ustar00rootroot00000000000000! ! ---------------------------------------------------------------------------- ! | Copyright (C) 2002 Emergent IT Inc. and Raytheon Systems Company | ! ---------------------------------------------------------------------------- ! program he5_za_rdexternaldataF_32 implicit none include 'hdfeos5.inc' integer i integer status integer he5_zaopen integer he5_zaattach integer he5_zaread integer he5_zagetxdat integer he5_ehrdwrfile integer he5_zadetach integer he5_zaclose integer zafid, zaid integer nfiles integer datain1(100) integer datain2(100) integer datain3(100) integer dataout(60) integer*4 start(2) integer*4 stride(2) integer*4 count(2) integer*4 offset(3) integer*4 size(3) integer*4 nmlgth integer*4 num_elements character filelist*256 integer FAIL parameter (FAIL=-1) !.....Use this for writing (only) to an existing file integer WRITE_EXISTING_ONLY parameter (WRITE_EXISTING_ONLY=0) !.....Use this for reading (only) from an existing file integer READ_ONLY parameter (READ_ONLY=1) !.....Use this for creating and writing to a file integer WRITE_NEW parameter (WRITE_NEW=2) ! Create the external data sets ! ----------------------------- do 10 i=1,100 datain1(i) = 1000+i datain2(i) = 2000+i datain3(i) = 3000+i 10 continue num_elements = 100 status = he5_ehrdwrfile("extf1.dat",WRITE_NEW, 1HE5T_NATIVE_INT,num_elements,datain1) write(*,*) 'Status returned from he5_ehrdwrfile: ',status status = he5_ehrdwrfile("extf2.dat",WRITE_NEW, 1HE5T_NATIVE_INT,num_elements,datain2) write(*,*) 'Status returned from he5_ehrdwrfile: ',status status = he5_ehrdwrfile("extf3.dat",WRITE_NEW, 1HE5T_NATIVE_INT,num_elements,datain3) write(*,*) 'Status returned from he5_ehrdwrfile: ',status ! Open HDF-EOS za file, "za.he5" ! ------------------------------ zafid = he5_zaopen("za.he5", HE5F_ACC_RDWR) write(*,*) 'File ID returned from he5_zaopen(): ',zafid if (zafid .NE. FAIL) then zaid = he5_zaattach(zafid, "ZA1") write(*,*) 'ZA ID returned from he5_zaattach(): ',zaid if (zaid .NE. FAIL) then ! Read the external data field ! ---------------------------- start(1) = 0 stride(1) = 1 count(1) = 60 status = he5_zaread(zaid,"ExtData", 1 start,stride,count,dataout) write(*,*) 'Status returned from he5_zaread(): ',status ! Display the data ! ---------------- do i=1,60 write(*,*)'External data',dataout(i) enddo nmlgth = 48 ! Get the number of external files ! -------------------------------- nfiles = he5_zagetxdat(zaid,"ExtData",nmlgth, 1 filelist,offset,size) write(*,*) 'Number of external files',nfiles write(*,*) 'External files:',filelist do i=1,nfiles write(*,*) 'offsets:',offset(i) write(*,*) 'sizes:',size(i) enddo endif endif ! Detach from za ! -------------- status = he5_zadetach(zaid) write(*,*) 'Status returned from he5_zadetach(): ',status ! Close the file ! -------------- status = he5_zaclose(zafid) write(*,*) 'Status returned from he5_zaclose(): ',status stop end hdf-eos5-2.0/samples/he5_za_rdexternaldataF_64.f000077500000000000000000000074441507520047200214720ustar00rootroot00000000000000! ! ---------------------------------------------------------------------------- ! | Copyright (C) 2002 Emergent IT Inc. and Raytheon Systems Company | ! ---------------------------------------------------------------------------- ! program he5_za_rdexternaldataF_64 implicit none include 'hdfeos5.inc' integer i integer status integer he5_zaopen integer he5_zaattach integer he5_zaread integer he5_zagetxdat integer he5_ehrdwrfile integer he5_zadetach integer he5_zaclose integer zafid, zaid integer nfiles integer datain1(100) integer datain2(100) integer datain3(100) integer dataout(60) integer*8 start(2) integer*8 stride(2) integer*8 count(2) integer*8 offset(3) integer*8 size(3) integer*8 nmlgth integer*8 num_elements character filelist*256 integer FAIL parameter (FAIL=-1) !.....Use this for writing (only) to an existing file integer WRITE_EXISTING_ONLY parameter (WRITE_EXISTING_ONLY=0) !.....Use this for reading (only) from an existing file integer READ_ONLY parameter (READ_ONLY=1) !.....Use this for creating and writing to a file integer WRITE_NEW parameter (WRITE_NEW=2) ! Create the external data sets ! ----------------------------- do 10 i=1,100 datain1(i) = 1000+i datain2(i) = 2000+i datain3(i) = 3000+i 10 continue num_elements = 100 status = he5_ehrdwrfile("extf1.dat",WRITE_NEW, 1HE5T_NATIVE_INT,num_elements,datain1) write(*,*) 'Status returned from he5_ehrdwrfile: ',status status = he5_ehrdwrfile("extf2.dat",WRITE_NEW, 1HE5T_NATIVE_INT,num_elements,datain2) write(*,*) 'Status returned from he5_ehrdwrfile: ',status status = he5_ehrdwrfile("extf3.dat",WRITE_NEW, 1HE5T_NATIVE_INT,num_elements,datain3) write(*,*) 'Status returned from he5_ehrdwrfile: ',status ! Open HDF-EOS za file, "za.he5" ! ------------------------------ zafid = he5_zaopen("za.he5", HE5F_ACC_RDWR) write(*,*) 'File ID returned from he5_zaopen(): ',zafid if (zafid .NE. FAIL) then zaid = he5_zaattach(zafid, "ZA1") write(*,*) 'ZA ID returned from he5_zaattach(): ',zaid if (zaid .NE. FAIL) then ! Read the external data field ! ---------------------------- start(1) = 0 stride(1) = 1 count(1) = 60 status = he5_zaread(zaid,"ExtData", 1 start,stride,count,dataout) write(*,*) 'Status returned from he5_zaread(): ',status ! Display the data ! ---------------- do i=1,60 write(*,*)'External data',dataout(i) enddo nmlgth = 48 ! Get the number of external files ! -------------------------------- nfiles = he5_zagetxdat(zaid,"ExtData",nmlgth, 1 filelist,offset,size) write(*,*) 'Number of external files',nfiles write(*,*) 'External files:',filelist do i=1,nfiles write(*,*) 'offsets:',offset(i) write(*,*) 'sizes:',size(i) enddo endif endif ! Detach from za ! -------------- status = he5_zadetach(zaid) write(*,*) 'Status returned from he5_zadetach(): ',status ! Close the file ! -------------- status = he5_zaclose(zafid) write(*,*) 'Status returned from he5_zaclose(): ',status stop end hdf-eos5-2.0/samples/he5_za_readdata.c000077500000000000000000000114551507520047200176100ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 2002 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include /* ------------------------------------------------------------------- */ /* In this program we (1) open the "ZA.he5" HDF-EOS file, (2) attach to */ /* the "ZA1" za, and (3) read data from the "Spectra" field. Also, we */ /* read the global/group/local attributes */ /* ------------------------------------------------------------------- */ int main() { herr_t status = FAIL; int i, j, k; int attr1[4]; /* data buffer for global attribute */ int attr2[4]; /* .... for group attribute */ int attr3[4]; /* .... for local attribute */ hid_t zafid = FAIL; hid_t ZAid = FAIL; char attr4[7] = {0}; /* ... for global 'char' attribute */ long attr5[4]; /* ... for global 'long' attribute */ double attr6[4]; /* ... for global 'double' attribute */ hssize_t start[3]; hsize_t count[3]; double plane[15][40][20]; char *charname[10] = {0}; /* Populate spectra data array. Value = 100*(track index)+(band index) */ /* ------------------------------------------------------------------- */ for (i = 0; i < 15; i++) { for (j = 0; j < 40; j++) for (k = 0; k < 20; k++) plane[i][j][k] = (double)(j*100 + i); } /* Open the HDF-EOS za file, "ZA.he5" */ /* --------------------------------- */ zafid = HE5_ZAopen("ZA.he5", H5F_ACC_RDONLY); if (zafid != FAIL) { /* Attach the "ZA1" za */ /* ------------------- */ ZAid = HE5_ZAattach(zafid, "ZA1"); if (ZAid != FAIL) { /* Read the entire Spectra field */ /* ----------------------------- */ start[0] = 0; start[1] = 0; start[2] = 0; count[0] = 15; count[1] = 40; count[2] = 20; status = HE5_ZAread(ZAid, "Spectra", start, NULL, count, plane); printf("Status returned by HE5_ZAread() : %d \n", status); start[0] = 0; count[0] = 10; for (i = 0; i < 10; i++) charname[i] = (char *)malloc(95*sizeof(char)); status = HE5_ZAread(ZAid, "Test_string", start, NULL, count, charname); printf("Status returned by HE5_ZAread() : %d \n", status); /* Display Test_string data */ /* ---------------------- */ for (i = 0; i < 10; i++) printf("i = %d string = %s\n", i, charname[i]); for (i = 0; i < 10; i++) free(charname[i]); /* Read Global 'int' Attribute */ /* --------------------------- */ status = HE5_ZAreadattr(ZAid, "GlobalAttribute", attr1); printf("Status returned by HE5_ZAreadattr() : %d \n", status); printf("Global attribute values:\n"); for (i = 0; i < 4; i++) printf("\t\t %d \n",attr1[i]); /* Read Group Attribute */ /* -------------------- */ status = HE5_ZAreadgrpattr(ZAid, "GroupAttribute", attr2); printf("Status returned by HE5_ZAreadgrpattr() : %d \n", status); printf("Group attribute values:\n"); for (i = 0; i < 4; i++) printf("\t\t %d \n",attr2[i]); /* Read Local Attribute */ /* -------------------- */ status = HE5_ZAreadlocattr(ZAid, "Density", "LocalAttribute", attr3); printf("Status returned by HE5_ZAreadlocattr() : %d \n", status); printf("Local attribute values:\n"); for (i = 0; i < 4; i++) printf("\t\t %d \n",attr3[i]); /* Read Global 'char' Attribute */ /* ---------------------------- */ status = HE5_ZAreadattr(ZAid, "GLOBAL_CHAR_ATTR", attr4); printf("Status returned by HE5_ZAreadattr() : %d \n", status); printf("Global attribute values:\n"); printf("\t\t %s \n",attr4); /* Read Global 'long' Attribute */ /* ---------------------------- */ status = HE5_ZAreadattr(ZAid, "GLOBAL_LONG_ATTR", attr5); printf("Status returned by HE5_ZAreadattr() : %d \n", status); printf("Global attribute values:\n"); for (i = 0; i < 4; i++) printf("\t\t %li \n",attr5[i]); /* Read Global 'double' Attribute */ /* ------------------------------ */ status = HE5_ZAreadattr(ZAid, "GLOBAL_DOUBLE_ATTR", attr6); printf("Status returned by HE5_ZAreadattr() : %d \n", status); printf("Global attribute values:\n"); for (i = 0; i < 4; i++) printf("\t\t %f \n",attr6[i]); } } status = HE5_ZAdetach(ZAid); status = HE5_ZAclose(zafid); return 0; } hdf-eos5-2.0/samples/he5_za_readdataF_32.f000077500000000000000000000047121507520047200202230ustar00rootroot00000000000000! In this program we (1) open the "za.he5" file, (2) attach to ! the "ZA1" za, and (3) read data from the "Spectra" field ! ============================================================ program he5_za_readdataF_32 implicit none include 'hdfeos5.inc' integer status integer he5_zaopen integer he5_zaattach integer he5_zaread integer he5_zardattr integer he5_zadetach integer he5_zaclose integer zafid, zaid integer i,j,k integer*4 attr(4) integer*4 start(3) integer*4 stride(3) integer*4 count(3) real*8 plane(800) integer FAIL parameter (FAIL=-1) ! Open HDF-EOS za file, "za.he5" ! ------------------------------ zafid = he5_zaopen("za.he5",HE5F_ACC_RDWR) write(*,*) 'File ID returned by he5_zaopen(): ',zafid if (zafid .NE. FAIL) then zaid = he5_zaattach(zafid, "ZA1") write(*,*) 'ZA ID returned by he5_zaattach(): ',zaid if (zaid .NE. FAIL) then ! Read the entire Spectra field ! ----------------------------- start(1) = 0 start(2) = 0 count(1) = 20 count(2) = 40 count(3) = 1 stride(1) = 1 stride(2) = 1 stride(3) = 1 do i=1,15 start(3) = i - 1 do j=1,40 do k=1,20 plane((j-1)*20+k) = (j-1)*100 + i-1 enddo enddo status = he5_zaread(zaid,"Spectra",start, 1 stride,count,plane) enddo ! Read Attribute ! -------------- status = he5_zardattr(zaid, "TestAttr", attr) do i=1,4 write(*,*) 'Attribute Element', i, ':', attr(i) enddo endif endif ! Detach from the za ! ------------------ status = he5_zadetach(zaid) write(*,*) 'Status returned from he5_zadetach: ',status ! Close the file ! -------------- status = he5_zaclose(zafid) write(*,*) 'Status returned from he5_zaclose: ',status stop end hdf-eos5-2.0/samples/he5_za_readdataF_64.f000077500000000000000000000050131507520047200202230ustar00rootroot00000000000000! In this program we (1) open the "za.he5" file, (2) attach to ! the "ZA1" za, and (3) read data from the "Spectra" field ! ============================================================ program he5_za_readdataF_64 implicit none include 'hdfeos5.inc' integer status integer he5_zaopen integer he5_zaattach integer he5_zaread integer he5_zardattr integer he5_zadetach integer he5_zaclose integer zafid, zaid integer i,j,k integer*4 attr(4) integer*8 start(3) integer*8 stride(3) integer*8 count(3) real*8 plane(800) integer FAIL parameter (FAIL=-1) ! Open HDF-EOS za file, "za.he5" ! ------------------------------ zafid = he5_zaopen("za.he5",HE5F_ACC_RDWR) write(*,*) 'File ID returned by he5_zaopen(): ',zafid if (zafid .NE. FAIL) then zaid = he5_zaattach(zafid, "ZA1") write(*,*) 'ZA ID returned by he5_zaattach(): ',zaid if (zaid .NE. FAIL) then ! Read the entire Spectra field ! ----------------------------- start(1) = 0 start(2) = 0 count(1) = 20 count(2) = 40 count(3) = 1 stride(1) = 1 stride(2) = 1 stride(3) = 1 do i=1,15 start(3) = i - 1 do j=1,40 do k=1,20 plane((j-1)*20+k) = (j-1)*100 + i-1 enddo enddo status = he5_zaread(zaid,"Spectra",start, 1 stride,count,plane) enddo ! Read Attribute ! -------------- status = he5_zardattr(zaid, "TestAttr", attr) do i=1,4 write(*,*) 'Attribute Element', i, ':', attr(i) enddo endif endif ! Detach from the za ! ------------------ status = he5_zadetach(zaid) write(*,*) 'Status returned from he5_zadetach: ',status ! Close the file ! -------------- status = he5_zaclose(zafid) write(*,*) 'Status returned from he5_zaclose: ',status stop end hdf-eos5-2.0/samples/he5_za_setup.c000077500000000000000000000047271507520047200172070ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 2002 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include /* In this program we (1) open an HDF-EOS file, (2) create the ZA */ /* interface within the file, and (3) define the za field dimensions */ /* ----------------------------------------------------------------- */ int main() { herr_t status = FAIL; hid_t zafid = FAIL; hid_t ZAid = FAIL; /* Open a new HDF-EOS za file, "ZA.he5" */ /* ----------------------------------- */ zafid = HE5_ZAopen("ZA.he5", H5F_ACC_TRUNC); printf("File ID returned by HE5_ZAopen(): %ld \n", (long) zafid); /* Create the ZA, "ZA1", within the file */ /* ------------------------------------- */ ZAid = HE5_ZAcreate(zafid, "ZA1"); printf("ZA ID returned by HE5_ZAcreate(): %ld \n", (long) ZAid); /* Define dimensions and specify their sizes */ /* ----------------------------------------- */ status = HE5_ZAdefdim(ZAid, "MyTrack1", 20); printf("Status returned by HE5_ZAdefdim(): %d \n", status); status = HE5_ZAdefdim(ZAid, "MyTrack2", 10); printf("Status returned by HE5_ZAdefdim(): %d \n", status); status = HE5_ZAdefdim(ZAid, "Res2tr", 40); printf("Status returned by HE5_ZAdefdim(): %d \n", status); status = HE5_ZAdefdim(ZAid, "Res2xtr", 20); printf("Status returned by HE5_ZAdefdim(): %d \n", status); status = HE5_ZAdefdim(ZAid, "Bands", 15); printf("Status returned by HE5_ZAdefdim(): %d \n", status); status = HE5_ZAdefdim(ZAid, "IndxTrack", 12); printf("Status returned by HE5_ZAdefdim(): %d \n", status); /* Define "External" Dimension */ /* --------------------------- */ status = HE5_ZAdefdim(ZAid, "ExtDim", 60); printf("Status returned by HE5_ZAdefdim(): %d \n", status); /* Define Unlimited Dimension */ /* -------------------------- */ status = HE5_ZAdefdim(ZAid, "Unlim", H5S_UNLIMITED); printf("Status returned by HE5_ZAdefdim(): %d \n", status); /* Close the za interface */ /* ---------------------- */ status = HE5_ZAdetach(ZAid); printf("Status returned by HE5_ZAdetach(): %d \n", status); /* Close the za file */ /* ----------------- */ status = HE5_ZAclose(zafid); printf("Status returned by HE5_ZAclose(): %d \n", status); return 0; } hdf-eos5-2.0/samples/he5_za_setupF_32.f000077500000000000000000000050711507520047200176150ustar00rootroot00000000000000! In this program we (1) open an HDF-EOS file, (2) create the ! za interface, and (3) define the za field dimensions ! =========================================================== program he5_za_setupF_32 implicit none include 'hdfeos5.inc' integer status integer he5_zaopen integer he5_zacreate integer he5_zadefdim integer he5_zadetach integer he5_zaclose integer zafid, zaid integer*4 dtrack, extdata ! Open the HDF-EOS file, "za.he5" using "TRUNC" file access code ! -------------------------------------------------------------- zafid = he5_zaopen('za.he5',HE5F_ACC_TRUNC) write(*,*) 'File ID returned by he5_zaopen(): ',zafid ! Create the za, "ZA1", within the file ! ------------------------------------- zaid = he5_zacreate(zafid, "ZA1") write(*,*) 'ZA ID returned by he5_zacreate(): ',zaid ! Define Data dimensions ! ---------------------- dtrack = 20 status = he5_zadefdim(zaid, "MyTrack1", dtrack) write(*,*) 'Status returned by he5_zadefdim(): ',status dtrack = 10 status = he5_zadefdim(zaid, "MyTrack2", dtrack) write(*,*) 'Status returned by he5_zadefdim(): ',status dtrack = 40 status = he5_zadefdim(zaid, "Res2tr", dtrack) write(*,*) 'Status returned by he5_zadefdim(): ',status dtrack = 20 status = he5_zadefdim(zaid, "Res2xtr", dtrack) write(*,*) 'Status returned by he5_zadefdim(): ',status dtrack = 15 status = he5_zadefdim(zaid, "Bands", dtrack) write(*,*) 'Status returned by he5_zadefdim(): ',status dtrack = 12 status = he5_zadefdim(zaid, "IndxTrack", dtrack) write(*,*) 'Status returned by he5_zadefdim(): ',status ! Define "External" dimension ! --------------------------- extdata = 60 status = he5_zadefdim(zaid, "ExtDim", extdata) write(*,*) 'Status returned by he5_zadefdim(): ',status ! Define Unlimited (appendable) dimension ! --------------------------------------- status = he5_zadefdim(zaid, "Unlim", HE5S_UNLIMITED_F) write(*,*) 'Status returned by he5_zadefdim(): ',status ! Detach from the za ! ------------------ status = he5_zadetach(zaid) write(*,*) 'Status returned by he5_zadetach(): ',status ! Close the za file ! ----------------- status = he5_zaclose(zafid) write(*,*) 'Status returned by he5_zaclose(): ',status stop end hdf-eos5-2.0/samples/he5_za_setupF_64.f000077500000000000000000000052411507520047200176210ustar00rootroot00000000000000! In this program we (1) open an HDF-EOS file, (2) create the ! za interface, and (3) define the za field dimensions ! =========================================================== program he5_za_setupF_64 implicit none include 'hdfeos5.inc' include 'hdfeos5_64.inc' integer status integer he5_zaopen integer he5_zacreate integer he5_zadefdim integer he5_zadetach integer he5_zaclose integer zafid, zaid integer*8 dtrack, extdata ! Open the HDF-EOS file, "za.he5" using "TRUNC" file access code ! -------------------------------------------------------------- zafid = he5_zaopen("za.he5",HE5F_ACC_TRUNC) write(*,*) 'File ID returned by he5_zaopen(): ',zafid ! Create the za, "ZA1", within the file ! ------------------------------------- zaid = he5_zacreate(zafid, "ZA1") write(*,*) 'ZA ID returned by he5_zacreate(): ',zaid ! Define Data dimensions ! ---------------------- dtrack = 20 status = he5_zadefdim(zaid, "MyTrack1", dtrack) write(*,*) 'Status returned by he5_zadefdim(): ',status dtrack = 10 status = he5_zadefdim(zaid, "MyTrack2", dtrack) write(*,*) 'Status returned by he5_zadefdim(): ',status dtrack = 40 status = he5_zadefdim(zaid, "Res2tr", dtrack) write(*,*) 'Status returned by he5_zadefdim(): ',status dtrack = 20 status = he5_zadefdim(zaid, "Res2xtr", dtrack) write(*,*) 'Status returned by he5_zadefdim(): ',status dtrack = 15 status = he5_zadefdim(zaid, "Bands", dtrack) write(*,*) 'Status returned by he5_zadefdim(): ',status dtrack = 12 status = he5_zadefdim(zaid, "IndxTrack", dtrack) write(*,*) 'Status returned by he5_zadefdim(): ',status ! Define "External" dimension ! --------------------------- extdata = 60 status = he5_zadefdim(zaid, "ExtDim", extdata) write(*,*) 'Status returned by he5_zadefdim(): ',status ! Define Unlimited (appendable) dimension ! --------------------------------------- status = he5_zadefdim(zaid, "Unlim", HE5S_UNLIMITED_F_64) write(*,*) 'Status returned by he5_zadefdim(): ',status ! Detach from the za ! ------------------ status = he5_zadetach(zaid) write(*,*) 'Status returned by he5_zadetach(): ',status ! Close the za file ! ----------------- status = he5_zaclose(zafid) write(*,*) 'Status returned by he5_zaclose(): ',status stop end hdf-eos5-2.0/samples/he5_za_wrexternaldata.c000077500000000000000000000055271507520047200210730ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 2002 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include #define DIM 100 #define DIMTOT 60 int main() { FILE *in_1, *in_2, *in_3; herr_t status = FAIL; int i; int data_out_1[DIM]; int data_out_2[DIM]; int data_out_3[DIM]; int data[DIMTOT]; hid_t zafid = FAIL; hid_t ZAid = FAIL; hssize_t start[2]; hsize_t count[2]; /* Create new data buffer */ /* ---------------------- */ for (i = 0; i < DIMTOT; i++) data[ i ] = 9999; /* Open the HDF-EOS za file, "ZA.he5" */ /* --------------------------------- */ zafid = HE5_ZAopen("ZA.he5", H5F_ACC_RDWR); if (zafid != FAIL) { /* Attach the "ZA1" za */ /* ------------------- */ ZAid = HE5_ZAattach(zafid, "ZA1"); if (ZAid != FAIL) { /* Write new data to the external files */ /* ------------------------------------ */ start[0] = 0; count[0] = DIMTOT; status = HE5_ZAwrite(ZAid, "ExtData", start, NULL, count, data); printf("Status returned by HE5_ZAwrite() : %d \n", status); /* Open the external data files */ /* ---------------------------- */ in_1 = fopen("external_1.data", "r"); in_2 = fopen("external_2.data", "r"); in_3 = fopen("external_3.data", "r"); /* Read data from external data files */ /* ---------------------------------- */ i = fread(data_out_1, sizeof(int), DIM, in_1); i = fread(data_out_2, sizeof(int), DIM, in_2); i = fread(data_out_3, sizeof(int), DIM, in_3); /* Close the external data files */ /* ----------------------------- */ fclose(in_1); fclose(in_2); fclose(in_3); /* Check the contents of external files */ /* ------------------------------------ */ printf(" \n"); printf("Reading data from 1st file: \n"); printf(" \n"); for (i = 0; i < DIM; i++) printf("%d ", data_out_1[i]); printf(" \n"); printf(" \n"); printf("Reading data from 2d file: \n"); printf(" \n"); for (i = 0; i < DIM; i++) printf("%d ", data_out_2[i]); printf(" \n"); printf(" \n"); printf("Reading data from 3d file: \n"); printf(" \n"); for (i = 0; i < DIM; i++) printf("%d ", data_out_3[i]); printf(" \n"); printf(" \n"); } } /* Detach from the za */ /* ------------------ */ status = HE5_ZAdetach(ZAid); printf("Status returned by HE5_ZAdetach() : %d \n", status); /* Close the file */ /* -------------- */ status = HE5_ZAclose(zafid); printf("Status returned by HE5_ZAclose() : %d \n", status); return 0; } hdf-eos5-2.0/samples/he5_za_wrexternaldataF_32.f000077500000000000000000000064521507520047200215060ustar00rootroot00000000000000! ! ---------------------------------------------------------------------------- ! | Copyright (C) 2002 Emergent IT Inc. and Raytheon Systems Company | ! ---------------------------------------------------------------------------- ! program he5_za_wrexternaldataF_32 implicit none include 'hdfeos5.inc' integer i integer status integer he5_zaopen integer he5_zaattach integer he5_zawrite integer he5_ehrdwrfile integer he5_zadetach integer he5_zaclose integer zafid, zaid integer data_out_1(100) integer data_out_2(100) integer data_out_3(100) integer data(60) integer*4 start(2) integer*4 stride(2) integer*4 count(2) integer*4 num_elements integer FAIL parameter (FAIL=-1) !.....Use this for writing (only) to an existing file integer WRITE_EXISTING_ONLY parameter (WRITE_EXISTING_ONLY=0) !.....Use this for reading (only) from an existing file integer READ_ONLY parameter (READ_ONLY=1) !.....Use this for creating and writing to a file integer WRITE_NEW parameter (WRITE_NEW=2) ! Create the new data buffer ! -------------------------- do 10 i=1,60 data(i) = 9999 10 continue ! Open HDF-EOS za file, "za.he5" ! ------------------------------ zafid = he5_zaopen("za.he5", HE5F_ACC_RDWR) write(*,*) 'File ID returned from he5_zaopen(): ',zafid if (zafid .NE. FAIL) then zaid = he5_zaattach(zafid, "ZA1") write(*,*) 'ZA ID returned from he5_zaattach(): ',zaid if (zaid .NE. FAIL) then ! Write new data to the external files ! ------------------------------------ start(1) = 0 stride(1) = 1 count(1) = 60 status = he5_zawrite(zaid,"ExtData", 1 start,stride,count,data) write(*,*) 'Status returned from he5_zawrite(): ',status num_elements = 100 status = he5_ehrdwrfile("extf1.dat",READ_ONLY, 1HE5T_NATIVE_INT,num_elements,data_out_1) write(*,*) 'Status returned from he5_ehrdwrfile: ',status status = he5_ehrdwrfile("extf2.dat",READ_ONLY, 1HE5T_NATIVE_INT,num_elements,data_out_2) write(*,*) 'Status returned from he5_ehrdwrfile: ',status status = he5_ehrdwrfile("extf3.dat",READ_ONLY, 1HE5T_NATIVE_INT,num_elements,data_out_3) write(*,*) 'Status returned from he5_ehrdwrfile: ',status write(*,*)'External file extf1.dat:' write(*,*) data_out_1 write(*,*) ' ' write(*,*)'External file extf2.dat:' write(*,*) data_out_2 write(*,*) ' ' write(*,*)'External file extf3.dat:' write(*,*) data_out_3 write(*,*) ' ' endif endif ! Detach from za ! -------------- status = he5_zadetach(zaid) write(*,*) 'Status returned from he5_zadetach(): ',status ! Close the file ! -------------- status = he5_zaclose(zafid) write(*,*) 'Status returned from he5_zaclose(): ',status stop end hdf-eos5-2.0/samples/he5_za_wrexternaldataF_64.f000077500000000000000000000064601507520047200215120ustar00rootroot00000000000000! ! ---------------------------------------------------------------------------- ! | Copyright (C) 2002 Emergent IT Inc. and Raytheon Systems Company | ! ---------------------------------------------------------------------------- ! program he5_za_wrexternaldataF_64 implicit none include 'hdfeos5.inc' integer i integer status integer he5_zaopen integer he5_zaattach integer he5_zawrite integer he5_ehrdwrfile integer he5_zadetach integer he5_zaclose integer zafid, zaid integer data_out_1(100) integer data_out_2(100) integer data_out_3(100) integer data(60) integer*8 start(2) integer*8 stride(2) integer*8 count(2) integer*8 num_elements integer FAIL parameter (FAIL=-1) !.....Use this for writing (only) to an existing file integer WRITE_EXISTING_ONLY parameter (WRITE_EXISTING_ONLY=0) !.....Use this for reading (only) from an existing file integer READ_ONLY parameter (READ_ONLY=1) !.....Use this for creating and writing to a file integer WRITE_NEW parameter (WRITE_NEW=2) ! Create the new data buffer ! -------------------------- do 10 i=1,60 data(i) = 9999 10 continue ! Open HDF-EOS za file, "za.he5" ! ------------------------------ zafid = he5_zaopen("za.he5", HE5F_ACC_RDWR) write(*,*) 'File ID returned from he5_zaopen(): ',zafid if (zafid .NE. FAIL) then zaid = he5_zaattach(zafid, "ZA1") write(*,*) 'ZA ID returned from he5_zaattach(): ',zaid if (zaid .NE. FAIL) then ! Write new data to the external files ! ------------------------------------ start(1) = 0 stride(1) = 1 count(1) = 60 status = he5_zawrite(zaid,"ExtData", 1 start,stride,count,data) write(*,*) 'Status returned from he5_zawrite(): ',status num_elements = 100 status = he5_ehrdwrfile("extf1.dat",READ_ONLY, 1HE5T_NATIVE_INT,num_elements,data_out_1) write(*,*) 'Status returned from he5_ehrdwrfile: ',status status = he5_ehrdwrfile("extf2.dat",READ_ONLY, 1HE5T_NATIVE_INT,num_elements,data_out_2) write(*,*) 'Status returned from he5_ehrdwrfile: ',status status = he5_ehrdwrfile("extf3.dat",READ_ONLY, 1HE5T_NATIVE_INT,num_elements,data_out_3) write(*,*) 'Status returned from he5_ehrdwrfile: ',status write(*,*)'External file extf1.dat:' write(*,*) data_out_1 write(*,*) ' ' write(*,*)'External file extf2.dat:' write(*,*) data_out_2 write(*,*) ' ' write(*,*)'External file extf3.dat:' write(*,*) data_out_3 write(*,*) ' ' endif endif ! Detach from swath ! ----------------- status = he5_zadetach(zaid) write(*,*) 'Status returned from he5_zadetach(): ',status ! Close the file ! -------------- status = he5_zaclose(zafid) write(*,*) 'Status returned from he5_zaclose(): ',status stop end hdf-eos5-2.0/samples/he5_za_writedata.c000077500000000000000000000106721507520047200200270ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 2002 Emergent IT Inc. and Raytheon Systems Company | ---------------------------------------------------------------------------- */ #include /* In this program we (1) open the "ZA.he5" file, (2) attach to the */ /* "ZA1" za, and (3) write data to the "Spectra" fields. Also, set up */ /* the global, group, and local attributes */ /* ------------------------------------------------------------------ */ int main() { herr_t status = FAIL; int i, j, k; int attr1[4] = {1, 2, 3, 4}; /* global attribute */ int attr2[4] = {10, 20, 30, 40}; /* group attribute */ int attr3[4] = {100, 200, 300, 400}; /* local attribute */ hid_t zafid = FAIL; hid_t ZAid = FAIL; char attr4[7]; /* Global 'char' attribute */ long attr5[4] = {1111111L,2222222L,3333333L,4444444L};/* Global 'long' attribute */ double attr6[4] = {1.111111,2.222222,3.333333,4.444444};/* Global 'double' attribute */ hssize_t start[3]; hsize_t count[3]; double plane[15][40][20]; const char *charname[10] = { "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "BBBBBBBBBBBBBBBB", "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC", "DDDDDDDDDDDDDDDDDDDD", "EEEEEEEE", "FFFFFFFFFFFFF", "GGGGGGGGGGGGG", "HHHHHHHHHH", "IIIIIII", "JJJJJJJJJJJJJ" }; /* Populate spectra data array. Value = 100*(track index)+(band index) */ /* ------------------------------------------------------------------- */ for (i = 0; i < 15; i++) { for (j = 0; j < 40; j++) for (k = 0; k < 20; k++) plane[i][j][k] = (double)(j*100 + i); } /* Open the HDF za file, "ZA.he5" */ /* ----------------------------- */ zafid = HE5_ZAopen("ZA.he5", H5F_ACC_RDWR); if (zafid != FAIL) { /* Attach the "ZA1" za */ /* ------------------- */ ZAid = HE5_ZAattach(zafid, "ZA1"); if (ZAid != FAIL) { /* Write Spectra Field */ /* ------------------- */ start[0] = 0; count[0] = 15; start[1] = 0; count[1] = 40; start[2] = 0; count[2] = 20; status = HE5_ZAwrite(ZAid, "Spectra", start, NULL, count, plane); printf("status returned by HE5_ZAwrite(\"Spectra\"): %d\n", status); start[0] = 0; count[0] = 10; status = HE5_ZAwrite(ZAid, "Test_string", start, NULL, count, charname); printf("status returned by HE5_ZAwrite(\"Test_string\"): %d\n", status); /* Write Global 'int' Attribute */ /* ---------------------------- */ count[0] = 4; status = HE5_ZAwriteattr(ZAid, "GlobalAttribute", H5T_NATIVE_INT, count, attr1); printf("status returned by HE5_ZAwriteattr(\"GlobalAttribute\"): %d\n", status); /* Write Global 'char' Attribute */ /* ----------------------------- */ strcpy(attr4,"ABCDEF"); count[0] = 6; status = HE5_ZAwriteattr(ZAid, "GLOBAL_CHAR_ATTR", H5T_NATIVE_CHAR, count, attr4); printf("status returned by HE5_ZAwriteattr(\"GLOBAL_CHAR_ATTR\"): %d\n", status); /* Write Global 'long' Attribute */ /* ----------------------------- */ count[0] = 4; status = HE5_ZAwriteattr(ZAid, "GLOBAL_LONG_ATTR", H5T_NATIVE_LONG, count, attr5); printf("status returned by HE5_ZAwriteattr(\"GLOBAL_LONG_ATTR\"): %d\n", status); /* Write Global 'double' Attribute */ /* ------------------------------- */ count[0] = 4; status = HE5_ZAwriteattr(ZAid, "GLOBAL_DOUBLE_ATTR", H5T_NATIVE_DOUBLE, count, attr6); printf("status returned by HE5_ZAwriteattr(\"GLOBAL_DOUBLE_ATTR\"): %d\n", status); /* Write Group Attribute */ /* --------------------- */ status = HE5_ZAwritegrpattr(ZAid, "GroupAttribute", H5T_NATIVE_INT, count, attr2); printf("status returned by HE5_ZAwritegrpattr(\"GroupAttribute\"): %d\n", status); /* Write Local Attribute */ /* --------------------- */ status = HE5_ZAwritelocattr(ZAid, "Density", "LocalAttribute", H5T_NATIVE_INT, count, attr3); printf("status returned by HE5_ZAwritelocattr(\"LocalAttribute\"):%d\n", status); } } status = HE5_ZAdetach(ZAid); status = HE5_ZAclose(zafid); return 0; } hdf-eos5-2.0/samples/he5_za_writedataF_32.f000077500000000000000000000044141507520047200204410ustar00rootroot00000000000000! In this program we (1) open the "za.he5" file, (2) attach to ! the "ZA1" za, and (3) write data to the "Spectra" fields program he5_za_writedataF_32 implicit none include 'hdfeos5.inc' integer status integer he5_zaopen integer he5_zaattach integer he5_zawrite integer he5_zawrattr integer he5_zadetach integer he5_zaclose integer zafid, zaid integer i, j, k integer*4 attr(4) integer*4 start(3) integer*4 stride(3) integer*4 count(3) real*8 plane(800) integer FAIL parameter (FAIL=-1) ! Open HDF-EOS file, "za.he5" ! --------------------------- zafid = he5_zaopen("za.he5", HE5F_ACC_RDWR) write(*,*) 'File ID returned by he5_zaopen(): ',zafid if (zafid .NE. FAIL) then zaid = he5_zaattach(zafid, "ZA1") write(*,*) 'ZA ID returned by he5_zaattach(): ',zaid if (zaid .NE. FAIL) then ! Write Spectra one plane at a time ! Value is 100 * track index + band index (0-based) ! ------------------------------------------------- start(1) = 0 start(2) = 0 count(1) = 20 count(2) = 40 count(3) = 1 stride(1) = 1 stride(2) = 1 stride(3) = 1 do i=1,15 start(3) = i - 1 do j=1,40 do k=1,20 plane((j-1)*20+k) = (j-1)*100 + i-1 enddo enddo status = he5_zawrite(zaid,"Spectra",start, 1 stride,count,plane) enddo write(*,*) 'Status returned by he5_zawrite(): ',status ! Write User defined Attribute ! ---------------------------- attr(1) = 3 attr(2) = 5 attr(3) = 7 attr(4) = 11 count(1) = 4 status = he5_zawrattr(zaid,"TestAttr",HE5T_NATIVE_INT, 1 count,attr) endif endif ! Detach from the za ! ------------------ status = he5_zadetach(zaid) write(*,*) 'Status returned by he5_zadetach(): ',status ! Close the file ! -------------- status = he5_zaclose(zafid) write(*,*) 'Status returned by he5_zaclose(): ',status stop end hdf-eos5-2.0/samples/he5_za_writedataF_64.f000077500000000000000000000043451507520047200204510ustar00rootroot00000000000000! In this program we (1) open the "za.he5" file, (2) attach to ! the "ZA1" za, and (3) write data to the "Spectra" field program he5_za_writedataF_64 implicit none include 'hdfeos5.inc' integer status integer he5_zaopen integer he5_zaattach integer he5_zawrite integer he5_zawrattr integer he5_zadetach integer he5_zaclose integer zafid, zaid integer i, j , k integer*4 attr(4) integer*8 start(3) integer*8 stride(3) integer*8 count(3) real*8 plane(800) integer FAIL parameter (FAIL=-1) ! Open HDF-EOS file, "za.he5" ! --------------------------- zafid = he5_zaopen("za.he5", HE5F_ACC_RDWR) write(*,*) 'File ID returned by he5_zaopen(): ',zafid if (zafid .NE. FAIL) then zaid = he5_zaattach(zafid, "ZA1") write(*,*) 'ZA ID returned by he5_zaattach(): ',zaid if (zaid .NE. FAIL) then ! Write Spectra one plane at a time ! Value is 100 * track index + band index (0-based) ! ------------------------------------------------- start(1) = 0 start(2) = 0 count(1) = 20 count(2) = 40 count(3) = 1 stride(1) = 1 stride(2) = 1 stride(3) = 1 do i=1,15 start(3) = i - 1 do j=1,40 do k=1,20 plane((j-1)*20+k) = (j-1)*100 + i-1 enddo enddo status = he5_zawrite(zaid,"Spectra",start, 1 stride,count,plane) enddo write(*,*) 'Status returned by he5_zawrite(): ',status ! Write User defined Attribute ! ---------------------------- attr(1) = 3 attr(2) = 5 attr(3) = 7 attr(4) = 11 count(1) = 4 status = he5_zawrattr(zaid,"TestAttr",HE5T_NATIVE_INT, 1 count,attr) endif endif ! Detach from the za ! ------------------ status = he5_zadetach(zaid) write(*,*) 'Status returned by he5_zadetach(): ',status ! Close the file ! -------------- status = he5_zaclose(zafid) write(*,*) 'Status returned by he5_zaclose(): ',status stop end hdf-eos5-2.0/samples/simple.txt000077500000000000000000000011661507520047200164740ustar00rootroot00000000000000 46353400.0 2.98 3.99 2.63 1.41 CO 46572420.7 3.99 4.52 2.35 2.52 CO2 46853103.3 2.11 3.10 4.81 1.83 CO 47485493.4 3.39 3.02 3.09 3.90 CO2 48066418.5 2.06 4.49 1.67 1.74 O3 48474414.6 1.06 4.63 4.44 3.33 CO2 48866282.4 2.18 2.02 1.41 1.00 O3 49388188.2 3.73 2.00 2.30 1.46 O3 49858070.5 2.97 3.75 2.33 5.02 NOx 50370437.1 4.38 3.70 1.96 3.11 NOx 50515373.3 0.24 1.91 4.33 1.49 CO 51257471.8 3.62 1.40 0.48 2.32 CO2 51708197.8 3.53 3.16 2.01 1.56 O3 51859454.7 0.62 0.76 2.06 4.01 O3 52433289.8 1.68 1.35 1.71 4.06 O3 hdf-eos5-2.0/src/000077500000000000000000000000001507520047200135565ustar00rootroot00000000000000hdf-eos5-2.0/src/EHapi.c000077500000000000000000017456101507520047200147310ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | | | | Permission to use, 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 and that both that | | copyright notice and this permission notice appear in supporting | | documentation. | ---------------------------------------------------------------------------- */ #include #include #include #ifndef MAX_NAME #define MAX_NAME 1024 #endif #ifndef MAX_ORDER #define MAX_ORDER 65535 /* for writing metadata with HE5_EHwritemeta compatible with TOOLKIT Coremetadata writing */ #endif /* The modification that needs _IGNORE_DIMSCALE_ preprocessor macro definition. It can be defined somewhere other than in EHapi.c, such as when configure script is executed. Problem ~ We want to make existing HDF-EOS5 files read by the netCDF-4 library. Although the netCDF-4 library is similar to the HDF-EOS5 library, the netCDF-4 library cannot read HDF-EOS5 files mainly due to the lack of netCDF-4 dimensions. So, we added netCDF-4 dimensions to existing HDF-EOS5 files. Attaching a netCDF-4 dimension scale to an HDF-EOS5 field introduces an attribute, "DIMENSION_LIST". Unfortunately, the type class of "DIMENSION_LIST" is H5T_VLEN, and its element is of H5T_STD_REF_OBJ type. This type is not allowed by the HDF-EOS5 library; so, users may get errors when accessing that attribute. For example, HE5_GDlocattrinfo() fails saying Cannot retrieve information about Attribute "DIMENSION_LIST" associated with the "..." field. Goal ~ Assuming that users do not have hard-coded list of attributes, they will call HE5_GDinqlocattrs() to get the attribute names attached to a field. If "DIMENSION_LIST" is not contained in the attribute names, users will not know that the problematic "DIMENSION_LIST" attribute exists, which prevents users from accessing that attribute. Implementation Details ~ HE5_GDinqlocattrs() is the function users call to get the list of attribute names. This HE5_GDinqlocattrs() will finally call HE5_EHobj_info() for each attribute, and we modified HE5_EHobj_info() function so that this function ignores an attribute if its class is H5T_VLEN, and its base type is H5T_STD_REF_OBJ If these two conditions are satisfied, HE5_EHobj_info() will return immediately without appending this attribute name to the list of attribute names. */ #ifndef _IGNORE_DIMSCALE_ #define _IGNORE_DIMSCALE_ #endif #define HE5_EHIDOFFSET 67108864 #define HE5_VERSIONLEN 32 #define HE5_NEOSHDF 200 #define HE5_DYNAMIC_BLKSIZE 32000 /* size of each Structure metadata block */ #define MetaBlocks 32 /* Max number of 32000 Structure metadata blocks */ /*int HDFEOS5ver_flg ; *//* will be set to 1 if the HDF-EOS5 version is NOT later than 5.1.7, otherwise to 0 */ /*int HE5_STATIC_BLKSIZE = HE5_BLKSIZE;*/ /* will be used, after mdifications in EHopen, for buffer size memory allocatins of StructMetadata.0 for static method */ static int error_flg = 0; typedef struct { int active; /* File open flag */ hid_t HDFfid; /* HDF-EOS file ID */ hid_t gid; /* "HDFEOS" group ID */ uintn flags; /* File access flag */ char *filename; /* File name */ int DYNAMIC_flag; /* Flage for checking for the compatibality of StruvtMetadata with the version of HDF-EOS5 */ int HE5_STATIC_BLKSIZE; /* will be used, after modifications in EHopen, for buffer size memory allocatins of StructMetadata.0 for static method */ }HE5_EHXTable; HE5_EHXTable HE5_HeosTable[HE5_NEOSHDF]; typedef struct { int metafile_active; char *saved_metabuf; long metabuf_length; long nmeta; int metaread_flag; }HE5_SAVED_METABUF; HE5_SAVED_METABUF Stored_meta[HE5_NEOSHDF]; /* FORTRAN WRAPPER PROTOTYPES */ int HE5_EHidinfoF(int fileID, int *fid, int *gid); double HE5_EHconvAngF(double inAngle, int code); int HE5_EHwrglatt(int fileID, char *attrname, int ntype, long fortcount[], void *datbuf); int HE5_EHrdglatt(int fileID, char *attrname, void *datbuf); int HE5_EHglattinf(int fileID, char *attrname, int *ntype, long *fortcount); long HE5_EHinqglatts(int fileID, char *attrnames, long *strbufsize); int HE5_EHrdwrfileF(char *extfilename, uintn Flags, int ntype, long nelmnts, void *data); int HE5_EHinqglbtype(int fileID, char *attrname, int *Type, int *Class, int *Order, long *size); herr_t HE5_EHinsertmeta_Static(hid_t fid, const char *structname, char *structcode, long metacode, char *metastr, hsize_t metadata[]); herr_t HE5_EHinsertmeta_Dynamic(hid_t fid, const char *structname, char *structcode, long metacode, char *metastr, hsize_t metadata[]); char * HE5_EHmetagroup_Static(hid_t fid , char *structname, char *structcode, char *groupname, char *metaptrs[]); char * HE5_EHmetagroup_Dynamic(hid_t fid , char *structname, char *structcode, char *groupname, char *metaptrs[]); herr_t HE5_EHupdatemeta_Static(hid_t fid, const char *structname, char *structcode, long metacode, char *metastr, hsize_t metadata[]); herr_t HE5_EHupdatemeta_Dynamic(hid_t fid, const char *structname, char *structcode, long metacode, char *metastr, hsize_t metadata[]); herr_t HE5_EHgetnmeta(hid_t gid, long *nmeta); /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | FUNCTION: HE5_EHchkptr | | DESCRIPTION : Checks if the passed pointer != NULL | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | | | INPUTS: | | p void * Pointer | | OUTPUTS: | | | | NOTES: | | Date Programmer Description | | ======== ============ ================================================= | | 05/01/01 A.Muslimov Original development. | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_EHchkptr(void *p, char *name) { herr_t status = SUCCEED; char errbuf[HE5_HDFE_ERRBUFSIZE]; if(p == NULL) { status = FAIL; sprintf(errbuf,"INPUT ERROR: Parameter-pointer %s == NULL.\n", name); H5Epush(__FILE__, "HE5_EHchkptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | FUNCTION: HE5_EHchkname | | DESCRIPTION : Checks if the passed string doesn't contain illegal | | characters | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | | | INPUTS: | | p void * Pointer | | OUTPUTS: | | | | NOTES: | | Date Programmer Description | | ======== ============ ================================================= | | 06/01/01 A.Muslimov Original development. | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_EHchkname(char *p, char *name) { herr_t status = SUCCEED; char errbuf[HE5_HDFE_ERRBUFSIZE]; if(p == NULL) { status = FAIL; sprintf(errbuf,"HDF-EOS WARNING: The input parameter \"%s\" is a null pointer.\n", name); H5Epush(__FILE__, "HE5_EHchkname", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } if( strchr(p,',') || strchr(p,';') || strchr(p,'/')) { status = FAIL; sprintf(errbuf,"HDF-EOS WARNING: The input string named \"%s\" contains illegal character.\n", name); H5Epush(__FILE__, "HE5_EHchkname", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | FUNCTION: HE5_EHdtype2mtype | | DESCRIPTION : Takes file data type ID, converts it to a memory data type ID| | Return Value Type Units Description | | ============ ====== ========= ===================================== | | mtype hid_t Memory data type ID | | INPUTS: | | dtype hid_t File data type ID | | OUTPUTS: | | None | | NOTES: | | Date Programmer Description | | ======== ============ ================================================= | | 07/12/00 A.Muslimov Original development. | | June 02 S.Zhao Added an H5T_NATIVE_CHAR data type ID. | | END_PROLOG | -----------------------------------------------------------------------------*/ hid_t HE5_EHdtype2mtype(hid_t dtype) { hid_t mtype = FAIL; hid_t nativetype; char *errbuf = NULL;/* Error message buffer */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char *) calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_EHdtype2mtype", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n"); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } nativetype = H5Tget_native_type(dtype, H5T_DIR_ASCEND); /* We cannot return nativetype because the caller will not call H5Tclose() for it. */ if (nativetype == FAIL) { sprintf(errbuf,"The datatype \"%d\" is not supported (unknown).\n", (int)dtype); H5Epush(__FILE__, "HE5_EHdtype2mtype", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); } else { int i; hid_t typelists[] = { H5T_NATIVE_CHAR, H5T_NATIVE_SCHAR, H5T_NATIVE_UCHAR, H5T_NATIVE_SHORT, H5T_NATIVE_USHORT, H5T_NATIVE_INT, H5T_NATIVE_UINT, H5T_NATIVE_LONG, H5T_NATIVE_ULONG, H5T_NATIVE_LLONG, H5T_NATIVE_ULLONG, H5T_NATIVE_FLOAT, H5T_NATIVE_DOUBLE, H5T_NATIVE_LDOUBLE }; for (i = 0; i < sizeof(typelists) / sizeof(typelists[0]); ++i) { if (H5Tequal(typelists[i], nativetype) ) { mtype = typelists[i]; break; } } if (mtype == FAIL) { sprintf(errbuf,"The datatype \"%d\" is not supported (unknown).\n", (int)dtype); H5Epush(__FILE__, "HE5_EHdtype2mtype", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); } H5Tclose(nativetype); } free(errbuf); return(mtype); } /* Data type WRAPPERS */ /* ================== */ /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | FUNCTION: HE5_EHhid2long | | DESCRIPTION : Takes a scalar variable of 'hid_t' type, converts it to a | | scalar variable of 'long' type, and returns the value. | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | outvalue long | | INPUTS: | | invalue hid_t | | OUTPUTS: | | None | | NOTES: | | Date Programmer Description | | ======== ============ ================================================= | | 04/25/00 A.Muslimov Original development. | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_EHhid2long(hid_t invalue) { long outvalue = FAIL; if (sizeof(hid_t) == sizeof(int)) outvalue = HE5_EHint2long(invalue); else if (sizeof(hid_t) == sizeof(long)) outvalue = invalue; return(outvalue); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHint2long | | | | DESCRIPTION : Takes a scalar variable of 'int' type, converts it to a | | scalar variable of 'long' type, and returns the value. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | outvalue long | | INPUTS: | | invalue int | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ======== ============ ================================================= | | 04/25/00 A.Muslimov Original development. | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_EHint2long(int invalue) { herr_t status = FAIL; long outvalue = FAIL; long buf = FAIL; memmove(&buf,&invalue,sizeof(int)); status = H5Tconvert(H5T_NATIVE_INT, H5T_NATIVE_LONG, 1, &buf, NULL, H5P_DEFAULT); if (status == FAIL) { H5Epush(__FILE__, "HE5_EHint2long", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot convert \"int\" to \"long\" data type."); return(status); } memmove(&outvalue,&buf,sizeof(long)); return(outvalue); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHhid2int | | | | DESCRIPTION : Takes a scalar variable of 'hid_t' type, converts it to a | | scalar variable of 'int' type, and returns the value. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | outvalue int | | INPUTS: | | invalue hid_t | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ======== ============ ================================================= | | 04/25/00 A.Muslimov Original development. | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_EHhid2int(hid_t invalue) { int outvalue = FAIL; if (sizeof(hid_t) == sizeof(int)) outvalue = invalue; else if (sizeof(hid_t) == sizeof(long)) outvalue = HE5_EHlong2int(invalue); return(outvalue); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHint2hid | | | | DESCRIPTION : Takes a scalar variable of 'int' type, converts it to a | | scalar variable of 'hid_t' type, and returns the value. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | outvalue hid_t | | INPUTS: | | invalue int | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ======== ============ ================================================= | | 04/25/00 A.Muslimov Original development. | | END_PROLOG | -----------------------------------------------------------------------------*/ hid_t HE5_EHint2hid(int invalue) { hid_t outvalue = FAIL; if (sizeof(hid_t) == sizeof(int)) outvalue = invalue; else if (sizeof(hid_t) == sizeof(long)) outvalue = HE5_EHint2long(invalue); return(outvalue); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHlong2hid | | | | DESCRIPTION : Takes a scalar variable of 'long' type, converts it to a | | scalar variable of 'hid_t' type, and returns the value. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | outvalue hid_t | | INPUTS: | | invalue long | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ======== ============ ================================================= | | 04/25/00 A.Muslimov Original development. | | END_PROLOG | -----------------------------------------------------------------------------*/ hid_t HE5_EHlong2hid(long invalue) { hid_t outvalue = FAIL; if (sizeof(hid_t) == sizeof(int)) outvalue = HE5_EHlong2int(invalue); else if (sizeof(hid_t) == sizeof(long)) outvalue = invalue; return(outvalue); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHlong2int | | | | DESCRIPTION : Takes a scalar variable of 'long' type, converts it to a | | scalar variable of 'int' type, and returns the value. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | outvalue int | | INPUTS: | | invalue long | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ======== ============ ================================================= | | 04/25/00 A.Muslimov Original development. | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_EHlong2int(long invalue) { herr_t status = FAIL; int outvalue = FAIL; long *buf = (long *)NULL; buf = (long *)calloc(1,sizeof(long)); memmove(buf,&invalue,sizeof(long)); status = H5Tconvert(H5T_NATIVE_LONG, H5T_NATIVE_INT, 1, buf, NULL, H5P_DEFAULT); if (status == FAIL) { H5Epush(__FILE__, "HE5_EHlong2int", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot convert \"long\" to \"int\" data type."); return(status); } memmove(&outvalue,buf,sizeof(int)); free(buf); return(outvalue); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHhid2hsize | | | | DESCRIPTION : Takes a scalar variable of 'hid_t' type, converts it to a | | scalar variable of 'hsize_t' type, and returns the value. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | outvalue hsize_t | | INPUTS: | | invalue hid_t | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ======== ============ ================================================= | | 04/25/00 A.Muslimov Original development. | | END_PROLOG | -----------------------------------------------------------------------------*/ hsize_t HE5_EHhid2hsize(hid_t invalue) { hsize_t outvalue = 0; if (sizeof(hid_t) == sizeof(int)) outvalue = HE5_EHint2hsize(invalue); else if (sizeof(hid_t) == sizeof(long) ) outvalue = HE5_EHlong2hsize(invalue); return(outvalue); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHint2hsize | | | | DESCRIPTION : Takes a scalar variable of 'int' type, converts it to a | | scalar variable of 'hsize_t' type, and returns the value. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | outvalue hsize_t | | INPUTS: | | invalue int | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ======== ============ ================================================= | | 04/25/00 A.Muslimov Original development. | | END_PROLOG | -----------------------------------------------------------------------------*/ hsize_t HE5_EHint2hsize(int invalue) { herr_t status = FAIL; int *buf = (int *)NULL; hsize_t outvalue = 0; size_t maxsize = 0; maxsize = MAX(sizeof(int),H5Tget_size(H5T_NATIVE_HSIZE)); buf = (int *)calloc(1,maxsize); memmove(buf,&invalue, sizeof(int)); status = H5Tconvert(H5T_NATIVE_INT, H5T_NATIVE_HSIZE, 1, buf, NULL, H5P_DEFAULT); if (status == FAIL) { H5Epush(__FILE__, "HE5_EHint2hsize", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot convert \"int\" to \"hsize_t\" data type."); return(status); } memmove(&outvalue,buf,H5Tget_size(H5T_NATIVE_HSIZE)); free(buf); return(outvalue); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHlong2hsize | | | | DESCRIPTION : Takes a scalar variable of 'long' type, converts it to a | | scalar variable of 'hsize_t' type, and returns the value. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | outvalue hsize_t | | INPUTS: | | invalue long | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ======== ============ ================================================= | | 04/25/00 A.Muslimov Original development. | | END_PROLOG | -----------------------------------------------------------------------------*/ hsize_t HE5_EHlong2hsize(long invalue) { herr_t status = FAIL; long *buf = (long *)NULL; hsize_t outvalue = 0; size_t maxsize = 0; maxsize = MAX(H5Tget_size(H5T_NATIVE_LONG),H5Tget_size(H5T_NATIVE_HSIZE)); buf = (long *)calloc(1,maxsize); memmove(buf,&invalue,sizeof(long)); status = H5Tconvert(H5T_NATIVE_LONG, H5T_NATIVE_HSIZE, 1, buf, NULL, H5P_DEFAULT); if (status == FAIL) { H5Epush(__FILE__, "HE5_EHlong2hsize", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot convert \"long\" to \"hsize_t\" data type."); return(status); } memmove(&outvalue,buf,H5Tget_size(H5T_NATIVE_HSIZE)); free(buf); return(outvalue); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHhsize2hid | | | | DESCRIPTION : Takes a scalar variable of 'hsize_t' type, converts it to a | | scalar variable of 'hid_t' type, and returns the value. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | outvalue hid_t | | INPUTS: | | invalue hsize_t | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ======== ============ ================================================= | | 04/25/00 A.Muslimov Original development. | | END_PROLOG | -----------------------------------------------------------------------------*/ hid_t HE5_EHhsize2hid(hsize_t invalue) { hid_t outvalue = FAIL; if (sizeof(hid_t) == sizeof(int)) outvalue = HE5_EHhsize2int(invalue); else if (sizeof(hid_t) == sizeof(long) ) outvalue = HE5_EHhsize2long(invalue); return(outvalue); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHhsize2long | | | | DESCRIPTION : Takes a scalar variable of 'hsize_t' type, converts it to a | | scalar variable of 'long' type, and returns the value. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | outvalue long | | INPUTS: | | invalue hsize_t | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ======== ============ ================================================= | | 04/25/00 A.Muslimov Original development. | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_EHhsize2long(hsize_t invalue) { herr_t status = FAIL; long *buf = (long *)NULL; long outvalue = FAIL; size_t maxsize = 0; maxsize = MAX(H5Tget_size(H5T_NATIVE_LONG),H5Tget_size(H5T_NATIVE_HSIZE)); buf = (long *)calloc(1,maxsize); memmove(buf,&invalue,H5Tget_size(H5T_NATIVE_HSIZE)); status = H5Tconvert(H5T_NATIVE_HSIZE, H5T_NATIVE_LONG, 1, buf, NULL, H5P_DEFAULT); if (status == FAIL) { H5Epush(__FILE__, "HE5_EHhsize2long", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot convert \"hsize_t\" to \"long\" data type."); return(status); } memmove(&outvalue,buf,H5Tget_size(H5T_NATIVE_LONG)); free(buf); return(outvalue); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHhsize2int | | | | DESCRIPTION : Takes a scalar variable of 'hsize_t' type, converts it to a | | scalar variable of 'int' type, and returns the value. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | outvalue int | | INPUTS: | | invalue hsize_t | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ======== ============ ================================================= | | 04/25/00 A.Muslimov Original development. | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_EHhsize2int(hsize_t invalue) { herr_t status = FAIL; int *buf = (int *)NULL; int outvalue = FAIL; size_t maxsize = 0; maxsize = MAX(H5Tget_size(H5T_NATIVE_INT),H5Tget_size(H5T_NATIVE_HSIZE)); buf = (int *)calloc(1,maxsize); memmove(buf,&invalue,H5Tget_size(H5T_NATIVE_HSIZE)); status = H5Tconvert(H5T_NATIVE_HSIZE, H5T_NATIVE_INT, 1, buf, NULL, H5P_DEFAULT); if (status == FAIL) { H5Epush(__FILE__, "HE5_EHhsize2int", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot convert \"hsize_t\" to \"int\" data type."); return(status); } memmove(&outvalue,buf,H5Tget_size(H5T_NATIVE_INT)); free(buf); return(outvalue); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHhid2hssize | | | | DESCRIPTION : Takes a scalar variable of 'hid_t' type, converts it to a | | scalar variable of 'hssize_t' type, and returns the value. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | outvalue hssize_t | | INPUTS: | | invalue hid_t | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ======== ============ ================================================= | | 04/25/00 A.Muslimov Original development. | | END_PROLOG | -----------------------------------------------------------------------------*/ hssize_t HE5_EHhid2hssize(hid_t invalue) { hssize_t outvalue = FAIL; if (sizeof(hid_t) == sizeof(int)) outvalue = HE5_EHint2hssize(invalue); else if (sizeof(hid_t) == sizeof(long) ) outvalue = HE5_EHlong2hssize(invalue); return(outvalue); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHint2hssize | | | | DESCRIPTION : Takes a scalar variable of 'int' type, converts it to a | | scalar variable of 'hssize_t' type, and returns the value. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | outvalue hssize_t | | INPUTS: | | invalue int | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ======== ============ ================================================= | | 04/25/00 A.Muslimov Original development. | | END_PROLOG | -----------------------------------------------------------------------------*/ hssize_t HE5_EHint2hssize(int invalue) { herr_t status = FAIL; int *buf = (int *)NULL; hssize_t outvalue = FAIL; size_t maxsize = 0; maxsize = MAX(sizeof(int),H5Tget_size(H5T_NATIVE_HSSIZE)); buf = (int *)calloc(1,maxsize); memmove(buf,&invalue, sizeof(int)); status = H5Tconvert(H5T_NATIVE_INT, H5T_NATIVE_HSSIZE, 1, buf, NULL, H5P_DEFAULT); if (status == FAIL) { H5Epush(__FILE__, "HE5_EHint2hssize", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot convert \"int\" to \"hssize\" data type."); return(status); } memmove(&outvalue,buf,H5Tget_size(H5T_NATIVE_HSSIZE)); free(buf); return(outvalue); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHlong2hssize | | | | DESCRIPTION : Takes a scalar variable of 'int' type, converts it to a | | scalar variable of 'hssize_t' type, and returns the value. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | outvalue hssize_t | | INPUTS: | | invalue long | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ======== ============ ================================================= | | 04/25/00 A.Muslimov Original development. | | END_PROLOG | -----------------------------------------------------------------------------*/ hssize_t HE5_EHlong2hssize(long invalue) { herr_t status = FAIL; long *buf = (long *)NULL; hssize_t outvalue = FAIL; size_t maxsize = 0; maxsize = MAX(sizeof(long),H5Tget_size(H5T_NATIVE_HSSIZE)); buf = (long *)calloc(1,maxsize); memmove(buf,&invalue,sizeof(long)); status = H5Tconvert(H5T_NATIVE_LONG, H5T_NATIVE_HSSIZE, 1, buf, NULL, H5P_DEFAULT); if (status == FAIL) { H5Epush(__FILE__, "HE5_EHint2ullong", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot convert \"long\" to \"hssize_t\" data type."); return(status); } memmove(&outvalue,buf,H5Tget_size(H5T_NATIVE_HSSIZE)); free(buf); return(outvalue); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHhssize2hid | | | | DESCRIPTION : Takes a scalar variable of 'hsize_t' type, converts it to a | | scalar variable of 'hid_t' type, and returns the value. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | outvalue hid_t | | INPUTS: | | invalue hssize_t | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ======== ============ ================================================= | | 04/25/00 A.Muslimov Original development. | | END_PROLOG | -----------------------------------------------------------------------------*/ hid_t HE5_EHhssize2hid(hssize_t invalue) { hid_t outvalue = FAIL; if (sizeof(hid_t) == sizeof(int)) outvalue = HE5_EHhssize2int(invalue); else if (sizeof(hid_t) == sizeof(long) ) outvalue = HE5_EHhssize2long(invalue); return(outvalue); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHhssize2long | | | | DESCRIPTION : Takes a scalar variable of 'hsize_t' type, converts it to a | | scalar variable of 'long' type, and returns the value. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | outvalue long | | INPUTS: | | invalue hssize_t | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ======== ============ ================================================= | | 04/25/00 A.Muslimov Original development. | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_EHhssize2long(hssize_t invalue) { herr_t status = FAIL; long *buf = (long *)NULL; long outvalue = FAIL; size_t maxsize = 0; maxsize = MAX(H5Tget_size(H5T_NATIVE_LONG),H5Tget_size(H5T_NATIVE_HSSIZE)); buf = (long *)calloc(1,maxsize); memmove(buf,&invalue,H5Tget_size(H5T_NATIVE_HSSIZE)); status = H5Tconvert(H5T_NATIVE_HSSIZE, H5T_NATIVE_LONG, 1, buf, NULL, H5P_DEFAULT); if (status == FAIL) { H5Epush(__FILE__, "HE5_EHhssize2long", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot convert \"hssize_t\" to \"long\" data type."); return(status); } memmove(&outvalue,buf,H5Tget_size(H5T_NATIVE_LONG)); free(buf); return(outvalue); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHhssize2int | | | | DESCRIPTION : Takes a scalar variable of 'hsize_t' type, converts it to a | | scalar variable of 'int' type, and returns the value. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | outvalue int | | INPUTS: | | invalue hssize_t | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ======== ============ ================================================= | | 04/25/00 A.Muslimov Original development. | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_EHhssize2int(hssize_t invalue) { herr_t status = FAIL; int *buf = (int *)NULL; int outvalue = FAIL; size_t maxsize = 0; maxsize = MAX(H5Tget_size(H5T_NATIVE_INT),H5Tget_size(H5T_NATIVE_HSSIZE)); buf = (int *)calloc(1,maxsize); memmove(buf,&invalue,H5Tget_size(H5T_NATIVE_HSSIZE)); status = H5Tconvert(H5T_NATIVE_HSSIZE, H5T_NATIVE_INT, 1, buf, NULL, H5P_DEFAULT); if (status == FAIL) { H5Epush(__FILE__, "HE5_EHhssize2int", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot convert \"hssize_t\" to \"int\" data type."); return(status); } memmove(&outvalue,buf,H5Tget_size(H5T_NATIVE_INT)); free(buf); return(outvalue); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHint2ullong | | | | DESCRIPTION : Takes a scalar variable of 'int' type, converts it to a | | scalar variable of 'ullong' type, and returns the value. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | outvalue ullong | | INPUTS: | | invalue int | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ======== ============ ================================================= | | 04/25/00 A.Muslimov Original development. | | Sept. 04 S.Zhao Changed "long long" to "LONGLONG" for Windows. | | END_PROLOG | -----------------------------------------------------------------------------*/ unsigned LONGLONG HE5_EHint2ullong(int invalue) { herr_t status = FAIL; unsigned LONGLONG outvalue = 0; unsigned LONGLONG buf = 0; memmove(&buf,&invalue,sizeof(int)); status = H5Tconvert(H5T_NATIVE_INT, H5T_NATIVE_ULLONG, 1, &buf, NULL, H5P_DEFAULT); if (status == FAIL) { H5Epush(__FILE__, "HE5_EHint2ullong", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot convert \"int\" to \"unsigned long long\" data type."); return(status); } memmove(&outvalue,&buf,sizeof(unsigned LONGLONG)); return(outvalue); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHullong2long | | | | DESCRIPTION : Takes a scalar variable of 'ullong' type, converts it to a | | scalar variable of 'long' type, and returns the value. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | outvalue long | | INPUTS: | | invalue ullong | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ======== ============ ================================================= | | 04/25/00 A.Muslimov Original development. | | Sept. 04 S.Zhao Changed "long long" to "LONGLONG" for Windows. | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_EHullong2long(unsigned LONGLONG invalue) { herr_t status = FAIL; long outvalue = FAIL; long *buf = (long *)NULL; size_t maxsize = 0; maxsize = MAX(sizeof(unsigned LONGLONG),sizeof(long)); buf = (long *)calloc(1,maxsize); memmove(buf,&invalue,sizeof(unsigned LONGLONG)); status = H5Tconvert(H5T_NATIVE_ULLONG, H5T_NATIVE_LONG, 1, buf, NULL, H5P_DEFAULT); if (status == FAIL) { H5Epush(__FILE__, "HE5_EHullong2long", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot convert \"unsigned long long\" to \"long\" data type."); return(status); } memmove(&outvalue,buf,sizeof(long)); free(buf); return(outvalue); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHhssize2hsize | | | | DESCRIPTION : Takes a scalar variable of 'hssize_t' type, converts it to a | | scalar variable of 'hsize_t' type, and returns the value. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | outvalue hsize_t | | INPUTS: | | invalue hssize_t | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ======== ============ ================================================= | | 04/25/00 A.Muslimov Original development. | | Sept. 04 S.Zhao Changed "long long" to "LONGLONG" for Windows. | | END_PROLOG | -----------------------------------------------------------------------------*/ hsize_t HE5_EHhssize2hsize(hssize_t invalue) { herr_t status = FAIL; LONGLONG *buf = (LONGLONG *)NULL; hsize_t outvalue = 0; size_t maxsize = 0; maxsize = MAX(H5Tget_size(H5T_NATIVE_HSIZE),H5Tget_size(H5T_NATIVE_HSSIZE)); buf = (LONGLONG *)calloc(1,maxsize); memmove(buf,&invalue,H5Tget_size(H5T_NATIVE_HSSIZE)); status = H5Tconvert(H5T_NATIVE_HSSIZE, H5T_NATIVE_HSIZE, 1, buf, NULL, H5P_DEFAULT); if (status == FAIL) { H5Epush(__FILE__, "HE5_EHhssize2hsize", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot convert \"hssize_t\" to \"hsize\" data type."); return(status); } memmove(&outvalue,buf,H5Tget_size(H5T_NATIVE_HSIZE)); free(buf); return(outvalue); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHhsize2hssize | | | | DESCRIPTION : Takes a scalar variable of 'hsize_t' type, converts it to a | | scalar variable of 'hssize_t' type, and returns the value. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | outvalue hssize_t | | INPUTS: | | invalue hsize_t | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ======== ============ ================================================= | | 04/25/00 A.Muslimov Original development. | | Sept. 04 S.Zhao Changed "long long" to "LONGLONG" for Windows. | | END_PROLOG | -----------------------------------------------------------------------------*/ hssize_t HE5_EHhsize2hssize(hsize_t invalue) { herr_t status = FAIL; LONGLONG *buf = (LONGLONG *)NULL; hssize_t outvalue = FAIL; size_t maxsize = 0; maxsize = MAX(H5Tget_size(H5T_NATIVE_HSIZE),H5Tget_size(H5T_NATIVE_HSSIZE)); buf = (LONGLONG *)calloc(1,maxsize); memmove(buf,&invalue,H5Tget_size(H5T_NATIVE_HSIZE)); status = H5Tconvert(H5T_NATIVE_HSIZE, H5T_NATIVE_HSSIZE, 1, buf, NULL, H5P_DEFAULT); if (status == FAIL) { H5Epush(__FILE__, "HE5_EHhsize2hssize", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot convert \"hsize_t\" to \"hssize\" data type."); return(status); } memmove(&outvalue,buf,H5Tget_size(H5T_NATIVE_HSSIZE)); free(buf); return(outvalue); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHopen | | | | DESCRIPTION: opens HDF-EOS file and returns file handle | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | fid hid_t None HDF-EOS file ID | | | | INPUTS: | | filename char* None HDF-EOS file name string | | | | flags uintn None File access Flag | | | | valid flags: H5F_ACC_RDONLY | | H5F_ACC_RDWR | | H5F_ACC_TRUNC | | | | | | access_id hid_t None File access property list ID (or | | H5P_DEFAULT for the default I/O access | | parameters. | | OUTPUTS: | | None | | | | NOTES: The dataset StructMetadata is not extandible. The next release | | (V5.?) will be supporting 'variable-length strings'. | | | | ----------- | | | Root "/" | | | ----------- | | / \ | | ---------------------- -------------------- | | | HDFEOS INFORMATION | | HDFEOS | | | ---------------------- -------------------- | | / | / / \ \ \ | | / | / / \ \ \ | | [StructMetadata.0] / / \ \ \ | | / | | \ \ | | ---------- ------ ------- ------- -------- | | |ADDITIONAL| |GRID| |POINT| |SWATH| | ZA | | | ---------- ------ ------- ------- -------- | | / : : : : | | / [dts] [dts] [dts] [dts] | | ----------------- | | |FILE_ATTRIBUTES| | | ----------------- | | : | | | | | | Date Programmer Description | | ====== ============ ================================================= | | July 99 A.Muslimov Modified to conform to the HDFEOS file structure | | 07.15.99 A.Muslimov Implemented creating of two separate groups HDFEOS, | | and HDFEOS INFORMATION. Added the calls to H5Tcopy | | and H5Tset_size(). Modified a block "Create dataset | | StructMetadata.0 ... " to allocate memory for the | | BLKSIZE elements of metabuf array. | | 9/24/99 A.Muslimov Added some more error handling after function calls.| | 02/07/00 A.Muslimov Added error handling after function calls and | | "free(errbuf)". | | May 01 A.Muslimov Added "ADDITIONAL/FILE_ATTRIBUTES" group. | | Nov 01 A.Muslimov Changed the data space/datatype of Version attribute| | Retaylored the OPEN/CREATE blocks. | | Jun 02 S.Zhao Added some warnings for "ADDITIONAL/FILE_ATTRIBUTES"| | groups. | | 05/17/04 Abe Taaheri Modified to adopt alocation of metabuf in chunks of | | HE5_DYNAMIC_BLKSIZE | | Nov 04 S.Zhao Modified to save tsize in HE5_HeosTable[HE5_NEOSHDF]| | Sep 06 Abe Taaheri Added initialize of hdfeosVersion | | END_PROLOG | -----------------------------------------------------------------------------*/ hid_t HE5_EHopen(const char *filename, uintn flags, hid_t access_id) { hid_t fid = FAIL;/* HDF-EOS file ID (RETURN VALUE) */ hid_t HDFfid = FAIL;/* HDF file ID */ hid_t sid1 = FAIL;/* Data space ID */ hid_t sid2 = FAIL;/* Data space ID */ hid_t atype = FAIL;/* Data type ID */ hid_t attid = FAIL;/* "HDFEOSVersion" Attribute ID */ hid_t datid = FAIL;/* "StructuralMetadata.0" dataset ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t ggid = FAIL;/* "HDFEOS INFORMATION" group ID */ hid_t adid = FAIL;/* "ADDITIONAL" group ID */ hid_t fagid = FAIL;/* "FILE_ATTRIBUTES" group ID */ hid_t i; /* Loop index */ hid_t iver; /* Loop index */ herr_t status = FAIL;/* Status variable */ int nfileopen = 0; /* "Number of files opened" Flag */ size_t size = 0; /* Data size (bytes) */ char *errbuf = (char *)NULL; /* Error message buffer */ char *metabuf = (char *)NULL; /* Pointer to SM buffer */ char hdfeosVersion[HE5_VERSIONLEN];/* HDFEOS version string */ char *version_buf = NULL; char version_buf1[13]; size_t tsize = 0; /* size of dataset */ int HDFEOS5ver_flg ; /* will be set to 1 if the HDF-EOS5 version is NOT later than 5.1.7, otherwise to 0 */ int newfile_num; /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n"); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } for (i = 0; i < HE5_NEOSHDF; i++) { if (HE5_HeosTable[i].active == 0) Stored_meta[i].metaread_flag = 0; } /* Determine number of files currently opened */ /* ------------------------------------------ */ for (i = 0; i < HE5_NEOSHDF; i++) nfileopen += HE5_HeosTable[i].active; /* Setup file interface */ /* -------------------- */ if (nfileopen < HE5_NEOSHDF) { /* Open HDF-EOS file */ /* ================= */ if (flags == H5F_ACC_RDWR || flags == H5F_ACC_RDONLY) { H5Eset_auto(NULL,NULL); HDFfid = H5Fopen(filename, flags, access_id); if(HDFfid < 0) { sprintf(errbuf,"File \"%s\" cannot be opened. \n", filename); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_FILE, H5E_CANTOPENFILE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } } else if (flags == H5F_ACC_TRUNC) { hid_t fapid; herr_t opstatus; /* H5Eset_auto(NULL,NULL); */ /* To add very big attributes to HDF5 objects we need to create HDF5 file as below, instead of just using H5Fcreate() */ fapid = H5Pcreate(H5P_FILE_ACCESS); opstatus = H5Pset_libver_bounds(fapid, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); HDFfid = H5Fcreate(filename,flags,H5P_DEFAULT,fapid); opstatus = H5Pclose(fapid); if(HDFfid < 0) { sprintf(errbuf,"File \"%s\" cannot be created. \n", filename); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_FILE,H5E_CANTCREATE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } } else { sprintf(errbuf,"Invalid file access flag. \n"); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_FILE,H5E_CANTOPENFILE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } if(flags == H5F_ACC_RDONLY ) { /* open group "HDFEOS" */ /* =================== */ gid = H5Gopen(HDFfid, "HDFEOS"); if(gid < 0) { sprintf(errbuf, "Group \"HDFEOS\" does not exist in \"%s\" file. \n", filename); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* open group "ADDITIONAL" */ /* ======================= */ adid = H5Gopen(gid, "ADDITIONAL"); if(adid < 0) { sprintf(errbuf, "Warning: Group \"ADDITIONAL\" does not exist in \"%s\" file, the hdfeos5 files produced by hdfeos5.0 or an earlier version. \n", filename); printf("Warning: Group \"ADDITIONAL\" does not exist in \"%s\" file, the hdfeos5 files produced by hdfeos5.0 or an earlier version. \n", filename); } else if(adid > 0) { /* open group "FILE_ATTRIBUTES" */ /* ============================ */ fagid = H5Gopen(adid, "FILE_ATTRIBUTES"); if(fagid < 0) { sprintf(errbuf, "Warning: Group \"FILE_ATTRIBUTES\" does not exist in \"%s\" file. \n", filename); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } } /* open group "HDFEOS INFORMATION" */ /* =============================== */ ggid = H5Gopen(HDFfid,"HDFEOS INFORMATION"); if(ggid < 0) { sprintf(errbuf, "Group \"HDFEOS INFORMATION\" does not exist in \"%s\" file. \n", filename); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } } else if (flags == H5F_ACC_RDWR) { /* open group "HDFEOS" */ /* =================== */ gid = H5Gopen(HDFfid, "HDFEOS"); if(gid < 0) { sprintf(errbuf, "Group \"HDFEOS\" does not exist in \"%s\" file. \n", filename); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* open group "ADDITIONAL" */ /* ======================= */ adid = H5Gopen(gid, "ADDITIONAL"); if(adid < 0) { sprintf(errbuf, "Warning: Group \"ADDITIONAL\" does not exist in \"%s\" file, need to create it. \n", filename); printf("Warning: Group \"ADDITIONAL\" does not exist in \"%s\" file, need to create it. \n", filename); /* Create a group "ADDITIONAL" */ /* =========================== */ adid = H5Gcreate(gid, "ADDITIONAL", 0); if (adid < 0) { sprintf(errbuf, "Cannot create \"ADDITIONAL\" group. \n"); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_OHDR, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } } /* open group "FILE_ATTRIBUTES" */ /* ============================ */ fagid = H5Gopen(adid, "FILE_ATTRIBUTES"); if(fagid < 0) { sprintf(errbuf, "Group \"FILE_ATTRIBUTES\" does not exist in \"%s\" file, need to create it. \n", filename); printf("Warning: Group \"FILE_ATTRIBUTES\" does not exist in \"%s\" file, need to create it. \n", filename); /* Create a group "FILE_ATTRIBUTES" */ /* ================================ */ fagid = H5Gcreate(adid, "FILE_ATTRIBUTES", 0); if (fagid < 0) { sprintf(errbuf, "Cannot create \"FILE_ATTRIBUTES\" group. \n"); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_OHDR, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } } /* open group "HDFEOS INFORMATION" */ /* =============================== */ ggid = H5Gopen(HDFfid,"HDFEOS INFORMATION"); if(ggid < 0) { sprintf(errbuf, "Group \"HDFEOS INFORMATION\" does not exist in \"%s\" file. \n", filename) ; H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } } else if (flags == H5F_ACC_TRUNC) { /* Create a group "HDFEOS" */ /* ======================= */ gid = H5Gcreate(HDFfid, "HDFEOS", 0); if (gid < 0) { sprintf(errbuf, "Cannot create \"HDFEOS\" group. \n"); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_OHDR, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Create a group "ADDITIONAL" */ /* =========================== */ adid = H5Gcreate(gid, "ADDITIONAL", 0); if (adid < 0) { sprintf(errbuf, "Cannot create \"ADDITIONAL\" group. \n"); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_OHDR, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Create a group "FILE_ATTRIBUTES" */ /* ================================ */ fagid = H5Gcreate(adid, "FILE_ATTRIBUTES", 0); if (fagid < 0) { sprintf(errbuf, "Cannot create \"FILE_ATTRIBUTES\" group. \n"); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_OHDR, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Create a group "HDFEOS INFORMATION" */ /* =================================== */ ggid = H5Gcreate(HDFfid, "HDFEOS INFORMATION", 0); if (ggid == FAIL) { sprintf(errbuf, "Cannot create \"HDFEOS INFORMATION\" group. \n"); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_OHDR, H5E_CANTCREATE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Initialize hdfeosVersion */ for( iver=0; iver < HE5_VERSIONLEN; iver++) hdfeosVersion[iver]='\0'; /* Set HDFEOS version number in file */ /* ================================= */ sprintf(hdfeosVersion, "%s.%s", "HDFEOS_5", HE5_HDFEOSVERSION); /* create attribute "HDFEOSVersion" under "HDFEOS INFORMATION */ /* ========================================================== */ sid1 = H5Screate(H5S_SCALAR); if (sid1 == FAIL) { sprintf(errbuf, "Cannot create dataspace for \"HDFEOSVersion\" attribute. \n"); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_DATASPACE, H5E_CANTCREATE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } atype = H5Tcopy(H5T_C_S1); status = H5Tset_size(atype,HE5_VERSIONLEN); if (status == FAIL) { sprintf(errbuf, "Cannot set the total size for atomic datatype. \n"); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_DATATYPE, H5E_CANTCREATE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Set up "HDFEOSVersion" attribute */ /* -------------------------------- */ attid = H5Acreate(ggid, "HDFEOSVersion", atype, sid1, H5P_DEFAULT); if (attid == FAIL) { sprintf(errbuf, "Cannot create \"HDFEOSVersion\" attribute. \n"); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_ATTR, H5E_CANTCREATE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Write attribute */ /* --------------- */ status = H5Awrite(attid, atype, hdfeosVersion); if (status == FAIL) { sprintf(errbuf, "Cannot write in data to the \"HDFEOSVerion\" attribute. \n"); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* ******************************* * Setup Structural Metadata * ******************************* */ metabuf = (char *)calloc(HE5_DYNAMIC_BLKSIZE, sizeof(char )); if (metabuf == NULL) { sprintf(errbuf, "Cannot allocate memory for the metadata buffer. \n"); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } strcpy(metabuf, "GROUP=SwathStructure\n"); strcat(metabuf, "END_GROUP=SwathStructure\n"); strcat(metabuf, "GROUP=GridStructure\n"); strcat(metabuf, "END_GROUP=GridStructure\n"); strcat(metabuf, "GROUP=PointStructure\n"); strcat(metabuf, "END_GROUP=PointStructure\n"); strcat(metabuf, "GROUP=ZaStructure\n"); strcat(metabuf, "END_GROUP=ZaStructure\n"); strcat(metabuf, "END\n"); /* ----------------------------------------------- | Create dataset "StructMetadata.0" and attach | | it to the "HDFEOS INFORMATION" group | ------------------------------------------------ */ /* metalen = strlen(metabuf) + 1; */ /* Create dataspace */ /* ---------------- */ sid2 = H5Screate(H5S_SCALAR); if (sid2 == FAIL) { sprintf(errbuf, "Cannot create dataspace for \"StructMetadata.0\" dataset. \n"); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_DATASPACE, H5E_CANTCREATE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(metabuf); return(FAIL); } atype = H5Tcopy(H5T_C_S1); /* size = metalen; */ size = HE5_DYNAMIC_BLKSIZE; /* Set data type size */ /* ------------------ */ status = H5Tset_size(atype,size); if (status == FAIL) { sprintf(errbuf, "Cannot set the total size for atomic datatype. \n"); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_DATATYPE, H5E_CANTCREATE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(metabuf); return(FAIL); } metabuf[ HE5_DYNAMIC_BLKSIZE - 1 ] = '\0'; /* Create "StructMetadata" dataset */ /* ------------------------------- */ datid = H5Dcreate(ggid,"StructMetadata.0", atype, sid2, H5P_DEFAULT); if (datid == FAIL) { sprintf(errbuf, "Cannot create \"StructMetadata.0\" dataset. \n"); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_DATASET, H5E_CANTCREATE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(metabuf); return(FAIL); } /* ----------------------------------------------------------- */ /* ! The dataset extension for a string is not supported yet ! */ /* the corresponding call is H5Dextend(datid, &metalen); */ /* ----------------------------------------------------------- */ /* ------------------------------------- | Write data to "StructMetadata.0" | ------------------------------------- */ status = H5Dwrite(datid,atype,H5S_ALL,H5S_ALL,H5P_DEFAULT,metabuf); if (status == FAIL) { sprintf(errbuf, "Cannot write in data to the \"StructMetadata.0\" dataset. \n"); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(metabuf); return(FAIL); } free(metabuf); /* Release IDs */ /* ----------- */ status = H5Sclose(sid1); if (status == FAIL) { sprintf(errbuf, "Cannot release the dataspace ID. \n"); H5Epush(__FILE__, "HE5_HE5_EHopen", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } status = H5Aclose(attid); if (status == FAIL) { sprintf(errbuf, "Cannot release the attribute ID. \n"); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_ATTR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } status = H5Sclose(sid2); if (status == FAIL) { sprintf(errbuf, "Cannot release the dataspace ID. \n"); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } status = H5Dclose(datid); if (status == FAIL) { sprintf(errbuf, "Cannot release the dataset ID. \n"); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } } /* Close "HDFEOS INFORMATION" group */ /* -------------------------------- */ status = H5Gclose(ggid); if (status == FAIL) { sprintf(errbuf, "Cannot release the \"HDFEOS INFORMATION\" group ID. \n"); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Close "ADDITIONAL" group */ /* ------------------------ */ status = H5Gclose(adid); if (status == FAIL) { sprintf(errbuf, "Cannot release the \"ADDITIONAL\" group ID. \n"); /* H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); */ } /* Close "FILE_ATTRIBUTES" group */ /* ----------------------------- */ status = H5Gclose(fagid); if (status == FAIL) { sprintf(errbuf, "Cannot release the \"FILE_ATTRIBUTES\" group ID. \n"); /* H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); */ } /* Assign HDFEOS fid # & Load HDF fid tables */ /* ========================================= */ for (i = 0; i < HE5_NEOSHDF; i++) { if (HE5_HeosTable[i].active == 0) { HE5_HeosTable[i].flags = flags; HE5_HeosTable[i].active = 1; HE5_HeosTable[i].gid = gid; HE5_HeosTable[i].HDFfid = HDFfid; fid = i + HE5_EHIDOFFSET; HE5_HeosTable[i].filename = (char *)calloc((strlen(filename)+1), sizeof(char)); if (HE5_HeosTable[i].filename == NULL) { sprintf(errbuf, "Cannot allocate memory for file name. \n"); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } strcpy(HE5_HeosTable[i].filename, filename); newfile_num = i; break; } } if (flags == H5F_ACC_RDWR || flags == H5F_ACC_RDONLY) { /* if version is before 5.1.7 set DYNAMIC_SMB global flag to 1, Otherwise to 0. Starting with version 5.1.8 we use dynamic memory allocation for StructMetadata buffer */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ version_buf = (char * )calloc( 64, sizeof(char)); if(version_buf == NULL) { H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n"); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } status = HE5_EHgetversion(fid, version_buf); if (status == FAIL) { sprintf(errbuf, "Cannot get version. \n"); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(version_buf); return(FAIL); } if(strlen(version_buf) < 12) { strcpy(version_buf1, version_buf); } else { strncpy(version_buf1, version_buf, 12); version_buf1[12] = '\0'; } if ( strcmp(version_buf1, "HDFEOS_5.0") == 0 || strcmp(version_buf1, "HDFEOS_5.1") == 0 || strcmp(version_buf1, "HDFEOS_5.1.2") == 0 || strcmp(version_buf1, "HDFEOS_5.1.3") == 0 || strcmp(version_buf1, "HDFEOS_5.1.4") == 0 || strcmp(version_buf1, "HDFEOS_5.1.5") == 0 || strcmp(version_buf1, "HDFEOS_5.1.6") == 0 || strcmp(version_buf1, "HDFEOS_5.1.7") == 0 ) { HDFEOS5ver_flg = 1; /* Static StructMetadata type */ } else { HDFEOS5ver_flg = 0; /* Dynamic StructMetadata type */ } free(version_buf); version_buf = NULL; if(HDFEOS5ver_flg == 1) /* if StructMetadata is static type, get size of StructMetadata.0 and save it in global parameter for later use */ { /* Open "HDFEOS INFORMATION" group to get its zise for backward compatibality issue */ /* =========================================================== */ ggid = H5Gopen(HDFfid, "HDFEOS INFORMATION"); if(ggid == FAIL) { status = FAIL; sprintf(errbuf,"Cannot open \"HDFEOS INFORMATION\" group. \n"); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } /* *--------------------------------------------------------------* * Open dataset "StructMetadata.0", get datatype and space ID * *--------------------------------------------------------------* */ datid = H5Dopen(ggid, "StructMetadata.0"); if( datid == FAIL) { status = FAIL; sprintf(errbuf,"Cannot open \"StructMetadata.0\" dataset. \n"); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } atype = H5Dget_type(datid); if( atype == FAIL) { status = FAIL; sprintf(errbuf,"Cannot get the dataset datatype. \n"); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } /* Get dataset size */ /* ---------------- */ tsize = H5Tget_size(atype); if ( tsize == 0 ) { status = FAIL; sprintf(errbuf, "The datatype is of ZERO size. \n"); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return( status ); } HE5_HeosTable[newfile_num].HE5_STATIC_BLKSIZE = tsize; /* Save tsize in global parameter for later use */ /*HE5_STATIC_BLKSIZE = tsize;*/ status = H5Tclose(atype); if( status == FAIL) { sprintf(errbuf, "Cannot release the data type ID.\n"); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } status = H5Dclose(datid); if( status == FAIL) { sprintf(errbuf,"Cannot release the dataset ID.\n"); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } status = H5Gclose(ggid); if( status == FAIL) { sprintf(errbuf,"Cannot release the group ID.\n"); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } } } else { HDFEOS5ver_flg = 0; /* Dynamic StructMetadata type */ } /* Load table with the flag */ /* ========================================= */ for (i = 0; i < HE5_NEOSHDF; i++) { if ((HE5_HeosTable[i].active == 1) && (strcmp(HE5_HeosTable[i].filename, filename) == 0) && (fid == i + HE5_EHIDOFFSET)) { HE5_HeosTable[i].DYNAMIC_flag = HDFEOS5ver_flg; break; } } } else { /* Too many files opened */ /* --------------------- */ fid = FAIL; sprintf(errbuf,"Illegal attempt to open more than %d files simultaneously. \n", HE5_NEOSHDF); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_FILE, H5E_CANTOPENFILE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } free(errbuf); errbuf = NULL; return(fid); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHchkfid | | | | DESCRIPTION: Checks for valid file id and returns HDF file ID and | | "HDFEOS" group id | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | | | INPUTS: | | | | OUTPUTS: | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | July 99 A.Muslimov Modified to conform to the HDFEOS file structure | | 9/29/99 A.Muslimov Added dynamic memory allocation for error message | | buffer. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_EHchkfid(hid_t fid, const char *name, hid_t *HDFfid, hid_t *grpID, uintn *access) { herr_t status = FAIL; /* routine return status variable */ hid_t fid0 = 0; /* HDFEOS file ID-offset */ char *errbuf; /* Error message buffer */ CHECKPOINTER(name); /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char *) calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_EHchkfid", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n"); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Check for valid HDFEOS file ID range */ /* ------------------------------------ */ if (fid < HE5_EHIDOFFSET || fid > HE5_NEOSHDF + HE5_EHIDOFFSET) { status = FAIL; sprintf(errbuf,"Invalid file ID: %d. ID should range from %d to %d .\n", fid, HE5_EHIDOFFSET, HE5_NEOSHDF + HE5_EHIDOFFSET); H5Epush(__FILE__, "HE5_EHchkfid", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } else { /* Compute "reduced" file ID */ /* ------------------------- */ fid0 = fid % HE5_EHIDOFFSET; if( HE5_HeosTable[ fid0 ].active == 0) { status = FAIL; sprintf(errbuf,"HE5_EHchkid: File ID %d not active (%s).\n",fid, name); H5Epush(__FILE__, "HE5_EHchkfid", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } else { /* Get HDF file ID, group ID and file access from external arrays */ /* ============================================================== */ *HDFfid = HE5_HeosTable[ fid0 ].HDFfid; *grpID = HE5_HeosTable[ fid0 ].gid; *access = HE5_HeosTable[ fid0 ].flags; status = SUCCEED; } } free(errbuf); errbuf = NULL; COMPLETION: return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHidinfo | | | | DESCRIPTION: Gets HDF ID and group ID from HDF-EOS ID | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | fid hid_t HDF-EOS file ID | | | | OUTPUTS: | | HDFfid hid_t HDF File ID | | gid hid_t group ID | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_EHidinfo(hid_t fid, hid_t *HDFfid, hid_t *gid) { herr_t status = FAIL; /* routine return status variable */ uintn access = 0; /* file access code */ /* Call HE5_EHchkfid to get HDF-EOS interface IDs */ /* ---------------------------------------------- */ status = HE5_EHchkfid(fid, "HE5_EHidinfo", HDFfid, gid, &access); return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHfilename | | | | DESCRIPTION: Returns HDF filename | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | fid hid_t HDF-EOS file id | | | | OUTPUTS: | | filename char* HDF-EOS file name | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_EHfilename(hid_t fid, char *filename) { herr_t status = SUCCEED; /* routine return status variable */ if( filename == NULL || HE5_HeosTable[fid % HE5_EHIDOFFSET].filename == NULL) status = FAIL; else strcpy(filename, HE5_HeosTable[fid % HE5_EHIDOFFSET].filename); return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHgetversion | | | | DESCRIPTION: Returns HDF-EOS version string | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | fid hid_t HDF-EOS file id | | | | OUTPUTS: | | version char* HDF-EOS version string | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 8/23/99 A. Muslimov Initialized status to -1, and checked for the | | statuses returned by H5Tclose() and H5Aclose(). | | 9/29/99 A.Muslimov Added dynamic memory allocation for error message | | buffer and atttribute name string. | | 2/01/00 A.Muslimov Fixed a bug associated with a pointing to the wrong | | group and aborting a call. | | 2/07/00 A.Muslimov Added free() calls. | | Nov 01 A.Muslimov Commented out two blocks, and changed the attribute | | data type to H5T_NATIVE_CHAR. | | Aug 02 S.Zhao Fixed a bug regarding 'HDFEOSVersion' represented | | as a series of integers, not a character string. | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_EHgetversion(hid_t fid, char *version) { herr_t status = FAIL; /* routine return status variable */ uintn access = 0; /* Access code */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t att_id = FAIL; /* attribute ID */ hid_t HDFfid = FAIL; /* HDF-EOS file ID */ hid_t InfGrpID = FAIL; /* "HDFEOS INFORMATION" group ID */ hid_t atype = FAIL; /* Attribute data type ID */ hid_t mtype = FAIL; /* Attribute memory data type ID */ char *errbuf = (char *)NULL;/* error message buffer */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_EHgetversion", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n"); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Get HDF-EOS file ID and "HDFEOS" group ID */ /* ========================================= */ status = HE5_EHchkfid(fid,"HE5_EHgetversion", &HDFfid, &gid, &access); if(status == FAIL) { H5Epush(__FILE__, "HE5_EHgetversion", __LINE__, H5E_FILE, H5E_NOTFOUND, "Invalid file ID. \n"); HE5_EHprint("Error: Invalid file ID, occured", __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Open "HDFEOS/HDFEOS INFORMATION" group */ /* -------------------------------------- */ InfGrpID = H5Gopen(HDFfid, "HDFEOS INFORMATION"); if(InfGrpID == FAIL) { status = FAIL; sprintf(errbuf, "Cannot open \"HDFEOS INFORMATION\" group. \n"); H5Epush(__FILE__, "HE5_EHgetversion", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } if(status == SUCCEED) { /* Open attribute "HDFEOSVersion" */ /* ============================== */ att_id = H5Aopen_name(InfGrpID, "HDFEOSVersion"); if(att_id == FAIL) { status = FAIL; sprintf(errbuf,"Cannot get the \"HDFEOSVersion\" attribute ID."); H5Epush(__FILE__, "HE5_EHgetversion", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } atype = H5Aget_type(att_id); if( atype == FAIL) { status = FAIL; sprintf(errbuf,"Cannot get the \"HDFEOSVersion\" attribute data type ID."); H5Epush(__FILE__, "HE5_EHgetversion", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } /* Get the memory data type ID */ /* --------------------------- */ mtype = HE5_EHdtype2mtype(atype); if (mtype < 0) { atype = H5Tcopy(H5T_C_S1); if( atype == FAIL) { status = FAIL; sprintf(errbuf,"Cannot copy the \"HDFEOSVersion\" attribute datatype."); H5Epush(__FILE__, "HE5_EHgetversion", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } status = H5Tset_size(atype, HE5_VERSIONLEN); if( status == FAIL) { sprintf(errbuf,"Cannot set the total size for the \"HDFEOSVersion\" attribute."); H5Epush(__FILE__, "HE5_EHgetversion", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } /* Read out version attribute */ /* ========================== */ status = H5Aread(att_id, atype, version); if( status == FAIL) { sprintf(errbuf,"Cannot read out the \"HDFEOSVersion\" attribute."); H5Epush(__FILE__, "HE5_EHgetversion", __LINE__, H5E_ATTR, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } } else { /* Read out version attribute */ /* ========================== */ status = H5Aread(att_id, mtype, (void *)version); if( status == FAIL) { sprintf(errbuf,"Cannot read out the \"HDFEOSVersion\" attribute."); H5Epush(__FILE__, "HE5_EHgetversion", __LINE__, H5E_ATTR, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } } /* Release the attribute datatype ID */ /* --------------------------------- */ status = H5Tclose(atype); if( status == FAIL) { sprintf(errbuf,"Cannot release the \"HDFEOSVersion\" attribute datatype ID."); H5Epush(__FILE__, "HE5_EHgetversion", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } /* Release the attribute ID */ /* ------------------------ */ status = H5Aclose(att_id); if( status == FAIL) { sprintf(errbuf,"Cannot release the \"HDFEOSVersion\" attribute ID."); H5Epush(__FILE__, "HE5_EHgetversion", __LINE__, H5E_ATTR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } status = H5Gclose(InfGrpID); if( status == FAIL) { sprintf(errbuf,"Cannot release the \"HDFEOS INFORMATION\" group ID."); H5Epush(__FILE__, "HE5_EHgetversion", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } } free(errbuf); errbuf = NULL; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHconvAng | | | | DESCRIPTION: Angle conversion Utility | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | outAngle double Output Angle value | | | | INPUTS: | | inAngle double Input Angle value | | code int Conversion code | | HDFE_RAD_DEG (0) | | HDFE_DEG_RAD (1) | | HDFE_DMS_DEG (2) | | HDFE_DEG_DMS (3) | | HDFE_RAD_DMS (4) | | HDFE_DMS_RAD (5) | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jun 96 Joel Gales Original Programmer | | Feb 97 Joel Gales Correct "60" min & "60" sec in _DMS conversion | | Feb 06 Abe Taaheri Modified checking sec not to exceed 60. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ double HE5_EHconvAng(double inAngle, int code) { long min = 0; /* Truncated Minutes */ long deg = 0; /* Truncated Degrees */ double sec = 0.; /* Seconds */ double outAngle = 0.; /* Angle in desired units */ double pi = 3.14159265358979324;/* Pi */ double r2d = 180 / pi; /* Rad-deg conversion */ double d2r = 1 / r2d; /* Deg-rad conversion */ switch (code) { /* Convert radians to degrees */ /* -------------------------- */ case HE5_HDFE_RAD_DEG: outAngle = inAngle * r2d; break; /* Convert degrees to radians */ /* -------------------------- */ case HE5_HDFE_DEG_RAD: outAngle = inAngle * d2r; break; /* Convert packed degrees to degrees */ /* --------------------------------- */ case HE5_HDFE_DMS_DEG: deg = (long)(inAngle / 1000000); min = (long)((inAngle - deg * 1000000) / 1000); sec = (inAngle - deg * 1000000 - min * 1000); outAngle = deg + min / 60.0 + sec / 3600.0; break; /* Convert degrees to packed degrees */ /* --------------------------------- */ case HE5_HDFE_DEG_DMS: deg = (long)inAngle; min = (long)((inAngle - deg) * 60); sec = (inAngle - deg - min / 60.0) * 3600; /* if ((int)sec == 60) { sec = sec - 60; min = min + 1; } */ if ( fabs(sec - 0.0) < 1.e-7 ) { sec = 0.0; } if ( (fabs(sec - 60) < 1.e-7 ) || ( sec > 60.0 )) { sec = sec - 60; min = min + 1; if(sec < 0.0) { sec = 0.0; } } if (min == 60) { min = min - 60; deg = deg + 1; } outAngle = deg * 1000000 + min * 1000 + sec; break; /* Convert radians to packed degrees */ /* --------------------------------- */ case HE5_HDFE_RAD_DMS: inAngle = inAngle * r2d; deg = (long)inAngle; min = (long)((inAngle - deg) * 60); sec = ((inAngle - deg - min / 60.0) * 3600); /* if ((int)sec == 60) { sec = sec - 60; min = min + 1; } */ if ( fabs(sec - 0.0) < 1.e-7 ) { sec = 0.0; } if ( (fabs(sec - 60) < 1.e-7 ) || ( sec > 60.0 )) { sec = sec - 60; min = min + 1; if(sec < 0.0) { sec = 0.0; } } if (min == 60) { min = min - 60; deg = deg + 1; } outAngle = deg * 1000000 + min * 1000 + sec; break; /* Convert packed degrees to radians */ /* --------------------------------- */ case HE5_HDFE_DMS_RAD: deg = (long)(inAngle / 1000000); min = (long)((inAngle - deg * 1000000) / 1000); sec = (inAngle - deg * 1000000 - min * 1000); outAngle = deg + min / 60.0 + sec / 3600.0; outAngle = outAngle * d2r; break; } return (outAngle); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHparsestr | | | | DESCRIPTION: String Parser Utility | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | count long Number of string entries | | | | INPUTS: | | instring char* Input string | | delim char string delimitor | | | | OUTPUTS: | | pntr char* Pointer array to beginning of each | | string entry | | len size_t Array of string entry lengths | | | | NOTES: | | | | | | Date Programmer Description | | ======== ============ ================================================= | | 04/19/00 A.Muslimov Changed type of 'slen','i','prevDelimPos' and | | 'len[]' from long to size_t. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_EHparsestr(const char *instring, char delim, char *pntr[], size_t len[]) { long count = 0;/* Number of elements in string list */ herr_t status = FAIL; /* Return status variable */ size_t slen = 0;/* String length */ size_t i; /* Loop index */ size_t prevDelimPos = 0;/* Previous delimitor position */ char *delimitor = (char *)NULL;/* Pointer to delimitor */ CHECKPOINTER(instring); /* Get length of input string list & Point to first delimitor */ /* ---------------------------------------------------------- */ slen = strlen(instring); delimitor = strchr((char *)instring, delim); /* If NULL string set count to zero otherwise set to 1 */ /* --------------------------------------------------- */ count = (slen == 0) ? 0 : 1; /* if string pointers are requested set first one to beginning of string */ /* --------------------------------------------------------------------- */ if (&pntr[0] != NULL) pntr[0] = (char *)instring; /* If delimitor not found ... */ /* -------------------------- */ if (delimitor == NULL) { /* if string length requested then set to input string length */ /* ---------------------------------------------------------- */ if (len != NULL) len[0] = slen; } else /* Delimitors Found */ /* ---------------- */ { /* Loop through all characters in string */ /* ------------------------------------- */ for (i = 1; i < slen; i++) { /* If character is a delimitor ... */ /* ------------------------------- */ if (instring[i] == delim) { /* If string pointer requested */ /* --------------------------- */ if (&pntr[0] != NULL) { /* if requested then compute string length of entry */ /* ------------------------------------------------ */ if (len != NULL) len[count - 1] = i - prevDelimPos; /* Point to beginning of string entry */ /* ---------------------------------- */ pntr[count] = (char *)instring + i + 1; } /* Reset previous delimitor position and increment counter */ /* ------------------------------------------------------- */ prevDelimPos = i + 1; count++; } } /* Compute string length of last entry */ /* ----------------------------------- */ if (&pntr[0] != NULL && len != NULL) len[count - 1] = i - prevDelimPos; } COMPLETION: return(count); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHstrwithin | | | | DESCRIPTION: Searchs for string within target string | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | indx long Element index (0 - based) | | | | INPUTS: | | target char Target string | | search char Search string | | delim char Delimitor | | | | OUTPUTS: | | None | | | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 10/05/99 A.Muslimov Added dynamical memory allocation for the buffers. | | 10/18/99 A.Muslimov Replaced memcpy() by memmove() to avoid a problem | | when arguments 1 and 2 overlap in memory. | | 02/07/00 A.Muslimov Added free() calls before return(FAIL) and more | | error handlings. | | 04/19/00 A.Muslimov Changed type of '*slen' from long to size_t. | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_EHstrwithin(char *target, char *search, char delim) { long indx = FAIL; /* Index of searched element (RETURN) */ long nentries = 0; /* Number of entries in search string */ herr_t status = FAIL; /* Return status variable */ size_t *slen = (size_t *)NULL;/* Pointer to string length array */ int found = 0; /* Target string found flag */ char **ptr; /* Pointer to string pointer array */ char *buffer = (char *)NULL;/* Buffer to hold "test" string entry */ char *errbuf = (char *)NULL;/* buffer for error message */ CHECKPOINTER(target); CHECKPOINTER(search); /* Allocate memory for error message buffer */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_EHstrwithin", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Allocate memory for buffer */ buffer = (char * )calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char)); if(buffer == NULL) { sprintf(errbuf,"Cannot allocate memory for buffer."); H5Epush(__FILE__, "HE5_EHstrwithin", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Count number of entries in search string list */ /* --------------------------------------------- */ nentries = HE5_EHparsestr(search, delim, NULL, NULL); if(nentries == 0) { sprintf(errbuf,"Input test string has no entries."); H5Epush(__FILE__, "HE5_EHstrwithin", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(buffer); return(FAIL); } /* Allocate string pointer and length arrays */ /* ----------------------------------------- */ ptr = (char **) calloc(nentries, sizeof(char *)); if(ptr == NULL) { sprintf(errbuf,"Cannot allocate memory for a string pointer."); H5Epush(__FILE__, "HE5_EHstrwithin", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(buffer); return(FAIL); } slen = (size_t *) calloc(nentries, sizeof(size_t)); if(slen == NULL) { sprintf(errbuf,"Cannot allocate memory for a string length pointer."); H5Epush(__FILE__, "HE5_EHstrwithin", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(buffer); free(ptr); return(FAIL); } /* Parse search string */ /* ------------------- */ nentries = HE5_EHparsestr(search, delim, ptr, slen); if(nentries == 0) { sprintf(errbuf,"Input test string has no entries."); H5Epush(__FILE__, "HE5_EHstrwithin", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(buffer); free(ptr); free(slen); return(FAIL); } /* Loop through all elements in search string list */ /* ----------------------------------------------- */ for (indx = 0; indx < nentries; indx++) { /* Copy string entry into buffer */ /* ----------------------------- */ memmove(buffer, ptr[indx], slen[indx]); buffer[slen[indx]] = 0; /* Compare target string with string entry */ /* --------------------------------------- */ if (strcmp(target, buffer) == 0) { found = 1; break; } } /* If not found set return to FAIL */ /* ------------------------------- */ if (found == 0) indx = FAIL; free(slen); free(ptr); free(errbuf); free(buffer); COMPLETION: return(indx); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHstrwithin_index | | | | DESCRIPTION: Simulate HE5_EHstrwithin but return all the indexes of the | | found string. | | | | The return value returns how many elements in the target that has search | | when index_found is passed as NULL. | | This then can be used to allocate memory to hold the index_found when | | passing this function second time to obtain all the index of search. See | | SWapi.c for the use of this function. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_EHstrwithin_index(char *target, char *search, char delim,int* index_found) { long indx = FAIL; /* Index of searched element (RETURN) */ long nentries = 0; /* Number of entries in search string */ herr_t status = FAIL; /* Return status variable */ size_t *slen = (size_t *)NULL;/* Pointer to string length array */ int found = 0; /* Target string found flag */ char **ptr; /* Pointer to string pointer array */ char *buffer = (char *)NULL;/* Buffer to hold "test" string entry */ char *errbuf = (char *)NULL;/* buffer for error message */ int num_index_found = 0; int* temp_index_found = NULL; int* temp_index_ptr = NULL; int i = 0; CHECKPOINTER(target); CHECKPOINTER(search); /* Allocate memory for error message buffer */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_EHstrwithin", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Allocate memory for buffer */ buffer = (char * )calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char)); if(buffer == NULL) { sprintf(errbuf,"Cannot allocate memory for buffer."); H5Epush(__FILE__, "HE5_EHstrwithin", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Count number of entries in search string list */ /* --------------------------------------------- */ nentries = HE5_EHparsestr(search, delim, NULL, NULL); if(nentries == 0) { sprintf(errbuf,"Input test string has no entries."); H5Epush(__FILE__, "HE5_EHstrwithin", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(buffer); return(FAIL); } /* Allocate string pointer and length arrays */ /* ----------------------------------------- */ ptr = (char **) calloc(nentries, sizeof(char *)); if(ptr == NULL) { sprintf(errbuf,"Cannot allocate memory for a string pointer."); H5Epush(__FILE__, "HE5_EHstrwithin", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(buffer); return(FAIL); } slen = (size_t *) calloc(nentries, sizeof(size_t)); if(slen == NULL) { sprintf(errbuf,"Cannot allocate memory for a string length pointer."); H5Epush(__FILE__, "HE5_EHstrwithin", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(buffer); free(ptr); return(FAIL); } /* Parse search string */ /* ------------------- */ nentries = HE5_EHparsestr(search, delim, ptr, slen); if(nentries == 0) { sprintf(errbuf,"Input test string has no entries."); H5Epush(__FILE__, "HE5_EHstrwithin", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(buffer); free(ptr); free(slen); return(FAIL); } temp_index_found = (int *)calloc(nentries,sizeof(int)); /* Loop through all elements in search string list */ /* ----------------------------------------------- */ for (indx = 0; indx < nentries; indx++) { /* Copy string entry into buffer */ /* ----------------------------- */ memmove(buffer, ptr[indx], slen[indx]); buffer[slen[indx]] = 0; /* Compare target string with string entry */ /* --------------------------------------- */ if (strcmp(target, buffer) == 0) { if(found != 0) found = 1; temp_index_found[num_index_found] = indx; num_index_found++; } } /* If not found set return to FAIL */ /* ------------------------------- */ if (found == 0) indx = FAIL; temp_index_ptr = index_found; if(index_found) { for(i = 0; i HE5_DYNAMIC_BLKSIZE * nmeta - 1) { /* Reallocate metadata buffer with additional HE5_DYNAMIC_BLKSIZE bytes */ /* -------------------------------------------------------------------- */ newbuf = (char *) calloc(HE5_DYNAMIC_BLKSIZE * (nmeta + 1), sizeof(char)); if(newbuf == NULL) { sprintf(errbuf, "Cannot allocate memory for a new metadata string.\n"); H5Epush(__FILE__, "HE5_EHinsertmeta_Dynamic", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); status = FAIL; free(errbuf); free(type); free(metabuf); free(utlstr); free(utlstr2); return(status); } /* Increment metadata section counter */ /* ---------------------------------- */ nmeta++; sprintf(metutlstr, "%s%ld", "StructMetadata.", nmeta - 1); /* and create meta_id, atype and aspace for the new block */ /* Create dataspace first*/ /* ---------------- */ aspace[nmeta - 1] = H5Screate(H5S_SCALAR); if (aspace[nmeta - 1] == FAIL) { sprintf(errbuf, "Cannot create dataspace for %s dataset. \n",metutlstr); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_DATASPACE, H5E_CANTCREATE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(type); free(metabuf); free(utlstr); free(utlstr2); return(FAIL); } atype[nmeta - 1] = H5Tcopy(H5T_C_S1); size = HE5_DYNAMIC_BLKSIZE; /* Set data type size */ /* ------------------ */ status = H5Tset_size(atype[nmeta - 1], size); if (status == FAIL) { sprintf(errbuf, "Cannot set the total size for atomic datatype. \n"); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_DATATYPE, H5E_CANTCREATE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(type); free(metabuf); free(utlstr); free(utlstr2); return(FAIL); } /* Create "StructMetadata" dataset */ /* ------------------------------- */ meta_id[nmeta - 1] = H5Dcreate(gid, metutlstr, atype[nmeta - 1], aspace[nmeta - 1], H5P_DEFAULT); if (meta_id[nmeta - 1] == FAIL) { sprintf(errbuf, "Cannot create %s dataset. \n", metutlstr); H5Epush(__FILE__, "HE5_EHopen", __LINE__, H5E_DATASET, H5E_CANTCREATE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(type); free(metabuf); free(utlstr); free(utlstr2); return(FAIL); } /* Reposition metadata pointer (entry position) */ /* -------------------------------------------- */ metaptr = metabuf + offset; } else { newbuf = (char *) calloc(HE5_DYNAMIC_BLKSIZE * (nmeta), sizeof(char)); if(newbuf == NULL) { sprintf(errbuf, "Cannot allocate memory for a new metadata string.\n"); H5Epush(__FILE__, "HE5_EHinsertmeta_Dynamic", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); status = FAIL; free(errbuf); free(type); free(metabuf); free(utlstr); free(utlstr2); return(status); } /* Reposition metadata pointer (entry position) */ /* -------------------------------------------- */ metaptr = metabuf + offset; } /* Copy new metadata string to newbuf array */ /* ---------------------------------------- */ for(i = 0; i < offset; i++) newbuf[ i ] = metabuf[ i ]; newbuf[ offset ] = 0; strcat( newbuf, utlstr); strcat( newbuf, metaptr); /* set to null character remaining of the metabuf */ memset((newbuf + metalen + seglen), '\0', (nmeta*HE5_DYNAMIC_BLKSIZE - (metalen + seglen))); /* Add new null string terminator */ /* ------------------------------ */ newbuf[metalen + seglen] = 0; tempdim = (hsize_t)strlen( newbuf ); tempdim++; /* *-----------------------------------------------------------------* * Write metadata back to dataset "StructMetadata.X" * *-----------------------------------------------------------------* */ /* H5Sset_extent_simple(aspace, 1, &tempdim, 0 ); NOT SUPPORTED YET !!! */ /* H5Dextend(meta_id, &tempdim); NOT SUPPORTED YET !!! */ for (ism = 0; ism < nmeta; ism++) { status = H5Dwrite(meta_id[ism], atype[ism], H5S_ALL, H5S_ALL, H5P_DEFAULT, newbuf + ism * HE5_DYNAMIC_BLKSIZE); if( status == FAIL) { sprintf(errbuf,"Cannot write in structural metadata.\n"); H5Epush(__FILE__, "HE5_EHinsertmeta_Dynamic", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(type); free(metabuf); free(utlstr); free(utlstr2); free(newbuf); return(status); } } free(metabuf); free(newbuf); free(utlstr); free(utlstr2); free(type); metabuf = NULL; newbuf = NULL; utlstr2 = NULL; utlstr = NULL; type = NULL; for (ism = 0; ism < nmeta; ism++) { status = H5Sclose(aspace[ism]); if( status == FAIL) { sprintf(errbuf,"Cannot release the data space ID.\n"); H5Epush(__FILE__, "HE5_EHinsertmeta_Dynamic", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } status = H5Tclose(atype[ism]); if( status == FAIL) { sprintf(errbuf, "Cannot release the data type ID.\n"); H5Epush(__FILE__, "HE5_EHinsertmeta_Dynamic", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } status = H5Dclose(meta_id[ism]); if( status == FAIL) { sprintf(errbuf,"Cannot release the dataset ID.\n"); H5Epush(__FILE__, "HE5_EHinsertmeta_Dynamic", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } } status = H5Gclose(gid); if( status == FAIL) { sprintf(errbuf,"Cannot release the group ID.\n"); H5Epush(__FILE__, "HE5_EHinsertmeta_Dynamic", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } free(errbuf); errbuf = NULL; COMPLETION: return status; } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHgetmetavalue | | | | DESCRIPTION: Returns metadata value | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | metaptrs char Begin and end of metadata section | | parameter char parameter to access | | | | OUTPUTS: | | metaptr char Ptr to (updated) beginning of metadata | | retstr char return string containing value | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 10/18/99 A.Muslimov Replaced memcpy() by memmove() to avoid a problem | | when arguments 1 and 2 overlap in memory. | | 4/19/00 A.Muslimov Changed type of 'slen' from int to size_t. | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_EHgetmetavalue(char *metaptrs[], char *parameter, char *retstr) { herr_t status = FAIL; /* routine return status variable */ size_t slen = 0; /* String length */ char *newline = (char *)NULL;/* Position of new line character */ char *sptr = (char *)NULL;/* String pointer within metadata */ CHECKPOINTER(metaptrs[0]); CHECKPOINTER(metaptrs[1]); CHECKPOINTER(parameter); /* Get string length of parameter string + 1 */ /* ----------------------------------------- */ slen = strlen(parameter) + 1; /* Build search string (parameter string + "=") */ /* -------------------------------------------- */ strcpy(retstr, parameter); strcat(retstr, "="); /* Search for string within metadata (beginning at metaptrs[0]) */ /* ------------------------------------------------------------ */ sptr = strstr(metaptrs[0], retstr); /* If string found within desired section ... */ /* ------------------------------------------ */ if (sptr != NULL && sptr < metaptrs[1]) { /* Store position of string within metadata */ /* ---------------------------------------- */ metaptrs[0] = sptr; /* Find newline "\n" character */ /* --------------------------- */ newline = strchr(metaptrs[0], '\n'); /* Copy from "=" to "\n" (exclusive) into return string */ /* ---------------------------------------------------- */ memmove(retstr, metaptrs[0] + slen, newline - metaptrs[0] - slen); /* Terminate return string with null */ /* --------------------------------- */ retstr[newline - metaptrs[0] - slen] = 0; status = SUCCEED; } else { /* * if parameter string not found within section, null return string * and set status to FAIL. */ retstr[0] = 0; status = FAIL; } COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHmetagroup | | | | DESCRIPTION: Returns pointers to beginning and end of metadata group | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | metabuf char* None Pointer to HDF-EOS object in metadata | | | | INPUTS: | | gid hid_t None group ID | | structname char* None HDF-EOS structure name | | structcode char* None Structure code ("s/g/p/z") | | groupname char* None Metadata group name | | | | OUTPUTS: | | metaptrs char* None pointers to begin and end of metadata | | | | NOTES: Allocates memory of fixed size (= HE5_STATIC_BLKSIZE) | | for metabuf[] array (old scheme), or allocates buffer in chuncks | | of HE5_DYNAMIC_BLKSIZE (new scheme). | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 05/17/04 Abe Taaheri Initial version | | END_PROLOG | -----------------------------------------------------------------------------*/ char * HE5_EHmetagroup(hid_t fid , char *structname, char *structcode, char *groupname, char *metaptrs[]) { char *metabuf=(char *)NULL; /* Ptr to StrucMetadata (SM) */ int HDFEOS5ver_flg ; /* will be set to 1 if the HDF-EOS5 version is NOT later than 5.1.7, otherwise to 0 */ /* Get HDFEOS5ver_flg flag for the file */ /* --------------- */ HDFEOS5ver_flg = HE5_HeosTable[fid%HE5_EHIDOFFSET].DYNAMIC_flag; if(HDFEOS5ver_flg == 1) { metabuf = (char *)HE5_EHmetagroup_Static(fid , structname, structcode, groupname, metaptrs); } else if(HDFEOS5ver_flg == 0) { metabuf = (char *)HE5_EHmetagroup_Dynamic(fid , structname, structcode, groupname, metaptrs); } return(metabuf); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHmetagroup_Static | | | | DESCRIPTION: Returns pointers to beginning and end of metadata group | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | metabuf char* None Pointer to HDF-EOS object in metadata | | | | INPUTS: | | gid hid_t None group ID | | structname char* None HDF-EOS structure name | | structcode char* None Structure code ("s/g/p/z") | | groupname char* None Metadata group name | | | | OUTPUTS: | | metaptrs char* None pointers to begin and end of metadata | | | | NOTES: A.M.: Temporarily allocates memory of fixed size (= BLKSIZE) | | for metabuf[] array. Also allocates memory of fixed | | size (= HDFE_UTLBUFSIZE) for utlstr[]. | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 3/30/99 Make metadata ODL compliant | | 7/28/99 A.Muslimov Replaced the 1st argument of EHmetagroup by fid | | (file ID). Did the same change in the call to | | H5Gopen(). Added error handling right after the | | call to H5Dread(). | | 9/02/99 A.Muslimov Replaced the call in 'OPEN "HDFEOS INFORMATION" | | GROUP' block by two calls to pass the HDFfid | | instead of fid to H5Gopen(). | | 9/29/99 A.Muslimov Added dynamic memory allocation for error message | | buffer. | | 02/07/00 A.Muslimov Added free() calls before return(NULL). | | July 02 S.Zhao Added H5Gclose(gid) to release the "HDFEOS | | INFORMATION" group ID. | | END_PROLOG | -----------------------------------------------------------------------------*/ char * HE5_EHmetagroup_Static(hid_t fid , char *structname, char *structcode, char *groupname, char *metaptrs[]) { herr_t status = FAIL;/* return status variable */ hid_t meta_id = FAIL;/* metadata ID */ hid_t gid = FAIL;/* "HDFEOS INFORMATION" group ID */ hid_t atype = FAIL;/* datatype ID */ hid_t aspace = FAIL;/* dataspace ID */ hid_t HDFfid = FAIL;/* HDF-EOS file ID */ hid_t grpID = FAIL;/* HDFEOS group ID */ size_t tsize = 0; /* number of elements in a dataset */ uintn access = 0; /* read-write access mode */ char *metabuf = NULL; /* Pointer (handle) to structural metadata */ char *endptr = NULL; /* Pointer to end of metadata section */ char *metaptr = NULL; /* Metadata pointer */ char *prevmetaptr =NULL;/* Previous position of metadata pointer */ char *utlstr = NULL; /* Utility string */ char *errbuf = NULL; /* buffer for error message */ CHECKPOINTER(structname); CHECKPOINTER(structcode); /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_EHmetagroup_Static", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n"); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(NULL); } /* Check HDF-EOS file ID */ /* --------------------- */ status = HE5_EHchkfid(fid, "HE5_EHmetagroup_Static", &HDFfid, &grpID, &access); if ( status == FAIL ) { sprintf(errbuf, "Checking for file ID failed.\n"); H5Epush(__FILE__, "HE5_EHmetagroup_Static", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(NULL); } /* *-------------------------------------------------------------------------* * O P E N "HDFEOS INFORMATION" G R O U P * *-------------------------------------------------------------------------* */ gid = H5Gopen(HDFfid,"HDFEOS INFORMATION"); if ( gid == FAIL ) { sprintf(errbuf,"Cannot open \"HDFEOS INFORMATION\" group. \n"); H5Epush(__FILE__, "HE5_EHmetagroup_Static", __LINE__, H5E_OHDR, H5E_NOTFOUND,errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return( NULL ); } /* *--------------------------------------------------------------------------* * Open dataset "StructMetadata.0" * *--------------------------------------------------------------------------* */ meta_id = H5Dopen(gid, "StructMetadata.0"); if ( meta_id == FAIL ) { sprintf(errbuf,"Cannot open \"StructMetadata.0\" dataset. \n"); H5Epush(__FILE__, "HE5_EHmetagroup_Static", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return( NULL ); } /* Get dataset type */ /* ---------------- */ atype = H5Dget_type(meta_id); if ( atype == FAIL ) { sprintf(errbuf,"Cannot get datatype ID. \n"); H5Epush(__FILE__, "HE5_EHmetagroup_Static", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return( NULL ); } /* Get dataset size */ /* ---------------- */ tsize = H5Tget_size(atype); if ( tsize == 0 ) { sprintf(errbuf, "The datatype is of ZERO size. \n"); H5Epush(__FILE__, "HE5_EHmetagroup_Static", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return( NULL ); } /* Get dataset space */ /* ----------------- */ aspace = H5Dget_space(meta_id); if ( aspace == FAIL ) { sprintf(errbuf,"Cannot get the data space ID. \n"); H5Epush(__FILE__, "HE5_EHmetagroup_Static", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return( NULL ); } /* -------------------------------------------------------------- */ /* Get attribute size */ /* NOTE: this call is now supported for a string and is used now */ /* in HE5_EHattrinfoto get the number of elements for string array*/ /* npoints = H5Sget_simple_extent_npoints(aspace); */ /* It'll be implemented for memory allocation for metabuf[] array */ /* -------------------------------------------------------------- */ /* Allocate memory */ /* --------------- */ metabuf = (char *)calloc( HE5_HeosTable[fid%HE5_EHIDOFFSET].HE5_STATIC_BLKSIZE, sizeof(tsize) ); if( metabuf==NULL) { sprintf(errbuf,"Can not allocate memory for meta bufer. \n"); H5Epush(__FILE__, "HE5_EHmetagroup_Static", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(NULL); } utlstr = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(tsize) ); if( utlstr==NULL) { sprintf(errbuf,"Can not allocate memory for utility string. \n"); H5Epush(__FILE__, "HE5_EHmetagroup_Static", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(metabuf); return(NULL); } /* Read the metadata buffer */ /* ------------------------ */ status = H5Dread(meta_id,atype,H5S_ALL, H5S_ALL, H5P_DEFAULT, metabuf); if (status == FAIL ) { metabuf = NULL; sprintf(errbuf,"Cannot read the metadata buffer. \n"); H5Epush(__FILE__, "HE5_EHmetagroup_Static", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(metabuf); free(utlstr); return(NULL); } /* Find HDF-EOS structure "root" group in metadata */ /* ----------------------------------------------- */ /* Setup proper search string */ /* -------------------------- */ if (strcmp(structcode, "s") == 0) strcpy(utlstr, "GROUP=SwathStructure"); else if (strcmp(structcode, "g") == 0) strcpy(utlstr, "GROUP=GridStructure"); else if (strcmp(structcode, "p") == 0) strcpy(utlstr, "GROUP=PointStructure"); else if (strcmp(structcode, "z") == 0) strcpy(utlstr, "GROUP=ZaStructure"); /* Use string search routine (strstr) to move through metadata */ /* ----------------------------------------------------------- */ metaptr = strstr(metabuf, utlstr); /* Save current metadata pointer */ /* ----------------------------- */ prevmetaptr = metaptr; /* First loop for "old-style" (non-ODL) metadata string */ /* ---------------------------------------------------- */ if (strcmp(structcode, "s") == 0) sprintf(utlstr, "%s%s%s", "SwathName=\"", structname, "\""); else if (strcmp(structcode, "g") == 0) sprintf(utlstr, "%s%s%s", "GridName=\"", structname, "\""); else if (strcmp(structcode, "p") == 0) sprintf(utlstr, "%s%s%s", "PointName=\"", structname, "\""); else if (strcmp(structcode, "z") == 0) sprintf(utlstr, "%s%s%s", "ZaName=\"", structname, "\""); /* Do string search */ /* ---------------- */ metaptr = strstr(metaptr, utlstr); /* * If not found then return to previous position in metadata and look for * "new-style" (ODL) metadata string */ if (metaptr == NULL) { sprintf(utlstr, "%s%s%s", "GROUP=\"", structname, "\""); metaptr = strstr(prevmetaptr, utlstr); } /* Find group within structure */ /* --------------------------- */ if (groupname != NULL) { sprintf(utlstr, "%s%s", "GROUP=", groupname); metaptr = strstr(metaptr, utlstr); sprintf(utlstr, "%s%s", "\t\tEND_GROUP=", groupname); endptr = strstr(metaptr, utlstr); } else { /* If groupname == NULL then find end of structure in metadata */ /* ----------------------------------------------------------- */ sprintf(utlstr, "%s", "\n\tEND_GROUP="); endptr = strstr(metaptr, utlstr); } /* Return beginning and ending pointers */ /* ------------------------------------ */ metaptrs[0] = metaptr; metaptrs[1] = endptr; /* Release the dataspace ID */ /* ------------------------ */ status = H5Sclose(aspace); if (status == FAIL ) { sprintf(errbuf, "Cannot release the dataspace ID. \n"); H5Epush(__FILE__, "HE5_EHmetagroup_Static", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(metabuf); free(utlstr); return(NULL); } /* Release the datatype ID */ /* ----------------------- */ status = H5Tclose(atype); if (status == FAIL ) { sprintf(errbuf,"Cannot release the datatype ID. \n"); H5Epush(__FILE__, "HE5_EHmetagroup_Static", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(metabuf); free(utlstr); return(NULL); } /* Release the dataset ID */ /* ---------------------- */ status = H5Dclose(meta_id); if (status == FAIL ) { sprintf(errbuf,"Cannot release the dataset ID. \n"); H5Epush(__FILE__, "HE5_EHmetagroup_Static", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(metabuf); free(utlstr); return(NULL); } /* Release the "HDFEOS INFORMATION" group ID */ /* ----------------------------------------- */ status = H5Gclose(gid); if (status == FAIL ) { sprintf(errbuf,"Cannot release the \"HDFEOS INFORMATION\" group ID. \n"); H5Epush(__FILE__, "HE5_EHmetagroup_Static", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(metabuf); free(utlstr); return(NULL); } free(errbuf); free(utlstr); COMPLETION: return(metabuf); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHmetagroup_Dynamic | | | | DESCRIPTION: Returns pointers to beginning and end of metadata group | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | metabuf char* None Pointer to HDF-EOS object in metadata | | | | INPUTS: | | gid hid_t None group ID | | structname char* None HDF-EOS structure name | | structcode char* None Structure code ("s/g/p/z") | | groupname char* None Metadata group name | | | | OUTPUTS: | | metaptrs char* None pointers to begin and end of metadata | | | | NOTES: Allocates buffer in chuncks of HE5_DYNAMIC_BLKSIZE (new scheme). | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 05/17/04 Abe Taaheri Modified the version with static buffer allocation | | to adopt dynamic buffer allocation in chuncks of | | HE5_DYNAMIC_BLKSIZE | | END_PROLOG | -----------------------------------------------------------------------------*/ char * HE5_EHmetagroup_Dynamic(hid_t fid , char *structname, char *structcode, char *groupname, char *metaptrs[]) { herr_t status = FAIL;/* return status variable */ hid_t meta_id[MetaBlocks] = {FAIL};/* metadata ID */ hid_t gid = FAIL;/* "HDFEOS INFORMATION" group ID */ hid_t atype[MetaBlocks] = {FAIL};/* datatype ID */ hid_t aspace[MetaBlocks] = {FAIL};/* dataspace ID */ hid_t HDFfid = FAIL;/* HDF-EOS file ID */ hid_t grpID = FAIL;/* HDFEOS group ID */ size_t tsizeblk[MetaBlocks] = {0}; /* number of elements in a dataset */ size_t tsize = 0; /* number of elements in a dataset */ uintn access = 0; /* read-write access mode */ char *metabuf = NULL; /* Pointer (handle) to structural metadata */ char *endptr = NULL; /* Pointer to end of metadata section */ char *metaptr = NULL; /* Metadata pointer */ char *prevmetaptr =NULL;/* Previous position of metadata pointer */ char *utlstr = NULL; /* Utility string */ char *errbuf = NULL; /* buffer for error message */ int ism; long nmeta; /*long *metstrbufsize = 0;*/ char metutlstr[32]; long metalen; CHECKPOINTER(structname); CHECKPOINTER(structcode); /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_EHmetagroup_Dynamic", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n"); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(NULL); } /* Check HDF-EOS file ID */ /* --------------------- */ status = HE5_EHchkfid(fid, "HE5_EHmetagroup_Dynamic", &HDFfid, &grpID, &access); if ( status == FAIL ) { sprintf(errbuf, "Checking for file ID failed.\n"); H5Epush(__FILE__, "HE5_EHmetagroup_Dynamic", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(NULL); } /* *-------------------------------------------------------------------------* * O P E N "HDFEOS INFORMATION" G R O U P * *-------------------------------------------------------------------------* */ gid = H5Gopen(HDFfid,"HDFEOS INFORMATION"); if ( gid == FAIL ) { sprintf(errbuf,"Cannot open \"HDFEOS INFORMATION\" group. \n"); H5Epush(__FILE__, "HE5_EHmetagroup_Dynamic", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return( NULL ); } /* *--------------------------------------------------------------------------* * Open dataset "StructMetadata.X" * *--------------------------------------------------------------------------* */ /* Determine number of structural metadata "sections" */ /* -------------------------------------------------- */ nmeta = 0; status= HE5_EHgetnmeta(gid, &nmeta); if(status == FAIL) { sprintf(errbuf,"Cannot find any StructMetadata.X dataset. \n"); H5Epush(__FILE__, "HE5_EHmetagroup_Dynamic", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(NULL); } for (ism = 0; ism < nmeta; ism++) { sprintf(metutlstr, "%s%d", "StructMetadata.", ism); meta_id[ism] = H5Dopen(gid, metutlstr); if ( meta_id[ism] == FAIL ) { sprintf(errbuf,"Cannot open %s dataset. \n", metutlstr); H5Epush(__FILE__, "HE5_EHmetagroup_Dynamic", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return( NULL ); } /* Get dataset type */ /* ---------------- */ atype[ism] = H5Dget_type(meta_id[ism]); if ( atype[ism] == FAIL ) { sprintf(errbuf,"Cannot get datatype ID. \n"); H5Epush(__FILE__, "HE5_EHmetagroup_Dynamic", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return( NULL ); } /* Get dataset size */ /* ---------------- */ tsizeblk[ism] = H5Tget_size(atype[ism]); if ( tsizeblk[ism] == 0 ) { sprintf(errbuf, "The datatype is of ZERO size for StructMetadata block (zero based) %d. \n", ism); H5Epush(__FILE__, "HE5_EHmetagroup_Dynamic", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return( NULL ); } /* Get dataset space */ /* ----------------- */ aspace[ism] = H5Dget_space(meta_id[ism]); if ( aspace[ism] == FAIL ) { sprintf(errbuf,"Cannot get the data space ID for StructMetadata block (zero based) %d. \n", ism); H5Epush(__FILE__, "HE5_EHmetagroup_Dynamic", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return( NULL ); } } tsize = tsizeblk[0]; for (ism = 0; ism < nmeta; ism++) { if(tsizeblk[ism] != tsize) { sprintf(errbuf,"Data sizes are not the same for StructMetadata blocks. \n"); H5Epush(__FILE__, "HE5_EHmetagroup_Dynamic", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return( NULL ); } } /* -------------------------------------------------------------- */ /* Get attribute size */ /* NOTE: this call is now supported for a string and is used now */ /* in HE5_EHattrinfo to get the number of elements for string array*/ /* npoints = H5Sget_simple_extent_npoints(aspace); */ /* It'll be implemented for memory allocation for metabuf[] array */ /* -------------------------------------------------------------- */ /* Allocate memory */ /* --------------- */ metabuf = (char *)calloc( HE5_DYNAMIC_BLKSIZE * nmeta, sizeof(tsize) ); if( metabuf==NULL) { sprintf(errbuf,"Can not allocate memory for meta bufer. \n"); H5Epush(__FILE__, "HE5_EHmetagroup_Dynamic", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(NULL); } utlstr = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(tsize) ); if( utlstr==NULL) { sprintf(errbuf,"Can not allocate memory for utility string. \n"); H5Epush(__FILE__, "HE5_EHmetagroup_Dynamic", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(metabuf); return(NULL); } /* Read the metadata buffer */ /* ------------------------ */ metalen = 0; if (Stored_meta[fid%HE5_EHIDOFFSET].metaread_flag == 0) { for (ism = 0; ism < nmeta; ism++) { status = H5Dread(meta_id[ism],atype[ism],H5S_ALL, H5S_ALL, H5P_DEFAULT, metabuf + metalen); if (status == FAIL ) { metabuf = NULL; sprintf(errbuf,"Cannot read the metadata buffer. \n"); H5Epush(__FILE__, "HE5_EHmetagroup_Dynamic", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(metabuf); free(utlstr); return(NULL); } /* Determine length (# of characters) of metadata */ /* ---------------------------------------------- */ metalen = strlen(metabuf); } Stored_meta[fid%HE5_EHIDOFFSET].metabuf_length = strlen(metabuf); Stored_meta[fid%HE5_EHIDOFFSET].saved_metabuf = (char *)realloc(Stored_meta[fid%HE5_EHIDOFFSET].saved_metabuf,(Stored_meta[fid%HE5_EHIDOFFSET].metabuf_length+1)*sizeof(tsize)); strcpy(Stored_meta[fid%HE5_EHIDOFFSET].saved_metabuf, metabuf); Stored_meta[fid%HE5_EHIDOFFSET].nmeta = nmeta; Stored_meta[fid%HE5_EHIDOFFSET].metaread_flag = 1; } else { strcpy(metabuf,Stored_meta[fid%HE5_EHIDOFFSET].saved_metabuf); } /* Find HDF-EOS structure "root" group in metadata */ /* ----------------------------------------------- */ /* Setup proper search string */ /* -------------------------- */ if (strcmp(structcode, "s") == 0) strcpy(utlstr, "GROUP=SwathStructure"); else if (strcmp(structcode, "g") == 0) strcpy(utlstr, "GROUP=GridStructure"); else if (strcmp(structcode, "p") == 0) strcpy(utlstr, "GROUP=PointStructure"); else if (strcmp(structcode, "z") == 0) strcpy(utlstr, "GROUP=ZaStructure"); /* Use string search routine (strstr) to move through metadata */ /* ----------------------------------------------------------- */ metaptr = strstr(metabuf, utlstr); /* Save current metadata pointer */ /* ----------------------------- */ prevmetaptr = metaptr; /* First loop for "old-style" (non-ODL) metadata string */ /* ---------------------------------------------------- */ if (strcmp(structcode, "s") == 0) sprintf(utlstr, "%s%s%s", "SwathName=\"", structname, "\""); else if (strcmp(structcode, "g") == 0) sprintf(utlstr, "%s%s%s", "GridName=\"", structname, "\""); else if (strcmp(structcode, "p") == 0) sprintf(utlstr, "%s%s%s", "PointName=\"", structname, "\""); else if (strcmp(structcode, "z") == 0) sprintf(utlstr, "%s%s%s", "ZaName=\"", structname, "\""); /* Do string search */ /* ---------------- */ metaptr = strstr(metaptr, utlstr); /* * If not found then return to previous position in metadata and look for * "new-style" (ODL) metadata string */ if (metaptr == NULL) { sprintf(utlstr, "%s%s%s", "GROUP=\"", structname, "\""); metaptr = strstr(prevmetaptr, utlstr); } /* Find group within structure */ /* --------------------------- */ if (groupname != NULL) { sprintf(utlstr, "%s%s", "GROUP=", groupname); metaptr = strstr(metaptr, utlstr); sprintf(utlstr, "%s%s", "\t\tEND_GROUP=", groupname); endptr = strstr(metaptr, utlstr); } else { /* If groupname == NULL then find end of structure in metadata */ /* ----------------------------------------------------------- */ sprintf(utlstr, "%s", "\n\tEND_GROUP="); endptr = strstr(metaptr, utlstr); } /* Return beginning and ending pointers */ /* ------------------------------------ */ metaptrs[0] = metaptr; metaptrs[1] = endptr; /* Release the dataspace ID */ /* ------------------------ */ for (ism = 0; ism < nmeta; ism++) { status = H5Sclose(aspace[ism]); if (status == FAIL ) { sprintf(errbuf, "Cannot release the dataspace ID. \n"); H5Epush(__FILE__, "HE5_EHmetagroup_Dynamic", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(metabuf); free(utlstr); return(NULL); } /* Release the datatype ID */ /* ----------------------- */ status = H5Tclose(atype[ism]); if (status == FAIL ) { sprintf(errbuf,"Cannot release the datatype ID. \n"); H5Epush(__FILE__, "HE5_EHmetagroup_Dynamic", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(metabuf); free(utlstr); return(NULL); } /* Release the dataset ID */ /* ---------------------- */ status = H5Dclose(meta_id[ism]); if (status == FAIL ) { sprintf(errbuf,"Cannot release the dataset ID. \n"); H5Epush(__FILE__, "HE5_EHmetagroup_Dynamic", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(metabuf); free(utlstr); return(NULL); } } /* Release the "HDFEOS INFORMATION" group ID */ /* ----------------------------------------- */ status = H5Gclose(gid); if (status == FAIL ) { sprintf(errbuf,"Cannot release the \"HDFEOS INFORMATION\" group ID. \n"); H5Epush(__FILE__, "HE5_EHmetagroup_Dynamic", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(metabuf); free(utlstr); return(NULL); } free(errbuf); free(utlstr); COMPLETION: return(metabuf); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHbisect | | | | DESCRIPTION: Finds root of function using bisection | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | func() double Function to bisect | | funcParms double Function parameters (fixed) | | nParms long Number of function parameters | | limLft double Lower limit of function arguement | | limRgt double Upper limit of function arguement | | convCrit double Convergence criterion | | | | OUTPUTS: | | root double Function root | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_EHbisect(double(*func) (double[]), double funcParms[], long nParms, double limLft, double limRgt, double convCrit, double *root) { herr_t status = SUCCEED;/* routine return status variable */ int i; /* Loop index */ double midPnt = 0.;/* Mid-point value */ double newmidPnt = 0.;/* New mid-point value */ double funcLft = 0.;/* Function value at left-hand limit */ double funcMid = 0.;/* Function value at mid-point */ double funcRgt = 0.;/* Function value at right-hand limit*/ double *parms=(double *)NULL;/* Function parameters */ /* Allocate space for function parameters */ /* -------------------------------------- */ parms = (double *)calloc(nParms + 1, sizeof(double)); if(parms == NULL) { H5Epush(__FILE__,"HE5_EHbisect", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory"); HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__); return(FAIL); } /* Copy (fixed) function parameters */ /* -------------------------------- */ for (i = 0; i < nParms; i++) parms[i + 1] = funcParms[i]; /* Copy left-hand limit to "floating" parameter */ /* -------------------------------------------- */ parms[0] = limLft; /* Determine function value */ /* ------------------------ */ funcLft = (*func) (parms); /* Copy right-hand limit to "floating" parameter */ /* --------------------------------------------- */ parms[0] = limRgt; /* Determine function value */ /* ------------------------ */ funcRgt = (*func) (parms); /* If left and right limits function values of same sign then no root */ /* ------------------------------------------------------------------ */ if (funcLft * funcRgt > 0) { if (parms != NULL) free(parms); return (FAIL); } /* Compute (initial) mid-point */ /* --------------------------- */ newmidPnt = 0.5 * (limLft + limRgt); /* Bisection Loop */ /* -------------- */ while (1) { /* Compute function at new mid-point */ /* --------------------------------- */ midPnt = newmidPnt; parms[0] = midPnt; funcMid = (*func) (parms); /* If left limit same sign as mid-point move it to mid-point */ /* --------------------------------------------------------- */ if (funcLft * funcMid > 0.0) { limLft = midPnt; }else { /* Otherwise move over right-hand limit */ /* ------------------------------------ */ limRgt = midPnt; } /* Compute new mid-point */ /* --------------------- */ newmidPnt = 0.5 * (limLft + limRgt); /* If relative change in midpoint < convergence crit then exit loop */ /* ---------------------------------------------------------------- */ if (fabs((newmidPnt - midPnt) / midPnt) < convCrit) break; } /* Save root */ /* --------- */ *root = newmidPnt; free(parms); return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | FUNCTION: HE5_EHattr | | | | DESCRIPTION: Reads/Writes attributes for HDF-EOS structures | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | fid hid_t HDF-EOS file ID | | attrname char attribute name | | numbertype hid_t attribute HDF numbertype | | count[] hsize_t Number of attribute elements | | wrcode char Read/Write Code "w/r" | | datbuf void I/O buffer | | | | | | OUTPUTS: | | datbuf void I/O buffer | | | | | | Date Programmer Description | | ========= ============ ============================================== | | July 1999 A.Muslimov Changed the sequence of calls in "write attri- | | bute" block (the change is based on examples | | provided in "Introduction to HDF5 Release 1.0" | | Chapter 4, Paragraph 8). | | 9/29/99 A.Muslimov Added dynamic memory allocation for error message| | buffer. Added error handlings after the function | | calls. | | 12/13/99 A.Muslimov Fixed a bug associated with the attempt to | | close the data space outside the block in which | | it was created. Put a call to H5Sclose() inside | | this block and separated the rest by else{} | | block. | | 07/12/00 A.Muslimov Added conversion of disk/file data type ID into | | memory data type ID before H5Aread() call. | | July 02 S.Zhao Updated for writing a character string attribute.| | Mar 04 S.Zhao Modified for a character string attribute. | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_EHattr(hid_t grpID, const char *attrname, hid_t numbertype, hsize_t count[], char *wrcode, void *datbuf) { herr_t status = FAIL; /* Return status variable */ int RANK = 1; /* Rank of attribute dataset */ hid_t attid = FAIL; /* Attribute ID */ hid_t sid = FAIL; /* dataspace ID */ hid_t atype = FAIL; /* attribute datatype ID */ hid_t mtype = FAIL; /* memory data type ID */ char *errbuf = (char *)NULL;/* Error message buffer */ size_t size = 0; CHECKPOINTER(attrname); /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_EHattr", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n"); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Probe , if Attribute does not exist, Create it */ /* ---------------------------------------------- */ H5E_BEGIN_TRY { attid = H5Aopen_name(grpID,attrname); } H5E_END_TRY; /* Write Attribute Section */ /* ----------------------- */ if (strcmp(wrcode, "w") == 0) { if( attid == FAIL) { if ((numbertype == HE5T_CHARSTRING) || (numbertype == H5T_NATIVE_CHAR) || (numbertype == H5T_C_S1)) { /* Create attribute dataspace */ /* -------------------------- */ sid = H5Screate(H5S_SCALAR); if(sid == FAIL) { status = FAIL; sprintf(errbuf, "Cannot create the data space for attribute \"%s\".\n", attrname); H5Epush(__FILE__, "HE5_EHattr", __LINE__, H5E_DATASPACE, H5E_CANTCREATE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); errbuf = NULL; return(status); } numbertype = H5Tcopy(H5T_C_S1); if( (size_t)count[0] > strlen((char *)datbuf) ) { size = strlen((char *)datbuf); } else { size = (size_t)count[0]; } status = H5Tset_size(numbertype, size); if( status == FAIL) { sprintf(errbuf,"Cannot set the total size for the attribute \"%s\".\n", attrname); H5Epush(__FILE__, "HE5_EHattr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); errbuf = NULL; return(status); } } else { /* Create attribute dataspace */ /* -------------------------- */ sid = H5Screate(H5S_SIMPLE); if(sid == FAIL) { status = FAIL; sprintf(errbuf, "Cannot create the data space for attribute \"%s\".\n", attrname); H5Epush(__FILE__, "HE5_EHattr", __LINE__, H5E_DATASPACE, H5E_CANTCREATE, errbuf ); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); errbuf = NULL; return(status); } /* Extend the dataspace */ /* -------------------- */ status = H5Sset_extent_simple(sid,RANK,count,NULL); if(status == FAIL) { sprintf(errbuf, "Cannot extend data space.\n"); H5Epush(__FILE__, "HE5_EHattr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf ); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); errbuf = NULL; return(status); } } /* Create the attribute */ /* -------------------- */ attid = H5Acreate(grpID,attrname,numbertype,sid,H5P_DEFAULT); if(attid == FAIL) { status = FAIL; sprintf(errbuf, "Cannot create the attribute \"%s\".\n",attrname); H5Epush(__FILE__, "HE5_EHattr", __LINE__, H5E_ATTR, H5E_CANTCREATE, errbuf ); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); errbuf = NULL; return(status); } /* Write attribute data */ /* -------------------- */ status = H5Awrite(attid,numbertype,datbuf); if(status == FAIL) { status = FAIL; sprintf(errbuf, "Cannot write in data to the attribute.\n"); H5Epush(__FILE__, "HE5_EHattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf ); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); errbuf = NULL; return(status); } /* Release the dataspace ID */ /* ------------------------ */ status = H5Sclose(sid); if(status == FAIL) { sprintf(errbuf, "Cannot release the data space ID.\n"); H5Epush(__FILE__, "HE5_EHattr", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf ); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); errbuf = NULL; return(status); } /* Release the attribute ID */ /* ------------------------ */ status = H5Aclose(attid); if(status == FAIL) { sprintf(errbuf, "Cannot release the attribute ID.\n"); H5Epush(__FILE__, "HE5_EHattr", __LINE__, H5E_ATTR, H5E_CLOSEERROR, errbuf ); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); errbuf = NULL; return(status); } } else { if ((numbertype == HE5T_CHARSTRING) || (numbertype == H5T_NATIVE_CHAR) || (numbertype == H5T_C_S1)) { numbertype = H5Tcopy(H5T_C_S1); if( (size_t)count[0] > strlen((char *)datbuf) ) { size = strlen((char *)datbuf); } else { size = (size_t)count[0]; } status = H5Tset_size(numbertype, size); if( status == FAIL) { sprintf(errbuf,"Cannot set the total size for the attribute \"%s\".\n", attrname); H5Epush(__FILE__, "HE5_EHattr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); errbuf = NULL; return(status); } } /* Write data to the attribute */ /* --------------------------- */ status = H5Awrite(attid,numbertype,datbuf); if(status == FAIL) { status = FAIL; sprintf(errbuf, "Cannot write in data to the attribute.\n"); H5Epush(__FILE__, "HE5_EHattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf ); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); errbuf = NULL; return(status); } /* Release the attribute ID */ /* ------------------------ */ status = H5Aclose(attid); if(status == FAIL) { sprintf(errbuf, "Cannot release the attribute ID.\n"); H5Epush(__FILE__, "HE5_EHattr", __LINE__, H5E_ATTR, H5E_CLOSEERROR, errbuf ); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); errbuf = NULL; return(status); } } } /* Read Attribute Section */ /* ---------------------- */ else if (strcmp(wrcode, "r") == 0) { if(attid == FAIL) { status = FAIL; sprintf(errbuf, "Attribute \"%s\" not defined.", attrname); H5Epush(__FILE__, "HE5_EHattr", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf ); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); errbuf = NULL; return(status); } else { atype = H5Aget_type(attid); if(atype == FAIL) { status = FAIL; sprintf(errbuf, "Cannot get the data type ID for attribute \"%s\".\n",attrname); H5Epush(__FILE__, "HE5_EHattr", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf ); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); errbuf = NULL; return(status); } /* Get the memory data type ID */ /* --------------------------- */ mtype = HE5_EHdtype2mtype(atype); if (mtype < 0) { mtype = atype; } /* Read attribute */ /* -------------- */ status = H5Aread(attid, mtype, datbuf); if(status == FAIL) { sprintf(errbuf, "Cannot read out data from the attribute \"%s\".\n",attrname); H5Epush(__FILE__, "HE5_EHattr", __LINE__, H5E_ATTR, H5E_READERROR, errbuf ); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); errbuf = NULL; return(status); } /* Release the attribute datatype ID */ /* --------------------------------- */ status = H5Tclose(atype); if(status == FAIL) { sprintf(errbuf, "Cannot release the data type ID.\n"); H5Epush(__FILE__, "HE5_EHattr", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf ); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); errbuf = NULL; return(status); } /* Release the attribute ID */ /* ------------------------ */ status = H5Aclose(attid); if(status == FAIL) { sprintf(errbuf, "Cannot release the attribute ID.\n"); H5Epush(__FILE__, "HE5_EHattr", __LINE__, H5E_ATTR, H5E_CLOSEERROR, errbuf ); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); errbuf = NULL; return(status); } } } if(errbuf != NULL) free(errbuf); COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHattrinfo | | | | DESCRIPTION: Returns numbertype and count of given HDF-EOS attribute | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | grpID hid_t Attribute group ID | | attrname char* attribute name | | | | OUTPUTS: | | datatype hid_t* Attribute Data type ID | | count hsize_t * Number of attribute elements | | | | | | Date Programmer Description | | ====== ============ ================================================= | | | | 9/29/99 A.Muslimov Added dynamic memory allocation for error message | | buffer. | | Feb 03 S.Zhao Changed the type of 'datatype' from an H5T_class_t | | to an hid_t. | | Mar 04 S.Zhao Modified for a character string attribute. | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_EHattrinfo( hid_t grpID, const char *attrname, hid_t *datatype, hsize_t *count) { herr_t status = FAIL; /* Return status variable */ hsize_t *bufsize = (hsize_t *)NULL; char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ status = HE5_EHattrinfo2( grpID, attrname, datatype, count, bufsize); if(status == FAIL) { sprintf(errbuf,"Cannot retrieve information about Attribute \"%s\" \n", attrname); H5Epush(__FILE__, "HE5_EHattrinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHattrinfo2 | | | | DESCRIPTION: Returns numbertype, count and buffer size of given HDF-EOS | | attribute | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | grpID hid_t Attribute group ID | | attrname char* attribute name | | | | OUTPUTS: | | datatype hid_t* Attribute Data type ID | | count hsize_t * Number of attribute elements | | size hsize_t * buf size of attribute elements | | | | | | Date Programmer Description | | ====== ============ ================================================= | | | | 9/29/99 A.Muslimov Added dynamic memory allocation for error message | | buffer. | | Feb 03 S.Zhao Changed the type of 'datatype' from an H5T_class_t | | to an hid_t. | | Mar 04 S.Zhao Modified for a character string attribute. | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_EHattrinfo2( hid_t grpID, const char *attrname, hid_t *datatype, hsize_t *count, hsize_t *size) { herr_t status = FAIL; /* Return status variable */ hid_t aspace = FAIL; /* attribute data space ID */ hid_t atype = FAIL; /* attribute data type ID */ hid_t attid = FAIL; /* attribute object ID */ H5T_class_t classid = H5T_NO_CLASS; /* data type class ID */ char *errbuf = (char *)NULL;/* Error message buffer */ CHECKPOINTER(attrname); /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_EHattrinfo", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n"); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Try to open up specified attribute */ /* ---------------------------------- */ H5E_BEGIN_TRY { attid = H5Aopen_name(grpID, attrname); } H5E_END_TRY; if( attid == FAIL ) { status = FAIL; sprintf(errbuf, "Attribute \"%s\" not defined.", attrname); H5Epush(__FILE__, "HE5_EHattrinfo", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } /* Get attribute data type ID */ /* -------------------------- */ atype = H5Aget_type(attid); if(atype == FAIL) { status = FAIL; sprintf(errbuf, "Cannot get the data type ID for attribute \"%s\".\n",attrname); H5Epush(__FILE__, "HE5_EHattrinfo", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf ); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } /* Get attribute data space ID */ /* --------------------------- */ aspace = H5Aget_space(attid); if(aspace == FAIL) { status = FAIL; sprintf(errbuf, "Cannot get the data space ID for attribute \"%s\".\n",attrname); H5Epush(__FILE__, "HE5_EHattrinfo", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf ); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } /* Get attribute Data type class ID */ /* -------------------------------- */ classid = H5Tget_class(atype); if( classid == FAIL ) { status = FAIL; sprintf(errbuf,"Cannot get the data type class ID for attribute \"%s\".\n", attrname); H5Epush(__FILE__, "HE5_EHattrinfo", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } /* Get the number of attribute elements */ /* ------------------------------------ */ if (classid == H5T_STRING) { *count = H5Sget_simple_extent_npoints(aspace); if( *count == 0) { status = FAIL; sprintf(errbuf,"Cannot get the size of string in attribute \"%s\".\n", attrname); H5Epush(__FILE__, "HE5_EHattrinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } *datatype = HE5T_CHARSTRING; if(size != NULL) { *size = H5Tget_size(atype); if( *size == 0) { status = FAIL; sprintf(errbuf,"Cannot get the size of string in attribute \"%s\".\n", attrname); H5Epush(__FILE__, "HE5_EHattrinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } } } else { *count = H5Sget_simple_extent_npoints(aspace); if( *count == 0) { status = FAIL; sprintf(errbuf,"Cannot get the number of elements in attribute \"%s\".\n", attrname); H5Epush(__FILE__, "HE5_EHattrinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } *datatype = HE5_EHdtype2numtype(atype); if(*datatype == FAIL) { status = FAIL; sprintf(errbuf,"Cannot get the number type in attribute \"%s\".\n", attrname); H5Epush(__FILE__, "HE5_EHattrinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } if(size != NULL) { hsize_t tsize; tsize = H5Tget_size(atype); if( tsize == 0) { status = FAIL; sprintf(errbuf,"Cannot get the size of in attribute \"%s\".\n", attrname); H5Epush(__FILE__, "HE5_EHattrinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } else { *size = (*count) * tsize; } } } /* Release the data type ID */ /* ------------------------ */ status = H5Tclose(atype); if(status == FAIL) { sprintf(errbuf, "Cannot release the data type ID.\n"); H5Epush(__FILE__, "HE5_EHattrinfo", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf ); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } /* Release the data space ID */ /* ------------------------- */ status = H5Sclose(aspace); if(status == FAIL) { sprintf(errbuf, "Cannot release the data space ID.\n"); H5Epush(__FILE__, "HE5_EHattrinfo", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf ); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } /* Release the attribute ID */ /* ------------------------ */ status = H5Aclose(attid); if(status == FAIL) { sprintf(errbuf, "Cannot release the attribute ID.\n"); H5Epush(__FILE__, "HE5_EHattrinfo", __LINE__, H5E_ATTR, H5E_CLOSEERROR, errbuf ); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } free(errbuf); errbuf = NULL; COMPLETION: return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHobj_info | | | | DESCRIPTION: Returns number and names of objects in HDF-EOS structure | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | | | INPUTS: | | NOTES: | | | | | | Date Programmer Description | | 10/15/99 A.Muslimov Replaced memcmp() by strncmp() to fix an ABR | | associated with the the first if() block for | | name string containing less than 13 characters. | | 04/19/00 A.Muslimov Changed type of 'slen' from long to size_t. | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_EHobj_info(hid_t loc_id, const char *name, void *opdata) { size_t slen = 0; HE5_OBJINFO *ptr; char *indxstr = "_INDEXMAP:"; char *bsom = "_BLKSOM"; char *lvwr = "_LevelWritten"; #ifdef _IGNORE_DIMSCALE_ hid_t attid = FAIL; hid_t atype = FAIL; H5T_class_t atclass; hid_t suptype = FAIL; char errbuf[HE5_HDFE_ERRBUFSIZE]; #endif ptr = (HE5_OBJINFO *)opdata; #ifdef _IGNORE_DIMSCALE_ H5E_BEGIN_TRY { attid = H5Aopen_name(loc_id,name); } H5E_END_TRY; if ( attid != FAIL ) { /* Check if the type class is H5T_VLEN, and its base type is H5T_STD_REF_OBJ. */ atype = H5Aget_type(attid); if ( atype == FAIL) { sprintf(errbuf, "Cannot get the data type ID for attribute \"%s\".\n", name); H5Epush(__FILE__, "HE5_EHattr", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf ); HE5_EHprint(errbuf, __FILE__, __LINE__); H5Aclose(attid); return 0; } atclass = H5Tget_class(atype); if ( atclass == H5T_NO_CLASS ) { sprintf(errbuf, "Cannot get the data type class for attribute \"%s\".\n", name); H5Epush(__FILE__, "HE5_EHattr", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf ); HE5_EHprint(errbuf, __FILE__, __LINE__); H5Aclose(attid); return 0; } else if ( atclass == H5T_VLEN ) { suptype = H5Tget_super(atype); if ( suptype >= 0 ) { if ( H5Tequal(suptype, H5T_STD_REF_OBJ) == TRUE ) { /* Do not append the attribute name because this attribute is not a proper * attribute like "DIMENSION_LIST". */ H5Aclose(attid); return 0; } } } H5Aclose(attid); } #endif if ( strncmp(name, indxstr, strlen(indxstr)) != 0 && strncmp(name, bsom, strlen(bsom)) != 0 && strncmp(name, lvwr, strlen(lvwr)) != 0 ) { /* Get the number of objects */ /* ------------------------- */ ptr->count++; /* Compute string length of object entry */ /* ------------------------------------- */ slen = ( ptr->count == 1) ? strlen(name) : strlen(name) + 1; ptr->strsize = ptr->strsize + slen; /* Get comma separated name list */ /* ----------------------------- */ if( ptr->count == 1) { ptr->name = (char *)calloc( (strlen(name)+1), sizeof(char) ); strcpy( ptr->name, name); } else { ptr->name = (char *)realloc( ptr->name, sizeof(char)*(ptr->strsize+1)); strcat( ptr->name, ","); strcat( ptr->name, name); } } return 0; } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHinquire | | | | DESCRIPTION: Returns number and names of HDF-EOS structures in file | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nobj long Number of HDF-EOS structures in file | | | | INPUTS: | | filename char HDF-EOS filename | | grpname char Object Group name("SWATH/GRID/POINT/ZA")| | | | OUTPUTS: | | objectlist char List of object names (comma-separated) | | strbufsize long Length of objectlist | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 9/01/99 A.Muslimov Checked for the statuses returned by H5Gclose() and | | H5Fclose() calls. | | 9/29/99 A.Muslimov Added dynamic memory allocation for error message | | buffer. | | Nov. 00 A.Muslimov Disabled error message and set return value to | | "0" if a specified group is not found. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_EHinquire(const char *filename, char *grpname, char *objectlist, long *strbufsize) { long nobj = FAIL;/* Number of objects in the group */ herr_t status = FAIL;/* Return status variable */ HE5_OBJINFO inout; /* Output "info" data structure */ hid_t HDFfid = FAIL;/* HDFEOS file ID */ hid_t heos_id = FAIL;/* Group ID for a specified group */ int index = FAIL;/* Return value from an operator */ char *errbuf; /* Buffer for error message */ CHECKPOINTER(filename); CHECKPOINTER(grpname); /* Initialize the data */ /* ------------------- */ inout.strsize = 0; inout.count = 0; inout.name = (char *)NULL; /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_EHinquire", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n"); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Try to open HDFEOS file for read-only */ /* ------------------------------------- */ H5E_BEGIN_TRY { HDFfid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT); } H5E_END_TRY; if(HDFfid == FAIL ) { sprintf(errbuf, " Cannot open \"%s\" file. Check the file name. \n", filename); H5Epush(__FILE__, "HE5_EHinquire", __LINE__, H5E_FILE, H5E_CANTOPENFILE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); nobj = FAIL; free(errbuf); return(nobj); } /* Try to open group "grpname" */ /* --------------------------- */ H5E_BEGIN_TRY { heos_id = H5Gopen(HDFfid, grpname); } H5E_END_TRY; if(heos_id == FAIL) { nobj = 0; H5Fclose(HDFfid); free(errbuf); return(nobj); } /* Loop to get hdfeos object information */ /* ------------------------------------- */ index = H5Giterate(heos_id, grpname, NULL, HE5_EHobj_info, &inout); if( index == FAIL) { H5Epush(__FILE__, "HE5_EHinquire",__LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot get HDFEOS object information. \n"); HE5_EHprint("Error: Cannot get HDFEOS object information, occured", __FILE__, __LINE__); nobj = FAIL; goto done; } if(objectlist != (char *)NULL) memmove(objectlist, inout.name, strlen(inout.name)); if(strbufsize != (long *)NULL) *strbufsize = inout.strsize; nobj = inout.count; done: /* inout.name is allocated in HE5_EHobj_info() */ /* ------------------------------------------- */ if( inout.name != NULL) free( inout.name); /* Release group ID */ /* ---------------- */ status = H5Gclose(heos_id); if( status == FAIL) { sprintf(errbuf, "Cannot close the group \"%s\". \n", grpname); H5Epush(__FILE__, "HE5_EHinquire",__LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); errbuf = NULL; return(nobj); } /* Release file ID */ /* --------------- */ status = H5Fclose(HDFfid); if( status == FAIL) { sprintf(errbuf, "Cannot close the HDFEOS file \"%s\" . \n", filename); H5Epush(__FILE__, "HE5_EHinquire",__LINE__, H5E_FILE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } free(errbuf); errbuf = NULL; COMPLETION: return(nobj); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHattrcat | | | | DESCRIPTION: Returns a listing of attributes within an HDF-EOS structure | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nobj long Number of attributes in a struct | | | | INPUTS: | | fid hid_t HDF-EOS file ID | | | | OUTPUTS: | | grpname char* Group name | | objectlist char* Attribute names in a struct | | (Comma-separated list) | | strbufsize long Attributes name list string length | | | | NOTES: attributes "INDXMAP:..", "_FV_", "_BLKSOM:.." are not counted. | | | | 9/29/99 A.Muslimov Added dynamic memory allocation for error message | | buffer. | | 2/1/00 A.Muslimov Added H5Dopen(dts_id, ...) call for the case of | | accessing dataset. | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_EHattrcat(hid_t fid, char *grpname, char *objectlist, long *strbufsize) { long nobj = FAIL;/* number of attributes in a structure */ HE5_OBJINFO inout; hid_t heos_id = FAIL;/* Group ID of a specified group */ hid_t HDFfid = FAIL; hid_t dts_id = FAIL;/* Dataset ID of a specified dataset */ herr_t status = FAIL;/* return status variable */ int index = FAIL;/* return value of index */ char *errbuf = NULL;/* buffer for error message */ CHECKPOINTER(grpname); /* Initialize the data */ /* ------------------- */ inout.strsize = 0; /* object list size */ inout.count = 0; /* number of objects */ inout.name = NULL; /* onject name (comma separated) list */ /* Get HDF file ID */ /* --------------- */ HDFfid = HE5_HeosTable[fid%HE5_EHIDOFFSET].HDFfid; /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_EHattrcat", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n"); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Try to open group with name "grpname" */ /* ------------------------------------- */ H5E_BEGIN_TRY { heos_id = H5Gopen(HDFfid, grpname); } H5E_END_TRY; if(heos_id == FAIL) { /* Try to open dataset with name "grpname" */ /* --------------------------------------- */ H5E_BEGIN_TRY { dts_id = H5Dopen(HDFfid, grpname); } H5E_END_TRY; if(dts_id == FAIL) { sprintf(errbuf, "No group/dataset named \"%s\" exists. \n", grpname); H5Epush(__FILE__, "HE5_EHattrcat", __LINE__, H5E_FILE, H5E_CANTOPENOBJ, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); nobj = FAIL; free(errbuf); return(nobj); } } /* Loop to get attributes information */ /* ---------------------------------- */ if (heos_id != FAIL) index = H5Aiterate(heos_id, NULL, HE5_EHobj_info, &inout); if (dts_id != FAIL) index = H5Aiterate(dts_id, NULL, HE5_EHobj_info, &inout); if( index == FAIL) { sprintf(errbuf,"Cannot get attribute information. \n"); H5Epush(__FILE__, "HE5_EHattrcat", __LINE__, H5E_ATTR, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); nobj = FAIL; goto done; } if(objectlist != NULL && inout.name != NULL ) strcpy( objectlist, inout.name); if(strbufsize != NULL) *strbufsize = inout.strsize; nobj = inout.count; done: /* inout.name is allocated in HE5_EHobj_info() */ /* ------------------------------------------- */ if( inout.name != NULL) free( inout.name); if (heos_id != FAIL) { status = H5Gclose(heos_id); if( status == FAIL ) { sprintf(errbuf, "Cannot release the group ID.\n"); H5Epush(__FILE__, "HE5_EHattrcat",__LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } if (dts_id != FAIL) { status = H5Dclose(dts_id); if( status == FAIL ) { sprintf(errbuf, "Cannot release the dataset ID.\n"); H5Epush(__FILE__, "HE5_EHattrcat",__LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } free(errbuf); errbuf = NULL; COMPLETION: return(nobj); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHdatasetcat | | | | DESCRIPTION: Returns a listing of datasets within an HDF-EOS structure | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | | | INPUTS: | | fid hid_t HDF-EOS file ID | | | | OUTPUTS: | | strbufsize long Attributes name list string length | | | | 9/29/99 A.Muslimov Added dynamic memory allocation for error message | | buffer. | | | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_EHdatasetcat(hid_t fid, char *grpname, char *objectlist, long *strbufsize) { long nobj = FAIL;/* Number of datasets (RETURN) */ herr_t status = FAIL;/* Return status variable */ int index = FAIL;/* Return value of an operation */ HE5_OBJINFO inout; hid_t heos_id = FAIL;/* Group ID */ hid_t HDFfid = FAIL;/* HDF-EOS file ID */ char *errbuf; /* buffer for error message */ CHECKPOINTER(grpname); /* Initialize data */ /* --------------- */ inout.strsize = 0; /*object list size*/ inout.count = 0; /*number of objects*/ inout.name = NULL; /*onject name list, seperated by comma*/ /* Get HDF file ID */ /* --------------- */ HDFfid = HE5_HeosTable[fid%HE5_EHIDOFFSET].HDFfid; /* Allocate memory for error message buffer */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_EHdatasetcat", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n"); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Try to open group "grpname" */ /* --------------------------- */ H5E_BEGIN_TRY { heos_id = H5Gopen(HDFfid, grpname); } H5E_END_TRY; if(heos_id == FAIL) { sprintf(errbuf, "Cannot open \"%s\" group. Group may not exist. \n", grpname); H5Epush(__FILE__, "HE5_EHdatasetcat", __LINE__, H5E_FILE, H5E_CANTOPENOBJ, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); nobj = FAIL; free(errbuf); return(nobj); } /* Loop to get datasets information */ /* -------------------------------- */ index = H5Giterate(heos_id, grpname, NULL, HE5_EHobj_info, &inout); if( index == FAIL ) { sprintf(errbuf,"Cannot get datasets information.\n"); H5Epush(__FILE__, "HE5_EHdatasetcat", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); nobj = FAIL; goto done; } if(objectlist != NULL) strcpy( objectlist, inout.name); if(strbufsize != NULL) *strbufsize = inout.strsize; nobj = inout.count; done: /* inout.name is allocated in HE5_EHobj_info() */ if( inout.name != NULL) free( inout.name); status = H5Gclose(heos_id); if( status == FAIL ) { sprintf(errbuf, "Cannot release the group ID.\n"); H5Epush(__FILE__, "HE5_EHdatasetcat",__LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } free(errbuf); errbuf = NULL; COMPLETION: return(nobj); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHclose | | | | DESCRIPTION: close HDF-EOS file and returns status | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | | | INPUTS: fid hid_t None HDF-EOS file ID | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ======= ========== ================================================= | | July 99 A.Muslimov Modified to conform to the HDFEOS file structure | | 9/01/99 A.Muslimov Added error handling right after the calls to | | H5Gclose() and H5Fclose(). | | 9/29/99 A.Muslimov Added dynamic memory allocation for error message | | buffer. | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_EHclose(hid_t fid) { herr_t status = FAIL;/* routine return status variable */ hid_t idx = FAIL;/* HDF-EOS file index (reduced ID) */ char *errbuf = NULL;/* Error message buffer */ /* int i; ssize_t nobj,nobj1,nobj2; hid_t obj_id_list[100]; */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_EHclose", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n"); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Check for valid HDFEOS file ID range */ /* ------------------------------------ */ if (fid >= HE5_EHIDOFFSET && fid < HE5_NEOSHDF + HE5_EHIDOFFSET) { /* Compute "reduced" file ID */ /* ------------------------- */ idx = fid % HE5_EHIDOFFSET; /* Close "HDFEOS" group */ /* -------------------- */ status = H5Gclose(HE5_HeosTable[ idx ].gid); if( status == FAIL) { sprintf(errbuf,"Cannot release \"HDFEOS\" group ID. \n"); H5Epush(__FILE__, "HE5_EHclose", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* To see if user has forgotten to use detach somewhere in his/her code and because of that there is any open IDs before reaching this point,user can uncomment out the following few lines of code (and a few declerations above), recompile HDFEOS5, and link the library to the user code */ /* nobj1 = H5Fget_obj_count(HE5_HeosTable[idx].HDFfid, H5F_OBJ_DATASET | H5F_OBJ_GROUP | H5F_OBJ_DATATYPE | H5F_OBJ_ATTR); nobj2 = H5Fget_obj_count(HE5_HeosTable[idx].HDFfid,H5F_OBJ_ALL); printf("nobj1=%d\n",(int)nobj1); printf("nobj2=%d\n",(int)nobj2); nobj = H5Fget_obj_ids(HE5_HeosTable[idx].HDFfid, H5F_OBJ_DATASET | H5F_OBJ_GROUP | H5F_OBJ_DATATYPE | H5F_OBJ_ATTR , 100, obj_id_list); printf("nobj=%d\n",(int)nobj); for(i=0; i [StructMetadata.0] / / \ \ \ | | / | | \ \ | | ---------- ------ ------- ------- -------- | | |ADDITIONAL| |GRID| |POINT| |SWATH| | ZA | | | ---------- ------ ------- ------- -------- | | / : : : : | | / [dts] [dts] [dts] [dts] | | ----------------- | | |FILE_ATTRIBUTES| | | ----------------- | | : | | Writes/Updates data here=> | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | fid hid_t HDFEOS File ID | | attrname char attribute name | | numbertype hid_t attribute dataset datatype ID | | count[] hsize_t Number of attribute elements | | datbuf void I/O buffer | | | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | May 01 A.Muslimov Original development. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_EHwriteglbattr(hid_t fid, const char *attrname, hid_t numbertype, hsize_t count[], void *datbuf) { herr_t status = FAIL; /* Return status variable */ uintn access = 0; /* Access code */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t AddGrpID = FAIL; /* "ADDITIONAL" group ID */ hid_t FileAttrGrpID = FAIL; /* "FILE_ATTRIBUTES" group ID */ hid_t HDFfid = FAIL; /* HDF-EOS file ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ CHECKNAME(attrname); CHECKPOINTER(count); CHECKPOINTER(datbuf); /* Get HDF-EOS file ID and "HDFEOS" group ID */ /* ========================================= */ status = HE5_EHchkfid(fid,"HE5_EHwriteglbattr", &HDFfid, &gid, &access); if(status == FAIL) { H5Epush(__FILE__, "HE5_EHwriteglbattr", __LINE__, H5E_FILE, H5E_NOTFOUND, "Invalid file ID. \n"); HE5_EHprint("Error: Invalid file ID, occured", __FILE__, __LINE__); return(FAIL); } if (status == SUCCEED) { /* Get "ADDITIONAL" group ID */ /* ------------------------- */ AddGrpID = H5Gopen(gid, "ADDITIONAL"); if(AddGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"ADDITIONAL\" group. \n"); H5Epush(__FILE__, "HE5_EHwriteglbattr", __LINE__, H5E_OHDR, H5E_NOTFOUND,errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get "FILE_ATTRIBUTES" group ID and call HE5_EHattr to perform I/O */ /* ----------------------------------------------------------------- */ FileAttrGrpID = H5Gopen(AddGrpID, "FILE_ATTRIBUTES"); if(FileAttrGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"FILE_ATTRIBUTES\" group. \n"); H5Epush(__FILE__, "HE5_EHwriteglbattr", __LINE__, H5E_OHDR, H5E_NOTFOUND,errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } status = HE5_EHattr(FileAttrGrpID, attrname, numbertype, count,"w", datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot write Attribute \"%s\"to the \"FILE_ATTRIBUTES\" group.\n", attrname); H5Epush(__FILE__, "HE5_EHwriteglbattr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Gclose(AddGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"ADDITIONAL\" group ID. \n"); H5Epush(__FILE__, "HE5_EHwriteglbattr", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Gclose(FileAttrGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"FILE_ATTRIBUTES\" group ID. \n"); H5Epush(__FILE__, "HE5_EHwriteglbattr", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHreadglbattr | | | | DESCRIPTION: Reads attribute from the "FILE_ATTRIBUTES" group in a file. | | | | | | ----------- | | | Root "/"| | | ----------- | | / \ | | ---------------------- --------------------- | | | HDFEOS INFORMATION | | HDFEOS | | | ---------------------- --------------------- | | / | / / \ \ \ | | / | / / \ \ \ | | [StructMetadata.0] / / \ \ \ | | / | | \ \ | | ---------- ------ ------- ------- -------- | | |ADDITIONAL| |GRID| |POINT| |SWATH| | ZA | | | ---------- ------ ------- ------- -------- | | / : : : : | | / [dts] [dts] [dts] [dts] | | ----------------- | | |FILE_ATTRIBUTES| | | ----------------- | | : | | Reads attributes from => | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | fid hid_t file ID | | attrname char attribute name | | | | OUTPUTS: | | datbuf void I/O buffer | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | May 01 A.Muslimov Original development. | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_EHreadglbattr(hid_t fid, const char *attrname, void * datbuf) { herr_t status = FAIL; /* return status variable */ uintn access = 0; /* Access code */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t AddGrpID = FAIL; /* "ADDITIONAL" group ID */ hid_t FileAttrGrpID = FAIL; /* "FILE_ATTRIBUTES" group ID */ hid_t HDFfid = FAIL; /* HDF-EOS file ID */ hid_t ntype = FAIL; /* Data type ID */ hsize_t count[] = { 0 }; /* # of attribute elements */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ CHECKPOINTER(attrname); /* Get HDF-EOS file ID and "HDFEOS" group ID */ /* ========================================= */ status = HE5_EHchkfid(fid,"HE5_EHreadglbattr", &HDFfid, &gid, &access); if (status == SUCCEED) { /* Get "ADDITIONAL" group ID */ /* --------------------------- */ AddGrpID = H5Gopen(gid, "ADDITIONAL"); if(AddGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"ADDITIONAL\" group.\n"); H5Epush(__FILE__, "HE5_EHreadglbattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get "FILE_ATTRIBUTES" group ID and call HE5_EHattr to perform I/O */ /* ------------------------------------------------------------------ */ FileAttrGrpID = H5Gopen(AddGrpID, "FILE_ATTRIBUTES"); if(FileAttrGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"FILE_ATTRIBUTES\" group.\n"); H5Epush(__FILE__, "HE5_EHreadglbattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } status = HE5_EHattr(FileAttrGrpID,attrname,ntype,count,"r", datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot read Attribute \"%s\" from the \"FILE_ATTRIBUTES\" group.\n", attrname); H5Epush(__FILE__, "HE5_EHreadglbattr", __LINE__, H5E_ATTR, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Gclose(AddGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"ADDITIONAL\" group ID.\n"); H5Epush(__FILE__,"HE5_EHreadglbattr", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Gclose(FileAttrGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"FILE_ATTRIBUTES\" group ID.\n"); H5Epush(__FILE__, "HE5_EHreadglbattr", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHglbattrinfo | | | | DESCRIPTION: Wrapper around HE5_EHglbattrinfo2 that drops attribute buffer | | size. Gives to user only count as before | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | fid hid_t file ID | | attrname const char* attribute name | | | | OUTPUTS: | | ntype hid_t data type ID | | count hsize_t Number of attribute elements | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | May 01 A.Muslimov Original development. | | Feb 03 S.Zhao Changed the type of 'ntype' from an H5T_class_t to | | an hid_t. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_EHglbattrinfo(hid_t fid, const char *attrname, hid_t *ntype, hsize_t *count) { herr_t status = FAIL; /* Return status variable */ hsize_t *bufsize = (hsize_t *)NULL; char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ status = HE5_EHglbattrinfo2(fid, attrname, ntype, count, bufsize); if(status == FAIL) { sprintf(errbuf,"Cannot retrieve information about global Attribute \"%s\" \n", attrname); H5Epush(__FILE__, "HE5_EHglbattrinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHglbattrinfo2 | | | | DESCRIPTION: Retrieves information about attributes in "FILE_ATTRIBUTES" | | group within a file. | | | | ----------- | | | Root "/"| | | ----------- | | / \ | | ---------------------- --------------------- | | | HDFEOS INFORMATION | | HDFEOS | | | ---------------------- --------------------- | | / | / / \ \ \ | | / | / / \ \ \ | | [StructMetadata.0] / / \ \ \ | | / | | \ \ | | ---------- ------ ------- ------- -------- | | |ADDITIONAL| |GRID| |POINT| |SWATH| | ZA | | | ---------- ------ ------- ------- -------- | | / : : : : | | / [dts] [dts] [dts] [dts] | | ----------------- | | |FILE_ATTRIBUTES| | | ----------------- | | : | | | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | fid hid_t file ID | | attrname const char* attribute name | | | | OUTPUTS: | | ntype hid_t data type ID | | count hsize_t Number of attribute elements | | size hsize_t * buffer size of attribute elements | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | May 01 A.Muslimov Original development. | | Feb 03 S.Zhao Changed the type of 'ntype' from an H5T_class_t to | | an hid_t. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_EHglbattrinfo2(hid_t fid, const char *attrname, hid_t *ntype, hsize_t *count, hsize_t *size) { herr_t status = FAIL; /* Return status variable */ uintn access = 0; /* Access code */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t AddGrpID = FAIL; /* "ADDITIONAL" group ID */ hid_t FileAttrGrpID = FAIL; /* "FILE_ATTRIBUTES" group ID */ hid_t HDFfid = FAIL; /* HDF-EOS file ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ CHECKPOINTER(attrname); /* Get HDF-EOS file ID and "HDFEOS" group ID */ /* ========================================= */ status = HE5_EHchkfid(fid,"HE5_EHglbattrinfo", &HDFfid, &gid, &access); if (status == SUCCEED) { /* Get "ADDITIONAL" group ID */ /* -------------------------- */ AddGrpID = H5Gopen(gid, "ADDITIONAL"); if(AddGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"ADDITIONAL\" group.\n"); H5Epush(__FILE__, "HE5_EHglbattrinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get "FILE_ATTRIBUTES" group ID and call HE5_EHattrinfo */ /* ------------------------------------------------------- */ FileAttrGrpID = H5Gopen(AddGrpID, "FILE_ATTRIBUTES"); if(FileAttrGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"FILE_ATTRIBUTES\" group.\n"); H5Epush(__FILE__,"HE5_EHglbattrinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } status = HE5_EHattrinfo2(FileAttrGrpID,attrname,ntype,count,size); if(status == FAIL) { sprintf(errbuf,"Cannot retrieve information about Attribute \"%s\" in the \"FILE_ATTRIBUTES\" group.\n", attrname); H5Epush(__FILE__, "HE5_EHglbattrinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Gclose(AddGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"ADDITIONAL\" group ID.\n"); H5Epush(__FILE__, "HE5_EHglbattrinfo", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Gclose(FileAttrGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"FILE_ATTRIBUTES\" group ID.\n"); H5Epush(__FILE__, "HE5_EHglbattrinfo", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHinqglbattrs | | | | DESCRIPTION: Retrieves the number of attributes and string length of | | attribute list in "FILE_ATTRIBUTES" group | | | | ----------- | | | Root "/"| | | ----------- | | / \ | | ---------------------- -------------------- | | | HDFEOS INFORMATION | | HDFEOS | | | ---------------------- -------------------- | | / | / / \ \ \ | | / | / / \ \ \ | | [StructMetadata.0] / / \ \ \ | | / | | \ \ | | ---------- ------ ------- ------- -------- | | |ADDITIONAL| |GRID| |POINT| |SWATH| | ZA | | | ---------- ------ ------- ------- -------- | | / : : : : | | / [dts] [dts] [dts] [dts] | | ----------------- | | |FILE_ATTRIBUTES| | | ----------------- | | : | | | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nattr long Number of attributes in | | "FILE_ATTRIBUTES" group. | | | | INPUTS: | | fid hid_t file ID | | | | OUTPUTS: | | attrnames char Attribute names in "FILE_ATTRIBUTES" | | group (Comma-separated list) | | strbufsize long Attributes name list string length | | | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | May 01 A.Muslimov Original development. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_EHinqglbattrs(hid_t fid, char *attrnames, long *strbufsize) { long nattr = FAIL; /* Number of attributes */ herr_t status = FAIL; /* Return status variable */ uintn access = 0; /* Access code */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t HDFfid = FAIL; /* HDF-EOS file ID */ char *grpname = (char *)NULL; /* Group name string */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ /* Get HDF-EOS file ID and "HDFEOS" group ID */ /* ========================================= */ status = HE5_EHchkfid(fid,"HE5_EHinqglbattrs", &HDFfid, &gid, &access); if(status == SUCCEED ) { grpname = (char *)calloc(HE5_HDFE_NAMBUFSIZE, sizeof(char) ); if( grpname == NULL) { H5Epush(__FILE__, "HE5_EHinqgrpattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory"); HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__); return(FAIL); } /* Set the Group name */ /* ------------------ */ strcpy(grpname,"/HDFEOS/ADDITIONAL/FILE_ATTRIBUTES"); /* search group with grpname for the number of attributes */ /* ------------------------------------------------------ */ nattr = HE5_EHattrcat(fid, grpname, attrnames, strbufsize); if ( nattr < 0 ) { sprintf(errbuf, "Cannot find the attributes. \n"); H5Epush(__FILE__, "HE5_EHinqglbattrs", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); } if (grpname != NULL) free(grpname); } return (nattr); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHinqglbdatatype | | | | DESCRIPTION: Inquires the data type of attributes in "FILE_ATTRIBUTES" | | group within a file. | | | | ----------- | | | Root "/"| | | ----------- | | / \ | | ---------------------- -------------------- | | | HDFEOS INFORMATION | | HDFEOS | | | ---------------------- -------------------- | | / | / / \ \ \ | | / | / / \ \ \ | | [StructMetadata.0] / / \ \ \ | | / | | \ \ | | ---------- ------ ------- ------- -------- | | |ADDITIONAL| |GRID| |POINT| |SWATH| | ZA | | | ---------- ------ ------- ------- -------- | | / : : : : | | / [dts] [dts] [dts] [dts] | | ----------------- | | |FILE_ATTRIBUTES| | | ----------------- | | : | | | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | fid hid_t file ID | | attrname const char* attribute name | | | | OUTPUTS: | | datatype hid_t | | classid H5T_class_t | | order H5T_order_t | | size size_t | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Mar 03 S.Zhao Original development. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_EHinqglbdatatype(hid_t fid, const char *attrname, hid_t *datatype, H5T_class_t *classid, H5T_order_t *order, size_t *size) { herr_t status = FAIL; /* Return status variable */ uintn access = 0; /* Access code */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t AddGrpID = FAIL; /* "ADDITIONAL" group ID */ hid_t FileAttrGrpID = FAIL; /* "FILE_ATTRIBUTES" group ID */ hid_t HDFfid = FAIL; /* HDF-EOS file ID */ hid_t attr = FAIL; /* attribute dataset ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ CHECKPOINTER(attrname); /* Get HDF-EOS file ID and "HDFEOS" group ID */ /* ========================================= */ status = HE5_EHchkfid(fid,"HE5_EHinqglbdatatype", &HDFfid, &gid, &access); if (status == SUCCEED) { /* Get "ADDITIONAL" group ID */ /* -------------------------- */ AddGrpID = H5Gopen(gid, "ADDITIONAL"); if(AddGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"ADDITIONAL\" group.\n"); H5Epush(__FILE__, "HE5_EHinqglbdatatype", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get "FILE_ATTRIBUTES" group ID */ /* ------------------------------- */ FileAttrGrpID = H5Gopen(AddGrpID, "FILE_ATTRIBUTES"); if(FileAttrGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"FILE_ATTRIBUTES\" group.\n"); H5Epush(__FILE__, "HE5_EHinqglbdatatype", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get data type information about global attribute */ /* ------------------------------------------------ */ attr = H5Aopen_name(FileAttrGrpID,attrname); if (attr == FAIL) { sprintf(errbuf, "Cannot open the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_EHinqglbdatatype", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } *datatype = H5Aget_type(attr); if (*datatype == FAIL) { sprintf(errbuf, "Cannot get the data type for the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_EHinqglbdatatype", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } *classid = H5Tget_class(*datatype); if (*classid == H5T_NO_CLASS) { sprintf(errbuf, "Cannot get the data type class ID for the \"%s\" attribute.\n", attrname); H5Epush(__FILE__,"HE5_EHinqglbdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } *order = H5Tget_order(*datatype); if (*order == H5T_ORDER_ERROR) { sprintf(errbuf, "Cannot get the data type order for the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_EHinqglbdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } if (*classid == H5T_STRING) { *size = H5Tget_size(*datatype); if (*size == 0) { sprintf(errbuf, "Cannot get the data type size for the \"%s\" string attribute.\n", attrname); H5Epush(__FILE__, "HE5_EHinqglbdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } else { *size = H5Tget_size(*datatype); if (*size == 0) { sprintf(errbuf, "Cannot get the data type size for the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_EHinqglbdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } status = H5Aclose(attr); if (status == FAIL) { sprintf(errbuf, "Cannot release the dataset ID for the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_EHinqglbdatatype", __LINE__, H5E_DATASET, H5E_CLOSEERROR , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } status = H5Gclose(AddGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"ADDITIONAL\" group ID.\n"); H5Epush(__FILE__, "HE5_EHinqglbdatatype", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Gclose(FileAttrGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"FILE_ATTRIBUTES\" group ID.\n"); H5Epush(__FILE__, "HE5_EHinqglbdatatype", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHupdatemeta | | | | DESCRIPTION: Updates metadata | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | | | status herr_t None return status variable (0 for success, | | -1 for failure) | | | | INPUTS: | | | | fid hid_t None HDF-EOS file ID | | structname char* None Object name string | | structcode char* None "s" for a swath, "g" for a grid, | | "p" for a point, and "z" for a za. | | metacode long None Code of a metadata block to insert to. | | metastr char* None Buffer containing metadata information | | to insert. | | metadata[] hsize_t None Array of data values | | | | OUTPUTS: | | | | None | | | | NOTES: Allocates memory of fixed size (= HE5_STATIC_BLKSIZE) | | for metabuf[] array (old scheme), or allocates buffer in chuncks | | of HE5_DYNAMIC_BLKSIZE (new scheme). | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 05/17/04 Abe Taaheri Initial version | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_EHupdatemeta(hid_t fid, const char *structname, char *structcode, long metacode, char *metastr, hsize_t metadata[]) { herr_t status = SUCCEED; int HDFEOS5ver_flg ; /* will be set to 1 if the HDF-EOS5 version is NOT later than 5.1.7, otherwise to 0 */ /* Get HDFEOS5ver_flg flag for the file */ /* --------------- */ HDFEOS5ver_flg = HE5_HeosTable[fid%HE5_EHIDOFFSET].DYNAMIC_flag; if(HDFEOS5ver_flg == 1) { status = HE5_EHupdatemeta_Static(fid, structname, structcode, metacode, metastr, metadata); } else if(HDFEOS5ver_flg == 0) { status = HE5_EHupdatemeta_Dynamic(fid, structname, structcode, metacode, metastr, metadata); } return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHupdatemeta_Static | | | | DESCRIPTION: Updates metadata | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | | | status herr_t None return status variable (0 for success, | | -1 for failure) | | | | INPUTS: | | | | fid hid_t None HDF-EOS file ID | | structname char* None Object name string | | structcode char* None "s" for a swath, "g" for a grid, | | "p" for a point, and "z" for a za. | | metacode long None Code of a metadata block to insert to. | | metastr char* None Buffer containing metadata information | | to insert. | | metadata[] hsize_t None Array of data values | | | | OUTPUTS: | | | | None | | | | NOTES: There is memory allocation of BLKSIZE chunk for the | | dataset "StructMetadata.0" | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Oct. 02 S. ZHAO Original development | | Dec. 02 H. LO Update dimension size | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_EHupdatemeta_Static(hid_t fid, const char *structname, char *structcode, long metacode, char *metastr, hsize_t metadata[]) { herr_t status = FAIL; /* routine return status variable */ int i; /* Loop index */ hid_t gid = FAIL; /* "HDFEOS INFORMATION" group ID */ hid_t meta_id = FAIL; /* "StructuralMetadat.0" group ID */ hid_t atype = FAIL; /* Data type ID */ hid_t aspace = FAIL; /* Data space ID */ hid_t HDFfid = FAIL; /* HDF5 file ID */ hsize_t tempdim = 0; /* Temporary variable */ long count = 0; /* Objects/Groups counter */ char *metabuf = NULL; /* Pointer to Structural Metadata array */ char *metaptr = NULL; /* Metadata pointer */ char *prevmetaptr = NULL;/* Previous position of metadata pointer */ char *utlstr = NULL; /* Utility string */ char *utlstr2 = NULL; /* Utility string 2 */ char *newbuf = NULL; /* updated metadata string */ char *type = NULL; /* data type string */ char *errbuf = NULL; /* Error message buffer */ char *meta_dim_name = NULL; char *utl_dim_name = NULL; int ii, jj, i1, j1; CHECKPOINTER(structname); CHECKPOINTER(structcode); CHECKPOINTER(metastr); /* Get HDF file ID */ /* --------------- */ HDFfid = HE5_HeosTable[fid%HE5_EHIDOFFSET].HDFfid; /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_EHupdatemeta_Static", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n"); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Allocate memory for data type string */ /* ------------------------------------ */ type = (char * )calloc( HE5_HDFE_TYPESTRSIZE, sizeof(char)); if(type == NULL) { sprintf(errbuf,"Cannot allocate memory for data type string. \n"); H5Epush(__FILE__, "HE5_EHupdatemeta_Static", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Open "HDFEOS INFORMATION" group */ /* =============================== */ gid = H5Gopen(HDFfid, "HDFEOS INFORMATION"); if(gid == FAIL) { status = FAIL; sprintf(errbuf,"Cannot open \"HDFEOS INFORMATION\" group. \n"); H5Epush(__FILE__, "HE5_EHupdatemeta_Static", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(type); return(status); } /* *--------------------------------------------------------------* * Open dataset "StructMetadata.0", get datatype and space ID * *--------------------------------------------------------------* */ meta_id = H5Dopen(gid, "StructMetadata.0"); if( meta_id == FAIL) { status = FAIL; sprintf(errbuf,"Cannot open \"StructMetadata.0\" dataset. \n"); H5Epush(__FILE__, "HE5_EHupdatemeta_Static", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(type); return(status); } atype = H5Dget_type(meta_id); if( atype == FAIL) { status = FAIL; sprintf(errbuf,"Cannot get the dataset datatype. \n"); H5Epush(__FILE__, "HE5_EHupdatemeta_Static", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(type); return(status); } aspace = H5Dget_space(meta_id); if( aspace == FAIL ) { status = FAIL; sprintf(errbuf,"Cannot get the dataset dataspace. \n"); H5Epush(__FILE__, "HE5_EHupdatemeta_Static", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(type); return(status); } /* *-------------------------------------------------------------* * Allocate memory for the output array and Read attribute * *-------------------------------------------------------------* */ metabuf = (char *)calloc( HE5_HeosTable[fid%HE5_EHIDOFFSET].HE5_STATIC_BLKSIZE, sizeof(char)); if( metabuf == NULL ) { sprintf(errbuf,"Cannot allocate memory for meta buffer. \n"); H5Epush(__FILE__, "HE5_EHupdatemeta_Static", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); status = FAIL; free(errbuf); free(type); return(status); } utlstr = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char)); if( utlstr == NULL ) { sprintf(errbuf,"Cannot allocate memory for utility string buffer. \n"); H5Epush(__FILE__, "HE5_EHupdatemeta_Static", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); status = FAIL; free(errbuf); free(type); free(metabuf); return(status); } utlstr2 = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char)); if( utlstr2 == NULL ) { sprintf(errbuf,"Cannot allocate memory for the 2d utility string buffer. \n"); H5Epush(__FILE__, "HE5_EHupdatemeta_Static", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); status = FAIL; free(errbuf); free(type); free(metabuf); free(utlstr); return(status); } status = H5Dread(meta_id, atype,H5S_ALL, H5S_ALL, H5P_DEFAULT,metabuf); if( status == FAIL) { sprintf(errbuf, "Cannot read structural metadata. \n"); H5Epush(__FILE__, "HE5_EHupdatemeta_Static", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(type); free(metabuf); free(utlstr); free(utlstr2); return(status); } /* Find HDF-EOS structure "root" group in metadata */ /* ----------------------------------------------- */ /* Setup proper search string */ if (strcmp(structcode, "s") == 0) { strcpy(utlstr, "GROUP=SwathStructure"); } else if (strcmp(structcode, "g") == 0) { strcpy(utlstr, "GROUP=GridStructure"); } else if (strcmp(structcode, "p") == 0) { strcpy(utlstr, "GROUP=PointStructure"); } else if (strcmp(structcode, "z") == 0) { strcpy(utlstr, "GROUP=ZaStructure"); } /* Use string search routine (strstr) to move through metadata */ /* ----------------------------------------------------------- */ metaptr = strstr(metabuf, utlstr); /* Find specific (named) structure */ /* ------------------------------- */ if (metacode < 1000) { /* Save current metadata pointer */ /* ----------------------------- */ prevmetaptr = metaptr; /* First loop for "old-style" (non-ODL) metadata string */ /* ---------------------------------------------------- */ if (strcmp(structcode, "s") == 0) { sprintf(utlstr, "%s%s%s", "SwathName=\"", structname, "\""); } else if (strcmp(structcode, "g") == 0) { sprintf(utlstr, "%s%s%s", "GridName=\"", structname, "\""); } else if (strcmp(structcode, "p") == 0) { sprintf(utlstr, "%s%s%s", "PointName=\"", structname, "\""); } else if (strcmp(structcode, "z") == 0) { sprintf(utlstr, "%s%s%s", "ZaName=\"", structname, "\""); } /* Perform string search */ /* --------------------- */ metaptr = strstr(metaptr, utlstr); /* *--------------------------------------------------------------------* * If not found then return to previous position in metadata and look * * for "new-style" (ODL) metadata string * *--------------------------------------------------------------------* */ if (metaptr == NULL) { sprintf(utlstr, "%s%s%s", "GROUP=\"", structname, "\""); metaptr = strstr(prevmetaptr, utlstr); } } /* Metadata Section Switch */ /* ----------------------- */ switch ((int)abs((int)metacode)) { case 0: /* Dimension Section */ /* ================= */ /* Find beginning and end of metadata section */ /* ------------------------------------------ */ strcpy(utlstr, "\t\tGROUP=Dimension"); /* begptr = strstr(metaptr, utlstr);*/ strcpy(utlstr, "\t\tEND_GROUP=Dimension"); metaptr = strstr(metaptr, utlstr); count = 1; /* Build metadata entry string */ /* --------------------------- */ sprintf(utlstr, "%s%li%s%s%s%li%s%li%s", "\t\t\tOBJECT=Dimension_",count,"\n\t\t\t\tDimensionName=\"",&metastr[0],"\"\n\t\t\t\tSize=", (long)metadata[0],"\n\t\t\tEND_OBJECT=Dimension_", count, "\n"); break; default: { sprintf(errbuf, "Unknown metacode.\n"); H5Epush(__FILE__, "HE5_EHupdatemeta_Static", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } break; } /* Reallocate memory for a new metadata array, newbuf */ /* ------------------------------------------------------ */ newbuf = (char *) calloc(HE5_HeosTable[fid%HE5_EHIDOFFSET].HE5_STATIC_BLKSIZE, sizeof(char)); if(newbuf==NULL) { sprintf(errbuf, "Cannot allocate memory for a new metadata string.\n"); H5Epush(__FILE__, "HE5_EHupdatemeta_Static", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); status = FAIL; free(errbuf); free(type); free(metabuf); free(utlstr); free(utlstr2); return(status); } /* Copy new metadata string to newbuf array */ /* ---------------------------------------- */ strncpy(newbuf, prevmetaptr, strlen(prevmetaptr)); newbuf[strlen(prevmetaptr)] = '\0'; meta_dim_name = strstr(newbuf, metastr); utl_dim_name = strstr(utlstr, metastr); ii = strlen(newbuf) - strlen(meta_dim_name); jj = strlen(utlstr) - strlen(utl_dim_name); for(i = 1; i < jj+1; i++) { i1 = ii+i; j1 = jj+i; newbuf[i1] = utlstr[j1]; } tempdim = (hsize_t)strlen( newbuf ); tempdim++; /* *-----------------------------------------------------------------* * Write updated metadata back to dataset "StructMetadata.0" * *-----------------------------------------------------------------* */ status = H5Dwrite(meta_id, atype, H5S_ALL, H5S_ALL, H5P_DEFAULT, newbuf); if( status == FAIL) { sprintf(errbuf,"Cannot write in structural metadata.\n"); H5Epush(__FILE__, "HE5_EHupdatemeta_Static", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(type); free(metabuf); free(utlstr); free(utlstr2); free(newbuf); return(status); } free(metabuf); free(newbuf); free(utlstr); free(utlstr2); free(type); metabuf = NULL; newbuf = NULL; utlstr2 = NULL; utlstr = NULL; type = NULL; status = H5Sclose(aspace); if( status == FAIL) { sprintf(errbuf,"Cannot release the data space ID.\n"); H5Epush(__FILE__, "HE5_EHupdatemeta_Static", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } status = H5Tclose(atype); if( status == FAIL) { sprintf(errbuf, "Cannot release the data type ID.\n"); H5Epush(__FILE__, "HE5_EHupdatemeta_Static", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } status = H5Dclose(meta_id); if( status == FAIL) { sprintf(errbuf,"Cannot release the dataset ID.\n"); H5Epush(__FILE__, "HE5_EHupdatemeta_Static", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } status = H5Gclose(gid); if( status == FAIL) { sprintf(errbuf,"Cannot release the group ID.\n"); H5Epush(__FILE__, "HE5_EHupdatemeta_Static", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } free(errbuf); errbuf = NULL; COMPLETION: return status; } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHupdatemeta_Dynamic | | | | DESCRIPTION: Updates metadata | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | | | status herr_t None return status variable (0 for success, | | -1 for failure) | | | | INPUTS: | | | | fid hid_t None HDF-EOS file ID | | structname char* None Object name string | | structcode char* None "s" for a swath, "g" for a grid, | | "p" for a point, and "z" for a za. | | metacode long None Code of a metadata block to insert to. | | metastr char* None Buffer containing metadata information | | to insert. | | metadata[] hsize_t None Array of data values | | | | OUTPUTS: | | | | None | | | | NOTES: Allocates buffer in chuncks of HE5_DYNAMIC_BLKSIZE (new scheme). | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 05/17/04 Abe Taaheri Modified the version with static buffer allocation | | to adopt dynamic buffer allocation in chuncks of | | HE5_DYNAMIC_BLKSIZE | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_EHupdatemeta_Dynamic(hid_t fid, const char *structname, char *structcode, long metacode, char *metastr, hsize_t metadata[]) { herr_t status = FAIL; /* routine return status variable */ int i; /* Loop index */ hid_t gid = FAIL; /* "HDFEOS INFORMATION" group ID */ hid_t meta_id[MetaBlocks] = {FAIL}; /* "StructuralMetadat.0" group ID */ hid_t atype[MetaBlocks] = {FAIL}; /* Data type ID */ hid_t aspace[MetaBlocks] = {FAIL}; /* Data space ID */ hid_t HDFfid = FAIL; /* HDF5 file ID */ /*hsize_t tempdim = 0; */ /* Temporary variable */ long count = 0; /* Objects/Groups counter */ char *metabuf = NULL; /* Pointer to Structural Metadata array */ char *metaptr = NULL; /* Metadata pointer */ char *prevmetaptr = NULL;/* Previous position of metadata pointer */ char *utlstr = NULL; /* Utility string */ char *utlstr2 = NULL; /* Utility string 2 */ char *newbuf = NULL; /* updated metadata string */ char *type = NULL; /* data type string */ char *errbuf = NULL; /* Error message buffer */ char *meta_dim_name = NULL; char *utl_dim_name = NULL; int ii, jj, i1, j1, k1; long nmeta; /*long *metstrbufsize = 0;*/ char metutlstr[32]; int ism; long metalen; int location_updated_eos5obj_name = 0; int location_updated_dimension_name = 0; int location_updated_dimension_size = 0; int utlstr2len = 0; int newbuflen = 0; int temp_sizestrlen = 0; int metadatalen_left_sindex = 0; char* temp_smetadata_eos5obj_section = NULL; char* temp_smetadata_dimname_section = NULL; char* temp_smetadata_dimsize_section = NULL; char* temp_sizestr="Size="; char* temp_sizedata=NULL; CHECKPOINTER(structname); CHECKPOINTER(structcode); CHECKPOINTER(metastr); /* Get HDF file ID */ /* --------------- */ HDFfid = HE5_HeosTable[fid%HE5_EHIDOFFSET].HDFfid; /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_EHupdatemeta_Dynamic", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n"); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Allocate memory for data type string */ /* ------------------------------------ */ type = (char * )calloc( HE5_HDFE_TYPESTRSIZE, sizeof(char)); if(type == NULL) { sprintf(errbuf,"Cannot allocate memory for data type string. \n"); H5Epush(__FILE__, "HE5_EHupdatemeta_Dynamic", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Open "HDFEOS INFORMATION" group */ /* =============================== */ gid = H5Gopen(HDFfid, "HDFEOS INFORMATION"); if(gid == FAIL) { status = FAIL; sprintf(errbuf,"Cannot open \"HDFEOS INFORMATION\" group. \n"); H5Epush(__FILE__, "HE5_EHupdatemeta_Dynamic", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(type); return(status); } /* Determine number of structural metadata "sections" */ /* -------------------------------------------------- */ nmeta = 0; status= HE5_EHgetnmeta(gid, &nmeta); if(status == FAIL) { sprintf(errbuf,"Cannot find any StructMetadata.X dataset. \n"); H5Epush(__FILE__, "HE5_EHupdatemeta_Dynamic", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } for (ism = 0; ism < nmeta; ism++) { /* *--------------------------------------------------------------* * Open dataset "StructMetadata.X", get datatype and space ID * *--------------------------------------------------------------* */ sprintf(metutlstr, "%s%d", "StructMetadata.", ism); meta_id[ism] = H5Dopen(gid, metutlstr); if( meta_id[ism] == FAIL) { status = FAIL; sprintf(errbuf,"Cannot open %s dataset. \n", metutlstr); H5Epush(__FILE__, "HE5_EHupdatemeta_Dynamic", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(type); return(status); } atype[ism] = H5Dget_type(meta_id[ism]); if( atype[ism] == FAIL) { status = FAIL; sprintf(errbuf,"Cannot get the dataset datatype. \n"); H5Epush(__FILE__, "HE5_EHupdatemeta_Dynamic", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(type); return(status); } aspace[ism] = H5Dget_space(meta_id[ism]); if( aspace[ism] == FAIL ) { status = FAIL; sprintf(errbuf,"Cannot get the dataset dataspace. \n"); H5Epush(__FILE__, "HE5_EHupdatemeta_Dynamic", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(type); return(status); } } /* *-------------------------------------------------------------* * Allocate memory for the output array and Read attribute * *-------------------------------------------------------------* */ metabuf = (char *)calloc( HE5_DYNAMIC_BLKSIZE * nmeta, sizeof(char)); if( metabuf == NULL ) { sprintf(errbuf,"Cannot allocate memory for meta buffer. \n"); H5Epush(__FILE__, "HE5_EHupdatemeta_Dynamic", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); status = FAIL; free(errbuf); free(type); return(status); } utlstr = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char)); if( utlstr == NULL ) { sprintf(errbuf,"Cannot allocate memory for utility string buffer. \n"); H5Epush(__FILE__, "HE5_EHupdatemeta_Dynamic", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); status = FAIL; free(errbuf); free(type); free(metabuf); return(status); } metalen = 0; for (ism = 0; ism < nmeta; ism++) { status = H5Dread(meta_id[ism], atype[ism],H5S_ALL, H5S_ALL, H5P_DEFAULT,metabuf + metalen); if( status == FAIL) { sprintf(errbuf, "Cannot read structural metadata. \n"); H5Epush(__FILE__, "HE5_EHupdatemeta_Dynamic", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(type); free(metabuf); free(utlstr); return(status); } /* Determine length (# of characters) of metadata */ /* ---------------------------------------------- */ metalen = strlen(metabuf); } /* Find HDF-EOS structure "root" group in metadata */ /* ----------------------------------------------- */ /* Setup proper search string */ if (strcmp(structcode, "s") == 0) { strcpy(utlstr, "GROUP=SwathStructure"); } else if (strcmp(structcode, "g") == 0) { strcpy(utlstr, "GROUP=GridStructure"); } else if (strcmp(structcode, "p") == 0) { strcpy(utlstr, "GROUP=PointStructure"); } else if (strcmp(structcode, "z") == 0) { strcpy(utlstr, "GROUP=ZaStructure"); } /* Use string search routine (strstr) to move through metadata */ /* ----------------------------------------------------------- */ metaptr = strstr(metabuf, utlstr); /* Find specific (named) structure */ /* ------------------------------- */ if (metacode < 1000) { /* Save current metadata pointer */ /* ----------------------------- */ prevmetaptr = metaptr; /* First loop for "old-style" (non-ODL) metadata string */ /* ---------------------------------------------------- */ if (strcmp(structcode, "s") == 0) { sprintf(utlstr, "%s%s%s", "SwathName=\"", structname, "\""); } else if (strcmp(structcode, "g") == 0) { sprintf(utlstr, "%s%s%s", "GridName=\"", structname, "\""); } else if (strcmp(structcode, "p") == 0) { sprintf(utlstr, "%s%s%s", "PointName=\"", structname, "\""); } else if (strcmp(structcode, "z") == 0) { sprintf(utlstr, "%s%s%s", "ZaName=\"", structname, "\""); } /* Perform string search */ /* --------------------- */ metaptr = strstr(metaptr, utlstr); /* *--------------------------------------------------------------------* * If not found then return to previous position in metadata and look * * for "new-style" (ODL) metadata string * *--------------------------------------------------------------------* */ if (metaptr == NULL) { sprintf(utlstr, "%s%s%s", "GROUP=\"", structname, "\""); metaptr = strstr(prevmetaptr, utlstr); } } /* Metadata Section Switch */ /* ----------------------- */ switch ((int)abs((int)metacode)) { case 0: /* Dimension Section */ /* ================= */ /* Find beginning and end of metadata section */ /* ------------------------------------------ */ strcpy(utlstr, "\t\tGROUP=Dimension"); /* begptr = strstr(metaptr, utlstr);*/ strcpy(utlstr, "\t\tEND_GROUP=Dimension"); metaptr = strstr(metaptr, utlstr); count = 1; /* Build metadata entry string */ /* --------------------------- */ if( ((strcmp(metastr, "XDim") == 0) || (strcmp(metastr, "YDim") == 0))) { /* XDim and YDim assumed to be non-appendable (also cannot have Unlimited dimensions) */ return 0; } else { sprintf(utlstr, "%s%li%s%s%s%li%s%li%s", "\t\t\tOBJECT=Dimension_",count,"\n\t\t\t\tDimensionName=\"",&metastr[0],"\"\n\t\t\t\tSize=", (long)metadata[0],"\n\t\t\tEND_OBJECT=Dimension_", count, "\n"); /* // This section is only used to update the dimension size of unlimited dimension. */ { newbuf = (char *) calloc(HE5_DYNAMIC_BLKSIZE * (nmeta), sizeof(char)); if(newbuf==NULL) { sprintf(errbuf, "Cannot allocate memory for a new metadata string.\n"); H5Epush(__FILE__,"HE5_EHupdatemeta_Dynamic", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); status = FAIL; free(errbuf); free(type); free(metabuf); free(utlstr); return(status); } strncpy(newbuf, prevmetaptr, strlen(prevmetaptr)); newbuf[strlen(prevmetaptr)] = '\0'; newbuflen = strlen(newbuf); temp_smetadata_eos5obj_section = strstr((const char*)newbuf,utlstr); /* do not let NULL pointer to cause core dump */ if(temp_smetadata_eos5obj_section == NULL) return 0; location_updated_eos5obj_name = strlen(newbuf)-strlen(temp_smetadata_eos5obj_section); temp_smetadata_dimname_section = strstr((const char*)temp_smetadata_eos5obj_section,metastr); location_updated_dimension_name = strlen(temp_smetadata_eos5obj_section)-strlen(temp_smetadata_dimname_section); /* do not let NULL pointer to cause core dump */ if(temp_smetadata_dimname_section == NULL) return 0; temp_smetadata_dimsize_section = strstr((const char*)temp_smetadata_dimname_section,temp_sizestr); location_updated_dimension_size = strlen(temp_smetadata_dimname_section)-strlen(temp_smetadata_dimsize_section); temp_sizedata = strchr(temp_smetadata_dimsize_section,'\n'); utlstr2 = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char)); if( utlstr2 == NULL ) { sprintf(errbuf,"Cannot allocate memory for the 2d utility string buffer. \n"); H5Epush(__FILE__, "HE5_EHupdatemeta_Dynamic", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); status = FAIL; free(errbuf); free(type); free(metabuf); free(utlstr); return(status); } sprintf(utlstr2,"%li",(long)metadata[0]); utlstr2len = strlen(utlstr2); temp_sizestrlen = strlen(temp_sizestr); /*// The first untouched part */ ii = location_updated_eos5obj_name + location_updated_dimension_name + location_updated_dimension_size+temp_sizestrlen; /*// The changed part (from SIZE= ?? to SIZE=**) */ if((utlstr2len+ii+1) C) */ /* ------------------------------------------ */ for (i = 0; i < rank; i++) count[i] = (hsize_t)fortcount[rank - 1 - i]; fileID = (hid_t)FileID; if ((numbertype == HE5T_CHARSTRING) || (numbertype == H5T_NATIVE_CHAR) || (numbertype == H5T_C_S1)) { if (strlen((char *)datbuf) < count[0]) { sprintf(errbuf,"Size of databuf is less than the number of global attribute elements.\n"); H5Epush(__FILE__, "HE5_EHwrglatt", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); /*free(errbuf);*/ return(FAIL); } /* Allocate memory for temp buffer */ /* ------------------------------- */ tempbuf = (char * )calloc((count[0]+1), sizeof(char)); if(tempbuf == NULL) { sprintf(errbuf,"Cannot allocate memory for temp buffer.\n"); H5Epush(__FILE__, "HE5_EHwrglatt", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); /*free(errbuf);*/ return(FAIL); } strncpy(tempbuf, (char *)datbuf, count[0]); tempbuf[count[0]] = '\0'; status = HE5_EHwriteglbattr(fileID, attrname, numbertype, count, tempbuf); if(status == FAIL) { sprintf(errbuf,"Cannot write data to the global attribute.\n"); H5Epush(__FILE__, "HE5_EHwrglatt", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); /*free(errbuf);*/ free(count); free(tempbuf); return(FAIL); } free(count); /*free(errbuf);*/ free(tempbuf); } else { status = HE5_EHwriteglbattr(fileID, attrname, numbertype, count, datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot write data to the global attribute.\n"); H5Epush(__FILE__, "HE5_EHwrglatt", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); /*free(errbuf);*/ free(count); return(FAIL); } free(count); /*free(errbuf);*/ } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHrdglatt (FORTRAN wrapper) | | | | DESCRIPTION: Reads attribute from the "FILE_ATTRIBUTES" group in a file. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | FileID int file ID | | attrname char attribute name | | | | OUTPUTS: | | datbuf void I/O buffer | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | May 01 A.Muslimov Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_EHrdglatt(int FileID, char *attrname, void *datbuf) { int ret = FAIL; /* (int) return status */ herr_t status = FAIL; /* return status variable */ hid_t fileID = FAIL; /* HDF5 type File ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ fileID = (hid_t)FileID; status = HE5_EHreadglbattr(fileID,attrname,datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot read Attribute \"%s\" from the \"FILE_ATTRIBUTES\" group.\n", attrname); H5Epush(__FILE__, "HE5_EHrdglatt", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHglattinfo | | | | DESCRIPTION: FORTRAN wrapper for HE5_EHglbattrinfo() | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | FileID int File ID | | attrname char* Attribute name | | | | OUTPUTS: | | numbertype int Attribute HDFEOS data type Flag | | fortcount long Number of attribute elements | | | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | May 01 A.Muslimov Original development. | | | | END_PROLOG | | | -----------------------------------------------------------------------------*/ int HE5_EHglattinf(int FileID, char *attrname, int *numbertype, long *fortcount) { int ret = FAIL; /* (int) Return status variable */ herr_t status = FAIL; /* routine return status variable */ hid_t *ntype = (hid_t *)NULL; /* Data type ID */ hid_t fileID = FAIL; /* HDF5 type File ID */ hsize_t *count = (hsize_t *)NULL;/* Pointer to count (C order) */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* error message buffer */ /* Allocate memory for error message buffers */ /* errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_EHglattinf", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } */ count = (hsize_t *)calloc(1, sizeof(hsize_t)); if( count == NULL) { sprintf(errbuf,"Cannot allocate memory for count.\n"); H5Epush(__FILE__, "HE5_EHglattinf", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); /*free(errbuf);*/ return(FAIL); } ntype = (hid_t *)calloc(1, sizeof(hid_t)); if( ntype == (hid_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for ntype.\n"); H5Epush(__FILE__, "HE5_EHglattinf", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); /*free(errbuf);*/ free(count); return(FAIL); } fileID = (hid_t)FileID; status = HE5_EHglbattrinfo(fileID, attrname, ntype, count); if(status == FAIL) { sprintf(errbuf,"Cannot get information about global attribute from \"FILE_ATTRIBUTES\" group.\n"); H5Epush(__FILE__, "HE5_EHglattinf", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); /*free(errbuf);*/ free(count); free(ntype); return(FAIL); } *fortcount = (long)(*count); *numbertype = (int)(*ntype); /*free(errbuf);*/ free(count); free(ntype); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHinqglatts (FORTRAN wrapper) | | | | DESCRIPTION: Retrieves the number of attributes and string length of | | attribute list from "FILE_ATTRIBUTES" group | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nattr long No. of attributes in "FILE_ATTRIBUTES" | | group. | | | | INPUTS: | | FileID int file ID | | | | OUTPUTS: | | attrnames char Attribute names in "FILE_ATTRIBUTES" | | group (Comma-separated list) | | strbufsize long Attributes name list string length | | | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | May 01 A.Muslimov Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_EHinqglatts(int FileID, char *attrnames, long *strbufsize) { long nattr = FAIL; /* Number of attributes (return) */ hid_t fileID = FAIL; /* HDF5 type file ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ fileID = (hid_t)FileID; nattr = HE5_EHinqglbattrs(fileID, attrnames, strbufsize); if ( nattr < 0 ) { sprintf(errbuf, "Cannot retrieve the attributes. \n"); H5Epush(__FILE__, "HE5_EHinqglatts", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return(nattr); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHinqglbtype | | | | DESCRIPTION: FORTRAN wrapper for HE5_EHinqglbdatatype() | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | FileID int File ID | | attrname char* Attribute name | | | | OUTPUTS: | | Type int | | Class int | | Order int | | size long | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Mar 03 S.Zhao Original development. | | | | END_PROLOG | | | -----------------------------------------------------------------------------*/ int HE5_EHinqglbtype(int FileID, char *attrname, int *Type, int *Class, int *Order, long *size) { int ret = FAIL; /* (int) status variable */ herr_t status = FAIL; /* return status variable */ size_t *tsize = (size_t *)NULL; /* data size variable */ hid_t *typeID = (hid_t *)NULL; /* HDF5 Data type ID */ hid_t fileID = FAIL; /* HDF5 type File ID */ H5T_class_t *classID = (H5T_class_t *)NULL;/* Data type class ID */ H5T_order_t *order = (H5T_order_t *)NULL;/* Byte order of datatype */ char *errbuf = (char *)NULL; /* error message buffer */ /* Allocate memory for error message buffers */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_EHinqglbtype", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } typeID = (hid_t *)calloc(1, sizeof(hid_t)); if(typeID == NULL) { sprintf(errbuf,"Cannot allocate memory for typeID.\n"); H5Epush(__FILE__,"HE5_EHinqglbtype", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } tsize = (size_t *)calloc(1, sizeof(size_t)); if(tsize == NULL) { sprintf(errbuf,"Cannot allocate memory for tsize.\n"); H5Epush(__FILE__, "HE5_EHinqglbtype", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(typeID); return(FAIL); } classID = (H5T_class_t *)calloc(1, sizeof(H5T_class_t)); if(classID == (H5T_class_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for classID.\n"); H5Epush(__FILE__, "HE5_EHinqglbtype", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(typeID); free(tsize); return(FAIL); } order = (H5T_order_t *)calloc(1, sizeof(H5T_order_t)); if(order == (H5T_order_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for order.\n"); H5Epush(__FILE__, "HE5_EHinqglbtype", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(typeID); free(tsize); free(classID); return(FAIL); } fileID = (hid_t)FileID; /* Get data type information */ /* ------------------------- */ status = HE5_EHinqglbdatatype(fileID, attrname, typeID, classID, order, tsize); if(status == FAIL) { sprintf(errbuf,"Cannot get information about data type.\n"); H5Epush(__FILE__, "HE5_EHinqglbtype", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(typeID); free(tsize); free(classID); free(order); return(FAIL); } *Type = (int)(*typeID); *Class = (int)(*classID); *Order = (int)(*order); *size = (long)(*tsize); free(errbuf); free(typeID); free(classID); free(order); free(tsize); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHrdwrfileF (FORTRAN wrapper) | | | | DESCRIPTION: Opens and reads or writes an external binary file which is in | | non-Fortran format. This is needed for HDF-EOS5 routines | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | extfilename char External file name | | Flags uintn Access Code | | ntype int HDF numbertype of field datatype | | nelmnts long Number of datatype elements in data | | buffer. | | data char* Data buffer | | | | | | | | | | OUTPUTS: | | | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Jun 01 C.Praderas Original development. | | Dec 05 T.Roegner NCR 44092 - Added CYGWIN capability | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_EHrdwrfileF(char *extfilename, uintn Flags, int ntype, long nelmnts, void *data) { herr_t status = SUCCEED;/* routine return status variable */ int ret = SUCCEED;/* (int) return status variable */ long datatype_size = 0; /* Size of datatype */ long numread = 0; long numwrite = 0; char *access_code = (char *)NULL; char *errbuf = (char *)NULL;/*Error message buffer */ FILE *fptr; /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_EHrdwrfileF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Allocate memory for access code */ /* ------------------------------- */ access_code = (char * )calloc( 3, sizeof(char)); if(access_code == NULL) { H5Epush(__FILE__, "HE5_EHrdwrfileF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for access_code buffer."); HE5_EHprint("Error: Cannot allocate memory for access_code buffer, occured", __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Determine access_code */ /* --------------------- */ switch (Flags) { case 0: { strcpy(access_code, "r+"); access_code[2] = 0; } break; case 1: { strcpy(access_code, "r"); access_code[1] = 0; } break; case 2: { strcpy(access_code, "w"); access_code[1] = 0; } break; default: break; } /* Open external file */ /* ------------------ */ fptr = fopen( extfilename, access_code ); if(fptr == NULL) { sprintf(errbuf, "Cannot open external file:\"%s\".\n",extfilename) ; H5Epush(__FILE__, "HE5_EHrdwrfileF", __LINE__, H5E_FILE, H5E_CANTOPENFILE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(access_code); return(FAIL); } /* Determine datatype size */ /* ----------------------- */ switch( ntype ) { case 0: { datatype_size = sizeof(int); } break; case 1: { datatype_size = sizeof(float); } break; case 2: { datatype_size = sizeof(double); } break; case 3: { datatype_size = 1; } break; case 4: { datatype_size = 2; } break; case 5: { datatype_size = sizeof(char); } break; case 6: { datatype_size = sizeof(long); } break; default: break; } /* Read or write data to external file */ /* ----------------------------------- */ if( Flags == 0 || Flags == 2 ) { numwrite= fwrite( data, datatype_size, nelmnts, fptr ); if(numwrite <= 0) { sprintf(errbuf, "Cannot write to file:\"%s\".\n",extfilename) ; H5Epush(__FILE__, "HE5_EHrdwrfileF", __LINE__, H5E_FILE, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(access_code); return(FAIL); } } if( Flags == 1 ) { numread = fread( data, datatype_size, nelmnts, fptr ); if(numread <= 0) { sprintf(errbuf, "Cannot read from file:\"%s\".\n",extfilename) ; H5Epush(__FILE__, "HE5_EHrdwrfileF", __LINE__, H5E_FILE, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(access_code); return(FAIL); } } /* Close external file */ /* ------------------- */ fclose(fptr); free(errbuf); free(access_code); ret = (int)status; return(ret); } /* get number of metadatas for StructMetadata. * * The call HE5_GDinqmetadatas gets number of all * * meatadata datasets (jn addition to StructMetadata * * in HDFEOS INFORMATION group. */ herr_t HE5_EHgetnmeta(hid_t gid, long *nmeta) { char metutlstr[32]; hid_t status = -1; *nmeta = 0; while (1) { /* Search for "StructMetadata.x" attribute */ /* --------------------------------------- */ sprintf(metutlstr, "%s%ld", "StructMetadata.", *nmeta); H5Eset_auto(NULL,NULL); status = H5Dopen(gid, metutlstr); /* If found then increment metadata section counter else exit loop */ /* --------------------------------------------------------------- */ if (status != -1) { *nmeta = *nmeta + 1; H5Dclose(status); status = 0; } else { status = 0; break; } } if(*nmeta < 1) { return(FAIL); } return(status); } hsize_t HE5_EHset_error_on(int flag, int err_level) { H5Eclear(); if (flag == 0 || flag == 1 || flag == 2) { error_flg = flag; } else { error_flg = 0; } return(error_flg); } long HE5_EHset_error_onF(int flag, int err_level) { hsize_t status; status = HE5_EHset_error_on(flag, err_level); return((long)status); } herr_t HE5_EHprint(char *errbuf, const char *file, unsigned line) { if (error_flg == 0) { H5Eprint(stderr); } else if(error_flg == 1) { fprintf(stderr, "%s in %s on line %d \n", errbuf, file, line); } H5Eclear(); return(SUCCEED); } #ifdef H5_HAVE_FILTER_SZIP /*----------------------------------------------------------------------------- | Function: HE5_szip_can_encode | | | | Purpose: Retrieve the filter config flags for szip, tell if | | encoder is available. | | | | Return: 1: decode+encode is enabled | | 0: only decode is enabled | | -1: other | | | | Programmer: | | | | Modifications: | | | -----------------------------------------------------------------------------*/ int HE5_szip_can_encode(void ) { herr_t status; unsigned int filter_config_flags = 0; /* false */ status =H5Zget_filter_info(H5Z_FILTER_SZIP, &filter_config_flags); if ((filter_config_flags & (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) == 0) { /* filter present but neither encode nor decode is supported (???) */ return -1; } else if ((filter_config_flags & (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) == H5Z_FILTER_CONFIG_DECODE_ENABLED) { /* decoder only: read but not write */ return 0; } else if ((filter_config_flags & (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) == H5Z_FILTER_CONFIG_ENCODE_ENABLED) { /* encoder only: write but not read (???) */ return -1; } else if ((filter_config_flags & (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) == (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) { return 1; } return(-1); } #endif /* H5_HAVE_FILTER_SZIP */ /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHHEisHE5 | | | | DESCRIPTION: Find out if hdf file is HDF-EOS5 file (HDF5 based hdf-eos) | | | | | | Return Value Type Units Description | | ============ ====== ======= ===================================== | | retstatus int return TRUE (or 1) if file is HE5 | | (can be opened by EHopen and has | | SWATH, GRID, ZA, or POINT objects ) | | return FALSE (or 0) otherwise | | return -1 if file does not exist | | | | INPUTS: | | filename char Input file name | | | | OUTPUTS: | | None | | | | NOTES: Although any HDF4 file with ECS and structure metadata is HDFEOS | | file, but in practice we will consider a file as HDFEOS5 file if it | | is HDF5 based and contains one or more of the objects GRID, SWATH, | | ZA, and POINT. | | | | Date Programmer Description | | ====== ============ ================================================= | | Dec 13 Abe Taaheri Original Programmer | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_EHHEisHE5(char *filename) { int status = 0; /* return status variable for open calls */ int retstatus = 0; /* routine return status variable */ hid_t fid; herr_t cstatus; /* return status variable for close calls */ FILE *fp; int nGrid = FAIL; /* Number of grid structures in file */ int nSwath = FAIL; /* Number of swaths in file */ int nPoint = FAIL; /* Number of point structures in file */ int nZA = FAIL; /* Number of zas in file */ if ((fp = fopen(filename,"r")) == NULL) { /* file does not exist */ return(-1); } else { fclose( fp ); } /* Open file using EHopen */ /* If fails, then file is not HE5 file */ /* ---------------------------------------- */ HE5_EHset_error_on(2, 0);/* suppress both HDFEOS5 and HDF5 error repoets */ /* open HDF-EOS5 file for reading */ fid = HE5_EHopen( filename, H5F_ACC_RDONLY, H5P_DEFAULT ); if ( fid == FAIL ) { return(0); /* File is not HDF5 or HDFEOS5 file */ } else { cstatus = HE5_EHclose(fid); } /* File is HDF5 or HDFEOS5 file. See if it is HDFEOS5 */ /* Call "HE5_EHinquire" routine for grid */ /* ------------------------------------- */ nGrid = (int)HE5_EHinquire(filename, "/HDFEOS/GRIDS", NULL, NULL); if(nGrid == FAIL ) { /* Call "HE5_EHinquire" routine for swath */ /* -------------------------------------- */ nSwath = (int)HE5_EHinquire(filename, "/HDFEOS/SWATHS", NULL, NULL); if(nSwath == FAIL ) { /* Call HE5_EHinquire for point */ /* ---------------------------- */ nPoint = (int)HE5_EHinquire(filename, "/HDFEOS/POINTS", NULL, NULL); if(nPoint == FAIL ) { /* Call "HE5_EHinquire" routine for za */ /* ----------------------------------- */ nZA = HE5_EHinquire(filename, "/HDFEOS/ZAS", NULL, NULL); if ( nZA == FAIL ) { retstatus = 0; } else { retstatus = 1; } } } else { retstatus = 1; } } else { retstatus = 1; } HE5_EHset_error_on(0, 0);/* reset error report to default HDF5 errors only*/ if( retstatus == 0 ) { /* Failed to open file using GDopen, SWopen, ZAopen, and PTopen */ /* File is not HE5 file */ return(0); } else { /* File is HE5 file */ return(1); } } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHwritemeta | | | | DESCRIPTION: Writes metadata to "HDFEOS INFORMATION" | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | | | status herr_t None return status variable (0 for success, | | -1 for failure) | | | | INPUTS: | | | | fid hid_t None HDF-EOS file ID | | MetadataName char* None Name of the metadata (such as Coremetadata)| | metabuff char* None Buffer containing metadata information | | | | OUTPUTS: | | | | None | | | | NOTES: There is memory allocation in cuncks of MAX_ORDER = 65535 ] | allocated dynamically. | | The chuncks will be written to datasets "MetadataName", | | "MetadataName.1", "MetadataName.2", etc. | | | | Date Programmer Description | | ====== ============ =============================================== | | 12/1/2015 Abe Taaheri Initial version | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_EHwritemeta(hid_t fid, const char *MetadataName, char *metabuff) { herr_t status = FAIL; hid_t HDFfid = FAIL;/* HDF file ID */ int numAttr, buffsize; char *chunkBuffer = NULL, *chunkBuffer_temp = NULL; char *newAttrName = NULL; int hdfRetVal = SUCCEED; hid_t ggid; hid_t sid2; hid_t datid; size_t size; hid_t atype; char *errbuf = NULL;/* Error message buffer */ int i, remainingbuf; hid_t fid0 = 0; /* HDFEOS file ID-offset */ uintn access; hid_t grpID = FAIL; int ism; /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char *) calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_EHwritemeta", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n"); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Compute "reduced" file ID */ /* ------------------------- */ fid0 = fid % HE5_EHIDOFFSET; if( HE5_HeosTable[ fid0 ].active == 0) { status = FAIL; sprintf(errbuf,"HE5_EHwritemeta: File ID %d not active \n",fid); H5Epush(__FILE__, "HE5_EHwritemeta", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } else { /* Get HDF file ID, group ID and file access from external arrays */ /* ============================================================== */ HDFfid = HE5_HeosTable[ fid0 ].HDFfid; grpID = HE5_HeosTable[ fid0 ].gid; access = HE5_HeosTable[ fid0 ].flags; status = SUCCEED; } newAttrName = (char *)malloc((strlen(MetadataName) + 4) * sizeof(char)); buffsize = strlen(metabuff); numAttr = buffsize/MAX_ORDER + 1; /* number of MAX_ORDER chunks in metadata */ chunkBuffer = (char *)malloc((int)(MAX_ORDER + 1)*sizeof(char)); if(chunkBuffer == NULL) { H5Epush(__FILE__, "HE5_EHwritemeta", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n"); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); free(errbuf); return(FAIL); } ggid = H5Gopen(HDFfid,"HDFEOS INFORMATION"); /* if it doesn't exist, create it */ if( ggid < 0 ) { ggid = H5Gcreate(HDFfid, "HDFEOS INFORMATION", 0); if (ggid == -1) { sprintf(errbuf, "Cannot create \"HDFEOS INFORMATION\" group."); H5Epush(__FILE__, "HE5_EHwritemeta", __LINE__, H5E_OHDR, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(chunkBuffer); free(newAttrName); return(FAIL); } } for (i = 0; i < numAttr; i++) { remainingbuf = buffsize - i*MAX_ORDER; if(remainingbuf > MAX_ORDER) { memmove(chunkBuffer, metabuff + (i * MAX_ORDER) , MAX_ORDER); chunkBuffer[MAX_ORDER]= '\0'; } else { memmove(chunkBuffer, metabuff + (i * MAX_ORDER) , remainingbuf); chunkBuffer[remainingbuf]= '\0'; } /* attach the buffer to the HDF attribute */ if(i == 0) { sprintf(newAttrName, "%s", MetadataName); } else { sprintf(newAttrName, "%s.%d", MetadataName, i); } /* ------------------------------------------------------- |Create dataset "MetadataName, MetadataName.0, etc | |and attach to the "HDFEOS INFORMATION" group | ------------------------------------------------------- */ sid2 = H5Screate(H5S_SCALAR); if (sid2 == -1) { sprintf(errbuf, "Cannot create dataspace for %s dataset.",newAttrName); H5Epush(__FILE__, "HE5_EHwritemeta", __LINE__, H5E_DATASPACE, H5E_CANTCREATE, errbuf); hdfRetVal = FAIL; } if(hdfRetVal == SUCCEED) { atype = H5Tcopy(H5T_C_S1); size = (size_t)MAX_ORDER; status = H5Tset_size(atype,size); if (status == -1) { sprintf(errbuf, "Cannot set the total size for atomic datatype. \n"); H5Epush(__FILE__, "HE5_EHwritemeta", __LINE__, H5E_DATATYPE, H5E_CANTCREATE, errbuf); hdfRetVal = FAIL; } } if(hdfRetVal == SUCCEED) { datid = H5Dopen(ggid, newAttrName); if(datid == -1) { datid = H5Dcreate(ggid,newAttrName,atype,sid2,H5P_DEFAULT); if (datid == -1) { sprintf(errbuf, "Cannot create %s dataset. \n", newAttrName); H5Epush(__FILE__, "HE5_EHwritemeta", __LINE__, H5E_DATASET, H5E_CANTCREATE, errbuf); hdfRetVal = FAIL; } } } /* ----------------------------------------------------- | Write data to the dataset newAttrName | ----------------------------------------------------- */ chunkBuffer_temp = (char *) malloc((MAX_ORDER + 1)*sizeof(char)); /* initialize memory */ for(ism = 0; ism < (MAX_ORDER + 1); ism++) { chunkBuffer_temp[ism] = '\0'; } strcpy(chunkBuffer_temp, chunkBuffer); status = H5Dwrite(datid,atype,H5S_ALL,H5S_ALL,H5P_DEFAULT,chunkBuffer_temp); free(chunkBuffer_temp); chunkBuffer_temp = (char *) NULL; if( status == FAIL) { sprintf(errbuf, "Cannot write in data to the %s dataset.",newAttrName); H5Epush(__FILE__, "HE5_EHwritemeta", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); hdfRetVal = FAIL; } /* ---------------------------------------------------- | Release (close) the created objects | ---------------------------------------------------- */ if(hdfRetVal == SUCCEED) { status = H5Sclose(sid2); if (status == FAIL) { sprintf(errbuf,"Cannot release the dataspace ID."); H5Epush(__FILE__, "HE5_EHwritemeta", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); hdfRetVal = FAIL; } } if(hdfRetVal == SUCCEED) { status = H5Dclose(datid); if (status == FAIL) { sprintf(errbuf, "Cannot release the dataset ID."); H5Epush(__FILE__, "HE5_EHwritemeta", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); hdfRetVal = FAIL; } } if(hdfRetVal != SUCCEED) { HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(chunkBuffer); free(newAttrName); return(FAIL); } } status = H5Gclose(ggid); if (status == FAIL) { sprintf(errbuf, "Cannot release the \"HDFEOS INFORMATION\" group ID. \n"); H5Epush(__FILE__, "HE5_EHwritemeta", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(chunkBuffer); free(newAttrName); return(FAIL); } free(errbuf); free(chunkBuffer); free(newAttrName); errbuf = (char *) NULL; chunkBuffer = (char *) NULL; newAttrName = (char *) NULL; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHreadmeta | | | | DESCRIPTION: Reads metadata from "HDFEOS INFORMATION" | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | | | status herr_t None return status variable (0 for success, | | -1 for failure) | | | | INPUTS: | | | | fid hid_t None HDF-EOS file ID | | MetadataName char* None Name of the metadata (such as Coremetadata)| | | | OUTPUTS: | | metabuff char* None Buffer containing metadata information | | bufferSize long None size of Buffer containing metadata | | | | | | NOTES: There is memory allocation in cuncks of MAX_ORDER = 65535 ] | allocated dynamically. | | The chuncks will be read from datasets "MetadataName", | | "MetadataName.1", "MetadataName.2", etc. | | | | Date Programmer Description | | ========== ============ ============================================ | | 03/15/2017 Abe Taaheri Initial version | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_EHreadmeta(hid_t fid, const char *MetadataName, char *metabufout, long *bufferSize) { herr_t status = FAIL; hid_t HDFfid = FAIL; /* HDF file ID */ char *newAttrName = NULL; int hdfRetVal = SUCCEED; hid_t ggid= FAIL; /* "HDFEOS INFORMATION" group ID */ hid_t meta_id[MetaBlocks] = {FAIL}; hid_t atype[MetaBlocks] = {FAIL}; /* Data type ID */ hid_t aspace[MetaBlocks] = {FAIL}; /* Data space ID */ hid_t datid; size_t size; char *errbuf = NULL; /* Error message buffer */ hid_t fid0 = 0; /* HDFEOS file ID-offset*/ uintn access; hid_t grpID = FAIL; int ism; long metalen; long nmeta; char *metabuf = NULL; long strbufsize = 0; char *metadatanames = NULL; /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char *) calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_EHreadmeta", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n"); HE5_EHprint("Error: Cannot allocate memory for error buffer.", __FILE__, __LINE__); return(FAIL); } /* Compute "reduced" file ID */ /* ------------------------- */ fid0 = fid % HE5_EHIDOFFSET; if( HE5_HeosTable[ fid0 ].active == 0) { status = FAIL; sprintf(errbuf,"HE5_EHreadmeta: File ID %d not active \n",fid); H5Epush(__FILE__, "HE5_EHreadmeta", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } else { /* Get HDF file ID, group ID and file access from external arrays */ /* ============================================================== */ HDFfid = HE5_HeosTable[ fid0 ].HDFfid; grpID = HE5_HeosTable[ fid0 ].gid; access = HE5_HeosTable[ fid0 ].flags; status = SUCCEED; } newAttrName = (char *)malloc((strlen(MetadataName) + 4) * sizeof(char)); if(newAttrName == NULL) { H5Epush(__FILE__, "HE5_EHreadmeta", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n"); HE5_EHprint("Error: Cannot allocate memory for newAttrName buffer.", __FILE__, __LINE__); free(errbuf); return(FAIL); } ggid = H5Gopen(HDFfid,"HDFEOS INFORMATION"); /* if it doesn't exist, create it */ if( ggid < 0 ) { sprintf(errbuf, "Cannot open \"HDFEOS INFORMATION\" group."); H5Epush(__FILE__, "HE5_EHreadmeta", __LINE__, H5E_OHDR, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(newAttrName); return(FAIL); } /* Determine number of metadata "sections" */ /* -------------------------------------------------- */ nmeta = 0; /* status= HE5_EHgetnmeta(ggid, &nmeta); */ nmeta = HE5_EHinqmetadatas(fid, (char *)NULL, &strbufsize); if(nmeta == 0 || nmeta < 0) { status = FAIL; } if(status == FAIL) { sprintf(errbuf,"Cannot find any metadata dataset. \n"); H5Epush(__FILE__, "HE5_EHreadmeta", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(newAttrName); return(FAIL); } /* Allocate space for metadata (in units of bytes) */ /* ----------------------------------------------------- */ metabuf = (char *) calloc((int)(MAX_ORDER + 1) * nmeta, sizeof(char )); if(metabuf == NULL) { sprintf(errbuf, "Cannot allocate memory for the metadata buffer. \n"); H5Epush(__FILE__, "HE5_EHinsertmeta_Dynamic", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(newAttrName); return(FAIL); } /* initialize memory */ for(ism = 0; ism < (MAX_ORDER + 1) * nmeta; ism++) { metabuf[ism] = '\0'; } /* emplty MetadataName to add data later */ strcpy(metabuf, ""); /* Read metadata from all metadata datasets */ /* --------------------------------------------------------- */ for (ism = 0; ism < (nmeta+ 1); ism++) { if(ism == 0) { sprintf(newAttrName, "%s", MetadataName); } else { sprintf(newAttrName, "%s.%d", MetadataName, ism -1); } meta_id[ism] = H5Dopen(ggid, newAttrName); metalen = strlen(metabuf); if( meta_id[ism] == FAIL) { aspace[ism] = FAIL; atype[ism] = FAIL; /* look for next metadata dataset */ continue; } atype[ism] = H5Dget_type(meta_id[ism]); if( atype[ism] == FAIL) { status = FAIL; sprintf(errbuf,"Cannot get the dataset datatype. \n"); H5Epush(__FILE__, "HE5_EHreadmeta", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(metabuf); status = H5Dclose(meta_id[ism]); return(status); } aspace[ism] = H5Dget_space(meta_id[ism]); if( aspace[ism] == FAIL ) { status = FAIL; sprintf(errbuf,"Cannot get the dataset dataspace. \n"); H5Epush(__FILE__, "HE5_EHreadmeta", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(metabuf); status = H5Tclose(atype[ism]); status = H5Dclose(meta_id[ism]); return(status); } /* *-------------------------------------------------------------* * Allocated memory for the output array, now Read attribute * *-------------------------------------------------------------* */ status = H5Dread(meta_id[ism], atype[ism],H5S_ALL, H5S_ALL, H5P_DEFAULT, metabuf + metalen); if( status == FAIL) { sprintf(errbuf, "Cannot read metadata. \n"); H5Epush(__FILE__, "HE5_EHreadmeta", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(metabuf); return(status); } } /* Determine length (# of characters) of metadata */ /* ---------------------------------------------- */ metalen = strlen(metabuf); metabuf[metalen] = '\0'; *bufferSize = (long)strlen(metabuf); if(metabufout != NULL) { strcpy(metabufout, metabuf); } /* ---------------------------------------------------- | Release (close) the created objects | ---------------------------------------------------- */ /* close metadata for all metadata datasets */ /* --------------------------------------------------------- */ for (ism = 0; ism < (nmeta+ 1); ism++) { if(aspace[ism] != FAIL) { status = H5Sclose(aspace[ism]); if (status == FAIL) { sprintf(errbuf,"Cannot release the dataspace ID."); H5Epush(__FILE__, "HE5_EHreadmeta", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); hdfRetVal = FAIL; } } if(atype[ism] != FAIL) { status = H5Tclose(atype[ism]); if( status == FAIL) { sprintf(errbuf, "Cannot release the data type ID.\n"); H5Epush(__FILE__, "HE5_EHreadmeta", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); hdfRetVal = FAIL; } } if(meta_id[ism] != FAIL) { status = H5Dclose(meta_id[ism]); if (status == FAIL) { sprintf(errbuf, "Cannot release the dataset ID."); H5Epush(__FILE__, "HE5_EHreadmeta", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); hdfRetVal = FAIL; } } } if(hdfRetVal != SUCCEED) { HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(newAttrName); return(FAIL); } status = H5Gclose(ggid); if (status == FAIL) { sprintf(errbuf, "Cannot release the \"HDFEOS INFORMATION\" group ID. \n"); H5Epush(__FILE__, "HE5_EHreadmeta", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(newAttrName); return(FAIL); } free(errbuf); free(newAttrName); errbuf = (char *) NULL; newAttrName = (char *) NULL; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_EHinqmetadatas | | | | DESCRIPTION: Gets the string containing metadata datasets in | | HDFEOS INFORMATION group. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nmeta long number of metadatas (-1 if fails) | | | | INPUTS: | | fileID hid_t None HDF-EOS5 type file ID | | | | OUTPUTS: | | metadatanames char* metadata name(s) (comma-separated) | | strbufsize long String length of metadatas (in bytes) | | | | NOTES: | | Returns only the first metadata name for the metadata that is | | broken into sevral pices, such as myMeta, myMeta.01, myMeta.02, etc | | | | None | | | | Date Programmer Description | | ====== ============ ============================================== | | 03/16/2017 Abe Taaheri Added the api | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_EHinqmetadatas(hid_t fid, char *metadatanames, long *strbufsize) { herr_t status = FAIL;/* routine return status variable */ hid_t HDFfid = FAIL; /* HDF file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t grpID = FAIL; uintn access; long nmeta = 0; /* Number of attributes */ long idx = FAIL;/* Grid index */ char *grpname = (char *)NULL;/* Buffer for group name */ char *errbuf = (char *)NULL;/* error message buffer */ hid_t fid0 = 0; /* HDFEOS file ID-offset*/ herr_t Dstatus = FAIL;/* Status for H5Dclose */ hid_t datasetid = FAIL;/* Dataset ID */ hid_t datatype = FAIL;/* Datatype ID */ H5T_class_t classid = H5T_NO_CLASS; /* Data type class ID */ char filename[512]; hid_t infile; char hdfeosgroup[128]; char memb_name[MAX_NAME]; int otype; hid_t HIgid; herr_t err; hsize_t nobj; int i; ssize_t len; int nobjs; /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char *) calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_EHreadmeta", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer. \n"); HE5_EHprint("Error: Cannot allocate memory for error buffer.", __FILE__, __LINE__); return(FAIL); } /* Compute "reduced" file ID */ /* ------------------------- */ fid0 = fid % HE5_EHIDOFFSET; if( HE5_HeosTable[ fid0 ].active == 0) { status = FAIL; sprintf(errbuf,"HE5_EHreadmeta: File ID %d not active \n",fid); H5Epush(__FILE__, "HE5_EHreadmeta", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } else { /* Get HDF file ID, group ID and file access from external arrays */ /* ============================================================== */ HDFfid = HE5_HeosTable[ fid0 ].HDFfid; grpID = HE5_HeosTable[ fid0 ].gid; access = HE5_HeosTable[ fid0 ].flags; status = SUCCEED; } gid = H5Gopen(HDFfid,"HDFEOS INFORMATION"); if( gid < 0 ) { sprintf(errbuf, "Cannot open \"HDFEOS INFORMATION\" group."); H5Epush(__FILE__, "HE5_EHreadmeta", __LINE__, H5E_OHDR, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Determine number of metadata datasets */ /* --------------------------------------*/ nmeta = 0; status = HE5_EHfilename(fid, filename); infile = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT); strcpy(hdfeosgroup, "/HDFEOS INFORMATION"); HIgid = H5Gopen1(infile,hdfeosgroup); /* * Get all the members of the groups, one at a time. */ err = H5Gget_num_objs(HIgid, &nobj); if(nobj < 1) { return(nmeta); } *strbufsize = 0; /* If metadata names are desired then "clear" name buffer */ /* ------------------------------------------------------ */ if(metadatanames != NULL) { metadatanames[0] = 0; } nobjs = (int)nobj; for (i = 0; i < nobjs; i++) { /* * For each object in the group, get the name and * what type of object it is. ignore all but datasets. */ strcpy(memb_name, ""); len = H5Gget_objname_by_idx(HIgid, (hsize_t)i, memb_name, (size_t)MAX_NAME ); otype = H5Gget_objtype_by_idx(HIgid, (size_t)i ); /* * process each object according to its type */ switch(otype) { case H5G_LINK: /* printf(" SYM_LINK:\n"); do_link(ingid,memb_name); */ break; case H5G_GROUP: /* printf(" GROUP:\n"); outgrpid = H5Gopen1(outgid, memb_name); if(outgrpid < 0) continue; // Group is not in the output. Bail out. ingrpid = H5Gopen1(ingid,memb_name); transfer_all_groups_attr_H5(ingrpid, outgrpid, outfile_flag); H5Gclose(ingrpid); H5Gclose(outgrpid); */ break; case H5G_DATASET: datasetid = H5Dopen1(HIgid, memb_name); datatype = H5Dget_type(datasetid); classid = H5Tget_class(datatype); if(strcmp(memb_name,"StructMetadata.0")==0) { strcpy(memb_name, "StructMetadata"); len =(long)strlen(memb_name); } *strbufsize = *strbufsize + (int)len; /* Get metadatanames (if desired) */ /* --------------------------- */ if(metadatanames != NULL) { if(nmeta > 0) { if((strstr(memb_name, ".0" ) != NULL || strstr(memb_name, ".1" ) != NULL || strstr(memb_name, ".2" ) != NULL || strstr(memb_name, ".3" ) != NULL || strstr(memb_name, ".4" ) != NULL || strstr(memb_name, ".5" ) != NULL || strstr(memb_name, ".6" ) != NULL || strstr(memb_name, ".7" ) != NULL || strstr(memb_name, ".8" ) != NULL || strstr(memb_name, ".9" ) != NULL )) { continue; } else { strcat(metadatanames,","); *strbufsize = *strbufsize + 1; } } if((strstr(memb_name, ".0" ) != NULL || strstr(memb_name, ".1" ) != NULL || strstr(memb_name, ".2" ) != NULL || strstr(memb_name, ".3" ) != NULL || strstr(memb_name, ".4" ) != NULL || strstr(memb_name, ".5" ) != NULL || strstr(memb_name, ".6" ) != NULL || strstr(memb_name, ".7" ) != NULL || strstr(memb_name, ".8" ) != NULL || strstr(memb_name, ".9" ) != NULL )) { continue; } else { strcat(metadatanames, memb_name); } } nmeta = nmeta + 1; status = H5Tclose(datatype); Dstatus = H5Dclose(datasetid); break; } } free(errbuf); H5Gclose(HIgid); H5Fclose(infile); H5Gclose(gid ); return(nmeta); } #ifndef __cplusplus /* HDF types used in FORTRAN bindings */ #define INT32 INT #define INT32V INTV #define PINT32 PINT /* FORTRAN Macros */ FCALLSCFUN3(INT, HE5_EHidinfoF, HE5_EHIDINFO, he5_ehidinfo, INT, PINT, PINT) FCALLSCFUN2(DOUBLE, HE5_EHconvAngF, HE5_EHCONVANG, he5_ehconvang, DOUBLE, INT) FCALLSCFUN5(INT, HE5_EHwrglatt, HE5_EHWRGLATT, he5_ehwrglatt, INT, STRING, INT, LONGV,PVOID) FCALLSCFUN3(INT, HE5_EHrdglatt, HE5_EHRDGLATT, he5_ehrdglatt,INT,STRING,PVOID) FCALLSCFUN4(INT, HE5_EHglattinf, HE5_EHGLATTINF, he5_ehglattinf, INT, STRING, PINT, PLONG) FCALLSCFUN3(LONG, HE5_EHinqglatts, HE5_EHINQGLATTS, he5_ehinqglatts,INT,PSTRING,PLONG) FCALLSCFUN5(INT, HE5_EHrdwrfileF, HE5_EHRDWRFILE, he5_ehrdwrfile, STRING, INT, INT, LONG, PVOID) FCALLSCFUN6(INT, HE5_EHinqglbtype, HE5_EHINQGLBTYPE, he5_ehinqglbtype, INT, STRING, PINT, PINT, PINT, PLONG) FCALLSCFUN2(LONG, HE5_EHset_error_onF, HE5_EHSET_ERROR_ONF, he5_ehset_error_onf, INT, INT) FCALLSCFUN2(INT, HE5_EHgetversion, HE5_EHGETVERSION, he5_ehgetver, INT, PSTRING) FCALLSCFUN1(INT, HE5_EHHEisHE5, HE5_EHHEISHE5, he5_ehheishe5, STRING) FCALLSCFUN3(INT, HE5_EHwritemeta, HE5_EHWRITEMETA, he5_ehwritemeta, INT, STRING, STRING) FCALLSCFUN4(INT, HE5_EHreadmeta, HE5_EHREADMETA, he5_ehreadmeta, INT, STRING, STRING, PLONG) #ifdef H5_HAVE_FILTER_SZIP FCALLSCFUN0(INT, HE5_szip_can_encode, HE5_SZIP_CAN_ENCODE, he5_szip_can_encode) #endif #endif hdf-eos5-2.0/src/GDapi.c000077500000000000000000045675031507520047200147350ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (c) 1999 Emergent IT Inc. and Raytheon Systems Company | | | | Permission to use, 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 and that both that | | copyright notice and this permission notice appear in supporting | | documentation. | ---------------------------------------------------------------------------- */ #include #include #include #include #include #include #include #include #define HE5_GRIDOFFSET 671088642 /* (2**26)*10 + 2 */ #define HE5_NGRID 400 #define HE5_NGRIDREGN 512 #define M_PI1 3.14159265358979323846 #define SQUARE(x) ((x) * (x)) /* x**2 */ #ifndef MAX_NAME #define MAX_NAME 1024 #endif char HE5_GDXSDname[HE5_HDFE_NAMBUFSIZE]; char HE5_GDXSDdims[HE5_HDFE_DIMBUFSIZE]; /* Grid Structure External Arrays */ struct HE5_gridStructure { hid_t fid; /* HDF-EOS file ID */ hid_t obj_id; /* "GRIDS" group ID */ hid_t gd_id; /* one grid group ID */ hid_t data_id; /* "Data Fields" group ID */ hid_t plist; /* current dataset creation property */ HE5_DTSinfo *ddataset; /* Ptr to dataset info structure */ int compparm[5]; /* compression level */ int active; /* Flag: if file is active or not */ int tilecode; /* tile/no-tile flag */ int tilerank; /* rank of a dataset to tile */ long nDFLD; /* number of data fields */ hsize_t tiledims[HE5_DTSETRANKMAX];/* dimension sizes of tiled dataset */ char gdname[HE5_OBJNAMELENMAX]; /* grid name */ char compmethod[HE5_HDFE_NAMBUFSIZE];/* compression method */ }; struct HE5_gridStructure HE5_GDXGrid[HE5_NGRID]; struct HE5_gridRegion { hid_t fid; hid_t gridID; double upleftpt[2]; double lowrightpt[2]; long xStart; long xCount; long yStart; long yCount; long somStart; long somCount; long StartVertical[HE5_DTSETRANKMAX]; long StopVertical[HE5_DTSETRANKMAX]; char *DimNamePtr[HE5_DTSETRANKMAX]; }; struct HE5_gridRegion *HE5_GDXRegion[HE5_NGRIDREGN]; /* Grid Function Prototypes (internal routines) */ /* --------------------------------------------- */ static size_t HE5_GDfielddatasize(hid_t gridID, const char *fieldname ); static herr_t HE5_GDgetfieldID(hid_t gridID, const char *fieldname, hid_t *fieldID); static herr_t HE5_GDchkgdid(hid_t gridID, const char *routname, hid_t *fid, hid_t *gid, long *idx ); static herr_t HE5_GDwrrdfield(hid_t gridID, const char *fieldname, char *code,const hssize_t start[], const hsize_t stride[], const hsize_t edge[], void *datbuf); static herr_t HE5_GDtangentpnts(int, double[], double[], double[], double[], double[], long *); herr_t HE5_GDgetdefaults(int projcode, int zonecode, double projparm[], int spherecode, double upleftpt[], double lowrightpt[]); static int HE5_GDfldnameinfo(hid_t gridID, const char *fieldname, char *fldactualname); herr_t HE5_GDll2mm_cea(int projcode,int zonecode, int spherecode, double projparm[], long xdimsize, long ydimsize, double upleftpt[], double lowrightpt[], long npnts, double lon[], double lat[], double x[], double y[], double *scaleX, double *scaleY); herr_t HE5_GDmm2ll_cea(int projcode,int zonecode, int spherecode, double projparm[], long xdimsize, long ydimsize, double upleftpt[], double lowrightpt[], long npnts, double x[], double y[], double longitude[], double latitude[]); int HE5_szip_can_encode(void ); void HE5_GDgetEastAndNorthFiles(char *eastFile, char *northFile); static herr_t HE5_GDflddiminfo(hid_t gridID, char *fieldname, int *rank, hsize_t dims[], hsize_t maxdims[]); static herr_t HE5_GDupdatedim(hid_t gridhID, char *dimname, hsize_t dim); /* FORTRAN wrappers */ /* ================ */ /* File/Grid access routine */ int HE5_GDopenF(char *filename, int Flags); int HE5_GDcreateF(int fileID, char *gridname, long xdimsize, long ydimsize, double upleftpt[], double lowrightpt[]); int HE5_GDattachF(int fileID, char *gridname); int HE5_GDdetachF(int gridID); int HE5_GDcloseF(int fileID); /* Definition routines */ int HE5_GDdefdimF(int gridID, char *dimname, long dim); int HE5_GDdefprojF(int gridID, int projcode, int zonecode, int spherecode, double projparm[]); int HE5_GDdeforiginF(int gridID, int origincode); int HE5_GDdeffld(int gridID, char *fieldname, char *fortdimlist, char *fortmaxdimlist, int ntype, int merge); int HE5_GDsetfill(int gridID, char *fieldname, int ntype, void *fillval); int HE5_GDdefcompF(int gridID, int compcode, int compparm[]); int HE5_GDdeftileF(int gridID, int tilecode, int tilerank, long *tiledims); int HE5_GDdefcomtileF(int gridID, int compcode, int compparm[], int tilerank, long *tiledims ); int HE5_GDdefpixregF(int gridID, int pixregcode); int HE5_GDsetaliasF(int gridID, char *fieldname, char *fortaliaslist); int HE5_GDdropaliasF(int gridID, int fldgroup, char *aliasname); int HE5_GDsetflddimlabel(hid_t gridID, char *fieldname, char *dimname, char *label); int HE5_GDgetflddimlabel(hid_t gridID, char *fieldname, char *dimname, char *label); herr_t HE5_GDsetdimscale2(hid_t gridID, char *fieldname, char *dimname, char *dimscalename, const hsize_t dimsize, hid_t numbertype_in, void * data); /* I/O routines */ int HE5_GDwrfld(int gridID, char *fieldname, long fortstart[], long fortstride[], long fortedge[], void *data); int HE5_GDwrcharfld(int gridID, char *fieldname, int elemlen, int numelem, long fortstart[], long fortstride[], long fortedge[], void *data); int HE5_GDrdfld(int gridID, char *fieldname, long fortstart[], long fortstride[], long fortedge[], void *buffer); int HE5_GDrdcharfld(int gridID, char *fieldname, int elemlen, int numelem, long fortstart[], long fortstride[], long fortedge[], void *buffer); int HE5_GDgetfill(int gridID, char *fieldname, void *fillval); int HE5_GDwrattr(int gridID, char *attrname, int ntype, long fortcount[], void *datbuf); int HE5_GDwrgattr(int gridID, char *attrname, int ntype, long fortcount[], void *datbuf); int HE5_GDwrlattr(int gridID, char *fieldname, char *attrname, int ntype,long fortcount[], void *datbuf); int HE5_GDrdattr(int gridID, char *attrname, void *datbuf); int HE5_GDrdgattr(int gridID, char *attrname, void *datbuf); int HE5_GDrdlattr(int gridID, char *fieldname, char *attrname, void *datbuf); /* Inquiry routines */ long HE5_GDinqdimsF(int gridID, char *dimnames, long dims[]); long HE5_GDdiminfoF(int gridID, char *dimname); int HE5_GDinqflds(int gridID, char *fieldlist, int rank[], int ntype[]); int HE5_GDfldinfo(int gridID, char *fieldname, int *rank, long dims[], int *ntype, char *fortdimlist, char *fortmaxdimlist); int HE5_GDinqdatatypeF(int gridID, char *fieldname, char *attrname, int fieldgroup, int *type, int *TypeClass, int *TypeOrder, long *TypeSize); long HE5_GDinqgridF(char *filename, char *gridlist, long *strbufsize); int HE5_GDgridinfoF(int gridID, long *xdimsize, long *ydimsize, double upleftpt[], double lowrightpt[]); int HE5_GDatinfo(int gridID, char *attrname, int *ntype, long *fortcount); int HE5_GDgatinfo(int gridID, char *attrname, int *ntype, long *fortcount); int HE5_GDlatinfo(int gridID, char *fieldname, char *attrname, int *ntype, long *fortcount); int HE5_GDatinfo2(int gridID, char *attrname, int *ntype, long *fortcount, long *fortsize); int HE5_GDgatinfo2(int gridID, char *attrname, int *ntype, long *fortcount, long *fortsize); int HE5_GDlatinfo2(int gridID, char *fieldname, char *attrname, int *ntype, long *fortcount, long *fortsize); int HE5_GDprojinfoF(int gridID, int *projcode, int *zonecode, int *spherecode, double projparm[]); int HE5_GDorigininfoF(int gridID, int *origincode); int HE5_GDreginfo(int gridID, int regionID, char *fieldname, int *ntype, int *rank, long dims[], long *size, double upleftpt[], double lowrightpt[]); int HE5_GDpixreginfoF(int gridID, int *pixregcode); int HE5_GDcompinfoF(int gridID, char *fieldname, int *compcode, int compparm[]); long HE5_GDnentriesF(int gridID, int entrycode, long *strbufsize); long HE5_GDinqattrsF(int gridID, char *attrnames, long *strbufsize); long HE5_GDinqgrpattrsF(int gridID, char *attrnames, long *strbufsize); long HE5_GDinqlocattrsF(int gridID, char *fieldname, char *attrnames, long *strbufsize); int HE5_GDtileinfoF(int gridID, char *fieldname, int *tilecode, int *tilerank, long tiledims[]); int HE5_GDaliasinfoF(int gridID, int fldgroup, char *aliasname, int *length, char *buffer); long HE5_GDinqfldaliasF(int gridID, char *fldalias, long *strbufsize); long HE5_GDgetaliaslistF(int gridID, int fldgroup, char *aliaslist, long *strbufsize); /* Subsetting/Retrieving routines */ int HE5_GDdefboxregionF(int gridID, double cornerlon[], double cornerlat[]); int HE5_GDextractregionF(int gridID, int regionID, char *fieldname, void *buffer); int HE5_GDdeftimeperiodF(int gridID, int periodID, double starttime, double stoptime); int HE5_GDdefvrtregionF(int gridID, int regionID, char *vertObj, double range[]); int HE5_GDdupregionF(int oldregionID); int HE5_GDgetpixelsF(int gridID, long nLonLat, double lonVal[], double latVal[], long pixRow[], long pixCol[]); long HE5_GDgetpixvaluesF(int gridID, long nPixels, long pixRow[], long pixCol[], char *fieldname, void *buffer); long HE5_GDinterpolateF(int gridID, long nValues, double lonVal[], double latVal[], char *fieldname, double interpVal[]); /* EXTERNAL DATA FILE INTERFACE */ int HE5_GDsetextdataF(int gridID, char *fortfilelist, long offset[], long size[]); int HE5_GDgetextdataF(int gridID, char *fieldname, long namelength, char *fortfilelist, long offset[], long size[]); /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDopen | | | | DESCRIPTION: Opens or creates HDF file in order to create, read, or write | | a grid. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | fid hid_t None HDF-EOS file ID | | | | INPUTS: | | filename char* None Filename | | | | OUTPUTS: | | None | | | | NOTES: | | | | HDF5 Library Functions Called: | | | | None | | | | Date Programmer Description | | ====== ============ ================================================= | | 8/24/99 A. Muslimov Changed the return type from int32_t to hid_t. | | 7/12/00 A. Muslimov Unmasked the hdf5 data types. | | END_PROLOG | -----------------------------------------------------------------------------*/ hid_t HE5_GDopen(const char *filename, uintn flags) { hid_t fid = FAIL;/* hdf5 type file ID */ char *errbuf = NULL;/* Error message buffer */ /* Allocate memory for error buffer */ /* -------------------------------- */ errbuf = (char *)calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDopen", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory to error buffer."); HE5_EHprint("Error: Cannot allocate memory to error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Call EHopen to perform file access */ /* ---------------------------------- */ fid = HE5_EHopen(filename,flags, H5P_DEFAULT ); if(fid == FAIL) { sprintf(errbuf, "Cannot open the file \"%s\". Check the file name. \n", filename); H5Epush(__FILE__, "HE5_GDopen", __LINE__, H5E_FILE, H5E_CANTOPENFILE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } free(errbuf); return(fid); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDcreate | | | | DESCRIPTION: Creates a grid within the file. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | gridID hid_t None Grid structure ID | | | | INPUTS: | | fid hid_t None File ID | | gridname char None Grid structure name | | xdimsize long None Number of columns in grid | | ydimsize long None Number of rows in grid | | upleftpt double None Location (m/deg) of upper left corner | | lowrightpt double None Location (m/deg) of lower right corner | | | | OUTPUTS: | | None | | | | NOTES: | | | | HDF5 Library Functions Called: | | | | H5Gopen | | H5Gcreate | | H5Gclose | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 8/24/99 A. Muslimov Replaced gid by fid in the call to EHinsertmeta(). | | Added a statement 'nGrid = ngridopen;' to fix a bug | | associated with grid numbering in StructMetadata. | | Also, added the calls gd_id = H5Gcreate( GRIDS_ID, | | gridname, 0). Dynamically allocated memory for | | buffers. Replaced the call to EHattrcat() by | | EHdatasetcat(). Added error hadling after the calls | | to EHinsertmeta() and EHdatasetcat(). | | 3/29/00 A. Muslimov Added "Data Fields" group for consistency with the | | Swath interface. | | 7/12/00 A. Muslimov Unmasked the hdf5 data types. | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ hid_t HE5_GDcreate(hid_t fid, const char *gridname, long xdimsize, long ydimsize, double upleftpt[], double lowrightpt[]) { hid_t gridID = FAIL;/* grid ID (return value) */ hid_t HDFfid = FAIL;/* HDF file id */ hid_t gd_id = FAIL;/* gridname group ID */ hid_t GRIDS_ID = FAIL;/* GRIDS group ID */ hid_t gid = FAIL;/* HDF-EOS group ID */ hid_t data_id = FAIL;/* "Data Fields" group ID */ hid_t i; /* Loop index */ herr_t status = FAIL;/* routine status variable */ int ngridopen = 0; /* # of grid structures opened */ long nGrid = 0; /* Grid counter */ char *errbuf = (char *)NULL; /* Buffer for error message */ char *utlbuf = (char *)NULL; /* Utility buffer */ char *header = (char *)NULL; /* Structural metadata header string */ char *footer = (char *)NULL; /* Structural metadata footer string */ char *refstr1 = (char *)NULL; /* Upper left ref string (metadata) */ char *refstr2 = (char *)NULL; /* Lower right ref string (metadata) */ uintn acs = 777; /* Read/Write file access code */ HE5_LOCK; CHECKNAME(gridname); errbuf = (char *)calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char) ); if (errbuf == NULL) { H5Epush(__FILE__, "HE5_GDcreate", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Allocate memory for buffers */ /* --------------------------- */ utlbuf = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) ); if ( utlbuf == NULL ) { sprintf(errbuf, "Cannot allocate memory for buffer.\n"); H5Epush(__FILE__, "HE5_GDcreate", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } header = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) ); if ( header == NULL ) { sprintf(errbuf, "Cannot allocate memory for buffer.\n"); H5Epush(__FILE__, "HE5_GDcreate", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlbuf); return(FAIL); } footer = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) ); if ( footer == NULL ) { sprintf(errbuf, "Cannot allocate memory for buffer.\n"); H5Epush(__FILE__, "HE5_GDcreate", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlbuf); free(header); return(FAIL); } refstr1 = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) ); if ( refstr1 == NULL ) { sprintf(errbuf, "Cannot allocate memory for buffer.\n"); H5Epush(__FILE__, "HE5_GDcreate", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlbuf); free(header); free(footer); return(FAIL); } refstr2 = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) ); if ( refstr1 == NULL ) { sprintf(errbuf, "Cannot allocate memory for buffer.\n"); H5Epush(__FILE__, "HE5_GDcreate", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlbuf); free(header); free(footer); free(refstr1); return(FAIL); } /* ********************************************************** * Check for proper file ID and return HDF-EOS file ID, * * "HDFEOS" group ID and access code * ********************************************************** */ status = HE5_EHchkfid(fid,"HE5_GDcreate", &HDFfid, &gid, &acs); /* Check file access */ /* -------------------------- */ if ( acs == 0 ) { status = FAIL; sprintf(errbuf, "Cannot call HE5_GDcreate on a file opened read-only.\n"); H5Epush(__FILE__, "HE5_GDcreate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } if ( status == FAIL ) { sprintf(errbuf, "Checking for file ID failed.\n"); H5Epush(__FILE__, "HE5_GDcreate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlbuf); free(header); free(footer); free(refstr1); free(refstr2); return(FAIL); } /* Check gridname for length */ /* ------------------------- */ if ( strlen(gridname) > HE5_OBJNAMELENMAX) { status = FAIL; sprintf(errbuf, "Gridname \"%s\" must be less than %d characters.\n", gridname, HE5_OBJNAMELENMAX); H5Epush(__FILE__, "HE5_GDcreate", __LINE__, H5E_FILE, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } /* Determine number of grids currently opened */ /* ------------------------------------------- */ for (i = 0; i < HE5_NGRID; i++) ngridopen += HE5_GDXGrid[i].active; /* Setup file interface */ /* -------------------- */ if (ngridopen < HE5_NGRID) { /* Probe , check if GRIDS group exists */ /* ----------------------------------- */ H5E_BEGIN_TRY { GRIDS_ID = H5Gopen(gid, "GRIDS"); } H5E_END_TRY; if(GRIDS_ID == FAIL ) { nGrid = 0; /* Create the "GRIDS" group */ /* ------------------------ */ GRIDS_ID = H5Gcreate(gid,"GRIDS",0); if ( GRIDS_ID == FAIL ) { sprintf(errbuf, "Cannot create \"GRIDS\" group.\n"); H5Epush(__FILE__, "HE5_GDcreate", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (errbuf != NULL) free(errbuf); if (utlbuf != NULL) free(utlbuf); if (header != NULL) free(header); if (footer != NULL) free(footer); if (refstr1 != NULL) free(refstr1); if (refstr2 != NULL) free(refstr2); return( FAIL ); } } /* Group "GRIDS" exists */ else { /* Probe , check if gridname group exists */ /* -------------------------------------- */ H5E_BEGIN_TRY{ gd_id = H5Gopen(GRIDS_ID, gridname); } H5E_END_TRY; if( gd_id == FAIL ) { /* Get the number of grids in "GRIDS" group */ /* ---------------------------------------- */ nGrid = HE5_EHdatasetcat(fid, "/HDFEOS/GRIDS", NULL, NULL); if (nGrid == FAIL ) { sprintf(errbuf,"Cannot retrieve the number of grids."); H5Epush(__FILE__, "HE5_GDcreate", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); H5Gclose(GRIDS_ID); if (errbuf != NULL) free(errbuf); if (utlbuf != NULL) free(utlbuf); if (header != NULL) free(header); if (footer != NULL) free(footer); if (refstr1 != NULL) free(refstr1); if (refstr2 != NULL) free(refstr2); return(FAIL); } } else { sprintf(errbuf, "Grid \"%s\" already exists.", gridname); H5Epush(__FILE__, "HE5_GDcreate", __LINE__, H5E_BTREE, H5E_EXISTS, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); H5Gclose(GRIDS_ID); if (errbuf != NULL) free(errbuf); if (utlbuf != NULL) free(utlbuf); if (header != NULL) free(header); if (footer != NULL) free(footer); if (refstr1 != NULL) free(refstr1); if (refstr2 != NULL) free(refstr2); return(FAIL); } } /* gridname does not exist */ /* ----------------------- */ /* Create gridname group */ /* --------------------- */ gd_id = H5Gcreate( GRIDS_ID, gridname, 0); if ( gd_id == FAIL ) { sprintf(errbuf, "Cannot create \"%s\" group.\n", gridname); H5Epush(__FILE__, "HE5_GDcreate", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (errbuf != NULL) free(errbuf); if (utlbuf != NULL) free(utlbuf); if (header != NULL) free(header); if (footer != NULL) free(footer); if (refstr1 != NULL) free(refstr1); if (refstr2 != NULL) free(refstr2); return( FAIL ); } /* Create "gridname/Data Fields" group */ /* ----------------------------------- */ data_id = H5Gcreate( gd_id, "Data Fields", 0); if ( data_id == FAIL ) { sprintf(errbuf, "Cannot create \"Data Fields\" group.\n"); H5Epush(__FILE__, "HE5_GDcreate", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (errbuf != NULL) free(errbuf); if (utlbuf != NULL) free(utlbuf); if (header != NULL) free(header); if (footer != NULL) free(footer); if (refstr1 != NULL) free(refstr1); if (refstr2 != NULL) free(refstr2); return( FAIL ); } /* Establish Grid in Structural MetaData Block */ /* -------------------------------------------- */ sprintf(header, "%s%li%s%s%s%s%li%s%s%li%s", "\tGROUP=GRID_", nGrid + 1, "\n\t\tGridName=\"", gridname, "\"\n", "\t\tXDim=", xdimsize, "\n", "\t\tYDim=", ydimsize, "\n"); sprintf(footer, "%s%s%s%s%s%s%s%li%s", "\t\tGROUP=Dimension\n", "\t\tEND_GROUP=Dimension\n", "\t\tGROUP=DataField\n", "\t\tEND_GROUP=DataField\n", "\t\tGROUP=MergedFields\n", "\t\tEND_GROUP=MergedFields\n", "\tEND_GROUP=GRID_", nGrid + 1, "\n"); /* Build Ref point Col-Row strings */ /* ------------------------------- */ if ( upleftpt == NULL || ( upleftpt[0] == 0 && upleftpt[1] == 0 && lowrightpt[0] == 0 && lowrightpt[1] == 0)) { strcpy(refstr1, "DEFAULT"); strcpy(refstr2, "DEFAULT"); } else { sprintf(refstr1, "%s%lf%s%lf%s","(", upleftpt[0], ",", upleftpt[1], ")"); sprintf(refstr2, "%s%lf%s%lf%s", "(", lowrightpt[0], ",", lowrightpt[1], ")"); } sprintf(utlbuf, "%s%s%s%s%s%s%s%s", header, "\t\tUpperLeftPointMtrs=", refstr1, "\n","\t\tLowerRightMtrs=", refstr2, "\n",footer); /* Insert record to SM dataset */ /* --------------------------- */ status = HE5_EHinsertmeta(fid, (char*)gridname, "g", 1002L, utlbuf, NULL); if (status == FAIL ) { sprintf(errbuf,"Cannot insert metadata."); H5Epush(__FILE__, "HE5_GDcreate", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); H5Gclose(GRIDS_ID); if (errbuf != NULL) free(errbuf); if (utlbuf != NULL) free(utlbuf); if (header != NULL) free(header); if (footer != NULL) free(footer); if (refstr1 != NULL) free(refstr1); if (refstr2 != NULL) free(refstr2); return(FAIL); } /* Release "GRIDS" group ID */ /* ------------------------ */ status = H5Gclose(GRIDS_ID); if ( status == FAIL ) { sprintf(errbuf, "Cannot close \"GRIDS\" group.\n"); H5Epush(__FILE__, "HE5_GDcreate", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (errbuf != NULL) free(errbuf); if (utlbuf != NULL) free(utlbuf); if (header != NULL) free(header); if (footer != NULL) free(footer); if (refstr1 != NULL) free(refstr1); if (refstr2 != NULL) free(refstr2); return( FAIL ); } /* Set up entries in external Table */ /* -------------------------------- */ for (i = 0; i < HE5_NGRID; i++) { if (HE5_GDXGrid[ i ].active == 0) { gridID = i + HE5_GRIDOFFSET; HE5_GDXGrid[ i ].active = 1; HE5_GDXGrid[ i ].fid = fid; HE5_GDXGrid[ i ].gd_id = gd_id; HE5_GDXGrid[ i ].data_id = data_id; HE5_GDXGrid[ i ].obj_id = GRIDS_ID; HE5_GDXGrid[ i ].plist = FAIL; HE5_GDXGrid[ i ].tilecode = HE5_HDFE_NOTILE; strcpy(HE5_GDXGrid[ i ].gdname, gridname); strcpy(HE5_GDXGrid[ i ].compmethod,"HE5_HDFE_COMP_NONE"); break; } } } else { /* Too many files opened */ /* --------------------- */ gridID = FAIL; sprintf(errbuf, "No more than %d grids may be opened simutaneously.\n", HE5_NGRID); H5Epush(__FILE__, "HE5_GDcreate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } /* Deallocate memory */ /* ----------------- */ if (errbuf != NULL) free(errbuf); if (utlbuf != NULL) free(utlbuf); if (header != NULL) free(header); if (footer != NULL) free(footer); if (refstr1 != NULL) free(refstr1); if (refstr2 != NULL) free(refstr2); utlbuf = NULL; header = NULL; footer = NULL; refstr1 = NULL; refstr2 = NULL; errbuf = NULL; COMPLETION: HE5_UNLOCK; return(gridID); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDattach | | | | DESCRIPTION: Attaches to an existing grid within the file. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | gridID hid_t None HDF-EOS type grid ID | | | | INPUTS: | | fid hid_t None HDF-EOS file id | | gridname char* None grid sructure name | | | | OUTPUTS: | | None | | | | NOTES: | | | | HDF5 Library Functions Called: | | H5Gopen | | H5Giterate | | H5Dopen | | | | Date Programmer Description | | ====== ============ ================================================= | | 9/24/99 A.Muslimov Added proper error handling after function calls. | | Removed redundant if(status==0){} brackets. | | In the block if( inout.name != NULL){} changed the | | statement before the last one from | | "if(inout.name==NULL) free(inout.name);" onto | | "if(inout.name!=NULL) free(inout.name);" | | Changed the datatype of idx from int32_t to int. | | 10/18/99 A.Muslimov Replaced memcpy() by memmove() to avoid a problem | | when arguments 1 and 2 overlap in memory. | | 10/18/99 A.Taaheri Replaced strcpy() by memmove() to avoid a problem | | when arguments 1 and 2 overlap in memory. | | 01/21/00 A.Muslimov Reset the value of "tilecode" to HDFE_NOTILE in | | external array. | | 02/24/00 A.Muslimov Added more error checkings and cleanings. | | 03/29/00 A.Muslimov Added attaching to the "Data Fields" group. | | 07/12/00 A.Muslimov Unmasked hdf5 data types. | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | END_PROLOG | -----------------------------------------------------------------------------*/ hid_t HE5_GDattach(hid_t fid, const char *gridname) { hid_t gridID = FAIL; /* Return value of the Grid ID */ hid_t HDFfid = FAIL; /* HDF-EOS file ID */ hid_t datid = FAIL; /* dataset ID */ hid_t infogid = FAIL; /* "HDFEOS" group ID */ hid_t gd_id = FAIL; /* Grid group ID */ hid_t data_id = FAIL; /* "Data Fields" Group ID */ hid_t i; /* Loop index */ hid_t emptyslot = FAIL; /* "empty" grid index */ herr_t status = FAIL; /* routine return status variable */ int ngridopen = 0; /* no. of grid structures opened */ int idx = FAIL; /* Object index */ uintn acs = 777; /* Read/Write file access code */ HE5_OBJINFO inout; /* IN/OUT data of the operation */ char *grpname = (char *)NULL; /* Grid group name string */ char *errbuf = (char *)NULL; /* Error message buffer */ char *namebuf = (char *)NULL; /* Name list buffer */ char *fldname = (char *)NULL; /* Dataset name buffer */ char *comma = (char *)NULL; /* Pointer to the comma */ HE5_LOCK; CHECKPOINTER(gridname); /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory to error buffer."); HE5_EHprint("Error: Cannot allocate memory to error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* ********************************************************** * Check for proper file ID and return HDF-EOS file ID, * * "HDFEOS" group ID and access code * ********************************************************** */ status = HE5_EHchkfid(fid, "HE5_GDattach", &HDFfid, &infogid, &acs); if ( status == FAIL ) { sprintf(errbuf, "Checking for grid ID failed.\n"); H5Epush(__FILE__, "HE5_GDattach", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Determine number of grids currently opened */ /* ------------------------------------------ */ for (i = 0; i < HE5_NGRID; i++) ngridopen += HE5_GDXGrid[ i ].active; if (ngridopen < HE5_NGRID) { /* Allocate memory to the "HDFEOS/GRIDS/gridname" buffer */ grpname = (char *)calloc( (strlen(gridname)+40), sizeof(char)); if(grpname == NULL) { sprintf(errbuf, "Cannot allocate memory to the grpname.\n"); H5Epush(__FILE__, "HE5_GDattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } strcpy( grpname, "/HDFEOS/GRIDS/"); strcat( grpname, gridname); /* Try to open the Grid group */ /* ========================== */ H5E_BEGIN_TRY{ gd_id = H5Gopen(HDFfid,grpname); } H5E_END_TRY; if( gd_id == FAIL ) { sprintf(errbuf, "Grid:\"%s\" does not exist within HDF file.",gridname) ; H5Epush(__FILE__, "HE5_GDattach", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if(grpname != NULL) free(grpname); free(errbuf); return(FAIL); } /* Try to open the "Data Fields" group */ /* =================================== */ H5E_BEGIN_TRY{ data_id = H5Gopen(gd_id,"Data Fields"); } H5E_END_TRY; if( data_id == FAIL ) { sprintf(errbuf, "Group \"Data Fields\" does not exist in \"%s\" grid.",gridname) ; H5Epush(__FILE__, "HE5_GDattach", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if(grpname != NULL) free(grpname); free(errbuf); return(FAIL); } /* Setup External Arrays */ /* ===================== */ for (i = 0; i < HE5_NGRID; i++) { /* Find empty entry in array of grids */ /* ---------------------------------- */ if (HE5_GDXGrid[ i ].active == 0) { /* Set IDs, Flags, and Codes */ /* -------------------------- */ HE5_GDXGrid[ i ].active = 1; HE5_GDXGrid[ i ].fid = fid; HE5_GDXGrid[ i ].gd_id = gd_id; HE5_GDXGrid[ i ].data_id = data_id; HE5_GDXGrid[ i ].plist = FAIL; HE5_GDXGrid[ i ].tilecode = HE5_HDFE_NOTILE; strcpy(HE5_GDXGrid[ i ].compmethod,"HE5_HDFE_COMP_NONE"); gridID = i + HE5_GRIDOFFSET; strcpy(HE5_GDXGrid[ i ].gdname, gridname); break; } } emptyslot = i; /* Get the number of OBJECTS within the "Data Fields" group */ /* ========================================================= */ inout.count = 0; inout.name = NULL; inout.strsize = 0; strcat( grpname, "/Data Fields"); idx = H5Giterate(data_id, grpname , NULL, HE5_EHobj_info, &inout); if (idx == FAIL ) { sprintf(errbuf, "Cannot get information about \"Data Fields\" group.\n"); H5Epush(__FILE__, "HE5_GDattach", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); if (grpname != NULL) free(grpname); return(FAIL); } if(grpname != NULL) free(grpname); /* Set the data members of external structure */ /* ========================================== */ HE5_GDXGrid[ emptyslot ].nDFLD = inout.count; /*--------------------------------------------------*/ /* Loop through all datasets and open them */ /* Allocate space for namebuf, */ /* copy inout.name into it, append comma, etc. */ /*--------------------------------------------------*/ if( inout.name != NULL && inout.count > 0 ) { /* Allocate memory to "ddataset" struct */ HE5_GDXGrid[emptyslot].ddataset = (HE5_DTSinfo *)realloc((void *)HE5_GDXGrid[emptyslot].ddataset,(HE5_GDXGrid[emptyslot].nDFLD) * sizeof(HE5_DTSinfo)); if(HE5_GDXGrid[ emptyslot ].ddataset == NULL) { sprintf(errbuf, "Cannot allocate memory to the ddataset structure.\n"); H5Epush(__FILE__, "HE5_GDattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Allocate memory to the name list buffer */ namebuf = (char *) calloc(strlen(inout.name) + 2, sizeof(char)); if(namebuf == NULL) { sprintf(errbuf, "Cannot allocate memory to the name list buffer.\n"); H5Epush(__FILE__, "HE5_GDattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } strcpy(namebuf, inout.name); strcat(namebuf, ","); /* Find comma */ comma = strchr(namebuf, ','); i = 0; /* Loop through entries in name list */ /* ================================= */ while (comma != NULL) { /* Copy field list entry to fldname */ fldname = (char *) calloc(comma - namebuf + 1, sizeof(char)); if(fldname == NULL) { sprintf(errbuf, "Cannot allocate memory to fldname.\n"); H5Epush(__FILE__, "HE5_GDattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(namebuf); return(FAIL); } memmove(fldname, namebuf, comma - namebuf); fldname[comma - namebuf] = 0; /* Open the dataset */ /* ================ */ datid = H5Dopen(data_id, fldname); if ( datid == FAIL) { sprintf(errbuf, "Cannot open the dataset \"%s\" .\n", fldname); H5Epush(__FILE__, "HE5_GDattach", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(namebuf); free(fldname); return(FAIL); } /*allocate memory to the dataset name*/ HE5_GDXGrid[ emptyslot ].ddataset[ i ].name = (char *) calloc((strlen(fldname)+1), sizeof(char) ); if(HE5_GDXGrid[ emptyslot ].ddataset[ i ].name == NULL) { sprintf(errbuf, "Cannot allocate memory to the dataset name.\n"); H5Epush(__FILE__, "HE5_GDattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(namebuf); free(fldname); return(FAIL); } /* Set the data members of external structure */ /* ========================================== */ HE5_GDXGrid[ emptyslot ].ddataset[ i ].ID = datid; strcpy(HE5_GDXGrid[ emptyslot ].ddataset[ i ].name, fldname); /* Go to the next dataset/field entry */ /* ================================== */ memmove(namebuf, comma + 1, strlen(comma)-1); namebuf[strlen(comma)-1] = 0; comma = strchr(namebuf, ','); if (fldname != NULL) free(fldname); i++; } if (namebuf != NULL) { free(namebuf); namebuf = NULL; } if(inout.name != NULL ) { free( inout.name); inout.name = NULL; } } /* end 'if(name!==NULL)' */ } else { /* Too many Grids opened */ gridID = FAIL; sprintf(errbuf, "No more than %d grids may be open simultaneously", HE5_NGRID); H5Epush(__FILE__, "HE5_GDattach", __LINE__, H5E_FILE, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } if (errbuf != NULL) free(errbuf); COMPLETION: HE5_UNLOCK; return(gridID); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDchkgdid | | | | DESCRIPTION: | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t None hdf5 type grid ID | | routname char None Name of routine calling GDchkgdid | | | | OUTPUTS: | | fid hid_t None HDF-EOS file ID | | gid hid_t None "HDFEOS" group ID | | idx long None Grid index | | | | NOTES: | | | | HDF5 Library Functions Called: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 9/30/99 A.Muslimov Added error handlings after the function calls. | | 07/12/00 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ static herr_t HE5_GDchkgdid(hid_t gridID, const char *routname, hid_t *fid, hid_t *gid, long *idx ) { herr_t status = SUCCEED;/* routine return status variable */ uintn access = 777; /* Read/Write file access code */ hid_t HDFfid = FAIL; /* HDF-EOS file ID */ long idOffset = HE5_GRIDOFFSET;/* HDF-EOS Grid ID offset */ char message1[] = "Invalid grid id: %d in routine \"%s\". ID must be >= %d and < %d.\n"; char message2[] = "Grid id %d in routine \"%s\" not active.\n"; char errbuf[HE5_HDFE_ERRBUFSIZE]; /* ******************************* * Check for proper grid ID * ******************************* */ if (gridID < idOffset || gridID >= HE5_NGRID + idOffset) { status = FAIL; sprintf(errbuf, message1, gridID, routname, idOffset, HE5_NGRID + idOffset); H5Epush(__FILE__, "HE5_GDchkgdid", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } else { /* Check for active grid ID */ /* ------------------------- */ if (HE5_GDXGrid[gridID % idOffset].active == 0) { status = FAIL; sprintf(errbuf, message2, gridID, routname); H5Epush(__FILE__, "HE5_GDchkgdid", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf) ; HE5_EHprint(errbuf, __FILE__, __LINE__); } else { /* Get Grid index */ /* -------------- */ *idx = HE5_EHhid2long(gridID) % idOffset; if ( *idx == FAIL) { status = FAIL; sprintf(errbuf, "Cannot get the Grid index \n"); H5Epush(__FILE__, "HE5_GDchkgdid", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf) ; HE5_EHprint(errbuf, __FILE__, __LINE__); } /* Get HDF-EOS file ID and "HDFEOS" group ID */ /* ----------------------------------------- */ *fid = HE5_GDXGrid[ *idx ].fid; status = HE5_EHchkfid(*fid,"", &HDFfid, gid, &access); if (status == FAIL) { sprintf(errbuf, "Checking for file ID failed.\n"); H5Epush(__FILE__,"HE5_GDchkgdid", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } } return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDdefdim | | | | DESCRIPTION: Defines a new dimension within the grid. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | dimname char* None Dimension name to define | | dim hsize_t None Dimemsion value | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | HDF5 Library Functions Called: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 9/20/99 A.Muslimov In the call to EHinsertmeta() replaced the argument | | gid by fid. | | 9/27/99 A.Muslimov Added proper error handlings. Removed redundant | | if(status == 0){} brackets. | | 1/06/00 A.Muslimov Changed the datatype of "dim" from int32_t to | | hsize_t to make a call to EHinsertmeta() successfull| | 07/12/00 A.Muslimov Unmasked hdf5 data types. | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDdefdim(hid_t gridID, char *dimname, hsize_t dim) { herr_t status = FAIL; /* routine return status variable */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t fid = FAIL; /* HDF-EOS file ID */ long idx = FAIL; /* Grid index */ char *errbuf = (char *)NULL;/* Buffer for error message */ HE5_LOCK; CHECKNAME(dimname); /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDdefdim", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDdefdim", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for grid ID failed.\n"); H5Epush(__FILE__, "HE5_GDdefdim", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Insert Dimension value to Structural MetaData */ /* --------------------------------------------- */ status = HE5_EHinsertmeta(fid, HE5_GDXGrid[idx].gdname, "g", 0L, dimname, &dim); if (status == FAIL ) { status = FAIL; sprintf(errbuf,"Cannot insert metadata."); H5Epush(__FILE__, "HE5_GDdefdim", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } free(errbuf); errbuf = NULL; COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDdefproj | | | | DESCRIPTION: Defines projection of grid. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | projcode int GCTP projection code | | zonecode int UTM zone code | | spherecode int GCTP spheriod code | | projparm double Projection parameters | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | HDF5 Library Functions Called: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 8/24/99 A.Muslimov In the call to EHinsertmeta() replaced the argument | | gid by fid. Added error handling after the call to | | EHinsertmeta(). | | 4/19/00 A.Muslimov Changed 'slen' type from long to size_t. | | 07/12/00 A.Muslimov Unmasked hdf5 data types. | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDdefproj(hid_t gridID, int projcode, int zonecode, int spherecode, double projparm[]) { herr_t status = FAIL; /* routine return status variable */ int i; /* Loop index */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* Grid group ID */ long idx = FAIL; /* Grid index */ size_t slen = 0; /* String length */ char *utlbuf = (char *)NULL; /* Utility Buffer */ char projparmbuf[HE5_HDFE_UTLBUFSIZE];/* Projection parameter */ char *GCTPproj[128] = {"HE5_GCTP_GEO","HE5_GCTP_UTM","HE5_GCTP_SPCS", "HE5_GCTP_ALBERS","HE5_GCTP_LAMCC","HE5_GCTP_MERCAT", "HE5_GCTP_PS","HE5_GCTP_POLYC","HE5_GCTP_EQUIDC", "HE5_GCTP_TM","HE5_GCTP_STEREO", "HE5_GCTP_LAMAZ", "HE5_GCTP_AZMEQD", "HE5_GCTP_GNOMON","HE5_GCTP_ORTHO", "HE5_GCTP_GVNSP","HE5_GCTP_SNSOID","HE5_GCTP_EQRECT", "HE5_GCTP_MILLER","HE5_GCTP_VGRINT","HE5_GCTP_HOM", "HE5_GCTP_ROBIN","HE5_GCTP_SOM","HE5_GCTP_ALASKA", "HE5_GCTP_GOOD", "HE5_GCTP_MOLL","HE5_GCTP_IMOLL", "HE5_GCTP_HAMMER","HE5_GCTP_WAGIV","HE5_GCTP_WAGVII", "HE5_GCTP_OBLEQA"/*,"HE5_GCTP_CEA","HE5_GCTP_BCEA", "HE5_GCTP_ISINUS"*/};/* GCTP projection codes */ char *errbuf = (char *)NULL; /* Buffer for error message */ HE5_LOCK; /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDdefproj", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Allocate memory for utility buffer */ /* ---------------------------------- */ utlbuf = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) ); if(utlbuf == NULL) { sprintf(errbuf, "Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_GDdefproj", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Add "non-standard" GCTP codes */ /* ----------------------------- */ GCTPproj[ 97 ] = (char *)calloc( (strlen("HE5_GCTP_CEA")+ 1), sizeof(char) ); if(GCTPproj[ 97 ] == NULL) { sprintf(errbuf, "Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_GDdefproj", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlbuf); return(FAIL); } strcpy(GCTPproj[97], "HE5_GCTP_CEA"); GCTPproj[ 98 ] = (char *)calloc( (strlen("HE5_GCTP_BCEA")+ 1), sizeof(char) ); if(GCTPproj[ 98 ] == NULL) { sprintf(errbuf, "Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_GDdefproj", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlbuf); free(GCTPproj[97]); return(FAIL); } strcpy(GCTPproj[98], "HE5_GCTP_BCEA"); GCTPproj[ 99 ] = (char *)calloc( (strlen("HE5_GCTP_ISINUS") + 1), sizeof(char) ); if(GCTPproj[ 99 ] == NULL) { sprintf(errbuf, "Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_GDdefproj", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlbuf); free(GCTPproj[97]); free(GCTPproj[98]); return(FAIL); } strcpy(GCTPproj[99], "HE5_GCTP_ISINUS"); /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDdefproj", &fid, &gid, &idx); if (status == SUCCEED) { /* * If projection not GEO, UTM, or State Code build projection * parameter string */ if (projcode != HE5_GCTP_GEO && projcode != HE5_GCTP_UTM && projcode != HE5_GCTP_SPCS) { /* Begin projection parameter list with "(" */ strcpy(projparmbuf, "("); /* Add each projection parameter to string */ for (i = 0; i < 13; i++) { /* If projparm[i] = 0 ... */ if (projparm[i] == 0.0) { strcpy(utlbuf, "0,"); } else { /* if projparm[i] is integer ... */ if ( ((long)projparm[ i ]) == projparm[ i ]) { sprintf(utlbuf, "%li%s", (long)projparm[ i ], ","); } /* else if projparm[i] is between 0 and 1 ... */ else if ((i == 1) && (projparm[1] > 0) && (projparm[1] < 1)) { sprintf(utlbuf, "%g%s", projparm[i], ","); } else { sprintf(utlbuf, "%lf%s", projparm[i], ","); } } strcat(projparmbuf, utlbuf); } slen = strlen(projparmbuf); /* Add trailing ")" */ projparmbuf[slen - 1] = ')'; } /* Build metadata string */ /* --------------------- */ if (projcode == HE5_GCTP_GEO) { int spherecode_tmp = 12; sprintf(utlbuf, "%s%s%s%s%d%s", "\t\tProjection=", GCTPproj[projcode], "\n", "\t\tSphereCode=", spherecode_tmp, "\n"); } else if (projcode == HE5_GCTP_UTM || projcode == HE5_GCTP_SPCS) { sprintf(utlbuf, "%s%s%s%s%d%s%s%d%s", "\t\tProjection=", GCTPproj[projcode], "\n", "\t\tZoneCode=", zonecode, "\n", "\t\tSphereCode=", spherecode, "\n"); } else { sprintf(utlbuf, "%s%s%s%s%s%s%s%d%s", "\t\tProjection=", GCTPproj[projcode], "\n", "\t\tProjParams=", projparmbuf, "\n", "\t\tSphereCode=", spherecode, "\n"); } /* Insert in structural metadata */ /* ----------------------------- */ status = HE5_EHinsertmeta(fid, HE5_GDXGrid[ idx ].gdname, "g", 101L, utlbuf, NULL); if (status == FAIL ) { sprintf(errbuf,"Cannot insert metadata.\n"); H5Epush(__FILE__, "HE5_GDdefproj", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlbuf); if (GCTPproj[97] != NULL) free(GCTPproj[97]); if (GCTPproj[98] != NULL) free(GCTPproj[98]); if (GCTPproj[99] != NULL) free(GCTPproj[99]); return(FAIL); } } free(errbuf); free(utlbuf); free(GCTPproj[97]); free(GCTPproj[98]); free(GCTPproj[99]); GCTPproj[97] = NULL; GCTPproj[98] = NULL; GCTPproj[99] = NULL; utlbuf = NULL; errbuf = NULL; COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDblkSOMoffset | | | | DESCRIPTION: Writes Block SOM offset values | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | offset long Offset values | | count[] hsize_t Number of offset values | | code char w/r code (w/r) | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | HDF5 Library Functions Called: | | | | Date Programmer Description | | ====== ============ ================================================= | | Feb 00 A.Muslimov Added more checkings. | | 07/12/00 A.Muslimov Unmasked hdf5 data types. | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDblkSOMoffset(hid_t gridID, long offset[], hsize_t count[], char *code) { herr_t status = FAIL; /* routine return status variable */ int projcode = FAIL; /* GCTP projection code */ int i; /* Loop index */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ long idx = FAIL; /* Grid index */ double projparm[13]; /* Projection parameters */ char utlbuf[HE5_HDFE_UTLBUFSIZE];/* Utility Buffer */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message Buffer */ HE5_LOCK; CHECKPOINTER(offset); CHECKPOINTER(count); CHECKPOINTER(code); /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDblkSOMoffset", &fid, &gid, &idx); if (status == SUCCEED) { /* Initialize projection parameters */ /* -------------------------------- */ for (i = 0; i < 13; i++) projparm[i] = 0.; /* Get projection parameters */ /* ------------------------- */ status = HE5_GDprojinfo(gridID, &projcode, NULL, NULL, projparm); if ( status == FAIL) { sprintf(errbuf, "Cannot get projection information.\n"); H5Epush(__FILE__, "HE5_GDblkSOMoffset", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* If SOM projection with projparm[11] non-zero ... */ /* ------------------------------------------------ */ if (projcode == HE5_GCTP_SOM && projparm[11] != 0) { sprintf(utlbuf, "%s", "_BLKSOM"); /* Write offset values as attribute */ if (strcmp(code, "w") == 0) { status = HE5_GDwriteattr(gridID, "_BLKSOM", H5T_NATIVE_LONG, count, offset); if ( status == FAIL) { sprintf(errbuf, "Cannot write in offset values.\n"); H5Epush(__FILE__, "HE5_GDblkSOMoffset", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } /* Read offset values from attribute */ /* --------------------------------- */ else if (strcmp(code, "r") == 0) { status = HE5_GDreadattr(gridID, utlbuf, offset); if ( status == FAIL) { sprintf(errbuf, "Cannot read out the offset values.\n"); H5Epush(__FILE__, "HE5_GDblkSOMoffset", __LINE__, H5E_ATTR, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } } } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDdefcomp | | | | DESCRIPTION: Defines compression type and parameters | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | compcode int compression code | | compparm int compression parameters | | | | OUTPUTS: | | None | | | | NOTES: Before calling this function, storage must be CHUNKED | | Values of compression code | | HDFE_COMP_NONE 0 | | HDFE_COMP_RLE 1 | | HDFE_COMP_NBIT 2 | | HDFE_COMP_SKPHUFF 3 | | HDFE_COMP_DEFLATE 4 | | HDFE_COMP_SZIP_CHIP 5 | | HDFE_COMP_SZIP_K13 6 | | HDFE_COMP_SZIP_EC 7 | | HDFE_COMP_SZIP_NN 8 | | HDFE_COMP_SZIP_K13orEC 9 | | HDFE_COMP_SZIP_K13orNN 10 | | HDFE_COMP_SHUF_DEFLATE 11 | | HDFE_COMP_SHUF_SZIP_CHIP 12 | | HDFE_COMP_SHUF_SZIP_K13 13 | | HDFE_COMP_SHUF_SZIP_EC 14 | | HDFE_COMP_SHUF_SZIP_NN 15 | | HDFE_COMP_SHUF_SZIP_K13orEC 16 | | HDFE_COMP_SHUF_SZIP_K13orNN 17 | | RLE=Run Length Encoding | | | | HDF5 Library Functions Called: | | H5Pget_layout | | H5Pset_layout | | H5Pset_deflate | | H5Pset_szip | | H5Pset_shuffle | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 8/24/99 A.Muslimov Changed the return type from intn to int . | | 1/18/99 A.Muslimov Added compcode parameter, and "switch (comcode)" | | block. | | 07/12/00 A.Muslimov Unmasked hdf5 data types. | | 06/04/01 A.Muslimov Added checking for compression code/level. | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | Aug 03 S.Zhao Added Szip compression methods. | | Oct 03 S.Zhao Added the shuffling method. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDdefcomp(hid_t gridID, int compcode, int compparm[]) { herr_t status = FAIL;/* routine return status variable */ int level = 0; /* compression level */ hid_t fid = FAIL;/* HDF-EOS file id */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t (*func)(void*); void *edata = (void *)NULL; long idx = FAIL;/* Grid index */ H5D_layout_t layout = H5D_LAYOUT_ERROR;/* Type of storage */ int can_encode=0; /* szip encoder presence flag */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ H5Eget_auto((H5E_auto1_t *)&func,&edata); HE5_LOCK; CHECKPOINTER(compparm); /* Check if compression code is valid */ /* ---------------------------------- */ if( compcode != HE5_HDFE_COMP_DEFLATE && compcode != HE5_HDFE_COMP_NONE && compcode != HE5_HDFE_COMP_SZIP_CHIP && compcode != HE5_HDFE_COMP_SZIP_K13 && compcode != HE5_HDFE_COMP_SZIP_EC && compcode != HE5_HDFE_COMP_SZIP_NN && compcode != HE5_HDFE_COMP_SZIP_K13orEC && compcode != HE5_HDFE_COMP_SZIP_K13orNN && compcode != HE5_HDFE_COMP_SHUF_DEFLATE && compcode != HE5_HDFE_COMP_SHUF_SZIP_CHIP && compcode != HE5_HDFE_COMP_SHUF_SZIP_K13 && compcode != HE5_HDFE_COMP_SHUF_SZIP_EC && compcode != HE5_HDFE_COMP_SHUF_SZIP_NN && compcode != HE5_HDFE_COMP_SHUF_SZIP_K13orEC && compcode != HE5_HDFE_COMP_SHUF_SZIP_K13orNN ) { status = FAIL; H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, "Invalid/unsupported compression code. \n"); HE5_EHprint("Error: Invalid/unsupported compression code, occured", __FILE__, __LINE__); return(status); } if( compcode == HE5_HDFE_COMP_DEFLATE || compcode == HE5_HDFE_COMP_NONE || compcode == HE5_HDFE_COMP_SHUF_DEFLATE) { /* Check GZIP compression level */ /* ---------------------------- */ if( compparm[0] < 0 || compparm[0] > 9) { status = FAIL; H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, "Invalid GZIP compression level. \n"); HE5_EHprint("Error: Invalid GZIP compression level, occured", __FILE__, __LINE__); return(status); } } else { /* Check SZIP compression block size */ /* --------------------------------- */ if( compparm[0] != 2 && compparm[0] != 4 && compparm[0] != 6 && compparm[0] != 8 && compparm[0] != 10 && compparm[0] != 12 && compparm[0] != 14 && compparm[0] != 16 && compparm[0] != 18 && compparm[0] != 20 && compparm[0] != 22 && compparm[0] != 24 && compparm[0] != 26 && compparm[0] != 28 && compparm[0] != 30 && compparm[0] != 32) { status = FAIL; H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, "Invalid SZIP compression block size. \n"); HE5_EHprint("Error: Invalid SZIP compression block size, occured", __FILE__, __LINE__); return(status); } } #ifdef H5_HAVE_FILTER_SZIP can_encode = HE5_szip_can_encode(); #endif /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDdefcomp", &fid, &gid, &idx); if (status == FAIL) { H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_ARGS, H5E_BADRANGE, "Checking for grid ID failed.\n"); HE5_EHprint("Error: Checking for grid ID failed, occured", __FILE__, __LINE__); return( status ); } /* if current property instance has not been created, report error */ /* --------------------------------------------------------------- */ if( HE5_GDXGrid[ idx ].plist == FAIL ) { if (compcode != HE5_HDFE_COMP_NONE) { status = FAIL; H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_PLIST, H5E_NOTFOUND, "Unable to compress, dataset storage layout has not been set to CHUNKED."); HE5_EHprint("Error: Unable to compress, dataset storage layout has not been set to CHUNKED, occured", __FILE__, __LINE__); return(status); } } else { layout = H5Pget_layout(HE5_GDXGrid[ idx ].plist); if( layout != H5D_CHUNKED ) { status = H5Pset_layout(HE5_GDXGrid[idx].plist, H5D_CHUNKED); if ( status == FAIL ) { H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot set the layout.\n"); HE5_EHprint("Error: Cannot set the layout, occured", __FILE__, __LINE__); return(status ); } } switch(compcode) { /* Set NBIT compression parameters in ext. array */ /* --------------------------------------------- */ case HE5_HDFE_COMP_NBIT: HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ]; HE5_GDXGrid[ idx ].compparm[ 1 ] = compparm[ 1 ]; HE5_GDXGrid[ idx ].compparm[ 2 ] = compparm[ 2 ]; HE5_GDXGrid[ idx ].compparm[ 3 ] = compparm[ 3 ]; break; /* Set compression method to HE5_HDFE_COMP_DEFLATE */ /* ----------------------------------------------- */ case HE5_HDFE_COMP_DEFLATE: level = compparm[0]; status = H5Pset_deflate(HE5_GDXGrid[ idx ].plist, level); if ( status == FAIL) { H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot set GZIP compression method.\n"); HE5_EHprint("Error: Cannot set GZIP compression method, occured", __FILE__, __LINE__); return(status ); } /* ------------------------------------------------- */ /* Set GZIP compression method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_DEFLATE"); HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ]; break; case HE5_HDFE_COMP_SZIP_CHIP: #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_CHIP_OPTION_MASK,compparm[0]); if ( status == FAIL) { H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot set SZIP_CHIP compression method.\n"); HE5_EHprint("Error: Cannot set SZIP_CHIP compression method, occured", __FILE__, __LINE__); return(status ); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set SZIP_CHIP compression method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SZIP_CHIP"); HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ]; break; case HE5_HDFE_COMP_SZIP_K13: #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_ALLOW_K13_OPTION_MASK,compparm[0]); if ( status == FAIL) { H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot set SZIP_K13 compression method.\n"); HE5_EHprint("Error: Cannot set SZIP_K13 compression method, occured", __FILE__, __LINE__); return(status ); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set SZIP_K13 compression method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SZIP_K13"); HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ]; break; case HE5_HDFE_COMP_SZIP_EC: #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_EC_OPTION_MASK,compparm[0]); if ( status == FAIL) { H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot set SZIP_EC compression method.\n"); HE5_EHprint("Error: Cannot set SZIP_EC compression method, occured", __FILE__, __LINE__); return(status ); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set SZIP_EC compression method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SZIP_EC"); HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ]; break; case HE5_HDFE_COMP_SZIP_NN: #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_NN_OPTION_MASK,compparm[0]); if ( status == FAIL) { H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot set SZIP_NN compression method.\n"); HE5_EHprint("Error: Cannot set SZIP_NN compression method, occured", __FILE__, __LINE__); return(status ); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set SZIP_NN compression method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SZIP_NN"); HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ]; break; case HE5_HDFE_COMP_SZIP_K13orEC: #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_EC_OPTION_MASK,compparm[0]); if ( status == FAIL) { H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot set SZIP_K13orSZIP_EC compression method.\n"); HE5_EHprint("Error: Cannot set SZIP_K13orSZIP_EC compression method, occured", __FILE__, __LINE__); return(status ); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------------- */ /* Set SZIP_K13orEC compression method and compression */ /* parameters in external array */ /* ------------------------------------------------------- */ strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SZIP_K13orHE5_HDFE_COMP_SZIP_EC"); HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ]; break; case HE5_HDFE_COMP_SZIP_K13orNN: #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK,compparm[0]); if ( status == FAIL) { H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot set SZIP_K13orSZIP_NN compression method.\n"); HE5_EHprint("Error: Cannot set SZIP_K13orSZIP_NN compression method, occured", __FILE__, __LINE__); return(status ); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ----------------------------------------------------- */ /* Set SZIP_K13orNN compression method and compression */ /* parameters in external array */ /* ----------------------------------------------------- */ strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SZIP_K13orHE5_HDFE_COMP_SZIP_NN"); HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ]; break; case HE5_HDFE_COMP_SHUF_DEFLATE: status = H5Pset_shuffle(HE5_GDXGrid[idx].plist); if (status == FAIL) { H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, "Cannot set the shuffling method. \n"); HE5_EHprint("Error: Cannot set the shuffling method, occured", __FILE__, __LINE__); return(status); } level = compparm[0]; status = H5Pset_deflate(HE5_GDXGrid[ idx ].plist, level); if ( status == FAIL) { H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot set GZIP compression method.\n"); HE5_EHprint("Error: Cannot set GZIP compression method, occured", __FILE__, __LINE__); return(status ); } /* ------------------------------------------------- */ /* Set shuffling+GZIP method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SHUF_DEFLATE"); HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ]; break; case HE5_HDFE_COMP_SHUF_SZIP_CHIP: status = H5Pset_shuffle(HE5_GDXGrid[idx].plist); if (status == FAIL) { H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, "Cannot set the shuffling method. \n"); HE5_EHprint("Error: Cannot set the shuffling method, occured", __FILE__, __LINE__); return(status); } #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_CHIP_OPTION_MASK,compparm[0]); if ( status == FAIL) { H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot set SZIP_CHIP compression method.\n"); HE5_EHprint("Error: Cannot set SZIP_CHIP compression method, occured", __FILE__, __LINE__); return(status ); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set shuffling+SZIP_CHIP method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SHUF_SZIP_CHIP"); HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ]; break; case HE5_HDFE_COMP_SHUF_SZIP_K13: status = H5Pset_shuffle(HE5_GDXGrid[idx].plist); if (status == FAIL) { H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, "Cannot set the shuffling method. \n"); HE5_EHprint("Error: Cannot set the shuffling method, occured", __FILE__, __LINE__); return(status); } #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_ALLOW_K13_OPTION_MASK,compparm[0]); if ( status == FAIL) { H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot set SZIP_K13 compression method.\n"); HE5_EHprint("Error: Cannot set SZIP_K13 compression method, occured", __FILE__, __LINE__); return(status ); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set shuffling+SZIP_K13 method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SHUF_SZIP_K13"); HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ]; break; case HE5_HDFE_COMP_SHUF_SZIP_EC: status = H5Pset_shuffle(HE5_GDXGrid[idx].plist); if (status == FAIL) { H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, "Cannot set the shuffling method. \n"); HE5_EHprint("Error: Cannot set the shuffling method, occured", __FILE__, __LINE__); return(status); } #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_EC_OPTION_MASK,compparm[0]); if ( status == FAIL) { H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot set SZIP_EC compression method.\n"); HE5_EHprint("Error: Cannot set SZIP_EC compression method, occured", __FILE__, __LINE__); return(status ); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set shuffling+SZIP_EC method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SHUF_SZIP_EC"); HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ]; break; case HE5_HDFE_COMP_SHUF_SZIP_NN: status = H5Pset_shuffle(HE5_GDXGrid[idx].plist); if (status == FAIL) { H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, "Cannot set the shuffling method. \n"); HE5_EHprint("Error: Cannot set the shuffling method, occured", __FILE__, __LINE__); return(status); } #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_NN_OPTION_MASK,compparm[0]); if ( status == FAIL) { H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot set SZIP_NN compression method.\n"); HE5_EHprint("Error: Cannot set SZIP_NN compression method, occured", __FILE__, __LINE__); return(status ); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set shuffling+SZIP_NN method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SHUF_SZIP_NN"); HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ]; break; case HE5_HDFE_COMP_SHUF_SZIP_K13orEC: status = H5Pset_shuffle(HE5_GDXGrid[idx].plist); if (status == FAIL) { H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, "Cannot set the shuffling method. \n"); HE5_EHprint("Error: Cannot set the shuffling method, occured", __FILE__, __LINE__); return(status); } #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_EC_OPTION_MASK,compparm[0]); if ( status == FAIL) { H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot set SZIP_K13orEC compression method.\n"); HE5_EHprint("Error: Cannot set SZIP_K13orEC compression method, occured", __FILE__, __LINE__); return(status ); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------------ */ /* Set shuffling+SZIP_K13orEC method and compression */ /* parameters in external array */ /* ------------------------------------------------------ */ strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SHUF_SZIP_K13orEC"); HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ]; break; case HE5_HDFE_COMP_SHUF_SZIP_K13orNN: status = H5Pset_shuffle(HE5_GDXGrid[idx].plist); if (status == FAIL) { H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, "Cannot set the shuffling method. \n"); HE5_EHprint("Error: Cannot set the shuffling method, occured", __FILE__, __LINE__); return(status); } #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK,compparm[0]); if ( status == FAIL) { H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot set SZIP_K13orNN compression method.\n"); HE5_EHprint("Error: Cannot set SZIP_K13orNN compression method, occured", __FILE__, __LINE__); return(status ); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------------ */ /* Set shuffling+SZIP_K13orNN method and compression */ /* parameters in external array */ /* ------------------------------------------------------ */ strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SHUF_SZIP_K13orNN"); HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ]; break; case HE5_HDFE_COMP_NONE: strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_NONE"); HE5_GDXGrid[idx].compparm[0] = compparm[0]; break; default: { status = FAIL; H5Epush(__FILE__, "HE5_GDdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, "Compression method is not specified.\n"); HE5_EHprint("Error: Compression method is not specified, occured", __FILE__, __LINE__); } break; } } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDdeftile | | | | DESCRIPTION: Defines tiling parameters | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | tilecode int tile code | | tilerank int number of tiling dimensions | | tiledims hsize_t tiling dimensions | | | | OUTPUTS: | | None | | | | NOTES: | | None | | | | HDF5 Library Functions Called: | | H5Pcreate | | H5Pset_layout | | H5Pset_chunk | | | | Date Programmer Description | | ====== ============ ================================================= | | Jan 00 A.Muslimov Changed the datatype of tiledims[] from int32_t to | | const hsize_t. Added retrieving/creation of the | | property list. Added setting up of the dataset | | chunking. | | Feb 00 A.Muslimov Added error checkings. | | 07/12/00 A.Muslimov Unmasked hdf5 data types. | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDdeftile(hid_t gridID, int tilecode, int tilerank, const hsize_t *tiledims) { herr_t status = FAIL; /* routine return status variable */ int i; /* Loop index */ hid_t fid = FAIL; /* HDF-EOS file id */ hid_t gid = FAIL; /* "HDFEOS" group ID */ long idx = FAIL; /* Grid index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message Buffer */ int temp_tilerank; hsize_t temp_dims[8]; HE5_LOCK; /*CHECKPOINTER(tiledims);*/ if (tilerank == 0) { temp_tilerank = 1; } else { temp_tilerank = tilerank; } /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDdeftile", &fid, &gid, &idx); if (status == SUCCEED) { /* Initialize external array */ /* ------------------------- */ for (i = 0; i < HE5_DTSETRANKMAX; i++) { HE5_GDXGrid[ idx ].tiledims[ i ] = 0; } HE5_GDXGrid[ idx ].tilecode = tilecode; switch (tilecode) { case HE5_HDFE_NOTILE: HE5_GDXGrid[idx].tilerank = 0; break; case HE5_HDFE_TILE: HE5_GDXGrid[ idx ].tilerank = temp_tilerank; for (i = 0; i < temp_tilerank; i++) { HE5_GDXGrid[ idx ].tiledims[ i ] = tiledims[ i ]; if (HE5_GDXGrid[ idx ].tiledims[i] == 0) { HE5_GDXGrid[ idx ].tiledims[ i ] = 1; } } break; default: { sprintf(errbuf, "Unknown tile code.\n"); H5Epush(__FILE__, "HE5_GDdeftile", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } break; } /* get the current dataset creation property ID from external array */ /* if current property instance has not been created, then create it */ /* ----------------------------------------------------------------- */ if( HE5_GDXGrid[idx].plist == FAIL) { HE5_GDXGrid[idx].plist = H5Pcreate(H5P_DATASET_CREATE); if ( HE5_GDXGrid[idx].plist == FAIL ) { status = FAIL; sprintf(errbuf, "Cannot create the property list.\n"); H5Epush(__FILE__, "HE5_GDdeftile", __LINE__, H5E_PLIST, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } /* Set layout */ /* ---------- */ status = H5Pset_layout( HE5_GDXGrid[idx].plist, H5D_CHUNKED); if ( status == FAIL ) { sprintf(errbuf, "Cannot set the type of storage of the raw data to \"CHUNKED\".\n"); H5Epush(__FILE__, "HE5_GDdeftile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Set chunking */ /* ------------ */ if (tiledims == NULL) { for (i = 0; i < temp_tilerank; i++) { temp_dims[ i ] = 1; HE5_GDXGrid[ idx ].tiledims[ i ] = temp_dims[ i ]; } } else { for (i = 0; i < temp_tilerank; i++) { temp_dims[ i ] = tiledims[i]; HE5_GDXGrid[ idx ].tiledims[ i ] = temp_dims[ i ]; } } status = H5Pset_chunk( HE5_GDXGrid[idx].plist, temp_tilerank, temp_dims); if ( status == FAIL ) { sprintf(errbuf, "Cannot set the sizes of the chunks.\n"); H5Epush(__FILE__, "HE5_GDdeftile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDdefcomtile | | | | DESCRIPTION: Defines compression type and parameters and sets tiling/ | | chunking | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | compcode int compression code | | compparm[] int compression parameters | | tilerank int number of tiling dimensions | | tiledims hsize_t tiling dimensions | | | | OUTPUTS: | | None | | | | HDF5 Library Functions Called: | | H5Pcreate | | H5Pget_layout | | H5Pset_layout | | H5Pset_deflate | | H5Pset_szip | | | | | | Date Programmer Description | | ======== ============ ================================================= | | 07/24/00 A.Muslimov Original development. | | 06/04/01 A.Muslimov Added checking for compression code/level. | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | Aug 03 S.Zhao Added Szip compression methods. | | Oct 03 S.Zhao Added the shuffling method. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDdefcomtile(hid_t gridID, int compcode, int compparm[], int tilerank, const hsize_t *tiledims ) { herr_t status = FAIL;/* routine return status variable */ int i; /* Loop index */ hid_t fid = FAIL;/* HDF-EOS file id */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t (*func)(void*); hsize_t dims[HE5_DTSETRANKMAX];/* default dimension sizes */ void *edata = (void *)NULL; long idx = FAIL;/* Grid index */ H5D_layout_t layout = H5D_LAYOUT_ERROR;/* Type of storage of the raw data */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message Buffer */ int can_encode; /* szip encoder presence flag */ H5Eget_auto((H5E_auto1_t *)&func,&edata); HE5_LOCK; CHECKPOINTER(compparm); /*CHECKPOINTER(tiledims);*/ /* Check if compression code is valid */ /* ---------------------------------- */ if( compcode != HE5_HDFE_COMP_DEFLATE && compcode != HE5_HDFE_COMP_NONE && compcode != HE5_HDFE_COMP_SZIP_CHIP && compcode != HE5_HDFE_COMP_SZIP_K13 && compcode != HE5_HDFE_COMP_SZIP_EC && compcode != HE5_HDFE_COMP_SZIP_NN && compcode != HE5_HDFE_COMP_SZIP_K13orEC && compcode != HE5_HDFE_COMP_SZIP_K13orNN && compcode != HE5_HDFE_COMP_SHUF_DEFLATE && compcode != HE5_HDFE_COMP_SHUF_SZIP_CHIP && compcode != HE5_HDFE_COMP_SHUF_SZIP_K13 && compcode != HE5_HDFE_COMP_SHUF_SZIP_EC && compcode != HE5_HDFE_COMP_SHUF_SZIP_NN && compcode != HE5_HDFE_COMP_SHUF_SZIP_K13orEC && compcode != HE5_HDFE_COMP_SHUF_SZIP_K13orNN ) { status = FAIL; H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_ARGS, H5E_BADVALUE, "Invalid/unsupported compression code. \n"); HE5_EHprint("Error: Invalid/unsupported compression code, occured", __FILE__, __LINE__); return(status); } if( compcode == HE5_HDFE_COMP_DEFLATE || compcode == HE5_HDFE_COMP_NONE || compcode == HE5_HDFE_COMP_SHUF_DEFLATE) { /* Check GZIP compression level */ /* ---------------------------- */ if( compparm[0] < 0 || compparm[0] > 9) { status = FAIL; H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_ARGS, H5E_BADVALUE, "Invalid GZIP compression level. \n"); HE5_EHprint("Error: Invalid GZIP compression level, occured", __FILE__, __LINE__); return(status); } } else { /* Check SZIP compression block size */ /* --------------------------------- */ if( compparm[0] != 2 && compparm[0] != 4 && compparm[0] != 6 && compparm[0] != 8 && compparm[0] != 10 && compparm[0] != 12 && compparm[0] != 14 && compparm[0] != 16 && compparm[0] != 18 && compparm[0] != 20 && compparm[0] != 22 && compparm[0] != 24 && compparm[0] != 26 && compparm[0] != 28 && compparm[0] != 30 && compparm[0] != 32) { status = FAIL; H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_ARGS, H5E_BADVALUE, "Invalid SZIP compression block size. \n"); HE5_EHprint("Error: Invalid SZIP compression block size, occured", __FILE__, __LINE__); return(status); } } #ifdef H5_HAVE_FILTER_SZIP can_encode = HE5_szip_can_encode(); #endif /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDdefcomtile", &fid, &gid, &idx); if (status == FAIL) { sprintf(errbuf,"Checking for grid ID failed.\n"); H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return( status ); } /* Initialize arrays */ /* ----------------- */ for (i = 0; i < HE5_DTSETRANKMAX; i++) { HE5_GDXGrid[ idx ].tiledims[ i ] = 0; dims[ i ] = 0; } /* Get the current property list ID */ /* -------------------------------- */ if( HE5_GDXGrid[ idx ].plist == FAIL ) { /* create property list */ /* -------------------- */ HE5_GDXGrid[idx].plist = H5Pcreate(H5P_DATASET_CREATE); if (HE5_GDXGrid[idx].plist == FAIL ) { status = FAIL; sprintf(errbuf, "Cannot create the property list."); H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_PLIST, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* set layout to "H5D_CHUNKED" */ /* --------------------------- */ status = H5Pset_layout( HE5_GDXGrid[idx].plist, H5D_CHUNKED); if (status == FAIL ) { sprintf(errbuf, "Cannot set the \"CHUNKED\" type of storage."); H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_STORAGE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { /* Get layout of the raw data */ /* -------------------------- */ layout = H5Pget_layout(HE5_GDXGrid[ idx ].plist); if (layout == H5D_LAYOUT_ERROR) { status = FAIL; sprintf(errbuf, "Cannot get the layout of the raw data."); H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_STORAGE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } if( layout != H5D_CHUNKED ) { /* set layout to "H5D_CHUNKED" */ /* --------------------------- */ status = H5Pset_layout(HE5_GDXGrid[idx].plist, H5D_CHUNKED); if ( status == FAIL ) { H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot set the layout.\n"); HE5_EHprint("Error: Cannot set the layout, occured", __FILE__, __LINE__); return(status ); } } } /* Set tiling/chunking */ /* ------------------- */ if ( tilerank > 0 && tiledims != (hsize_t *)NULL) { status = H5Pset_chunk( HE5_GDXGrid[idx].plist, tilerank, tiledims); if (status == FAIL ) { sprintf(errbuf, "Cannot set the sizes of chunks."); H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Set tile/chunk sizes */ /* -------------------- */ for (i = 0; i < tilerank; i++) HE5_GDXGrid[ idx ].tiledims[ i ] = tiledims[ i ]; } else if ( tilerank > 0 && tiledims == (hsize_t *)NULL) { /* Set default tile/chunk sizes */ /* ---------------------------- */ for (i = 0; i < tilerank; i++) { /* dims[ i ] = HE5_CHUNKSIZE;*/ dims[ i ] = 1; HE5_GDXGrid[ idx ].tiledims[ i ] = dims[ i ]; } if (compcode == HE5_HDFE_COMP_NONE) { HE5_GDXGrid[idx].tilecode = HE5_HDFE_NOTILE; } status = H5Pset_chunk( HE5_GDXGrid[idx].plist, tilerank, dims); if (status == FAIL) { sprintf(errbuf, "Cannot set the sizes of chunks."); H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Invalid dataset rank: %d .", tilerank); H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } HE5_GDXGrid[ idx ].tilerank = tilerank; switch(compcode) { /* Set NBIT compression parameters in ext. array */ case HE5_HDFE_COMP_NBIT: HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ]; HE5_GDXGrid[ idx ].compparm[ 1 ] = compparm[ 1 ]; HE5_GDXGrid[ idx ].compparm[ 2 ] = compparm[ 2 ]; HE5_GDXGrid[ idx ].compparm[ 3 ] = compparm[ 3 ]; break; /* Set compression method to HE5_HDFE_COMP_DEFLATE */ /* ----------------------------------------------- */ case HE5_HDFE_COMP_DEFLATE: status = H5Pset_deflate(HE5_GDXGrid[ idx ].plist,compparm[0]); if ( status == FAIL) { sprintf(errbuf, "Cannot set GZIP compresssion method and level."); H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* ------------------------------------------------- */ /* Set GZIP compression method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_DEFLATE"); HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ]; break; case HE5_HDFE_COMP_SZIP_CHIP: #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_CHIP_OPTION_MASK,compparm[0]); if ( status == FAIL) { sprintf(errbuf, "Cannot set SZIP_CHIP compression method and block size.\n"); H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_GDdefcomptile", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set SZIP_CHIP compression method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SZIP_CHIP"); HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ]; break; case HE5_HDFE_COMP_SZIP_K13: #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_EC_OPTION_MASK,compparm[0]); if ( status == FAIL) { sprintf(errbuf, "Cannot set SZIP_K13 cmpression method and block size.\n"); H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_GDdefcomptile", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set SZIP_K13 compression method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SZIP_K13"); HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ]; break; case HE5_HDFE_COMP_SZIP_EC: #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_EC_OPTION_MASK,compparm[0]); if ( status == FAIL) { sprintf(errbuf, "Cannot set SZIP_EC compression method and block size.\n"); H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_GDdefcomptile", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set SZIP_EC compression method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SZIP_EC"); HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ]; break; case HE5_HDFE_COMP_SZIP_NN: #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_NN_OPTION_MASK,compparm[0]); if ( status == FAIL) { sprintf(errbuf, "Cannot set SZIP_NN compression method and block size.\n"); H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_GDdefcomptile", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set SZIP_NN compression method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SZIP_NN"); HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ]; break; case HE5_HDFE_COMP_SZIP_K13orEC: #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_EC_OPTION_MASK,compparm[0]); if ( status == FAIL) { sprintf(errbuf, "Cannot set SZIP_K13orEC compression method and block size.\n"); H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_GDdefcomptile", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ---------------------------------------------------------- */ /* Set SZIP_K13orEC compression method and compression */ /* parameters in external array */ /* ---------------------------------------------------------- */ strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SZIP_K13orEC"); HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ]; break; case HE5_HDFE_COMP_SZIP_K13orNN: #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK,compparm[0]); if ( status == FAIL) { sprintf(errbuf, "Cannot set SZIP_K13orNN compression method and block size.\n"); H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_GDdefcomptile", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ---------------------------------------------------------- */ /* Set SZIP_K13orNN compression method and compression */ /* parameters in external array */ /* ---------------------------------------------------------- */ strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SZIP_K13orNN"); HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ]; break; case HE5_HDFE_COMP_SHUF_DEFLATE: status = H5Pset_shuffle(HE5_GDXGrid[idx].plist); if ( status == FAIL) { sprintf(errbuf, "Cannot set the shuffling method."); H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Pset_deflate(HE5_GDXGrid[ idx ].plist,compparm[0]); if ( status == FAIL) { sprintf(errbuf, "Cannot set GZIP compresssion method and level."); H5Epush(__FILE__,"HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* ------------------------------------------------- */ /* Set shuffling+GZIP method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SHUF_DEFLATE"); HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ]; break; case HE5_HDFE_COMP_SHUF_SZIP_CHIP: status = H5Pset_shuffle(HE5_GDXGrid[idx].plist); if ( status == FAIL) { sprintf(errbuf, "Cannot set the shuffling method."); H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_CHIP_OPTION_MASK,compparm[0]); if ( status == FAIL) { sprintf(errbuf, "Cannot set SZIP_CHIP compression method and block size.\n"); H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_GDdefcomptile", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set shuffling+SZIP_CHIP method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SHUF_SZIP_CHIP"); HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ]; break; case HE5_HDFE_COMP_SHUF_SZIP_K13: status = H5Pset_shuffle(HE5_GDXGrid[idx].plist); if ( status == FAIL) { sprintf(errbuf, "Cannot set the shuffling method."); H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_EC_OPTION_MASK,compparm[0]); if ( status == FAIL) { sprintf(errbuf, "Cannot set SZIP_K13 cmpression method and block size.\n"); H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_GDdefcomptile", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set shuffling+SZIP_K13 method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SHUF_SZIP_K13"); HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ]; break; case HE5_HDFE_COMP_SHUF_SZIP_EC: status = H5Pset_shuffle(HE5_GDXGrid[idx].plist); if ( status == FAIL) { sprintf(errbuf, "Cannot set the shuffling method."); H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_EC_OPTION_MASK,compparm[0]); if ( status == FAIL) { sprintf(errbuf, "Cannot set SZIP_EC compression method and block size.\n"); H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_GDdefcomptile", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set shuffling+SZIP_EC method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SHUF_SZIP_EC"); HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ]; break; case HE5_HDFE_COMP_SHUF_SZIP_NN: status = H5Pset_shuffle(HE5_GDXGrid[idx].plist); if ( status == FAIL) { sprintf(errbuf, "Cannot set the shuffling method."); H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_NN_OPTION_MASK,compparm[0]); if ( status == FAIL) { sprintf(errbuf, "Cannot set SZIP_NN compression method and block size.\n"); H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_GDdefcomptile", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set shuffling+SZIP_NN method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SHUF_SZIP_NN"); HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ]; break; case HE5_HDFE_COMP_SHUF_SZIP_K13orEC: status = H5Pset_shuffle(HE5_GDXGrid[idx].plist); if ( status == FAIL) { sprintf(errbuf, "Cannot set the shuffling method."); H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_EC_OPTION_MASK,compparm[0]); if ( status == FAIL) { sprintf(errbuf, "Cannot set SZIP_K13orEC compression method and block size.\n"); H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_GDdefcomptile", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ---------------------------------------------------------- */ /* Set shuffling+SZIP_K13orEC method and compression */ /* parameters in external array */ /* ---------------------------------------------------------- */ strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SHUF_SZIP_K13orEC"); HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ]; break; case HE5_HDFE_COMP_SHUF_SZIP_K13orNN: status = H5Pset_shuffle(HE5_GDXGrid[idx].plist); if ( status == FAIL) { sprintf(errbuf, "Cannot set the shuffling method."); H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_GDXGrid[ idx ].plist,H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK,compparm[0]); if ( status == FAIL) { sprintf(errbuf, "Cannot set SZIP_K13orNN compression method and block size.\n"); H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_GDdefcomptile", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ---------------------------------------------------------- */ /* Set shuffling+SZIP_K13orNN method and compression */ /* parameters in external array */ /* ---------------------------------------------------------- */ strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_SHUF_SZIP_K13orNN"); HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ]; break; case HE5_HDFE_COMP_NONE: strcpy(HE5_GDXGrid[ idx ].compmethod, "HE5_HDFE_COMP_NONE"); HE5_GDXGrid[ idx ].compparm[ 0 ] = compparm[ 0 ]; break; default: { status = FAIL; sprintf(errbuf, "Compression method is not specified.\n"); H5Epush(__FILE__, "HE5_GDdefcomtile", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } break; } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDdeforigin | | | | DESCRIPTION: Defines the origin of the grid data. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | origincode int origin code | | HDFE_GD_UL (0) | | HDFE_GD_UR (1) | | HDFE_GD_LL (2) | | HDFE_GD_LR (3) | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | HDF5 Library Functions Called: | | | | Date Programmer Description | | ====== ============ ================================================= | | 9/20/99 A.Muslimov In the call to EHinsertmeta() replaced the argument | | gid by fid. | | 9/27/99 A.Muslimov Added proper error handlings. Removed redundant | | if(status == 0){} brackets. | | 07/12/00 A.Muslimov Unmasked hdf5 data types. | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDdeforigin(hid_t gridID, int origincode) { herr_t status = FAIL; /* routine return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ long idx = FAIL; /* Grid index */ char *utlbuf = (char *)NULL; /* Utility buffer */ char *errbuf = (char *)NULL; /* Buffer for error message */ char *originNames[] = {"HE5_HDFE_GD_UL", "HE5_HDFE_GD_UR", "HE5_HDFE_GD_LL", "HE5_HDFE_GD_LR"}; HE5_LOCK; /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDdeforigin", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDdeforigin", &fid, &gid, &idx); if ( status == FAIL) { sprintf(errbuf, "Checking for grid ID failed.\n"); H5Epush(__FILE__, "HE5_GDdeforigin", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } utlbuf = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) ); if( utlbuf == NULL) { sprintf(errbuf, "Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_GDdeforigin", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* If proper origin code then write to structural metadata */ /* ------------------------------------------------------- */ if (origincode >= 0 && origincode <= 3) { sprintf(utlbuf, "%s%s%s", "\t\tGridOrigin=", originNames[origincode], "\n"); status = HE5_EHinsertmeta(fid, HE5_GDXGrid[idx].gdname, "g", 101L, utlbuf, NULL); if (status == FAIL) { sprintf(errbuf,"Cannot insert metadata."); H5Epush(__FILE__, "HE5_GDdeforigin", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } else { status = FAIL; sprintf(errbuf, "Improper Grid Origin code: %d\n", origincode); H5Epush(__FILE__, "HE5_GDdeforigin", __LINE__, H5E_FILE, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } free(utlbuf); free(errbuf); utlbuf = NULL; errbuf = NULL; COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDdefpixreg | | | | DESCRIPTION: Defines pixel registration within grid cell. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | pixregcode int None Pixel registration code | | HDFE_CENTER (0) | | HDFE_CORNER (1) | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | HDF5 Library Functions Called: | | | | Date Programmer Description | | ====== ============ ================================================= | | 9/20/99 A.Muslimov In the call to EHinsertmeta() replaced gid by fid. | | 9/27/99 A.Muslimov Added proper error hadlings. Removed redundant | | if(status == 0){} brackets. | | 07/12/00 A.Muslimov Unmasked hdf5 data types. | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDdefpixreg(hid_t gridID, int pixregcode) { herr_t status = FAIL; /* routine return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ long idx = FAIL; /* Grid index */ char *utlbuf = (char *)NULL; /* Utility buffer */ char *pixregNames[] = {"HE5_HDFE_CENTER", "HE5_HDFE_CORNER"};/* Pixel Registration Codes */ char *errbuf = (char *)NULL; /* Buffer for error message */ HE5_LOCK; /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDdefpixreg", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDdefpixreg", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for grid ID failed.\n"); H5Epush(__FILE__, "HE5_GDdefpixreg", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Allocate memory for utility buffer */ utlbuf = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) ); if(utlbuf == NULL) { sprintf(errbuf, "Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_GDdefpixreg", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* If proper pix reg code then write to structural metadata */ /* -------------------------------------------------------- */ if (pixregcode >= 0 && pixregcode <= 1) { sprintf(utlbuf, "%s%s%s", "\t\tPixelRegistration=", pixregNames[pixregcode], "\n"); status = HE5_EHinsertmeta(fid, HE5_GDXGrid[idx].gdname, "g", 101L,utlbuf, NULL); if(status == FAIL) { status = FAIL; sprintf(errbuf, "Cannot insert metadata.\n"); H5Epush(__FILE__, "HE5_GDdefpixreg", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } else { status = FAIL; sprintf(errbuf, "Improper Pixel Registration code: %d\n", pixregcode); H5Epush(__FILE__, "HE5_GDdefpixreg", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } free(utlbuf); free(errbuf); utlbuf = NULL; errbuf = NULL; COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDdiminfo | | | | DESCRIPTION: Retrieve size of specified dimension. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | size hsize_t None Size of dimension | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | dimname char* None Dimension name | | | | OUTPUTS: | | None | | | | NOTES: | | | | HDF5 Library Functions Called: | | | | Date Programmer Description | | ====== ============ ================================================= | | 9/21/99 A.Muslimov In the call to EHmetagroup() replaced the argument | | gid by fid. | | 07/12/00 A.Muslimov Unmasked hdf5 data types. | | 04/11/01 A.Muslimov Initialized size to 0, but "Unlim" returns -1!, | | not 0! | | | | END_PROLOG | -----------------------------------------------------------------------------*/ hsize_t HE5_GDdiminfo(hid_t gridID, char *dimname) { hsize_t size = 0; /* Dimension size (return value) */ herr_t status = FAIL; /* routine return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ long idx = FAIL; /* Grid index */ char *metabuf = (char *)NULL; /* Pointer to structural metadata (SM) */ char *metaptrs[2] = {NULL,NULL};/* Pointers to begin and end of SM section */ char *utlstr = (char *)NULL; /* Utility string */ char *errbuf = (char *)NULL; /* Buffer for error mesage */ CHECKPOINTER(dimname); /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDdiminfo", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(0); } /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDdiminfo", &fid, &gid, &idx); if ( status == FAIL) { sprintf(errbuf, "Checking for grid ID failed.\n"); H5Epush(__FILE__, "HE5_GDdiminfo", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(0); } /* Allocate memory for utility string */ /* ---------------------------------- */ utlstr = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) ); if(utlstr == NULL) { sprintf(errbuf, "Cannot allocate memory for utility string.\n"); H5Epush(__FILE__, "HE5_GDdiminfo", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(0); } /* Get pointers to "Dimension" section within SM */ /* --------------------------------------------- */ metabuf = (char *)HE5_EHmetagroup(fid, HE5_GDXGrid[idx].gdname, "g", "Dimension", metaptrs); if(metabuf == NULL) { sprintf(errbuf, "Cannot allocate memory for metabuffer.\n"); H5Epush(__FILE__, "HE5_GDdiminfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlstr); return(0); } /* Search for dimension name (surrounded by quotes) */ /* ------------------------------------------------ */ sprintf(utlstr, "%s%s%s", "\"", dimname, "\"\n"); metaptrs[0] = strstr(metaptrs[0], utlstr); /* * If dimension found within grid structure then get dimension value */ if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL) { /* Set endptr at end of dimension definition entry */ metaptrs[1] = strstr(metaptrs[0], "\t\t\tEND_OBJECT"); status = HE5_EHgetmetavalue(metaptrs, "Size", utlstr); if (status == SUCCEED) size = atol(utlstr); else { size = 0; sprintf(errbuf, "\"Size\" string not found in metadata."); H5Epush(__FILE__, "HE5_GDdiminfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } else { size = 0; sprintf(errbuf, "Dimension \"%s\" not found.", dimname); H5Epush(__FILE__, "HE5_GDdiminfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } free(metabuf); free(utlstr); free(errbuf); metabuf = NULL; utlstr = NULL; errbuf = NULL; COMPLETION: return(size); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDgridinfo | | | | DESCRIPTION: Returns xdim, ydim and location of upper left and lower | | right corners, in meters. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | | | OUTPUTS: | | xdimsize long Number of columns in grid | | ydimsize long Number of rows in grid | | upleftpt double Location (m/deg) of upper left corner | | lowrightpt double Location (m/deg) of lower right corner | | | | NOTES: | | | | HDF5 Library Functions Called: | | | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 9/21/99 A.Muslimov In the call to EHmetagroup() replaced the argument | | gid by fid. Changed the data type of statmeta from | | intn to int . | | 07/12/00 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDgridinfo(hid_t gridID, long *xdimsize, long *ydimsize, double upleftpt[], double lowrightpt[]) { herr_t status = FAIL; /* routine return status variable */ herr_t statmeta = FAIL; /* EHgetmetavalue return status */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ long idx = FAIL; /* Grid index */ char *metabuf = (char *)NULL; /* Pointer to structural metadata (SM) */ char *metaptrs[2] = {NULL,NULL};/* Pointers to begin and end of SM section */ char *utlstr = (char *)NULL; /* Utility string */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDgridinfo", &fid, &gid, &idx); if ( status == FAIL) { sprintf(errbuf,"Checking for grid ID failed.\n"); H5Epush(__FILE__, "HE5_GDgridinfo", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return( FAIL ); } /* Allocate memory for utility string */ /* ---------------------------------- */ utlstr = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) ); if(utlstr == NULL) { sprintf(errbuf, "Cannot allocate memory for utility string.\n"); H5Epush(__FILE__, "HE5_GDgridinfo", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get pointers to grid structure section within SM */ /* ------------------------------------------------ */ metabuf = (char *)HE5_EHmetagroup(fid, HE5_GDXGrid[idx].gdname, "g", NULL, metaptrs); if(metabuf == NULL) { sprintf(errbuf, "Cannot allocate memory for metabuffer string.\n"); H5Epush(__FILE__, "HE5_GDgridinfo", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(utlstr); return(FAIL); } /* Get xdimsize if requested */ /* ------------------------- */ if (xdimsize != NULL) { statmeta = HE5_EHgetmetavalue(metaptrs, "XDim", utlstr); if (statmeta == SUCCEED) { *xdimsize = atol(utlstr); } else { status = FAIL; sprintf(errbuf, "\"XDim\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_GDgridinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } /* Get ydimsize if requested */ /* ------------------------- */ if (ydimsize != NULL) { statmeta = HE5_EHgetmetavalue(metaptrs, "YDim", utlstr); if (statmeta == SUCCEED) { *ydimsize = atol(utlstr); } else { status = FAIL; sprintf(errbuf, "\"YDim\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_GDgridinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } /* Get upleftpt if requested */ /* ------------------------- */ if (upleftpt != NULL) { statmeta = HE5_EHgetmetavalue(metaptrs, "UpperLeftPointMtrs", utlstr); if (statmeta == SUCCEED) { /* If value is "DEFAULT" then return zeros */ /* --------------------------------------- */ if (strcmp(utlstr, "DEFAULT") == 0) { upleftpt[0] = 0; upleftpt[1] = 0; } else { sscanf(utlstr, "(%lf,%lf)", &upleftpt[0], &upleftpt[1]); } } else { status = FAIL; sprintf( errbuf, "\"UpperLeftPointMtrs\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_GDgridinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } /* Get lowrightpt if requested */ /* --------------------------- */ if (lowrightpt != NULL) { statmeta = HE5_EHgetmetavalue(metaptrs, "LowerRightMtrs", utlstr); if (statmeta == SUCCEED) { /* If value is "DEFAULT" then return zeros */ if (strcmp(utlstr, "DEFAULT") == 0) { lowrightpt[0] = 0; lowrightpt[1] = 0; } else { sscanf(utlstr, "(%lf,%lf)", &lowrightpt[0], &lowrightpt[1]); } } else { status = FAIL; sprintf( errbuf,"\"LowerRightMtrs\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_GDgridinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } free(metabuf); free(utlstr); metabuf = NULL; utlstr = NULL; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDprojinfo | | | | DESCRIPTION: Returns GCTP projection code, zone code, spheroid code | | and projection parameters. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | | | OUTPUTS: | | projcode int GCTP projection code | | zonecode int UTM zone code | | spherecode int GCTP spheriod code | | projparm double Projection parameters | | | | NOTES: | | | | | | HDF5 Library Functions Called: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 9/21/99 A.Muslimov In the call to EHmetagroup() replaced the argument | | gid by fid. Changed the datatype of statmeta from | | intn to int , and initialized the return statuses | | to -1. | | 07/12/00 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDprojinfo(hid_t gridID, int *projcode, int *zonecode, int *spherecode, double projparm[]) { herr_t status = FAIL; /* routine return status variable */ herr_t statmeta = FAIL; /* EHgetmetavalue return status */ int i; /* Loop index */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ long idx = FAIL; /* Grid index */ char *metabuf = (char *)NULL; /*Pointer to structural metadata (SM) */ char *metaptrs[2] = {NULL,NULL};/* Pointers to begin and end of SM section */ char *utlstr = (char *)NULL; /* Utility string */ char fmt[96]; /* Format String */ char *GCTPproj[128] = {"HE5_GCTP_GEO", "HE5_GCTP_UTM", "HE5_GCTP_SPCS", "HE5_GCTP_ALBERS", "HE5_GCTP_LAMCC", "HE5_GCTP_MERCAT", "HE5_GCTP_PS", "HE5_GCTP_POLYC", "HE5_GCTP_EQUIDC", "HE5_GCTP_TM", "HE5_GCTP_STEREO", "HE5_GCTP_LAMAZ", "HE5_GCTP_AZMEQD", "HE5_GCTP_GNOMON", "HE5_GCTP_ORTHO", "HE5_GCTP_GVNSP","HE5_GCTP_SNSOID", "HE5_GCTP_EQRECT", "HE5_GCTP_MILLER", "HE5_GCTP_VGRINT","HE5_GCTP_HOM", "HE5_GCTP_ROBIN","HE5_GCTP_SOM", "HE5_GCTP_ALASKA", "HE5_GCTP_GOOD", "HE5_GCTP_MOLL","HE5_GCTP_IMOLL", "HE5_GCTP_HAMMER","HE5_GCTP_WAGIV", "HE5_GCTP_WAGVII","HE5_GCTP_OBLEQA" /*,"HE5_GCTP_CEA", "HE5_GCTP_BCEA", "HE5_GCTP_ISINUS"*/};/* GCTP projection codes */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDprojinfo", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf,"Checking for grid ID failed.\n"); H5Epush(__FILE__, "HE5_GDprojinfo", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return( FAIL); } /* Allocate memory for utility string */ /* ---------------------------------- */ utlstr = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) ); if(utlstr == NULL) { sprintf(errbuf, "Cannot allocate memory for utility string.\n"); H5Epush(__FILE__, "HE5_GDprojinfo", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Add "non-standard" GCTP codes */ /* ----------------------------- */ GCTPproj[ 97 ] = (char *)calloc( HE5_HDFE_NAMBUFSIZE, sizeof(char) ); if(GCTPproj[ 97 ] == NULL) { sprintf(errbuf, "Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_GDprojinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(utlstr); return(FAIL); } strcpy(GCTPproj[97], "HE5_GCTP_CEA"); GCTPproj[ 98 ] = (char *)calloc( HE5_HDFE_NAMBUFSIZE, sizeof(char) ); if(GCTPproj[ 98 ] == NULL) { sprintf(errbuf, "Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_GDprojinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(utlstr); free(GCTPproj[ 97 ]); return(FAIL); } strcpy(GCTPproj[98], "HE5_GCTP_BCEA"); GCTPproj[99] = (char *) calloc( HE5_HDFE_NAMBUFSIZE, sizeof(char) ); if(GCTPproj[99] == NULL) { sprintf(errbuf, "Cannot allocate memory for GCTP codes string.\n"); H5Epush(__FILE__, "HE5_GDprojinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(utlstr); free(GCTPproj[ 97 ]); free(GCTPproj[ 98 ]); return(FAIL); } strcpy(GCTPproj[99],"HE5_GCTP_ISINUS"); /* Get pointers to grid structure section within SM */ /* ------------------------------------------------ */ metabuf = (char *)HE5_EHmetagroup(fid, HE5_GDXGrid[idx].gdname, "g", NULL, metaptrs); if(metabuf == NULL) { sprintf(errbuf, "Cannot allocate memory for metabuffer string.\n"); H5Epush(__FILE__, "HE5_GDprojinfo", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(utlstr); free(GCTPproj[ 97 ]); free(GCTPproj[ 98 ]); free(GCTPproj[99]); return(FAIL); } /* Get projcode if requested */ /* ------------------------- */ if (projcode != NULL) { *projcode = FAIL; statmeta = HE5_EHgetmetavalue(metaptrs, "Projection", utlstr); if (statmeta == SUCCEED) { /* Loop through projection codes until found */ /* ----------------------------------------- */ for (i = 0; i < 128; i++) { if (GCTPproj[i] != NULL) { if (strcmp(utlstr, GCTPproj[i]) == 0) { *projcode = i; break; } } } } else { sprintf(errbuf, "Projection Code not defined for \"%s\".\n", HE5_GDXGrid[idx].gdname); H5Epush(__FILE__, "HE5_GDprojinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (projparm != NULL) { for (i = 0; i < 13; i++) { projparm[i] = FAIL; } } free(utlstr); free(GCTPproj[97]); free(GCTPproj[98]); free(GCTPproj[99]); free(metabuf); return(FAIL); } } /* Get zonecode if requested */ /* ------------------------- */ if (zonecode != NULL) { *zonecode = FAIL; /* Zone code only relevant for UTM and State Code projections */ /* ---------------------------------------------------------- */ if (*projcode == HE5_GCTP_UTM || *projcode == HE5_GCTP_SPCS) { statmeta = HE5_EHgetmetavalue(metaptrs, "ZoneCode", utlstr); if (statmeta == SUCCEED) { *zonecode = atoi(utlstr); } else { sprintf(errbuf, "Zone Code not defined for \"%s\".\n", HE5_GDXGrid[idx].gdname); H5Epush(__FILE__, "HE5_GDprojinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(utlstr); free(GCTPproj[97]); free(GCTPproj[98]); free(GCTPproj[99]); free(metabuf); return(FAIL); } } } /* Get projection parameters if requested */ /* -------------------------------------- */ if (projparm != NULL) { /* * Note: No projection parameters for GEO, UTM, and State Code * projections */ if (*projcode == HE5_GCTP_GEO || *projcode == HE5_GCTP_UTM || *projcode == HE5_GCTP_SPCS) { for (i = 0; i < 13; i++) { projparm[i] = 0.0; } } else { statmeta = HE5_EHgetmetavalue(metaptrs, "ProjParams", utlstr); if (statmeta == SUCCEED) { /* Build format string to read projection parameters */ /* ------------------------------------------------- */ strcpy(fmt, "%lf,"); for (i = 1; i <= 11; i++) strcat(fmt, "%lf,"); strcat(fmt, "%lf"); /* Read parameters from numeric list */ /* --------------------------------- */ sscanf(&utlstr[1], fmt, &projparm[0], &projparm[1], &projparm[2], &projparm[3], &projparm[4], &projparm[5], &projparm[6], &projparm[7], &projparm[8], &projparm[9], &projparm[10], &projparm[11], &projparm[12]); } else { sprintf(errbuf, "Projection parameters not defined for \"%s\".\n", HE5_GDXGrid[idx].gdname); H5Epush(__FILE__, "HE5_GDprojinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(utlstr); free(GCTPproj[97]); free(GCTPproj[98]); free(GCTPproj[99]); free(metabuf); return(FAIL); } } } /* Get spherecode if requested */ /* --------------------------- */ if (spherecode != NULL) { *spherecode = 0; /* Note: Spherecode not defined for GEO projection */ /* ----------------------------------------------- */ if (*projcode != HE5_GCTP_GEO) { statmeta = HE5_EHgetmetavalue(metaptrs, "SphereCode", utlstr); if (statmeta == SUCCEED) { *spherecode = atoi(utlstr); } } } free(metabuf); free(GCTPproj[97]); free(GCTPproj[98]); free(GCTPproj[99]); free(utlstr); metabuf = NULL; GCTPproj[97] = NULL; GCTPproj[98] = NULL; GCTPproj[99] = NULL; utlstr = NULL; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDorigininfo | | | | DESCRIPTION: Returns origin code | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | | | OUTPUTS: | | origincode int grid origin code | | | | NOTES: | | | | HDF5 Library Functions Called: | | | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 9/21/99 A.Muslimov In the call to EHmetagroup() replaced the argument | | gid by fid. Changed the type of statmeta from intn | | to int , and initialized the return statuses to | | -1. | | 07/12/00 A.Muslimov Unmasked hdf5 data types. | | Mar 04 S.Zhao Changed the default origin code from 0 to FAIL. | | Aug 11 Abe Taaheri Modified to return default value if it is not found | | in structure metadata | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDorigininfo(hid_t gridID, int *origincode) { herr_t status = FAIL; /* routine return status variable */ herr_t statmeta = FAIL; /* EHgetmetavalue return status */ int i; /* Loop index */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ long idx = FAIL; /* Grid index */ char *metabuf = (char *)NULL; /* Pointer to structural metadata (SM) */ char *metaptrs[2] = {NULL,NULL}; /* Pointers to begin and end of SM section */ char *utlstr = (char *)NULL; /* Utility string */ char *originNames[] = {"HE5_HDFE_GD_UL", "HE5_HDFE_GD_UR","HE5_HDFE_GD_LL", "HE5_HDFE_GD_LR"}; /* Array of origin codes */ char *errbuf = (char *)NULL;/* Buffer for error message */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDorigininfo", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDorigininfo", &fid, &gid, &idx); if ( status == FAIL) { *origincode = FAIL; sprintf(errbuf,"Checking for grid ID failed.\n"); H5Epush(__FILE__, "HE5_GDorigininfo", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Allocate memory for utility string */ /* ---------------------------------- */ utlstr = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) ); if(utlstr == NULL) { *origincode = FAIL; sprintf(errbuf, "Cannot allocate memory for utility string.\n"); H5Epush(__FILE__, "HE5_GDorigininfo", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Set default origin code */ /* ----------------------- */ *origincode = FAIL; /* Get pointers to grid structure section within SM */ /* ------------------------------------------------ */ metabuf = (char *)HE5_EHmetagroup(fid, HE5_GDXGrid[idx].gdname, "g",NULL, metaptrs); if(metabuf == NULL) { sprintf(errbuf, "Cannot allocate memory for metabuffer string.\n"); H5Epush(__FILE__, "HE5_GDorigininfo", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlstr); return(FAIL); } /* Get "GridOrigin" metadata string */ /* -------------------------------- */ statmeta = HE5_EHgetmetavalue(metaptrs, "GridOrigin", utlstr); if (statmeta == FAIL) { /* return default value */ status = 0; *origincode = 0; /* sprintf(errbuf,"Cannot get metadata string.\n"); H5Epush(__FILE__, "HE5_GDorigininfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); status=FAIL; */ free(errbuf); free(utlstr); free(metabuf); metabuf = NULL; utlstr = NULL; errbuf = NULL; return(status); } /* * If "GridOrigin" string found in metadata then convert to * numeric origin code (fixed added: Jan 97) */ for (i = 0; i < 4; i++) { if (strcmp(utlstr, originNames[i]) == 0) { *origincode = i; break; } } free(metabuf); free(utlstr); free(errbuf); metabuf = NULL; utlstr = NULL; errbuf = NULL; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDpixreginfo | | | | DESCRIPTION: | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | | | OUTPUTS: | | pixregcode int None Pixel registration code | | | | NOTES: | | | | | | HDF5 Library Functions Called: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 9/21/99 A.Muslimov In the call to EHmetagroup() replaced the argument | | gid by fid. Changed the type of statmeta from intn | | to int , and initialized the return statuses to | | -1. | | 07/12/00 A.Muslimov Unmasked hdf5 data types. | | Mar 04 S.Zhao Changed the default pixreg code from 0 to FAIL. | | Aug 11 Abe Taaheri Modified to return default value if it is not found | | in structure metadata | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDpixreginfo(hid_t gridID, int *pixregcode) { herr_t status = FAIL; /* routine return status variable */ herr_t statmeta = FAIL; /* EHgetmetavalue return status */ int i; /* Loop index */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ long idx = FAIL; /* Grid index */ char *metabuf = (char *)NULL; /* Ptr to structural metadata (SM) */ char *metaptrs[2] = {NULL,NULL}; /* Ptrs to begin/end of SM section */ char *utlstr = (char *)NULL; /* Utility string */ char *pixregNames[] = {"HE5_HDFE_CENTER", "HE5_HDFE_CORNER"};/* Pixel Registration Codes */ char *errbuf = (char *)NULL; /* Buffer for error message */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDpixreginfo", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDpixreginfo", &fid, &gid, &idx); if ( status == FAIL ) { *pixregcode = FAIL; sprintf(errbuf,"Checking for grid ID failed.\n"); H5Epush(__FILE__, "HE5_GDpixreginfo", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return( FAIL ); } /* Set default pixreg code */ /* ----------------------- */ *pixregcode = FAIL; /* Allocate memory for utility string */ /* ---------------------------------- */ utlstr = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) ); if(utlstr == NULL) { sprintf(errbuf, "Cannot allocate memory for utility string.\n"); H5Epush(__FILE__, "HE5_GDpixreginfo", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Get pointers to Grid structure section within SM */ /* ------------------------------------------------ */ metabuf = (char *)HE5_EHmetagroup(fid , HE5_GDXGrid[idx].gdname, "g", NULL, metaptrs); if(metabuf == NULL) { sprintf(errbuf, "Cannot allocate memory for metabuffer string.\n"); H5Epush(__FILE__, "HE5_GDpixreginfo", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlstr); return(FAIL); } /* Get "PixelRegistration" metadata string */ /* --------------------------------------- */ statmeta = HE5_EHgetmetavalue(metaptrs, "PixelRegistration", utlstr); if (statmeta == FAIL) { /* return default value */ status = 0; *pixregcode = 0; /* sprintf(errbuf,"Cannot get metadata string.\n"); H5Epush(__FILE__, "HE5_GDpixreginfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); status = FAIL; */ free(errbuf); free(utlstr); free(metabuf); metabuf = NULL; utlstr = NULL; errbuf = NULL; return(status); } /* * If "PixelRegistration" string found in metadata then convert * to numeric origin code (fixed added: Jan 97) */ for (i = 0; i < 2; i++) { if (strcmp(utlstr, pixregNames[i]) == 0) { *pixregcode = i; break; } } free(metabuf); free(utlstr); free(errbuf); metabuf = NULL; utlstr = NULL; errbuf = NULL; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDcompinfo | | | | DESCRIPTION: | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | fieldname char* None | | compcode int* None | | compparm int none | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | HDF5 Library Functions Called: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 8/24/99 A.Muslimov Changed the return type from intn to int . | | 9/21/99 A.Muslimov In the call to EHmetagroup() replaced the argument | | gid by fid. Changed the type of gridID from int32_t | | to hid_t. Changed the type of statmeta from intn | | to int , and initialized the return statuses to | | -1. | | 07/12/00 A.Muslimov Unmasked hdf5 data types. | | June 03 S.Zhao Changed the type of compcode from *char to *int. | | Aug 03 S.Zhao Added Szip compression methods. | | Apr 04 S.Zhao Added the HE5_GDfldnameinfo() call. | | Dec 13 Abe Taaheri Added compression detection from field, if it is | | not found from the structure metadata | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDcompinfo(hid_t gridID, const char *fieldname, int *compcode, int compparm[]) { herr_t status = FAIL; /* routine return status variable */ herr_t statmeta = FAIL; /* EHgetmetavalue return status */ int i; /* Loop Index */ hid_t (*func)(void*); hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ long idx = FAIL; /* Grid index */ long idOffset = HE5_GRIDOFFSET;/* HDF-EOS Grid ID offset */ int nameflag = FAIL; /* Name flag (0-alias,1-actual) */ char fldname[HE5_HDFE_NAMBUFSIZE]; /* Field name buffer */ char fldactualname[HE5_HDFE_NAMBUFSIZE];/* Actual name of a field */ char *metabuf = (char *)NULL; /* Ptr to structural metadata (SM) */ char *metaptrs[2] = {NULL,NULL};/* Ptrs to begin/end of SM section */ char *utlstr = (char *)NULL; /* Utility string */ char *errbuf = (char *)NULL; /* buffer for error message */ hid_t sdid,dcpl; size_t nelmts; unsigned int flags,filter_info; int got_compparm = 0; int found = 0; int numfilt; hid_t plist_id; int done_loop = 0; H5Z_filter_t filter_type; void *edata = (void *)NULL; char *HDFcomp[18] = {"HE5_HDFE_COMP_NONE", "HE5_HDFE_COMP_RLE", "HE5_HDFE_COMP_NBIT", "HE5_HDFE_COMP_SKPHUFF", "HE5_HDFE_COMP_DEFLATE", "HE5_HDFE_COMP_SZIP_CHIP", "HE5_HDFE_COMP_SZIP_K13", "HE5_HDFE_COMP_SZIP_EC", "HE5_HDFE_COMP_SZIP_NN", "HE5_HDFE_COMP_SZIP_K13orEC", "HE5_HDFE_COMP_SZIP_K13orNN", "HE5_HDFE_COMP_SHUF_DEFLATE", "HE5_HDFE_COMP_SHUF_SZIP_CHIP", "HE5_HDFE_COMP_SHUF_SZIP_K13", "HE5_HDFE_COMP_SHUF_SZIP_EC", "HE5_HDFE_COMP_SHUF_SZIP_NN", "HE5_HDFE_COMP_SHUF_SZIP_K13orEC", "HE5_HDFE_COMP_SHUF_SZIP_K13orNN"}; /* Compression method Codes */ H5Eget_auto((H5E_auto1_t *)&func, &edata); CHECKPOINTER(fieldname); /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDcompinfo", &fid, &gid, &idx); if ( status == FAIL) { sprintf(errbuf,"Checking for grid ID failed.\n"); H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return( FAIL ); } /* Allocate memory for utility string */ /* ---------------------------------- */ utlstr = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) ); if(utlstr == NULL) { sprintf(errbuf, "Cannot allocate memory for utility string.\n"); H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Call HE5_GDfldnameinfo() to get actual field name */ /* ------------------------------------------------- */ nameflag = HE5_GDfldnameinfo(gridID, fieldname, fldactualname); if ( nameflag == FAIL ) { sprintf(errbuf, "Cannot get the actual name of the field.\n"); H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlstr); return(FAIL); } /* If fldname is alias, then change it to the actual name */ /* ------------------------------------------------------ */ if (nameflag == FALSE) { strcpy(fldname,""); strcpy(fldname,fldactualname); } if (nameflag == TRUE) { strcpy(fldname,""); strcpy(fldname,fieldname); } /* Get pointers to "DataField" section within SM */ /* --------------------------------------------- */ metabuf = (char *)HE5_EHmetagroup(fid, HE5_GDXGrid[idx].gdname, "g","DataField", metaptrs); if(metabuf == NULL) { sprintf(errbuf, "Cannot allocate memory for metabuffer string.\n"); H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlstr); return(FAIL); } /* Search for field */ /* ---------------- */ sprintf(utlstr, "%s%s%s", "\"", fldname, "\"\n"); metaptrs[0] = strstr(metaptrs[0], utlstr); /* If field found and user wants compression code ... */ /* -------------------------------------------------- */ if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL) { if (compcode != NULL) { /* Set endptr at end of field's definition entry */ /* --------------------------------------------- */ metaptrs[1] = strstr(metaptrs[0], "\t\t\tEND_OBJECT"); /* Get compression type */ /* -------------------- */ statmeta = HE5_EHgetmetavalue(metaptrs, "CompressionType", utlstr); /* if (statmeta == FAIL) { sprintf(errbuf,"Cannot get metadata string.\n"); H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlstr); free(metabuf); return( FAIL ); } */ /* * Default is no compression if "CompressionType" string not * in metadata */ *compcode = HE5_HDFE_COMP_NONE; /* strcpy( compcode, utlstr);*/ /* If compression code is found ... */ /* -------------------------------- */ if (statmeta == SUCCEED) { /* Loop through compression types until match */ /* ------------------------------------------ */ for (i = 0; i < 18; i++) { if (strcmp(utlstr, HDFcomp[i]) == 0) { *compcode = i; break; } } } } /* If user wants compression parameters ... */ /* Compression is not listed in the structure metadata. Lets see if the field is compressed by other means such as herepack where the compression is done but does not show up in the structure metadata. */ got_compparm = 0; if(*compcode == HE5_HDFE_COMP_NONE) { if (HE5_GDXGrid[gridID % idOffset].active != 0) { /* Get Grid index */ /* -------------- */ idx = HE5_EHhid2long(gridID) % idOffset; if ( idx == FAIL) { status = FAIL; sprintf(errbuf, "Cannot get the Grid index \n"); H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf) ; HE5_EHprint(errbuf, __FILE__, __LINE__); } } /* Loop through all datasets in grid */ /* ------------------------------ */ for (i = 0; i < HE5_GDXGrid[idx].nDFLD; i++) { /* Get dataset name */ if( strcmp(fieldname, HE5_GDXGrid[ idx ].ddataset[ i ].name) == 0 ) { found = 1; sdid = HE5_GDXGrid[ idx ].ddataset[ i ].ID; break; } } if(found == 1) /* did not find fieldname */ { /* * Retrieve dataset creation property list. */ dcpl = H5Dget_create_plist (sdid); numfilt = H5Pget_nfilters (plist_id); done_loop = 0; for (i=0; i 2) { *compcode = 12; /* HE5_HDFE_COMP_SHUF_SZIP_CHIP */ compparm[0] = 16; done_loop = 1; } break; /*------------------------------------------------------------------------- * H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC *------------------------------------------------------------------------- */ case H5Z_FILTER_FLETCHER32: done_loop = 1; break; /*------------------------------------------------------------------------- * H5Z_FILTER_SCALEOFFSET *------------------------------------------------------------------------- */ case H5Z_FILTER_SCALEOFFSET: done_loop = 1; break; }/*switch*/ if(done_loop == 1) break; }/*for*/ } got_compparm = 1; } /* if compression parameters are obtained from field itself when calling SDgetcompinfo, we will skip next if statement */ /* If user wants compression parameters ... */ /* ---------------------------------------- */ if (compparm != NULL && compcode != NULL && got_compparm != 1) { /* Initialize to zero */ for (i = 0; i < 5; i++) { compparm[i] = 0; } /* * Get compression parameters */ if(*compcode == HE5_HDFE_COMP_NBIT) { statmeta = HE5_EHgetmetavalue(metaptrs, "CompressionParams", utlstr); if (statmeta == FAIL) { sprintf(errbuf,"\"CompressionParams\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlstr); free(metabuf); return( FAIL ); } sscanf(utlstr, "(%d,%d,%d,%d)",&compparm[0], &compparm[1],&compparm[2], &compparm[3]); } else if (*compcode == HE5_HDFE_COMP_DEFLATE) { statmeta = HE5_EHgetmetavalue(metaptrs, "DeflateLevel", utlstr); if (statmeta == FAIL) { sprintf(errbuf,"\"DeflateLevel\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlstr); free(metabuf); return( FAIL); } sscanf(utlstr, "%d", &compparm[0]); } else if (*compcode == HE5_HDFE_COMP_SZIP_CHIP) { statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr); if (statmeta == FAIL) { sprintf(errbuf,"\"BlockSize\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlstr); free(metabuf); return( FAIL); } sscanf(utlstr, "%d", &compparm[0]); } else if (*compcode == HE5_HDFE_COMP_SZIP_K13) { statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr); if (statmeta == FAIL) { sprintf(errbuf,"\"BlockSize\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlstr); free(metabuf); return( FAIL); } sscanf(utlstr, "%d", &compparm[0]); } else if (*compcode == HE5_HDFE_COMP_SZIP_EC) { statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr); if (statmeta == FAIL) { sprintf(errbuf,"\"BlockSize\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlstr); free(metabuf); return( FAIL); } sscanf(utlstr, "%d", &compparm[0]); } else if (*compcode == HE5_HDFE_COMP_SZIP_NN) { statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr); if (statmeta == FAIL) { sprintf(errbuf,"\"BlockSize\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlstr); free(metabuf); return( FAIL); } sscanf(utlstr, "%d", &compparm[0]); } else if (*compcode == HE5_HDFE_COMP_SZIP_K13orEC) { statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr); if (statmeta == FAIL) { sprintf(errbuf,"\"BlockSize\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlstr); free(metabuf); return( FAIL); } sscanf(utlstr, "%d", &compparm[0]); } else if (*compcode == HE5_HDFE_COMP_SZIP_K13orNN) { statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr); if (statmeta == FAIL) { sprintf(errbuf,"\"BlockSize\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlstr); free(metabuf); return( FAIL); } sscanf(utlstr, "%d", &compparm[0]); } else if (*compcode == HE5_HDFE_COMP_SHUF_DEFLATE) { statmeta = HE5_EHgetmetavalue(metaptrs, "DeflateLevel", utlstr); if (statmeta == FAIL) { sprintf(errbuf,"\"DeflateLevel\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlstr); free(metabuf); return( FAIL); } sscanf(utlstr, "%d", &compparm[0]); } else if (*compcode == HE5_HDFE_COMP_SHUF_SZIP_CHIP) { statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr); if (statmeta == FAIL) { sprintf(errbuf,"\"BlockSize\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlstr); free(metabuf); return( FAIL); } sscanf(utlstr, "%d", &compparm[0]); } else if (*compcode == HE5_HDFE_COMP_SHUF_SZIP_K13) { statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr); if (statmeta == FAIL) { sprintf(errbuf,"\"BlockSize\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlstr); free(metabuf); return( FAIL); } sscanf(utlstr, "%d", &compparm[0]); } else if (*compcode == HE5_HDFE_COMP_SHUF_SZIP_EC) { statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr); if (statmeta == FAIL) { sprintf(errbuf,"\"BlockSize\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlstr); free(metabuf); return( FAIL); } sscanf(utlstr, "%d", &compparm[0]); } else if (*compcode == HE5_HDFE_COMP_SHUF_SZIP_NN) { statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr); if (statmeta == FAIL) { sprintf(errbuf,"\"BlockSize\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlstr); free(metabuf); return( FAIL); } sscanf(utlstr, "%d", &compparm[0]); } else if (*compcode == HE5_HDFE_COMP_SHUF_SZIP_K13orEC) { statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr); if (statmeta == FAIL) { sprintf(errbuf,"\"BlockSize\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlstr); free(metabuf); return( FAIL); } sscanf(utlstr, "%d", &compparm[0]); } else if (*compcode == HE5_HDFE_COMP_SHUF_SZIP_K13orNN) { statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr); if (statmeta == FAIL) { sprintf(errbuf,"\"BlockSize\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlstr); free(metabuf); return( FAIL); } sscanf(utlstr, "%d", &compparm[0]); } } } else { status = FAIL; sprintf(errbuf, "Fieldname \"%s\" not found.\n", fldname); H5Epush(__FILE__, "HE5_GDcompinfo", __LINE__, H5E_FILE, H5E_SEEKERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } free(metabuf); free(utlstr); free(errbuf); metabuf = NULL; utlstr = NULL; errbuf = NULL; COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDfieldinfo | | | | DESCRIPTION: Retrieve information about a specific geolocation or data | | field in the grid. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | fieldname char* name of field | | | | OUTPUTS: | | rank int rank of field (# of dims) | | dims hsize_t field dimensions | | ntype hid_t field number types | | dimlist char* field dimension list | | maxdimlist char* field maximum dimension list | | | | NOTES: | | | | HDF5 Library Functions Called: | | H5Dopen | | H5Dget_type | | H5Tget_class | | H5Dclose | | H5Dget_space | | H5Sget_simple_extent_ndims | | H5Sget_simple_extent_dims | | H5Sclose | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 9/21/99 A.Muslimov In the call to EHmetagroup() replaced the argument | | gid by fid. Changed the type of statmeta from intn | | to int , and initialized the return status to | | -1. | | 9/27/99 A.Muslimov Added proper error handlings. | | 10/18/99 A.Muslimov Replace memcpy() by memmove() to avoid a problem | | when arguments 1 and 2 overlap in memory. | | 01/13/00 A.Muslimov Added "maxdimlist" parameter to make it possible | | working with the appendable datasets. Modified the | | blocks retrieving the dimension lists. Added proper | | error handlings after the function calls. | | Feb 00 A.Muslimov Casted the type of a variable assigned to rank to | | "int". | | Mar 00 A.Muslimov Changed the ID of field group from gd_id to data_id.| | Apr 00 A.Muslimov Changed type of 'slen' from long to size_t. | | 5/10/00 A.Muslimov Changed 'H5T_class_t' type to 'int' data type. | | 07/12/00 A.Muslimov Unmasked hdf5 data types. | | Jan 03 S.Zhao Changed the type of 'ntype' from an H5T_class_t to | | an hid_t. | | Oct. 03 S.Zhao Added the H5Tclose(datatype) call. | | Jan. 04 S.Zhao Modified to enable a character string dataset. | | Mar 04 S.Zhao Modified for a character string dataset. | | Apr 04 S.Zhao Added the HE5_GDfldnameinfo() call. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDfieldinfo(hid_t gridID, const char *fieldname, int *rank, hsize_t dims[], hid_t ntype[], char *dimlist, char *maxdimlist) { herr_t status = FAIL; /* routine return status variable */ herr_t statmeta = FAIL; /* EHgetmetavalue return status */ herr_t Dstatus = FAIL; /* Status for H5Dclose */ int i; /* Loop index */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t datasetid = FAIL; /* dataset ID */ hid_t datatype = FAIL; /* data type ID */ hid_t fieldID = FAIL; /* field ID */ hid_t dspace = FAIL; /* data space ID */ size_t slen[HE5_DTSETRANKMAX];/* Length of each entry in a list */ long idx = FAIL; /* Grid index */ long ndims = 0; /* Number of dimensions */ long xdim = 0; /* X dim size */ long ydim = 0; /* Y dim size */ H5T_class_t classid = H5T_NO_CLASS; /* Data type class ID */ char *metabuf = (char *)NULL; /* Pointer to structural metadata (SM) */ char *metaptrs[2] = {NULL,NULL}; /* Pnts to begin and end of SM section */ char *utlstr = (char *)NULL; /* Utility string */ char *ptr[HE5_DTSETRANKMAX]; /* String pointers for parsed string */ char dimstr[HE5_HDFE_DIMBUFSIZE]; /* Individual dimension entry string */ char maxdimstr[HE5_HDFE_DIMBUFSIZE];/* Maximum dimension entry string */ char errbuf[HE5_HDFE_ERRBUFSIZE]; int nameflag = FAIL; /* Actual(1)/Alias(0) field name */ char fldname[HE5_HDFE_NAMBUFSIZE]; /* field name buffer */ char fldactualname[HE5_HDFE_NAMBUFSIZE];/* Actual field name */ htri_t str_is_variable; /* boolean: TRUE if string is variable lengeth FALSE if string is fixed length -1 if error in H5Tis_variavle_str() */ CHECKPOINTER(fieldname); /* Allocate memory for utility string */ /* ---------------------------------- */ utlstr = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) ); if(utlstr == NULL) { sprintf(errbuf, "Cannot allocate memory for utility string.\n"); H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDfieldinfo", &fid, &gid, &idx); if(status == FAIL) { sprintf(errbuf,"Checking for Grid ID failed.\n"); H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(utlstr); return(FAIL); } /* Call HE5_GDfldnameinfo() to get actual field name */ /* ------------------------------------------------- */ nameflag = HE5_GDfldnameinfo(gridID, fieldname, fldactualname); if ( nameflag == FAIL ) { sprintf(errbuf, "Cannot get actual name of the field.\n"); H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(utlstr); return(FAIL); } /* Name is not alias */ /* ----------------- */ if (nameflag == TRUE) { strcpy(fldname,""); strcpy(fldname,fieldname); } /* Name is alias */ /* ------------- */ if (nameflag == FALSE) { strcpy(fldname,""); strcpy(fldname,fldactualname); } /* Allocate memory for metabuf string */ /* ---------------------------------- */ metabuf = (char *)HE5_EHmetagroup(fid, HE5_GDXGrid[idx].gdname, "g", "DataField", metaptrs); if(metabuf == NULL) { sprintf(errbuf, "cannot allocate memory for metabuffer.\n"); H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(utlstr); return(FAIL); } /* Search for field */ /* ---------------- */ sprintf(utlstr, "%s%s%s", "\"", fldname, "\"\n"); metaptrs[0] = strstr(metaptrs[0], utlstr); /* If field found ... */ /* ------------------ */ if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL) { /* initialize the rank value */ /* ------------------------- */ *rank = FAIL; /* Set endptr at end of dimension definition entry */ /* ----------------------------------------------- */ metaptrs[1] = strstr(metaptrs[0], "\t\t\tEND_OBJECT"); /* Get "DataType" string */ /* --------------------- */ statmeta = HE5_EHgetmetavalue(metaptrs, "DataType", utlstr); /* Convert to numbertype code */ /* -------------------------- */ if (statmeta == SUCCEED) { datasetid = H5Dopen(HE5_GDXGrid[idx].data_id, fldname); if (datasetid == FAIL) { sprintf(errbuf, "Cannot open the dataset \"%s\".", fldname); H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (utlstr != NULL) free(utlstr); if (metabuf != NULL) free(metabuf); return(FAIL); } /* Get data type ID */ /* ---------------- */ datatype = H5Dget_type(datasetid); if (datatype == FAIL) { sprintf(errbuf, "Cannot get the data type for \"%s\" dataset.", fldname); H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (utlstr != NULL) free(utlstr); if (metabuf != NULL) free(metabuf); return(FAIL); } /* Get data class ID */ /* ----------------- */ classid = H5Tget_class(datatype); if (classid == H5T_NO_CLASS) { sprintf(errbuf, "Cannot get the data type class ID for \"%s\" dataset.", fldname); H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (utlstr != NULL) free(utlstr); if (metabuf != NULL) free(metabuf); return(FAIL); } if (classid == H5T_STRING) { /* HE5T_CHARSTRING has variable length for data fields */ str_is_variable = H5Tis_variable_str(datatype); if(str_is_variable == TRUE) { ntype[0] = HE5T_CHARSTRING; } else if(str_is_variable == FALSE) { ntype[0] = HE5T_NATIVE_CHAR; } else { status = FAIL; sprintf(errbuf, "Failed to see if string field is varaible or fixed length for the \"%s\" field.\n",fldname); H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (utlstr != NULL) free(utlstr); if (metabuf != NULL) free(metabuf); return(status); } /*HE5_GDgetstringtype(swathID, fieldname,classid);*/ /*ntype[0] = HE5T_CHARSTRING;*/ } else { /* ntype[0] = classid; */ ntype[0] = HE5_EHdtype2numtype(datatype); if (ntype[0] == FAIL) { sprintf(errbuf, "Cannot get the number type for \"%s\" dataset.", fldname); H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (utlstr != NULL) free(utlstr); if (metabuf != NULL) free(metabuf); return(FAIL); } } /* Release datatype ID */ /* ------------------- */ status = H5Tclose(datatype); if (status == FAIL) { sprintf(errbuf, "Cannot close the datatype \"%s\".", fldname); H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (utlstr != NULL) free(utlstr); if (metabuf != NULL) free(metabuf); return(FAIL); } /* Release dataset ID */ /* ------------------ */ Dstatus = H5Dclose(datasetid); if (Dstatus == FAIL) { sprintf(errbuf, "Cannot close the dataset \"%s\".", fldname); H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (utlstr != NULL) free(utlstr); if (metabuf != NULL) free(metabuf); return(FAIL); } } else { sprintf(errbuf, "\"DataType\" string not found in metadata."); H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(utlstr); free(metabuf); return(FAIL); } /* * Get DimList string and trim off leading and trailing parens * "()" */ statmeta = HE5_EHgetmetavalue(metaptrs, "DimList", utlstr); if (statmeta == SUCCEED) { /* Initialize slen[] array */ /* ----------------------- */ for (i = 0; i < HE5_DTSETRANKMAX; i++) slen[ i ] = 0; memmove(utlstr, utlstr + 1, strlen(utlstr) - 2); utlstr[strlen(utlstr) - 2] = 0; /* Parse trimmed DimList string and get rank */ /* ----------------------------------------- */ ndims = HE5_EHparsestr(utlstr, ',', ptr, slen); *rank = (int)ndims; } else { sprintf(errbuf, "\"DimList\" string not found in metadata."); H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(utlstr); free(metabuf); return(FAIL); } /* Get information about grid */ /* -------------------------- */ status = HE5_GDgridinfo(gridID, &xdim, &ydim, NULL, NULL); if(status == FAIL) { sprintf(errbuf, "Cannot get information about Grid.\n"); H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(utlstr); free(metabuf); return(FAIL); } for (i = 0; i < ndims; i++) { memmove(dimstr, ptr[i] + 1, slen[i] - 2); dimstr[slen[i] - 2] = 0; if (strcmp(dimstr, "XDim") == 0) { dims[i] = (hsize_t)xdim; } else if (strcmp(dimstr, "YDim") == 0) { dims[i] = (hsize_t)ydim; } else { /* Get dimension size */ /* ------------------ */ dims[i] = (hsize_t)HE5_GDdiminfo(gridID, dimstr); if ( dims[i] == FAIL) { sprintf(errbuf, "Cannot get the size of dimension.\n"); H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(utlstr); free(metabuf); return(FAIL); } } /* If DimList string is requested ... */ /* ---------------------------------- */ if (dimlist != NULL) { if (i == 0) { dimlist[0] = 0; } if (i > 0) { strcat(dimlist, ","); } strcat(dimlist, dimstr); } } /* If MaxdimList is requested ... */ /* ------------------------------- */ if (maxdimlist != NULL ) { statmeta = HE5_EHgetmetavalue(metaptrs, "MaxdimList", utlstr); if (statmeta == SUCCEED) { memmove(utlstr, utlstr + 1, strlen(utlstr) - 2); utlstr[strlen(utlstr) - 2] = 0; /* Parse trimmed MaxdimList string and get rank */ /* -------------------------------------------- */ ndims = HE5_EHparsestr(utlstr, ',', ptr, slen); } else { sprintf(errbuf, "\"MaxdimList\" string not found in metadata."); H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(utlstr); free(metabuf); return(FAIL); } strcpy(maxdimstr,""); strcpy(maxdimlist,""); for (i = 0; i < ndims; i++) { memmove(maxdimstr, ptr[i] + 1, slen[i] - 2); maxdimstr[slen[i] - 2] = 0; /* If MaxdimList string is requested ... */ /* ------------------------------------- */ if (maxdimlist != NULL) { if (i > 0) { strcat(maxdimlist, ","); } strcat(maxdimlist, maxdimstr); } } } /* Get field-related dataset ID */ /* ---------------------------- */ status = HE5_GDgetfieldID(gridID, fldname, &fieldID); if ( status == FAIL ) { sprintf(errbuf, "Cannot get the dataset ID for the \"%s\" field.\n", fldname); H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(utlstr); free(metabuf); return(status); } /* Get data space ID */ /* ----------------- */ dspace = H5Dget_space( fieldID ); if (dspace == FAIL) { sprintf(errbuf, "Cannot get the dataspace ID for the \"%s\" field.\n", fldname); H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(utlstr); free(metabuf); return(FAIL); } /* Get dataset rank */ /* ---------------- */ *rank = H5Sget_simple_extent_ndims(dspace); if ( *rank == FAIL ) { sprintf(errbuf, "Cannot get the dataset rank for the \"%s\" field.\n", fldname); H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(utlstr); free(metabuf); return(FAIL); } /* Get dataset dimension sizes */ /* --------------------------- */ status = H5Sget_simple_extent_dims(dspace,dims, NULL); if ( status == FAIL ) { sprintf(errbuf, "Cannot get the dataset dimension sizes for the \"%s\" field.\n", fldname); H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(utlstr); free(metabuf); return(status); } /* Release the dataspace ID */ /* ------------------------ */ status = H5Sclose(dspace); if ( status == FAIL) { sprintf(errbuf, "Cannot release the dataset ID for the \"%s\" field.\n", fldname); H5Epush(__FILE__, "HE5_GDfieldinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(utlstr); free(metabuf); return(status); } } free(metabuf); free(utlstr); metabuf = NULL; utlstr = NULL; COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDtileinfo | | | | DESCRIPTION: Retrieves tiling information | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t Grid structure ID | | fldname char* name of field | | | | OUTPUTS: | | tilecode int* tile code | | tilerank int* number of tiling dimensions | | tiledims hsize_t the array containing sizes | | of each dimension of a tile | | NOTES: | | | | | | Date Programmer Description | | ========= ============ ============================================== | | Dec 03 S.Zhao Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDtileinfo(hid_t gridID, char *fldname, int *tilecode, int *tilerank, hsize_t tiledims[]) { herr_t status = FAIL;/* Return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ long idx = FAIL;/* Grid index */ hid_t fieldID = FAIL;/* field dataset ID */ hid_t plist = FAIL;/* field dataset property list ID */ hid_t dspace = FAIL;/* "fieldname" Dataspace ID */ int ndims = 0; /* Number of dimensions */ H5D_layout_t layout = H5D_LAYOUT_ERROR; /* Storage layout type */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKPOINTER(fldname); /* Get HDF-EOS file ID, "HDFEOS" group ID and Grid index */ /* ----------------------------------------------------- */ status = HE5_GDchkgdid(gridID, "HE5_GDtileinfo", &fid, &gid, &idx); if (status == FAIL) { sprintf(errbuf,"Checking for valid grid ID failed.\n"); H5Epush(__FILE__, "HE5_GDtileinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Check out the field group and get field ID */ /* ------------------------------------------ */ status = HE5_GDgetfieldID(gridID, fldname, &fieldID); if(status == FAIL) { sprintf(errbuf, "Cannot get the field ID for the \"%s\" field.\n", fldname); H5Epush(__FILE__, "HE5_GDtileinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the property list ID */ /* ------------------------ */ plist = H5Dget_create_plist(fieldID); if (plist == FAIL) { sprintf(errbuf, "Cannot get the property list ID for the \"%s\" data field.\n", fldname); H5Epush(__FILE__, "HE5_GDtileinfo", __LINE__, H5E_PLIST, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the data space ID */ /* --------------------- */ dspace = H5Dget_space(fieldID); if(dspace == FAIL) { sprintf(errbuf, "Cannot get the data space ID for the \"%s\" data field.\n", fldname); H5Epush(__FILE__, "HE5_GDtileinfo", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the dataset rank */ /* -------------------- */ ndims = H5Sget_simple_extent_ndims(dspace); if(ndims == FAIL) { sprintf(errbuf, "Cannot get the rank of the dataset.\n"); H5Epush(__FILE__, "HE5_GDtileinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get Layout */ /* ---------- */ layout = H5Pget_layout(plist); if (layout == H5D_LAYOUT_ERROR) { sprintf(errbuf, "Cannot get the layout of the raw data. \n"); H5Epush(__FILE__, "HE5_GDtileinfo", __LINE__, H5E_PLIST, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } else if (layout == H5D_CHUNKED) { *tilecode = HE5_HDFE_TILE; /* Get chunking */ /* ------------ */ *tilerank = H5Pget_chunk(plist, ndims, tiledims); if (*tilerank == FAIL) { sprintf(errbuf, "Cannot get the sizes of chunks. \n"); H5Epush(__FILE__, "HE5_GDtileinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } else { *tilecode = HE5_HDFE_NOTILE; *tilerank = 0; } /* Release property list ID */ /* ------------------------ */ status = H5Pclose(plist); if (status == FAIL ) { sprintf(errbuf, "Cannot release property list ID. \n"); H5Epush(__FILE__, "HE5_GDtileinfo", __LINE__, H5E_PLIST, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Release the data space ID */ /* ------------------------- */ status = H5Sclose(dspace); if( status == FAIL) { sprintf(errbuf, "Cannot release the data space ID.\n"); H5Epush(__FILE__, "HE5_GDtileinfo", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDdeffield | | | | DESCRIPTION: Defines a new data field within the grid. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | fieldname char* fieldname | | dimlist char* Dimension list (comma-separated list) | | maxdimlist char* Maximum Dimension list | | ntype hid_t Data type ID of the field | | merge int merge code | | | | OUTPUTS: | | None | | | | NOTES: | | | | HDF5 Library Functions Called: | | H5Tequal | | H5Pget_layout | | H5Screate_simple | | H5Dcreate | | H5Dextend | | H5Tget_size | | H5Pget_fill_value | | H5Pclose | | | | Date Programmer Description | | ====== ============ ================================================= | | 9/20/99 A.Muslimov In the call to EHinsertmeta() replaced the argument | | gid by fid. Added error handling after the function | | calls. In the call to H5Dcreate() replaced the first| | argument by gd_id (data field group ID). | | 9/30/99 A.Muslimov Added more error handlings after the function calls.| | Removed 'if(status == -1){}' block from the | | 'if((tilecode == HDFE_TILE ){}' block. | | 10/18/99 A.Muslimov Replace memcpy() by memmove() to avoid a problem | | when arguments 1 and 2 overlap in memory. | | 10/18/99 A.Taaheri Replaced strcpy() by memmove() to avoid a problem | | when arguments 1 and 2 overlap in memory. | | Jan 2000 A.Muslimov Modified to enable the functioning of routines | | dealing with extendible datsets. | | Mar,2000 A.Muslimov Changed the ID of field group from gd_id to | | data_id. | | 07/12/00 A.Muslimov Unmasked hdf5 data types. | | Nov 2000 A.Muslimov Modified to enable appendability of any dimension. | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | Aug 03 S.Zhao Added checking for SOMBlockDim in the dimlist. | | Aug 03 S.Zhao Added Szip compression methods. | | Jan 04 S.Zhao Added to create a character string dataset. | | Mar 04 S.Zhao Modified for a character string dataset. | | Apr 04 S.Zhao Modified for a character string dataset. | | May 04 S.Zhao Added to check in the maxdimlist section for "XDim" | | set to xdimsize and "YDim" set to ydimsize. | | May 05 S.Zhao Added HE5_EHdtype2numtype() and HE5_EHhid2hsize() | | functions calls. | | Aug 08 Abe Taaheri Fixed problem with fillvalue setting. Value set for | | fillvalue is used only in the field that intended. | | It must be set before defining the field. | | Sep 11 Abe Taaheri Modified for correcting Unlimited dimension | | behavior and extension, removing hardcoded name | | Unlim | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDdeffield(hid_t gridID, const char *fieldname, char *dimlist, char *maxdimlist, hid_t numbertype_in, int merge) { herr_t status = FAIL; /* routine return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t data_id = FAIL; /* "Data Fields" group ID */ hid_t dataset = FAIL; /* dataset ID */ hid_t data_space = FAIL; /* dataspace ID */ int i; /* Loop index */ int found = 0; /* "Found" flag */ int foundNT = 0; /* "Found number type" flag */ int foundAllDim = 1; /* "Found all dimensions" flag */ int first = 1; /* "First entry" flag */ int append = FALSE;/* "Appendability" flag */ int tilecode = FAIL; /* Tiling code */ int projcode = FAIL; /* Projection Code */ int rank = 0; /* Field rank */ int maxrank = 0; /* Maximum dimension rank */ long idx = FAIL; /* Grid index */ long xdim = 0; /* Grid "X" dimension size */ long ydim = 0; /* Grid "Y" dimension size */ hsize_t dims[HE5_DTSETRANKMAX]; /* Dimension size array */ hsize_t maxdims[HE5_DTSETRANKMAX];/* Max.Dimension size array */ hsize_t count[] = { 1 } ; /* Number of elements array */ hsize_t dimsize = 0; /* Dimension size */ double projparm[13]; /* Projection Parameters */ H5D_layout_t layout = H5D_LAYOUT_ERROR;/* Type of storage ID */ void *value; /* Fill value buffer */ size_t tsize = 0; /* Size of a data type */ char compmethod[HE5_HDFE_NAMBUFSIZE];/* Compression code */ char *dimbuf = (char *)NULL; /* Dimension buffer */ char *dimlist0 = (char *)NULL; /* Auxilliary dimension list */ char *comma = (char *)NULL; /* Pointer to "," */ char *dimcheck = (char *)NULL; /* Individual dimen. string */ char *utlbuf = (char *)NULL; /* Utility buffer */ char *utlbuf2 = (char *)NULL; /* Utility buffer 2 */ char gridname[HE5_HDFE_NAMBUFSIZE]; /* Grid name buffer */ char parmbuf[HE5_HDFE_NAMBUFSIZE]; /* Parameter string buffer */ char *errbuf1 = (char *)NULL; /* Error message buffer #1 */ char *errbuf2 = (char *)NULL; /* Error message buffer #2 */ char *errmsg1 = "Dimension: %d (size: %lu) not divisible by "; char *errmsg2 = "tile dimension (size: %lu).\n"; char *errmsg = (char *)NULL; /* Tiling error message */ /* char *HDFcomp[5] = {"HE5_HDFE_COMP_NONE", "HE5_HDFE_COMP_RLE","HE5_HDFE_COMP_NBIT", "HE5_HDFE_COMP_SKPHUFF","HE5_HDFE_COMP_DEFLATE"}; Compression code names */ char compparmbuf[HE5_HDFE_NAMBUFSIZE]; /* Compression string buffer */ char maxdimlstbuf[HE5_HDFE_NAMBUFSIZE];/* Max.Dimension list buffer */ char *errbuf = (char *)NULL; /* Error message buffer */ char *nameptr = (char *)NULL; char tempname[HE5_HDFE_NAMBUFSIZE]; hid_t numbertype = FAIL; /* Number type ID */ int attr = 0; /* attribute value */ H5D_fill_value_t fill_status; /* to see if fill value is set or not */ hid_t numtype = FAIL; hsize_t metavalue = 0; /* Metavalue to insert */ hid_t ntype; H5T_class_t classid = H5T_NO_CLASS; HE5_LOCK; CHECKNAME(fieldname); CHECKPOINTER(dimlist); /* Allocate memory for error message buffers */ /* ----------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* assuming that fillvalue is undefined for the field */ fill_status = H5D_FILL_VALUE_UNDEFINED; /* Convert HDF-EOS5 datatype to HDF5 datatype */ if ( H5Tequal(numbertype_in, H5T_NATIVE_CHAR) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_SCHAR) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_UCHAR) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_SHORT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_USHORT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_INT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_UINT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_LONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_ULONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_LLONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_ULLONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_FLOAT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_DOUBLE) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_LDOUBLE)== TRUE || H5Tequal(numbertype_in, H5T_C_S1) == TRUE) { ntype = numbertype_in; } else { ntype = HE5_EHconvdatatype((int) numbertype_in); } if(ntype == FAIL) { sprintf(errbuf,"Cannot convert to HDF5 type data type ID for defining field.\n"); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } errbuf1 = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf1 == NULL) { sprintf(errbuf,"Cannot allocate memory for error buffer1.\n"); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } errbuf2 = (char *)calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf2 == NULL) { sprintf(errbuf,"Cannot allocate memory for error buffer2.\n"); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(errbuf1); return(FAIL); } /* Allocate memory for tiling error message */ /* ---------------------------------------- */ errmsg = (char *)calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errmsg == NULL) { sprintf(errbuf,"Cannot allocate memory for tiling error message.\n"); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(errbuf1); free(errbuf2); return(FAIL); } /* Setup error message strings */ /* --------------------------- */ strcpy(errbuf1, "HE5_GDXSDname array too small.\nPlease increase "); strcat(errbuf1, "size of HE5_HDFE_NAMBUFSIZE in \"HE5_HdfEosDef.h\".\n"); strcpy(errbuf2, "HE5_GDXSDdims array too small.\nPlease increase "); strcat(errbuf2, "size of HE5_HDFE_DIMBUFSIZE in \"HE5_HdfEosDef.h\".\n"); /* Build tiling dimension error message */ /* ------------------------------------ */ strcpy(errmsg, errmsg1); strcat(errmsg, errmsg2); /* Initialize dims and maxdims arrays */ /* ---------------------------------- */ for(i = 0; i < HE5_DTSETRANKMAX; i++) { dims[i] = 0; maxdims[i] = 0; } /* Initialize projparm[] array */ /* --------------------------- */ for ( i = 0; i < 13; i++) projparm[ i ] = 0.; /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDdeffield", &fid, &gid, &idx); if(status == FAIL) { sprintf(errbuf,"Checking for Grid ID failed.\n"); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(errbuf1); free(errbuf2); free(errmsg); return(FAIL); } /* Allocate memory for utility buffers */ /* ----------------------------------- */ utlbuf = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) ); if( utlbuf == NULL ) { sprintf(errbuf,"Can not allocate memory for utility buffer.\n"); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(errbuf1); free(errbuf2); free(errmsg); return(FAIL); } utlbuf2 = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) ); if( utlbuf2 == NULL ) { sprintf(errbuf,"Can not allocate memory for utility buffer2.\n"); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(errbuf1); free(errbuf2); free(errmsg); free(utlbuf); return(FAIL); } strcpy(gridname, HE5_GDXGrid[idx].gdname); /* Allocate space for dimension buffer and auxilliary dimension list */ /* ----------------------------------------------------------------- */ dimbuf = (char *)calloc(strlen(dimlist) + 64, sizeof(char)); if(dimbuf == NULL) { sprintf(errbuf,"Can not allocate memory for dimension buffer.\n"); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(errbuf1); free(errbuf2); free(errmsg); free(utlbuf); free(utlbuf2); return(FAIL); } dimlist0 = (char *)calloc(strlen(dimlist) + 64, sizeof(char)); if(dimlist0 == NULL) { sprintf(errbuf,"Can not allocate memory for dimension list string.\n"); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(errbuf1); free(errbuf2); free(errmsg); free(utlbuf); free(utlbuf2); free(dimbuf); return(FAIL); } status = HE5_GDgridinfo(gridID, &xdim, &ydim, NULL, NULL); if(status == FAIL) { sprintf(errbuf,"Cannot get information about Grid.\n"); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(errbuf1); free(errbuf2); free(errmsg); free(utlbuf); free(utlbuf2); free(dimbuf); free(dimlist0); return(FAIL); } /* Get Grid and Projection info */ /* ---------------------------- */ status = HE5_GDprojinfo(gridID, &projcode, NULL, NULL, projparm); if(status == FAIL) { sprintf(errbuf,"Cannot get Grid projection information.\n"); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(errbuf1); free(errbuf2); free(errmsg); free(utlbuf); free(utlbuf2); free(dimbuf); free(dimlist0); return(FAIL); } /* Setup Block Dimension if "Blocked" SOM projection */ /* ------------------------------------------------- */ if (projcode == HE5_GCTP_SOM && (long)projparm[11] != 0) { dimsize = HE5_GDdiminfo(gridID, "SOMBlockDim"); /* If "SOMBlockDim" not yet defined then do it */ if (dimsize == 0) { status = HE5_GDdefdim(gridID, "SOMBlockDim", (hsize_t)projparm[11]); if(status == FAIL) { sprintf(errbuf,"Cannot define \"SOMBlockDim\" dimension.\n"); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(errbuf1); free(errbuf2); free(errmsg); free(utlbuf); free(utlbuf2); free(dimbuf); free(dimlist0); return(FAIL); } } /* If not 1D field then prepend to dimension list */ if (strchr(dimlist, ',') != NULL) { strcpy(tempname, dimlist); nameptr = strchr( tempname, ',' ); if ( nameptr != NULL ) { nameptr[0] = '\0'; } if ( strcmp(tempname, "SOMBlockDim") != 0) { strcpy(dimbuf, "SOMBlockDim,"); strcat(dimbuf, dimlist); } else { strcpy(dimbuf, dimlist); } } else { strcpy(dimbuf, dimlist); } } else { /* If not "Blocked" SOM then just copy dim list to dim buffer */ strcpy(dimbuf, dimlist); } /* * Copy dimension buffer to auxilliary dimlist and Append comma to * end of dimension list */ strcpy(dimlist0, dimbuf); strcat(dimbuf, ","); /* Find comma */ /* ---------- */ comma = strchr(dimbuf, ','); /* * Loop through entries in dimension list to make sure they are * defined in grid */ while (comma != NULL) { /* Copy dimension list entry to dimcheck */ /* ------------------------------------- */ dimcheck = (char *)calloc(comma - dimbuf + 1, sizeof(char)); if(dimcheck == NULL) { sprintf(errbuf, "Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if(dimbuf != NULL) free(dimbuf); if(dimlist0 != NULL) free(dimlist0); free(errbuf); free(errbuf1); free(errbuf2); free(errmsg); free(utlbuf); free(utlbuf2); return(FAIL); } memmove(dimcheck, dimbuf, comma - dimbuf); /* Get Dimension Size */ /* ------------------ */ if (strcmp(dimcheck, "XDim") == 0) { /* If "XDim" then use xdim value for grid definition */ /* ------------------------------------------------- */ dimsize = (hsize_t)xdim; found = 1; dims[ rank ] = dimsize; rank++; } else if (strcmp(dimcheck, "YDim") == 0) { /* If "YDim" then use ydim value for grid definition */ /* ------------------------------------------------- */ dimsize = (hsize_t)ydim; found = 1; dims[ rank ] = dimsize; rank++; } else { /* "Regular" Dimension */ /* ------------------- */ dimsize = HE5_GDdiminfo(gridID, dimcheck); if (dimsize > 0) { found = 1; dims[ rank ] = dimsize; rank++; } else { found = 0; } } /* * If dimension list entry not found - set error return status, * append name to utility buffer for error report */ if (found == 0) { foundAllDim = 0; if (first == 1) { strcpy(utlbuf, dimcheck); } else { strcat(utlbuf, ","); strcat(utlbuf, dimcheck); } first = 0; } /* * Go to next dimension entry, find next comma, & free up * dimcheck buffer */ memmove(dimbuf, comma + 1, strlen(comma)-1); dimbuf[strlen(comma)-1]= 0; comma = strchr(dimbuf, ','); if(dimcheck != NULL) free(dimcheck); } if(dimbuf != NULL) free(dimbuf); /* If all dimensions not found then report error */ /* --------------------------------------------- */ if (foundAllDim == 0) { status = FAIL; sprintf(errbuf, "Cannot find dimensions for \"%s\" field.\n", fieldname); H5Eclear(); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FILE, H5E_SEEKERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (dimlist0 != NULL) free(dimlist0); free(errbuf); free(errbuf1); free(errbuf2); free(errmsg); free(utlbuf); free(utlbuf2); return (status); } /* Check maxdimlist */ /* Allocate space for dimbuf, copy dimlist into it, & append comma */ /*----------------------------------------------------------------*/ if(maxdimlist != NULL) { dimbuf = (char *)calloc(strlen(maxdimlist) + 64, sizeof(char)); strcpy(dimbuf, maxdimlist); strcat(dimbuf, ","); /* Find comma */ comma = strchr(dimbuf, ','); /* * Loop through entries in dimension list to make sure they are * defined in grid */ while (comma != NULL) { /* Copy dimension list entry to dimcheck buffer */ /* -------------------------------------------- */ dimcheck = (char *)calloc(comma - dimbuf + 1, sizeof(char)); if(dimcheck == NULL) { sprintf(errbuf, "Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (dimbuf != NULL) free(dimbuf); free(errbuf); free(errbuf1); free(errbuf2); free(errmsg); free(utlbuf); free(utlbuf2); if (dimlist0 != NULL) free(dimlist0); return(FAIL); } memmove(dimcheck, dimbuf, comma - dimbuf); /* Get dimension size */ /* ------------------ */ if (strcmp(dimcheck, "XDim") == 0) { /* If "XDim" then use xdim value for grid definition */ /* ------------------------------------------------- */ dimsize = (hsize_t)xdim; maxdims[ maxrank ] = dimsize; maxrank++; } else if (strcmp(dimcheck, "YDim") == 0) { /* If "YDim" then use ydim value for grid definition */ /* ------------------------------------------------- */ dimsize = (hsize_t)ydim; maxdims[ maxrank ] = dimsize; maxrank++; } else { dimsize = HE5_GDdiminfo(gridID, dimcheck); if ( (dimsize > 0) || (dimsize == H5S_UNLIMITED) ) { maxdims[ maxrank ] = dimsize; maxrank++; } else { /* * If dimension list entry not found - set error return * status, append name to utility buffer for error report */ foundAllDim = 0; if (first == 1) strcpy(utlbuf, dimcheck); else { strcat(utlbuf, ","); strcat(utlbuf, dimcheck); } first = 0; } } /* * Go to next dimension entry, find next comma, & free up * dimcheck buffer */ memmove(dimbuf, comma + 1, strlen(comma + 1) + 1); comma = strchr(dimbuf, ','); if (dimcheck != NULL) free(dimcheck); } if(dimbuf != NULL) free(dimbuf); /* If all dimensions not found then report error */ /* --------------------------------------------- */ if (foundAllDim == 0) { status = FAIL; sprintf(errbuf, "Cannot find dimensions for \"%s\" field.\n", fieldname); H5Eclear(); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FILE, H5E_SEEKERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(errbuf1); free(errbuf2); free(errmsg); free(utlbuf); free(utlbuf2); if (dimlist0 != NULL) free(dimlist0); return(status); } } /* end if */ /* max dimmension equal to dims */ else { for(i = 0; i < rank; i++ ) maxdims[ i ] = dims[ i ]; } /* Check out if dataset dimension is appendable */ /* -------------------------------------------- */ for(i = 0; i < rank; i++) { if( dims[i] == maxdims[i] ) append = FALSE; else if ( (dims[i] < maxdims[i]) || (maxdims[i] == H5S_UNLIMITED)) { append = TRUE; break; } else { status = FAIL; sprintf(errbuf, "Maximum dimension size is smaller than dimension size.\n"); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(errbuf1); free(errbuf2); free(errmsg); free(utlbuf); free(utlbuf2); if (dimlist0 != NULL) free(dimlist0); return(status); } } /* Check for valid data type ID */ /* ----------------------------- */ if (ntype == HE5T_CHARSTRING) { foundNT=1; } else { if (H5Tequal(ntype, H5T_NATIVE_CHAR)) foundNT=1; else if (H5Tequal(ntype, H5T_NATIVE_UCHAR)) foundNT=1; else if (H5Tequal(ntype, H5T_NATIVE_SHORT)) foundNT=1; else if (H5Tequal(ntype, H5T_NATIVE_USHORT)) foundNT=1; else if (H5Tequal(ntype, H5T_NATIVE_INT)) foundNT=1; else if (H5Tequal(ntype, H5T_NATIVE_UINT)) foundNT=1; else if (H5Tequal(ntype, H5T_NATIVE_LONG)) foundNT=1; else if (H5Tequal(ntype, H5T_NATIVE_ULONG)) foundNT=1; else if (H5Tequal(ntype, H5T_NATIVE_LLONG)) foundNT=1; else if (H5Tequal(ntype, H5T_NATIVE_ULLONG)) foundNT=1; else if (H5Tequal(ntype, H5T_NATIVE_FLOAT)) foundNT=1; else if (H5Tequal(ntype, H5T_NATIVE_DOUBLE)) foundNT=1; else if (H5Tequal(ntype, H5T_NATIVE_LDOUBLE)) foundNT=1; else if (H5Tequal(ntype, H5T_C_S1)) foundNT=1; else foundNT=0; } classid = H5Tget_class(ntype); if( foundNT == 0 && classid == H5T_STRING) { /* we have string datatype H5T_C_S1 with a size larger than 1 */ foundNT=1; } if (foundNT == 0) { status = FAIL; sprintf(errbuf, "Invalid number type for \"%s\" field.\n", fieldname); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_DATATYPE, H5E_BADTYPE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(errbuf1); free(errbuf2); free(errmsg); free(utlbuf); free(utlbuf2); if (dimlist0 != NULL) free(dimlist0); return(status); } if (status == SUCCEED) { /* Get Field group ID, compresion code, & tiling code */ /* -------------------------------------------------- */ data_id = HE5_GDXGrid[idx].data_id; strcpy(compmethod, HE5_GDXGrid[idx].compmethod); tilecode = HE5_GDXGrid[idx].tilecode; /* Check that field dims are divisible by tile dims */ /* ------------------------------------------------ */ if (tilecode == HE5_HDFE_TILE) { for (i = 0; i < HE5_GDXGrid[idx].tilerank; i++) { if ((dims[ i ] % HE5_GDXGrid[ idx ].tiledims[ i ]) != 0) { status = FAIL; sprintf(errbuf, errmsg, i, (unsigned long)dims[i],(unsigned long)HE5_GDXGrid[idx].tiledims[i]); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(errbuf1); free(errbuf2); free(errmsg); free(utlbuf); free(utlbuf2); if (dimlist0 != NULL) free(dimlist0); return(status); } } } /* Create dataspace then create dataset */ /* dataset creation property is not set outside by */ /* GDdefchunksize() or GDdefcom() */ if(HE5_GDXGrid[ idx ].plist == FAIL) { HE5_GDXGrid[ idx ].plist = H5Pcreate(H5P_DATASET_CREATE); if(HE5_GDXGrid[ idx ].plist == FAIL) { sprintf(errbuf,"Cannot create a new property list.\n"); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(errbuf1); free(errbuf2); free(errmsg); free(utlbuf); free(utlbuf2); if (dimlist0 != NULL) free(dimlist0); return(FAIL); } } /* Get layout information */ /* ---------------------- */ layout = H5Pget_layout(HE5_GDXGrid[ idx ].plist); if(layout == H5D_LAYOUT_ERROR) { sprintf(errbuf,"Cannot get layout information for the dataset.\n"); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(errbuf1); free(errbuf2); free(errmsg); free(utlbuf); free(utlbuf2); if (dimlist0 != NULL) free(dimlist0); return(FAIL); } if(append == FALSE) { data_space = H5Screate_simple(rank, dims, NULL); if(data_space == FAIL) { sprintf(errbuf,"Cannot create dataspace for the dataset.\n"); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(errbuf1); free(errbuf2); free(errmsg); free(utlbuf); free(utlbuf2); if (dimlist0 != NULL) free(dimlist0); return(FAIL); } } else { if( layout == H5D_CHUNKED) { data_space = H5Screate_simple(rank, dims, maxdims); if(data_space == FAIL) { sprintf(errbuf,"Cannot create dataspace for the dataset.\n"); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(errbuf1); free(errbuf2); free(errmsg); free(utlbuf); free(utlbuf2); if (dimlist0 != NULL) free(dimlist0); return(FAIL); } } else { status = FAIL; sprintf(errbuf, "Dataset MUST BE CHUNKED if it is extendible.\n"); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_DATASPACE, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(errbuf1); free(errbuf2); free(errmsg); free(utlbuf); free(utlbuf2); if (dimlist0 != NULL) free(dimlist0); return(status); } } /* Note: in inquiry routines HE5T_CHARSTRING is distinguished from HE5T_NATIVE_CHAR for the field data (not attributes) based on whether string has variable or fixed length as set below. The field data of type HE5T_NATIVE_CHAR has fixed length of 1, and the field is array of characters, not strings. However, HE5T_CHARSTRING sets array of vaiable length strings for the field data. Currently HE5_EHattr treats HE5T_NATIVE_CHAR, HE5T_CHARSTRING, and H5T_C_S1 as fixed (any size) for attributes. */ numbertype = ntype; if (ntype == HE5T_CHARSTRING) { numbertype = H5Tcopy(H5T_C_S1); status = H5Tset_size(numbertype, H5T_VARIABLE); if( status == FAIL) { sprintf(errbuf, "Cannot set the total size for \"%s\" field. \n", fieldname); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(errbuf1); free(errbuf2); free(errmsg); free(utlbuf); free(utlbuf2); if (dimlist0 != NULL) free(dimlist0); return(status); } /* Create dataset */ /* -------------- */ dataset = H5Dcreate(data_id, fieldname, numbertype, data_space, HE5_GDXGrid[ idx ].plist); if (dataset == FAIL) { sprintf(errbuf, "Cannot create dataset for \"%s\" field. \n", fieldname); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(errbuf1); free(errbuf2); free(errmsg); free(utlbuf); free(utlbuf2); if (dimlist0 != NULL) free(dimlist0); return(FAIL); } } else if (/*numbertype == H5T_C_S1*/ classid == H5T_STRING && (int)H5Tget_size((hid_t)numbertype) > 1) { /* numbertype = H5Tcopy(H5T_C_S1); status = H5Tset_size(numbertype, H5T_VARIABLE); if( status == FAIL) { sprintf(errbuf, "Cannot set the total size for \"%s\" field. \n", fieldname); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(errbuf1); free(errbuf2); free(errmsg); free(utlbuf); free(utlbuf2); if (dimlist0 != NULL) free(dimlist0); return(status); } */ /* Create dataset */ /* -------------- */ dataset = H5Dcreate(data_id, fieldname, numbertype, data_space, HE5_GDXGrid[ idx ].plist); if (dataset == FAIL) { sprintf(errbuf, "Cannot create dataset for \"%s\" field. \n", fieldname); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(errbuf1); free(errbuf2); free(errmsg); free(utlbuf); free(utlbuf2); if (dimlist0 != NULL) free(dimlist0); return(FAIL); } } else if (numbertype == H5T_NATIVE_CHAR) { numbertype = H5Tcopy(H5T_C_S1); status = H5Tset_size(numbertype, 1); if( status == FAIL) { sprintf(errbuf, "Cannot set the total size for \"%s\" field. \n", fieldname); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(errbuf1); free(errbuf2); free(errmsg); free(utlbuf); free(utlbuf2); if (dimlist0 != NULL) free(dimlist0); return(status); } /* Create dataset */ /* -------------- */ dataset = H5Dcreate(data_id, fieldname, numbertype, data_space, HE5_GDXGrid[ idx ].plist); if (dataset == FAIL) { sprintf(errbuf, "Cannot create dataset for \"%s\" field. \n", fieldname); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(errbuf1); free(errbuf2); free(errmsg); free(utlbuf); free(utlbuf2); if (dimlist0 != NULL) free(dimlist0); return(FAIL); } } else { /* Create dataset */ /* -------------- */ dataset = H5Dcreate(data_id, fieldname, ntype, data_space, HE5_GDXGrid[ idx ].plist); if(dataset == FAIL) { sprintf(errbuf, "Cannot create dataset \"%s\".\n", fieldname); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(errbuf1); free(errbuf2); free(errmsg); free(utlbuf); free(utlbuf2); if (dimlist0 != NULL) free(dimlist0); return(FAIL); } } /* Extend dataset. Assure that dataset is at least dims */ /* ---------------------------------------------------- */ if(append == TRUE) { status = H5Dextend(dataset,dims); if(status == FAIL) { sprintf(errbuf,"Cannot extend the dataset.\n"); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(errbuf1); free(errbuf2); free(errmsg); free(utlbuf); free(utlbuf2); if (dimlist0 != NULL) free(dimlist0); return(status); } } /* Allocate space for the ID array */ /* ------------------------------- */ if (HE5_GDXGrid[idx].nDFLD > 0) { /* Array already exists therefore reallocate */ /* ----------------------------------------- */ HE5_GDXGrid[idx].ddataset = (HE5_DTSinfo *) realloc((void *)HE5_GDXGrid[idx].ddataset,(HE5_GDXGrid[idx].nDFLD + 1) * sizeof(HE5_DTSinfo)); if(HE5_GDXGrid[idx].ddataset == NULL) { sprintf(errbuf,"Cannot reallocate memory for the dataset.\n"); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(errbuf1); free(errbuf2); free(errmsg); free(utlbuf); free(utlbuf2); if (dimlist0 != NULL) free(dimlist0); return(FAIL); } } else { /* Array does not exist */ /* -------------------- */ HE5_GDXGrid[idx].ddataset = (HE5_DTSinfo *) calloc(1, sizeof(HE5_DTSinfo)); if(HE5_GDXGrid[idx].ddataset == NULL) { sprintf(errbuf,"Cannot allocate memory for the dataset.\n"); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(errbuf1); free(errbuf2); free(errmsg); free(utlbuf); free(utlbuf2); if (dimlist0 != NULL) free(dimlist0); return(FAIL); } } /* Allocate memory for the dataset name string */ /* ------------------------------------------- */ HE5_GDXGrid[idx].ddataset[HE5_GDXGrid[idx].nDFLD].name = (char *)calloc( (strlen(fieldname)+1), sizeof(char) ); if(HE5_GDXGrid[idx].ddataset[HE5_GDXGrid[idx].nDFLD].name == NULL) { sprintf(errbuf,"Cannot allocate memory for the dataset name string.\n"); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(errbuf1); free(errbuf2); free(errmsg); free(utlbuf); free(utlbuf2); if (dimlist0 != NULL) free(dimlist0); free(HE5_GDXGrid[idx].ddataset); return(FAIL); } /* Save the field/dataset ID and field/dataset name */ /* ------------------------------------------------ */ HE5_GDXGrid[idx].ddataset[HE5_GDXGrid[idx].nDFLD].ID = dataset; strcpy( HE5_GDXGrid[idx].ddataset[HE5_GDXGrid[idx].nDFLD].name, fieldname); HE5_GDXGrid[idx].nDFLD++; if ((ntype != HE5T_CHARSTRING) && (ntype != H5T_NATIVE_CHAR) && (ntype != H5T_C_S1)) { /* Get the data size (bytes) */ /* ------------------------- */ tsize = H5Tget_size(ntype); /* Allocate memory for the fillvalue buffer */ /* ---------------------------------------- */ value = (void *)calloc( 1, tsize ); if(value == (void *)NULL) { sprintf(errbuf,"Cannot allocate memory for the \"value\" variable.\n"); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(errbuf1); free(errbuf2); free(errmsg); free(utlbuf); free(utlbuf2); if (dimlist0 != NULL) free(dimlist0); free(HE5_GDXGrid[idx].ddataset); free(HE5_GDXGrid[idx].ddataset[HE5_GDXGrid[idx].nDFLD].name); return(FAIL); } /* Try to get fill value */ /* --------------------- */ H5E_BEGIN_TRY { status = H5Pfill_value_defined(HE5_GDXGrid[idx].plist, &fill_status ); } H5E_END_TRY; if (fill_status == H5D_FILL_VALUE_USER_DEFINED) { H5E_BEGIN_TRY { status = H5Pget_fill_value( HE5_GDXGrid[idx].plist, ntype, value); } H5E_END_TRY; /* Store fill value in the dataset attribute "_FillValue" */ /* ----------------------------------------------------- */ if( status != FAIL ) { status = HE5_EHattr( dataset, "_FillValue", ntype, count, "w", value); if(status == FAIL) { sprintf(errbuf, "Cannot write fill value to the \"_FillValue\" attribute.\n"); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(errbuf1); free(errbuf2); free(errmsg); free(utlbuf); free(utlbuf2); if (dimlist0 != NULL) free(dimlist0); free(HE5_GDXGrid[idx].ddataset[HE5_GDXGrid[idx].nDFLD].name); free(HE5_GDXGrid[idx].ddataset); free(value); return(FAIL); } } } free( value); } /* ************************************************************ * SET UP METADATA STRINGS * ************************************************************ */ /* set up "DimList" string content */ /* ------------------------------- */ strcpy(utlbuf,""); sprintf(utlbuf, "%s%s%s", fieldname, ":", dimlist0); /* set up max dim list string */ /* -------------------------- */ if ( maxdimlist != NULL) { /* Make metadata string list for max dimension list */ /* ------------------------------------------------ */ strcpy(utlbuf2,""); strcpy(maxdimlstbuf,""); status = HE5_EHmetalist(maxdimlist , maxdimlstbuf); if(status == FAIL) { sprintf(errbuf, "Cannot make metadata string list for the max dimension list.\n"); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(errbuf1); free(errbuf2); free(errmsg); free(utlbuf); free(utlbuf2); if (dimlist0 != NULL) free(dimlist0); free(HE5_GDXGrid[idx].ddataset[HE5_GDXGrid[idx].nDFLD].name); free(HE5_GDXGrid[idx].ddataset); return(FAIL); } sprintf(utlbuf2,"%s%s",":\n\t\t\t\tMaxdimList=",maxdimlstbuf); strcat(utlbuf,utlbuf2); } if ( maxdimlist == NULL ) { strcpy(utlbuf2,""); strcpy(maxdimlstbuf,""); status = HE5_EHmetalist(dimlist0, maxdimlstbuf); if(status == FAIL) { sprintf(errbuf, "Cannot make metadata string list for the max dimension list.\n"); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(errbuf1); free(errbuf2); free(errmsg); free(utlbuf); free(utlbuf2); if (dimlist0 != NULL) free(dimlist0); free(HE5_GDXGrid[idx].ddataset[HE5_GDXGrid[idx].nDFLD].name); free(HE5_GDXGrid[idx].ddataset); return(FAIL); } sprintf(utlbuf2,"%s%s",":\n\t\t\t\tMaxdimList=",maxdimlstbuf); strcat(utlbuf,utlbuf2); } /* Setup compression metadata */ /* -------------------------- */ strcpy(compmethod, HE5_GDXGrid[idx].compmethod); if ( strcmp(compmethod, "HE5_HDFE_COMP_NONE" ) != 0 ) { if(maxdimlist != NULL) { sprintf(utlbuf2, "%s%s", "\n\t\t\t\tCompressionType=", compmethod); } else { sprintf(utlbuf2, "%s%s", "\n\t\t\t\tCompressionType=", compmethod); } if( strcmp(compmethod,"HE5_HDFE_COMP_NBIT") == 0 ) { strcpy(compparmbuf,""); sprintf(compparmbuf, "%s%d,%d,%d,%d%s","\n\t\t\t\tCompressionParams=(", HE5_GDXGrid[idx].compparm[0], HE5_GDXGrid[idx].compparm[1], HE5_GDXGrid[idx].compparm[2], HE5_GDXGrid[idx].compparm[3], ")"); strcat(utlbuf2, compparmbuf); } else if ( strcmp(compmethod, "HE5_HDFE_COMP_DEFLATE") == 0) { strcpy(compparmbuf,""); sprintf(compparmbuf,"%s%d","\n\t\t\t\tDeflateLevel=", HE5_GDXGrid[idx].compparm[0]); strcat(utlbuf2, compparmbuf); } else if ( strcmp(compmethod, "HE5_HDFE_COMP_SZIP_CHIP") == 0) { strcpy(compparmbuf,""); sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_GDXGrid[idx].compparm[0]); strcat(utlbuf2, compparmbuf); } else if ( strcmp(compmethod, "HE5_HDFE_COMP_SZIP_K13") == 0) { strcpy(compparmbuf,""); sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_GDXGrid[idx].compparm[0]); strcat(utlbuf2, compparmbuf); } else if ( strcmp(compmethod, "HE5_HDFE_COMP_SZIP_EC") == 0) { strcpy(compparmbuf,""); sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_GDXGrid[idx].compparm[0]); strcat(utlbuf2, compparmbuf); } else if ( strcmp(compmethod, "HE5_HDFE_COMP_SZIP_NN") == 0) { strcpy(compparmbuf,""); sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_GDXGrid[idx].compparm[0]); strcat(utlbuf2, compparmbuf); } else if ( strcmp(compmethod, "HE5_HDFE_COMP_SZIP_K13orEC") == 0) { strcpy(compparmbuf,""); sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_GDXGrid[idx].compparm[0]); strcat(utlbuf2, compparmbuf); } else if ( strcmp(compmethod, "HE5_HDFE_COMP_SZIP_K13orNN") == 0) { strcpy(compparmbuf,""); sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_GDXGrid[idx].compparm[0]); strcat(utlbuf2, compparmbuf); } else if ( strcmp(compmethod, "HE5_HDFE_COMP_SHUF_DEFLATE") == 0) { strcpy(compparmbuf,""); sprintf(compparmbuf,"%s%d","\n\t\t\t\tDeflateLevel=", HE5_GDXGrid[idx].compparm[0]); strcat(utlbuf2, compparmbuf); } else if ( strcmp(compmethod, "HE5_HDFE_COMP_SHUF_SZIP_CHIP") == 0) { strcpy(compparmbuf,""); sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_GDXGrid[idx].compparm[0]); strcat(utlbuf2, compparmbuf); } else if ( strcmp(compmethod, "HE5_HDFE_COMP_SHUF_SZIP_K13") == 0) { strcpy(compparmbuf,""); sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_GDXGrid[idx].compparm[0]); strcat(utlbuf2, compparmbuf); } else if ( strcmp(compmethod, "HE5_HDFE_COMP_SHUF_SZIP_EC") == 0) { strcpy(compparmbuf,""); sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_GDXGrid[idx].compparm[0]); strcat(utlbuf2, compparmbuf); } else if ( strcmp(compmethod, "HE5_HDFE_COMP_SHUF_SZIP_NN") == 0) { strcpy(compparmbuf,""); sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_GDXGrid[idx].compparm[0]); strcat(utlbuf2, compparmbuf); } else if ( strcmp(compmethod, "HE5_HDFE_COMP_SHUF_SZIP_K13orEC") == 0) { strcpy(compparmbuf,""); sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_GDXGrid[idx].compparm[0]); strcat(utlbuf2, compparmbuf); } else if ( strcmp(compmethod, "HE5_HDFE_COMP_SHUF_SZIP_K13orNN") == 0) { strcpy(compparmbuf,""); sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_GDXGrid[idx].compparm[0]); strcat(utlbuf2, compparmbuf); } /* Append compression parameters with compression code */ /* --------------------------------------------------- */ strcat(utlbuf, utlbuf2); } /* Setup tiling information metadata */ /* --------------------------------- */ if (tilecode == HE5_HDFE_TILE) { if ( strcmp(compmethod, "HE5_HDFE_COMP_NONE" ) != 0 ) { strcpy(utlbuf2,""); sprintf(utlbuf2,"%s%li","\n\t\t\t\tTilingDimensions=(", (long)HE5_GDXGrid[idx].tiledims[0]); } else { strcpy(utlbuf2,""); sprintf(utlbuf2, "%s%li","\n\t\t\t\tTilingDimensions=(", (long)HE5_GDXGrid[idx].tiledims[0]); } for (i = 1; i < HE5_GDXGrid[idx].tilerank; i++) { sprintf(parmbuf, ",%li", (long)HE5_GDXGrid[idx].tiledims[ i ]); strcat(utlbuf2, parmbuf); } strcat(utlbuf2, ")"); strcat(utlbuf, utlbuf2); } if (classid == H5T_STRING && (int)H5Tget_size((hid_t)numbertype) > 1) { ntype = H5T_C_S1; } numtype = HE5_EHdtype2numtype(ntype); if (numtype == FAIL) { sprintf(errbuf, "Cannot get the number type ID. \n"); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(errbuf1); free(errbuf2); free(errmsg); free(utlbuf); free(utlbuf2); if (dimlist0 != NULL) free(dimlist0); free(HE5_GDXGrid[idx].ddataset[HE5_GDXGrid[idx].nDFLD].name); free(HE5_GDXGrid[idx].ddataset); return(FAIL); } else if (numtype == 0) { metavalue = 0; } else { metavalue = HE5_EHhid2hsize(numtype); if (metavalue == 0) { sprintf(errbuf, "Cannot convert \"hid_t\" to \"hsize_t\" data type. \n"); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(errbuf1); free(errbuf2); free(errmsg); free(utlbuf); free(utlbuf2); if (dimlist0 != NULL) free(dimlist0); free(HE5_GDXGrid[idx].ddataset[HE5_GDXGrid[idx].nDFLD].name); free(HE5_GDXGrid[idx].ddataset); return(FAIL); } } /* Insert field metadata within File Structural Metadata */ /* ----------------------------------------------------- */ status = HE5_EHinsertmeta(fid, gridname, "g", 4L, utlbuf, &metavalue); if(status == FAIL) { sprintf(errbuf,"Cannot insert metadata.\n"); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(errbuf1); free(errbuf2); free(errmsg); free(utlbuf); free(utlbuf2); if (dimlist0 != NULL) free(dimlist0); free(HE5_GDXGrid[idx].ddataset[HE5_GDXGrid[idx].nDFLD].name); free(HE5_GDXGrid[idx].ddataset); return(FAIL); } } /* Release the property list ID */ /* ---------------------------- */ status = H5Pclose(HE5_GDXGrid[idx].plist); if(status == FAIL) { sprintf(errbuf,"Cannot release the property list ID.\n"); H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_PLIST, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } /* Reset property list ID */ /* ---------------------- */ HE5_GDXGrid[idx].plist = FAIL; strcpy(HE5_GDXGrid[idx].compmethod,"HE5_HDFE_COMP_NONE"); HE5_GDXGrid[idx].tilecode = HE5_HDFE_NOTILE; if (dimlist0 != NULL) free(dimlist0); if (utlbuf != NULL) free(utlbuf); if (utlbuf2 != NULL) free(utlbuf2); if (errbuf != NULL) free(errbuf); if (errbuf1 != NULL) free(errbuf1); if (errbuf2 != NULL) free(errbuf2); if (errmsg != NULL) free(errmsg); if ((ntype == HE5T_CHARSTRING) || (ntype == H5T_C_S1)) { attr = HE5T_CHARSTRING; status = HE5_GDwritelocattr(gridID, fieldname, "ARRAYOFSTRINGS", H5T_NATIVE_INT, count, &attr); if (status == FAIL) { sprintf(errbuf, "Cannot write attribute to the field \"%s\".",fieldname) ; H5Epush(__FILE__, "HE5_GDdeffield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDupdatedim | | | | DESCRIPTION: Updates numerical value of dimension | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t Grid structure ID | | dimname char* Dimension name | | dim hsize_t Dimension size | | | | OUTPUTS: | | | | NOTES: | | | | | | Date Programmer Description | | ======== ============ ================================================ | | Sep 2011 Abe Taaheri Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ static herr_t HE5_GDupdatedim(hid_t gridID, char *dimname, hsize_t dim) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ long idx = FAIL;/* Grid index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ hsize_t predims; long xdim = 0; /* X dim size */ long ydim = 0; /* Y dim size */ HE5_LOCK; CHECKNAME(dimname); /* Get HDF-EOS file ID, "HDFEOS" group ID and Grid index */ /* ------------------------------------------------------ */ status = HE5_GDchkgdid(gridID, "HE5_GDupdatedim", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for grid ID failed.\n"); H5Epush(__FILE__, "HE5_GDupdatedim", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Make certain that dim != 0 */ /* -------------------------- */ if ( dim == 0 ) { status = FAIL; sprintf(errbuf, "Invalid (zero) dimension size.\n"); H5Epush(__FILE__, "HE5_GDupdatedim", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get dimension size */ /* ------------------ */ if ((strcmp(dimname, "XDim") == 0) || (strcmp(dimname, "YDim") == 0)) { status = HE5_GDgridinfo(gridID, &xdim, &ydim, NULL, NULL); if(status == FAIL) { sprintf(errbuf, "Cannot get information about Grid.\n"); H5Epush(__FILE__, "HE5_GDupdatedim", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } if(strcmp(dimname, "XDim") == 0) { predims = (hsize_t)xdim; } else if(strcmp(dimname, "YDim") == 0) { predims = (hsize_t)ydim; } } else { predims = HE5_GDdiminfo(gridID, dimname); } if (predims == 0) { status = FAIL; sprintf(errbuf, "Failed to retrieve the size of \"%s\" dimension. \n", dimname); H5Epush(__FILE__, "HE5_GDupdatedim", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Write updated dimension back to the dataset "StructMetadata.0" */ /* -------------------------------------------------------------- */ if (dim > predims) { status = HE5_EHupdatemeta(fid, HE5_GDXGrid[idx].gdname, "g", 0L, dimname, &dim); if ( status == FAIL ) { sprintf(errbuf, "Cannot update the value for \"%s\" dimension in Metadata.\n", dimname); H5Epush(__FILE__, "HE5_GDupdatedim", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDdefdimscale | | | | DESCRIPTION: Defines dimension scale for all fields that use the given | | dimesion (default dimscale name) | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t grid structure ID | | dimname char dim name | | dimsize hsize_t Dimemsion size value | | numbertype_in hid_t dim scale data type such as DFNT_INT32, | | DFNT_FLOAT64, DFNT_FLOAT32, etc. | | data void data buffer for write | | | | | | OUTPUTS: | | | | NOTES: This function finds out which field in a grid has the dimension | | and sets dimension scale for that field calling HE5_GDsetdimscale() | | User must detach grid after creating fields and attach again before | | calling the routine. | | | | | | Date Programmer Description | | ======== ============ =============================================== | | Dec 2013 Abe Taaheri Original Programmer | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDdefdimscale(hid_t gridID, char *dimname, const hsize_t dimsize, hid_t numbertype_in, void * data) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ long idx = FAIL;/* Grid index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ char *fieldlist = NULL; long strbufsize; long nflds = FAIL; HE5_LOCK; CHECKNAME(dimname); /* Get HDF-EOS file ID, "HDFEOS" group ID and Grid index */ /* ------------------------------------------------------ */ status = HE5_GDchkgdid(gridID, "HE5_GDdefdimscale", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for Grid ID failed.\n"); H5Epush(__FILE__, "HE5_GDdefdimscale", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Make certain that dimsize != 0 */ /* ------------------------------ */ if ( dimsize == 0 ) { status = FAIL; sprintf(errbuf, "Invalid (zero) dimension size.\n"); H5Epush(__FILE__, "HE5_GDdefdimscale", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Loop over all fields in the grid and find out if field's dimension list has the dimension name. If true then set the dimension scale for the dim in that field */ /* Inquire Data Fields first*/ /* ------------------------ */ nflds = HE5_GDnentries(gridID, HE5_HDFE_NENTDFLD, &strbufsize); if (nflds == FAIL) { sprintf(errbuf, "Cannot get the number of fields in \"Data Fields\" group. \n"); H5Epush(__FILE__, "HE5_GDdefdimscale", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } else { fieldlist = (char *) calloc(strbufsize + 1, sizeof(char)); if(fieldlist == NULL) { sprintf(errbuf,"Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_GDdefdimscale", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } nflds = HE5_GDinqfields(gridID, fieldlist, NULL, NULL); if (nflds == FAIL) { sprintf(errbuf, "Cannot get the list of fields in \"Data Fields\" group. \n"); H5Epush(__FILE__, "HE5_GDdefdimscale", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(fieldlist); return(FAIL); } if(nflds > 0) { size_t fldnmlen[HE5_FLDNUMBERMAX]; /* Array of namelengths */ char *fldnm[HE5_FLDNUMBERMAX]; /* Array of names */ char tempdimlist[HE5_HDFE_DIMBUFSIZE];/* Dimension list */ int rank = FAIL; /* Rank of dataset */ hsize_t tempdims[HE5_DTSETRANKMAX]; /* Dimension sizes array*/ hid_t dtype[1] = {FAIL}; /* Data type */ long ntflds = 0; /* field counter */ int i; char *tempfield = NULL; unsigned int Dimindex; ntflds = HE5_EHparsestr(fieldlist, ',', fldnm,fldnmlen); if(ntflds != FAIL) { for(i = 0; i < ntflds; i++) { tempfield = (char *)calloc(fldnmlen[i] + 1, sizeof(char)); memmove(tempfield,fldnm[i],fldnmlen[i]); tempfield[fldnmlen[i]]='\0'; /* for this field see if the dimlist contains dimname */ status = HE5_GDfieldinfo(gridID, tempfield, &rank, tempdims, dtype, tempdimlist, NULL); if (status != SUCCEED) { sprintf(errbuf, "Field \"%s\" not found.\n", tempfield); H5Epush(__FILE__, "HE5_GDdefdimscale", __LINE__, H5E_ARGS, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(tempfield); free(fieldlist); return(FAIL); } Dimindex = FAIL; Dimindex = HE5_EHstrwithin(dimname, tempdimlist, ','); if (Dimindex == FAIL) /* dimension not found */ { continue; /*dimlist does not contain dim name */ } else { /* call HE5_GDsetdimscle */ status = HE5_GDsetdimscale(gridID, (char *)tempfield, dimname, dimsize, numbertype_in, data); if ( status == FAIL ) { sprintf(errbuf,"Cannot set dimension scale %s for the field %s. \n", dimname, tempfield); H5Epush(__FILE__, "HE5_GDdefdimscale", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(tempfield); free(fieldlist); return(status); } } } free(tempfield); tempfield = NULL; } } free(fieldlist); fieldlist = NULL; } COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDdefdimscale2 | | | | DESCRIPTION: Defines dimension scale for all fields that use the given | | dimesion (user defined dimscale name) | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t grid structure ID | | dimname char dim name | | dimscalename char user defined dimscale name | | dimsize hsize_t Dimemsion size value | | numbertype_in hid_t dim scale data type such as DFNT_INT32, | | DFNT_FLOAT64, DFNT_FLOAT32, etc. | | data void data buffer for write | | | | | | OUTPUTS: | | | | NOTES: This function finds out which field in a grid has the dimension | | and sets dimension scale for that field calling HE5_GDsetdimscale2()| | User must detach grid after creating fields and attach again before | | calling the routine. | | | | | | Date Programmer Description | | ======== ============ =============================================== | | Dec 2017 Abe Taaheri Original Programmer | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDdefdimscale2(hid_t gridID, char *dimname, char *dimscalename, const hsize_t dimsize, hid_t numbertype_in, void * data) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ long idx = FAIL;/* Swath index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ char *fieldlist = NULL; long strbufsize; long nflds = FAIL; HE5_LOCK; CHECKNAME(dimname); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_GDchkgdid(gridID, "HE5_GDdefdimscale2", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for Grid ID failed.\n"); H5Epush(__FILE__, "HE5_GDdefdimscale2", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Make certain that dimsize != 0 */ /* ------------------------------ */ if ( dimsize == 0 ) { status = FAIL; sprintf(errbuf, "Invalid (zero) dimension size.\n"); H5Epush(__FILE__, "HE5_GDdefdimscale2", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Loop over all fields in the grid and find out if field's dimension list has the dimension name. If true then set the dimension scale for the dim in that field */ /* Inquire Data Fields first*/ /* ------------------------ */ nflds = HE5_GDnentries(gridID, HE5_HDFE_NENTDFLD, &strbufsize); if (nflds == FAIL) { sprintf(errbuf, "Cannot get the number of fields in \"Data Fields\" group. \n"); H5Epush(__FILE__, "HE5_GDdefdimscale2", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } else { fieldlist = (char *) calloc(strbufsize + 1, sizeof(char)); if(fieldlist == NULL) { sprintf(errbuf,"Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_GDdefdimscale2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } nflds = HE5_GDinqfields(gridID, fieldlist, NULL, NULL); if (nflds == FAIL) { sprintf(errbuf, "Cannot get the list of fields in \"Data Fields\" group. \n"); H5Epush(__FILE__, "HE5_GDdefdimscale2", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(fieldlist); return(FAIL); } if(nflds > 0) { size_t fldnmlen[HE5_FLDNUMBERMAX]; /* Array of namelengths */ char *fldnm[HE5_FLDNUMBERMAX]; /* Array of names */ char tempdimlist[HE5_HDFE_DIMBUFSIZE];/* Dimension list */ int rank = FAIL; /* Rank of dataset */ hsize_t tempdims[HE5_DTSETRANKMAX]; /* Dimension sizes array*/ hid_t dtype[1] = {FAIL}; /* Data type */ long ntflds = 0; /* field counter */ int i; char *tempfield = NULL; unsigned int Dimindex; ntflds = HE5_EHparsestr(fieldlist, ',', fldnm,fldnmlen); if(ntflds != FAIL) { for(i = 0; i < ntflds; i++) { tempfield = (char *)calloc(fldnmlen[i] + 1, sizeof(char)); memmove(tempfield,fldnm[i],fldnmlen[i]); tempfield[fldnmlen[i]]='\0'; /* for this field see if the dimlist contains dimname */ status = HE5_GDfieldinfo(gridID, tempfield, &rank, tempdims, dtype, tempdimlist, NULL); if (status != SUCCEED) { sprintf(errbuf, "Field \"%s\" not found.\n", tempfield); H5Epush(__FILE__, "HE5_GDdefdimscale2", __LINE__, H5E_ARGS, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(tempfield); free(fieldlist); return(FAIL); } Dimindex = FAIL; Dimindex = HE5_EHstrwithin(dimname, tempdimlist, ','); if (Dimindex == FAIL) /* dimension not found */ { continue; /*dimlist does not contain dim name */ } else { /* call HE5_GDsetdimscle */ status = HE5_GDsetdimscale2(gridID, (char *)tempfield, dimname, dimscalename, dimsize, numbertype_in, data); if ( status == FAIL ) { sprintf(errbuf,"Cannot set dimension scale %s for the field %s. \n", dimscalename, tempfield); H5Epush(__FILE__, "HE5_GDdefdimscale2", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(tempfield); free(fieldlist); return(status); } } } free(tempfield); tempfield = NULL; } } free(fieldlist); fieldlist = NULL; } COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDsetdimscale | | | | DESCRIPTION: Defines a dimension scale for a dimension for fields of a grid| | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t grid structure ID | | fieldname char field name | | dimname char Dimension name | | dimsize hsize_t Dimemsion size value | | numbertype_in hid_t dim scale data type such as DFNT_INT32, | | DFNT_FLOAT64, DFNT_FLOAT32, etc. | | data void data buffer for write | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | May 10 Abe Taaheri Original Programmer | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDsetdimscale(hid_t gridID, char *fieldname, char *dimname, const hsize_t dimsize, hid_t numbertype_in, void * data) { herr_t status; hid_t ntype; hsize_t dims[HE5_DTSETRANKMAX]; int rankSDS; hid_t field_ntype[1] = {FAIL}; /* number types */ char dimlist[HE5_HDFE_DIMBUFSIZE]; char maxdimlist[HE5_HDFE_DIMBUFSIZE]; long xdimsize; long ydimsize; double upleftpt[2]; double lowrightpt[2]; double pixsizeX; double pixsizeY; hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t did; hid_t dsid; hid_t fspace = FAIL; /* File dataspace ID */ unsigned int Dimindex; hid_t dsplist = FAIL; /* Property list ID */ H5D_layout_t layout = H5D_LAYOUT_ERROR; /* Type of storage */ hid_t data_space = FAIL; /* dataspace ID */ long idx = FAIL; /* Grid index */ char *errbuf = (char *)NULL; /* buffer for error message*/ double *data_bufff64= NULL; void *data_buff; int i, found; int rankds; hsize_t dimsds[1]; char *dimscalename = NULL; int projcode; int zonecode; int spherecode; double projparm[13]; HE5_LOCK; CHECKNAME(fieldname); CHECKNAME(dimname); /* Allocate memory for error buffer */ /* -------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDsetdimscale", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Convert HDF-EOS5 datatype to HDF5 datatype */ if ( H5Tequal(numbertype_in, H5T_NATIVE_CHAR) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_SCHAR) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_UCHAR) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_SHORT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_USHORT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_INT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_UINT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_LONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_ULONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_LLONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_ULLONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_FLOAT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_DOUBLE) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_LDOUBLE)== TRUE || H5Tequal(numbertype_in, H5T_C_S1) == TRUE) { ntype = numbertype_in; } else { ntype = HE5_EHconvdatatype((int) numbertype_in); } if(ntype == FAIL) { sprintf(errbuf,"Cannot convert to HDF5 type data type ID for dimscale.\n"); H5Epush(__FILE__, "HE5_GDsetdimscale", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the data size (bytes) */ /* ------------------------- */ /*tsize = H5Tget_size(ntype);*/ if((data == NULL) || (strcmp(dimname, "XDim") == 0) || (strcmp(dimname, "YDim") == 0)) { data_bufff64 = (double *)calloc(dimsize, sizeof(double)); if(data_bufff64 == NULL) { sprintf(errbuf, "Cannot allocate memory for buffer.\n"); H5Epush(__FILE__, "HE5_GDsetdimscale", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } } /************************************************************************ * Check for proper grid ID and return HDF-EOS file ID, SDinterface ID, * * and grid root Vgroup ID * ************************************************************************/ status = HE5_GDchkgdid(gridID, "HE5_GDsetdimscale", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for grid ID failed.\n"); H5Epush(__FILE__, "HE5_GDsetdimscale", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); if(data_bufff64 != NULL) free(data_bufff64); return(FAIL); } if (status == 0) { /* Check that field exists */ /* ----------------------- */ status = HE5_GDfieldinfo(gridID, fieldname, &rankSDS, dims, field_ntype, dimlist, maxdimlist); if (status != 0) { sprintf(errbuf, "Fieldname \"%s\" does not exist.\n", fieldname); H5Epush(__FILE__, "HE5_GDsetdimscale", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); if(data_bufff64 != NULL) free(data_bufff64); return(FAIL); } /* get gridname */ /*strcpy(gridname, HE5_GDXGrid[idx].gdname);*/ /* if dimname is XDim or YDim, data scale will be recalculated using xdim, ydim, upleft and lowright for the grid*/ if((data == NULL) || (strcmp(dimname, "XDim") == 0) || (strcmp(dimname, "YDim") == 0)) { status = HE5_GDgridinfo(gridID, &xdimsize, &ydimsize, upleftpt, lowrightpt); /* Get proj info */ /* ------------- */ status = HE5_GDprojinfo(gridID, &projcode, &zonecode, &spherecode, projparm); /* If no projection code defined then bail */ /* --------------------------------------- */ if (projcode == -1 || status == FAIL) { sprintf(errbuf,"Cannot get Grid projection information.\n"); H5Epush(__FILE__, "HE5_GDsetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); if(data_bufff64 != NULL) free(data_bufff64); return(FAIL); } /* Get default values for upleft and lowright if necessary */ /* ------------------------------------------------------- */ if (upleftpt[0] == 0 && upleftpt[1] == 0 && lowrightpt[0] == 0 && lowrightpt[1] == 0) { status = HE5_GDgetdefaults(projcode, zonecode, projparm, spherecode, upleftpt, lowrightpt); /* If error then bail */ /* ------------------ */ if (status != 0) { sprintf(errbuf,"Failed to get default values for uplft and lowrght points.\n" ); H5Epush(__FILE__, "HE5_GDsetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); if(data_bufff64 != NULL) free(data_bufff64); status = -1; return (status); } } if (projcode == HE5_GCTP_GEO) { /* GEO projection */ /* -------------- */ /* Convert upleft and lowright X coords from DMS to degrees */ /* -------------------------------------------------------- */ upleftpt[0] = HE5_EHconvAng(upleftpt[0], HE5_HDFE_DMS_DEG); lowrightpt[0] = HE5_EHconvAng(lowrightpt[0], HE5_HDFE_DMS_DEG); upleftpt[1] = HE5_EHconvAng(upleftpt[1], HE5_HDFE_DMS_DEG); lowrightpt[1] = HE5_EHconvAng(lowrightpt[1], HE5_HDFE_DMS_DEG); } if(strcmp(dimname, "XDim") == 0) { pixsizeX = (lowrightpt[0] - upleftpt[0])/dimsize; for (i = 0; i 0) { dims[rankidx1] = dimsize; dimname[rankidx1] = (char *)malloc(HE5_HDFE_NAMBUFSIZE * sizeof(char)); strcpy(dimname[rankidx1],dimcheck); rankidx1++; } else { sprintf(errbuf, "Dimension \"%s\" not found.\n", dimcheck); H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if(dimbuf != NULL) free(dimbuf); if(dimlist0 != NULL) free(dimlist0); return(FAIL); } } memmove(dimbuf, comma + 1, strlen(comma)-1); dimbuf[strlen(comma)-1]= 0; comma = strchr(dimbuf, ','); if(dimcheck != NULL) free(dimcheck); } if(dimbuf != NULL) free(dimbuf); free(dimlist0); /* Initialize maxdims[] array with dims[] array values */ /* --------------------------------------------------- */ for (i = 0; i < rank; i++) maxdims[i] = dims[i]; /* Check out if the field is appendable */ /* in the following it is assumed that XDim and YDim cannot be appendable since they define a grid that has a preset corner lat/lon (x/y) coordinates. The other dimensions represent band, etc abd can be appendable */ /* ---------------------------------------------------- */ dimbuf = (char *)calloc(strlen(maxdimlist) + 64, sizeof(char)); if(dimbuf == NULL) { sprintf(errbuf, "Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } strcpy(dimbuf, maxdimlist); strcat(dimbuf,","); comma = strchr(dimbuf,','); while(comma != NULL) { dimcheck = (char *)calloc(comma-dimbuf +1, 1); memmove(dimcheck,dimbuf,comma-dimbuf); if (strcmp(dimcheck,"XDim") == 0) { dimsize = (hsize_t)xdim; /* XDim will not be appendable */ } else if (strcmp(dimcheck,"YDim") == 0) { dimsize = (hsize_t)ydim; /* YDim will not be appendable */ } else dimsize = HE5_GDdiminfo(gridID, dimcheck); /* update maxdim array */ if ( (dimsize > 0) || (dimsize == H5S_UNLIMITED) ) { maxdims[ rankidx2 ] = dimsize; /* see if we need to update dim in the structuremetadata */ if ( (dims[rankidx2] < maxdims[rankidx2]) || (maxdims[rankidx2] == H5S_UNLIMITED)) { /* update dim if new dim is still <= maxdim */ if((start[rankidx2]+1) > maxdims[rankidx2] && (maxdims[rankidx2] != H5S_UNLIMITED)) { sprintf(errbuf, "Cannot update the dimension, new dimension size is larger than the max dimension size in the datafiled.\n"); H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } else { status = HE5_GDupdatedim(gridID,dimname[rankidx2], start[rankidx2]+1); if( status == FAIL ) { sprintf(errbuf, "Cannot update the dimension.\n"); H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } } rankidx2++; } memmove(dimbuf,comma+1,strlen(comma+1)+1); comma=strchr(dimbuf,','); free(dimcheck); } free(dimbuf); for(i = 0; i < rank; i++) { if(dimname[i] != NULL) { free(dimname[i]); dimname[i] = NULL; } } for(i = 0; i < rank; i++) { if( dims[i] == maxdims[i] ) append = FALSE; else if ( (dims[i] < maxdims[i]) || (maxdims[i] == H5S_UNLIMITED)) { append = TRUE; break; } else { status = FAIL; sprintf(errbuf, "Maximum dimension size is smaller than dimension size.\n"); H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } /* ============================================================== */ /* start and count are being passed as NULL from GDdefvrtregion */ /* which calls GDreadfield, which have NULL for start and count. */ /* H5Sselect_hyperslab won't take NULL values for start and count */ /* ============================================================== */ if(start == NULL) { tstart = (hssize_t *)calloc(rank, sizeof(hssize_t)); for(i = 0; i < rank; i++) tstart[ i ] = 0; startf = 1; } if(count == NULL) { tcount = (hsize_t *)calloc(rank, sizeof(hsize_t)); for(i = 0; i < rank; i++) tcount[ i ] = dims[ i ]; if(startf == 1) bothf = 1; else countf = 1; } else { lcount = (hsize_t *)calloc(rank, sizeof(hsize_t)); /* get dims and maxdims for the field after dim update for appendable dim*/ status = HE5_GDflddiminfo(gridID, fldname, &rank, dims, maxdims); for(i = 0; i < rank; i++) { if(count[ i ] > dims[ i ]) lcount[ i ] = dims[ i ]; else lcount[ i ] = count[ i ]; } } if (append == TRUE) { /* Get the field-related dataset ID */ /* -------------------------------- */ status = HE5_GDgetfieldID(gridID, fldname, &dtsid); if ( status == FAIL ) { sprintf(errbuf, "Cannot get %s field ID.\n", fldname ); H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } if(bothf == 1) status = H5Dextend(dtsid, tcount); else if(startf == 1) status = H5Dextend(dtsid, lcount); else if(countf == 1) status = H5Dextend(dtsid, tcount); else { /* Calculate the size to extend the dataset to */ /* ------------------------------------------- */ for (i = 0; i < rank; i++) size[ i ] = start[ i ] + lcount[ i ]; /* Extend the dataset size */ /* ----------------------- */ status = H5Dextend(dtsid, size); } if ( status == FAIL ) { sprintf(errbuf, "Cannot extend dataset for the \"%s\" field.\n", fldname ); H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } } if (append == FALSE) { /* Get the field-related dataset ID only */ status = HE5_GDgetfieldID(gridID, fldname, &dtsid); if ( status == FAIL ) { sprintf(errbuf, "Cannot get %s field ID.\n", fldname ); H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } } /* Get the field space ID */ /* --------------------- */ fspace = H5Dget_space(dtsid); if ( fspace == FAIL) { sprintf(errbuf, "Cannot get the file data space ID.\n"); H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } /* Select the hyperslab */ /* -------------------- */ if(bothf == 1) status = H5Sselect_hyperslab( fspace, H5S_SELECT_SET, (const hsize_t *)tstart,stride,tcount,NULL); else if(startf == 1) status = H5Sselect_hyperslab( fspace, H5S_SELECT_SET, (const hsize_t *)tstart,stride,lcount,NULL); else if(countf == 1) status = H5Sselect_hyperslab( fspace, H5S_SELECT_SET, (const hsize_t *)start,stride,tcount,NULL); else status = H5Sselect_hyperslab(fspace,H5S_SELECT_SET,(const hsize_t *)start,stride,lcount,NULL) ; if ( status == FAIL ) { sprintf(errbuf, "Cannot select the hyperslab.\n"); H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } /* Create dataspace for the dataset */ /* -------------------------------- */ if(countf == 1 || bothf == 1) mid = H5Screate_simple(rank, tcount, NULL); else mid = H5Screate_simple(rank,lcount, NULL); if ( mid == FAIL ) { sprintf(errbuf, "Cannot create the dataspace for the dataset.\n"); H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } /* Get the data type ID */ /* -------------------- */ tid = H5Dget_type( dtsid ); if ( tid == FAIL) { sprintf(errbuf, "Cannot get the data type ID.\n"); H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } /* Get the data type class ID */ /* -------------------------- */ classid = H5Tget_class(tid); if (classid == H5T_NO_CLASS) { sprintf(errbuf, "Cannot get the data type ID.\n"); H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } /* Write whole data to dataset */ /* --------------------------- */ if( strcmp(code,"w")==0) { strbufsize1 = 0; nattr = HE5_GDinqlocattrs(gridID, fldname, NULL, &strbufsize1); if ( nattr < 0 ) { sprintf(errbuf, "Cannot retrieve the attributes. \n"); H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } attrlist1 = (char *) calloc(strbufsize1 + 2, sizeof(char)); if (attrlist1 == NULL) { sprintf(errbuf, "Cannot allocate memory for attrlist1.\n") ; H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } nattr = HE5_GDinqlocattrs(gridID, fldname, attrlist1, &strbufsize1); if ( nattr < 0 ) { sprintf(errbuf, "Cannot retrieve the attributes. \n"); H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (attrlist1 != NULL) { free(attrlist1); attrlist1 = NULL; } if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } attptr = strstr(attrlist1,"ARRAYOFSTRINGS"); if ( (classid == H5T_STRING) && (attptr == NULL) ) { status = H5Dwrite(dtsid, tid, mid, fspace, H5P_DEFAULT, datbuf); if( status == FAIL ) { sprintf(errbuf,"Cannot write data to the dataset.\n"); H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (attrlist1 != NULL) { free(attrlist1); attrlist1 = NULL; } if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(status); } } else if ( (classid == H5T_STRING) && (attptr != NULL) ) { strbufsize2 = 0; nattr = HE5_GDinqlocattrs(gridID, fldname, NULL, &strbufsize2); if ( nattr < 0 ) { sprintf(errbuf, "Cannot retrieve the attributes. \n"); H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (attrlist1 != NULL) { free(attrlist1); attrlist1 = NULL; } if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } attrlist2 = (char *) calloc(strbufsize2 + 2, sizeof(char)); if (attrlist2 == NULL) { sprintf(errbuf, "Cannot allocate memory for attrlist2.\n") ; H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (attrlist1 != NULL) { free(attrlist1); attrlist1 = NULL; } if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } nattr = HE5_GDinqlocattrs(gridID, fldname, attrlist2, &strbufsize2); if ( nattr < 0 ) { sprintf(errbuf, "Cannot retrieve the attributes. \n"); H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (attrlist1 != NULL) { free(attrlist1); attrlist1 = NULL; } if (attrlist2 != NULL) { free(attrlist2); attrlist2 = NULL; } if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } if ( (nattr == 0) || ((attptr = strstr(attrlist2,"StringLengthAttribute")) == NULL) ) { htri_t str_is_variable = FALSE; chardatbuf = (char **)datbuf; str_is_variable = H5Tis_variable_str(tid); if(str_is_variable == TRUE) { if (count == NULL) mycount = tcount[0]; if (count != NULL) mycount = *lcount; for (ibuf = 0; ibuf < mycount; ibuf++) { if (chardatbuf[ibuf] == NULL) { strsize = 0; } else { strsize = strlen(chardatbuf[ibuf]); } if (strsize > maxlen) maxlen = strsize; } } else { strsize=(int)H5Tget_size(tid); maxlen = strsize; } numattr[0] = 1; status = HE5_GDwritelocattr(gridID, fldname, "StringLengthAttribute", H5T_NATIVE_INT, numattr, &maxlen); if (status == FAIL) { sprintf(errbuf, "Cannot write attribute to the field \"%s\".",fldname) ; H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (attrlist1 != NULL) { free(attrlist1); attrlist1 = NULL; } if (attrlist2 != NULL) { free(attrlist2); attrlist2 = NULL; } if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(status); } } status = H5Dwrite(dtsid, tid, mid, fspace, H5P_DEFAULT, datbuf); if( status == FAIL ) { sprintf(errbuf,"Cannot write data to the dataset.\n"); H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (attrlist1 != NULL) { free(attrlist1); attrlist1 = NULL; } if (attrlist2 != NULL) { free(attrlist2); attrlist2 = NULL; } if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(status); } } else { /* Get memory data type ID */ /* ----------------------- */ mtype = HE5_EHdtype2mtype(tid); if( mtype == FAIL ) { sprintf(errbuf,"Cannot convert to memory data type.\n"); status = FAIL; H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (attrlist1 != NULL) { free(attrlist1); attrlist1 = NULL; } if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(status); } status = H5Dwrite(dtsid, mtype, mid, fspace, H5P_DEFAULT, datbuf); if( status == FAIL ) { sprintf(errbuf,"Cannot write data to the dataset.\n"); H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (attrlist1 != NULL) { free(attrlist1); attrlist1 = NULL; } if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(status); } } if (attrlist1 != NULL) { free(attrlist1); attrlist1 = NULL; } if (attrlist2 != NULL) { free(attrlist2); attrlist2 = NULL; } } else { if (classid == H5T_STRING) { /* Read the data buffer */ /* -------------------- */ status = H5Dread(dtsid, tid, mid, fspace , H5P_DEFAULT, datbuf); if( status == FAIL ) { sprintf(errbuf,"Cannot read out data from the dataset.\n"); H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(status); } } else { /* Get memory data type ID */ /* ----------------------- */ mtype = HE5_EHdtype2mtype(tid); if ( mtype == FAIL ) { sprintf(errbuf, "Cannot get the memory data type.\n"); H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } status = H5Dread(dtsid, mtype, mid,fspace , H5P_DEFAULT, datbuf); if ( status == FAIL ) { sprintf(errbuf, "Cannot read out data from the dataset.\n"); H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } } } if ( count == NULL) { if(tcount != NULL) free(tcount); } if( start == NULL) { if(tstart != NULL) free(tstart); } if (lcount != NULL) free(lcount); /* Release data space ID */ /* --------------------- */ status = H5Sclose(fspace); if ( status == FAIL ) { sprintf(errbuf, "Cannot release the dataspace ID.\n"); H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Release data space ID */ /* --------------------- */ status = H5Sclose(mid); if ( status == FAIL ) { sprintf(errbuf, "Cannot release the dataspace ID.\n"); H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Release data type ID */ /* --------------------- */ status = H5Tclose( tid ); if ( status == FAIL ) { sprintf(errbuf, "Cannot release the datatype ID.\n"); H5Epush(__FILE__, "HE5_GDwrrdfield", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } COMPLETION: return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDwritefield | | | | DESCRIPTION: Writes data to a grid field. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | fieldname char* fieldname | | start hssize_t start array | | stride hsize_t stride array | | edge hsize_t edge array | | data void data buffer for write | | | | OUTPUTS: | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 07/12/00 A.Muslimov Unmasked hdf5 data types. | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | 09/29/11 Abe Taaheri Modified for correcting Unlimited dimension | | behavior and extension | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDwritefield(hid_t gridID, const char *fieldname, const hssize_t start[], const hsize_t stride[], const hsize_t edge[], void *data) { herr_t status = FAIL; /* routine return status variable */ hsize_t dims[HE5_DTSETRANKMAX]; /* Field dimensions */ int rank = 0; /* Field rank */ int unlimdim; hsize_t maxdims[HE5_DTSETRANKMAX];/* Field maximum dimensions */ int append = FALSE; /* FLAG (if field is appendable)*/ int i; /* Loop index */ char *errbuf = (char *)NULL; /* error message buffer */ char *temp_fieldname = (char *)NULL; int stlen; HE5_LOCK; CHECKNAME(fieldname); CHECKPOINTER(data); /* If a field is appendable and need to be extended, do extension here before writing extended data into it */ stlen = strlen(fieldname); temp_fieldname = (char *)malloc((stlen+1)*sizeof(char)); if(temp_fieldname == (char *)NULL) { H5Epush(__FILE__, "HE5_GDwritefield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for temp_fieldname, occured", __FILE__, __LINE__); return(FAIL); } else { strcpy(temp_fieldname,fieldname); temp_fieldname[stlen] = '\0'; } /* get maxdims for the field */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == (char *)NULL) { H5Epush(__FILE__, "HE5_GDwritefield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); free(temp_fieldname); temp_fieldname = (char *)NULL; return(FAIL); } status = HE5_GDflddiminfo(gridID, temp_fieldname, &rank, dims, maxdims); /* see if we need first to extend data dimensions for unlimited dimensions */ for (i = 0; i < rank; i++) { if( dims[i] == maxdims[i] ) append = FALSE; else if ( (dims[i] < maxdims[i]) || (maxdims[i] == H5S_UNLIMITED)) { append = TRUE; break; } } unlimdim = i; if((append == TRUE) && (edge[unlimdim] > dims[unlimdim])) { hssize_t newstart[8]; hsize_t newedge[8]; for (i = 0; i < rank; i++) { if (start != NULL) { newstart[i]=start[i]; } else { newstart[i]= 0; } if (edge!= NULL) { newedge[i] = edge[i]; } else { newedge[i]=dims[i]; } } newstart[unlimdim]=edge[unlimdim]-1; newedge[unlimdim] = 1; status = HE5_GDwrrdfield(gridID, fieldname, "w", newstart, stride, newedge, data); if (status == FAIL) { sprintf(errbuf, "Cannot write data to the field \"%s\".",fieldname) ; H5Epush(__FILE__, "HE5_GDwritefield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(temp_fieldname); temp_fieldname = (char *)NULL; return(FAIL); } else { for (i = 0; i < rank; i++) { dims[i]=edge[i]; } } } status = HE5_GDwrrdfield(gridID, fieldname, "w", start, stride, edge, data); if (status == FAIL) { sprintf(errbuf, "Cannot write data to the field \"%s\".",fieldname) ; H5Epush(__FILE__, "HE5_GDwritefield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); errbuf = (char *)NULL; free(temp_fieldname); temp_fieldname = (char *)NULL; return(FAIL); } else { status = SUCCEED; free(errbuf); errbuf = (char *)NULL; free(temp_fieldname); temp_fieldname = (char *)NULL; } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDreadfield | | | | DESCRIPTION: Reads data from a grid field. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | fieldname char fieldname | | start hssize_t start array | | stride hsize_t stride array | | edge hsize_t edge array | | | | OUTPUTS: | | buffer void data buffer for read | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 07/12/00 A.Muslimov Unmasked hdf5 data types. | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDreadfield(hid_t gridID, const char *fieldname, const hssize_t start[], const hsize_t stride[], const hsize_t edge[], void *buffer) { herr_t status = FAIL; /* routine return status variable */ HE5_LOCK; CHECKPOINTER(fieldname); status = HE5_GDwrrdfield(gridID, fieldname, "r", start, stride, edge, buffer); COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDwriteattr | | | | DESCRIPTION: Writes/updates attribute in a grid. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | attrname char* attribute name | | ntype hid_t Attribute data type ID | | count[] hsize_t Number of attribute elements | | datbuf void I/O buffer | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 07/12/00 A.Muslimov Unmasked hdf5 data types. | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDwriteattr(hid_t gridID, const char *attrname, hid_t ntype, hsize_t count[], void *datbuf) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ long idx = FAIL;/* Grid index */ hid_t dtype; HE5_LOCK; CHECKNAME(attrname); CHECKPOINTER(count); CHECKPOINTER(datbuf); /* if ntype is HE5 numbertype, rather than H5 numbertype, then convert it, otherwise use ntype itself */ dtype = HE5_EHconvdatatype(ntype); if(dtype == FAIL) { dtype = ntype; } /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDwriteattr", &fid, &gid, &idx); if (status == SUCCEED) { /* Get "Grid Attributes" group ID and call EHattr to perform I/O */ /* ------------------------------------------------------------- */ status = HE5_EHattr(HE5_GDXGrid[idx].gd_id, attrname, ntype, count,"w", datbuf); } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDreadattr | | | | DESCRIPTION: Reads attribute from a grid. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | attrname char attribute name | | | | OUTPUTS: | | datbuf void I/O buffer | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 07/12/00 A.Muslimov Unmasked hdf5 data types. | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDreadattr(hid_t gridID, const char *attrname, void *datbuf) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t ntype = FAIL;/* Data type ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hsize_t count[] = {0};/* array with elements number */ long idx = FAIL;/* Grid index */ HE5_LOCK; CHECKPOINTER(attrname); /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDreadattr", &fid, &gid, &idx); if (status == SUCCEED) { /* Get attribute group ID and call EHattr to perform I/O */ /* ------------------------------------------------------ */ status = HE5_EHattr(HE5_GDXGrid[idx].gd_id, attrname, ntype, count, "r", datbuf); } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDinqgrid | | | | DESCRIPTION: Returns number and names of grid structures in file | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nGrid long Number of grid structures in file | | | | INPUTS: | | filename char HDF-EOS filename | | | | OUTPUTS: | | gridlist char List of grid names (comma-separated) | | strbufsize long Length of gridlist | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 07/12/00 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_GDinqgrid(const char *filename, char *gridlist, long *strbufsize) { long nGrid = FAIL;/* Number of grid structures in file */ herr_t status = FAIL;/* status variable */ CHECKPOINTER(filename); /* Call "HE5_EHinquire" routine */ /* ---------------------------- */ nGrid = HE5_EHinquire(filename, "/HDFEOS/GRIDS", gridlist, strbufsize); COMPLETION: return (nGrid); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDsetfillvalue | | | | DESCRIPTION: Sets fill value for the specified field. | | write attribute "_FillValue" to dataset(field) | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | fieldname char* field name | | ntype hid_t None data type ID | | fillval void fill value | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | HDF5 Library Functions Called: | | H5Pset_fill_value | | | | Date Programmer Description | | ====== ============ ================================================= | | 10/5/99 A.Muslimov Added dynamical memory allocation for errbuf, and | | nt arrays. Added error handlings after the function | | calls. | | | | 12/3/99 A.Muslimov Fixed a bug resulted in not writing a fill value | | into the dataset. | | 07/12/00 A.Muslimov Unmasked hdf5 data types. | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | Mar 04 S.Zhao Modified for a character string dataset. | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDsetfillvalue(hid_t gridID, const char *fieldname, hid_t numbertype_in, void *fillval) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ long idx = FAIL;/* Grid index */ char *errbuf = (char *)NULL;/*error message buffer */ hid_t ntype; HE5_LOCK; CHECKPOINTER(fillval); /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDsetfillvalue", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Convert HDF-EOS5 datatype to HDF5 datatype */ if ( H5Tequal(numbertype_in, H5T_NATIVE_CHAR) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_SCHAR) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_UCHAR) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_SHORT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_USHORT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_INT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_UINT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_LONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_ULONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_LLONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_ULLONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_FLOAT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_DOUBLE) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_LDOUBLE)== TRUE || H5Tequal(numbertype_in, H5T_C_S1) == TRUE) { ntype = numbertype_in; } else { ntype = HE5_EHconvdatatype((int) numbertype_in); } if(ntype == FAIL) { sprintf(errbuf,"Cannot convert to HDF5 type data type ID for fillvalue.\n"); H5Epush(__FILE__, "HE5_GDsetfillvalue", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDsetfillvalue", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for grid ID failed.\n"); H5Epush(__FILE__, "HE5_GDsetfillvalue", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return( status ); } /* Get current dataset creation property ID, set dataset fill value */ /* ---------------------------------------------------------------- */ if( HE5_GDXGrid[idx].plist == FAIL) { HE5_GDXGrid[idx].plist = H5Pcreate(H5P_DATASET_CREATE); if ( HE5_GDXGrid[idx].plist == FAIL ) { sprintf(errbuf, "Cannot create the dataset property list.\n"); H5Epush(__FILE__, "HE5_GDsetfillvalue", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } } /* Set fill value */ /* -------------- */ if ((ntype != HE5T_CHARSTRING) && (ntype != H5T_NATIVE_CHAR) && (ntype != H5T_C_S1)) { status = H5Pset_fill_value(HE5_GDXGrid[idx].plist, ntype, fillval); if ( status == FAIL ) { sprintf(errbuf, "Cannot set the fill value for a dataset creation property list.\n"); H5Epush(__FILE__, "HE5_GDsetfillvalue", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status ); } } free(errbuf); errbuf = NULL; COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDgetfillvalue | | | | DESCRIPTION: Retrieves fill value for a specified field. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | fieldname char* field name | | | | OUTPUTS: | | fillval void fill value | | | | NOTES: | | | | HDF5 Library Functions Called: | | H5Dget_type | | H5Tclose | | | | Date Programmer Description | | ====== ============ ================================================= | | 9/22/99 A.Muslimov Changed the type of status variable from intn to | | int . Added error handlings. Removed redundant | | 'if else' statements. Initialized return status | | variable to -1. | | | | 07/12/00 A.Muslimov Unmasked hdf5 data types. | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | Aug 22,11 Abe Taaheri Add code to return error if fillvalue attribute | | not found. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDgetfillvalue(hid_t gridID, const char *fieldname, void *fillval) { herr_t status = FAIL;/* routine return status variable */ int rank = FAIL;/* Dummy rank variable */ int i; /* loop index */ int found = 0; /* found (1), not found (0) flag */ hid_t *nt = (hid_t *)NULL; /* number types */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t fieldid = FAIL;/* dataset ID */ hid_t typeID = FAIL;/* datatype ID */ long idx = FAIL;/* Grid index */ hsize_t dims[HE5_DTSETRANKMAX];/* Dimensions array */ hsize_t count[] = { 1 };/* number of attribute elements */ char *errbuf = (char *)NULL;/* error message buffer */ char *attrnames = NULL; long strbufsize; long nattr = 0; HE5_LOCK; /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDgetfillvalue", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDgetfillvalue", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for grid ID failed.\n"); H5Epush(__FILE__, "HE5_GDgetfillvalue", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Get field info */ /* -------------- */ nt = (hid_t *)calloc(1, sizeof(hid_t)); if ( nt == (hid_t *)NULL ) { sprintf(errbuf, "Cannot allocate memory for data type class ID.\n"); H5Epush(__FILE__, "HE5_GDgetfillvalue", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Initialize dims[] array */ /* ----------------------- */ for (i = 0; i < HE5_DTSETRANKMAX; i++) dims[ i ] = 0; status = HE5_GDfieldinfo(gridID, fieldname, &rank, dims, nt, NULL, NULL); if( status == FAIL) { sprintf(errbuf, "Failed to get information about \"%s\" data field.\n", fieldname); H5Epush(__FILE__, "HE5_GDgetfillvalue", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(nt); return(FAIL); } /* Loop through all data datasets in grid */ /* -------------------------------------- */ for (i = 0; i < HE5_GDXGrid[ idx ].nDFLD; i++) { /* Get dataset name */ if( strcmp(fieldname, HE5_GDXGrid[ idx ].ddataset[ i ].name) == 0 ) { found = 1; break; } } /* Get dataset ID */ /* -------------- */ if( found == 1) { fieldid = HE5_GDXGrid[ idx ].ddataset[ i ].ID; typeID = H5Dget_type(fieldid); if ( typeID == FAIL ) { sprintf(errbuf, "Cannot get the dataset data type ID.\n"); H5Epush(__FILE__, "HE5_GDgetfillvalue", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(nt); return(FAIL); } /* if fillvalue attribute exist, get the value */ nattr = HE5_GDinqlocattrs(gridID, fieldname, NULL, &strbufsize); if ( nattr < 0 ) { sprintf(errbuf, "Cannot retrieve fillvalue attribute. \n"); H5Epush(__FILE__, "HE5_GDgetfillvalue", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(nt); return(FAIL); } attrnames = (char*)malloc(sizeof(char)*(strbufsize+1)); if (attrnames == NULL) { sprintf(errbuf, "Cannot allocate memory for attrnames.\n") ; H5Epush(__FILE__, "HE5_GDgetfillvalue", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(nt); return(FAIL); } nattr = HE5_GDinqlocattrs(gridID, fieldname, attrnames, &strbufsize); if ( nattr < 0 ) { sprintf(errbuf, "Cannot retrieve fillvalue attribute. \n"); H5Epush(__FILE__, "HE5_GDgetfillvalue", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(nt); if(attrnames != NULL) { free(attrnames); attrnames = NULL; } return(FAIL); } if(strstr(attrnames, "_FillValue")!=NULL) { /* Retrieve the fill value */ /* ----------------------- */ status = HE5_EHattr( fieldid, "_FillValue", typeID, count, "r", fillval); if ( status == FAIL ) { sprintf(errbuf, "Cannot retrieve the fill value.\n"); H5Epush(__FILE__, "HE5_GDgetfillvalue", __LINE__, H5E_ATTR, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(nt); if(attrnames != NULL) { free(attrnames); attrnames = NULL; } return(FAIL); } /* Release the data type ID */ /* ------------------------ */ status = H5Tclose(typeID); if ( status == FAIL ) { sprintf(errbuf, "Cannot release the data type ID.\n"); H5Epush(__FILE__, "HE5_GDgetfillvalue", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(nt); if(attrnames != NULL) { free(attrnames); attrnames = NULL; } return(FAIL); } } else { status = FAIL; sprintf(errbuf, "Cannot retrieve fillvalue attribute. \n"); H5Epush(__FILE__, "HE5_GDgetfillvalue", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } else { status = FAIL; sprintf(errbuf, "Data field \"%s\" not found. \n", fieldname); H5Epush(__FILE__, "HE5_GDgetfillvalue", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } if(attrnames != NULL) { free(attrnames); attrnames = NULL; } free(errbuf); errbuf = NULL; if (nt != NULL) free(nt); COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDinqdatatype | | | | DESCRIPTION: Inquires about data fields in grid | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | fieldname char * | | attrname char * | | | | OUTPUTS: | | dtype H5T_class_t None HDF-EOS data type ID | | Class H5T_class_t | | Order H5T_order_t | | size size_t | | | | NOTES: | | | | | | HDF5 Library Functions Called: | | H5Dopen | | H5Dget_type | | H5Tget_class | | H5Tget_order | | H5Tget_size | | H5Dclose | | H5Aopen_name | | H5Aget_type | | H5Aclose | | | | Date Programmer Description | | ====== ============ ================================================= | | Oct 99 D.Wynne Original Programmer | | Dec 99 A.Muslimov Changed the status return data type from hid_t to | | int . | | Feb 00 A.Muslimov Added error checkings. | | Mar 00 A.Muslimov Changed the ID of field group from gd_id to data_id.| | Mar 00 A.Muslimov Updated to include Group/Local attributes. | | 5/10/00 A.Muslimov Changed 'H5T_class_t' type to 'int' data type. | | 07/12/00 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDinqdatatype(hid_t gridID, const char *fieldname, const char *attrname, int fieldgroup, hid_t *dtype, H5T_class_t *classID, H5T_order_t *Order, size_t *size) { herr_t status = FAIL; /* routine return status */ hid_t datasetid = FAIL; /* dataset ID */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t attr = FAIL; /* attribute dataset ID */ hid_t fldgroup = FAIL; /* group ID */ hid_t fieldID = FAIL; /* Data field dataset ID */ long idx = FAIL; /* Grid index */ char *errbuf = (char *)NULL;/* Error message buffer */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDinqdatatype", &fid, &gid, &idx); if(status == SUCCEED) { if(fieldgroup == HE5_HDFE_DATAGROUP) fldgroup = HE5_GDXGrid[idx].data_id; else if(fieldgroup == HE5_HDFE_ATTRGROUP) fldgroup = HE5_GDXGrid[idx].gd_id; else if(fieldgroup == HE5_HDFE_GRPATTRGROUP) fldgroup = HE5_GDXGrid[idx].data_id; else if(fieldgroup == HE5_HDFE_LOCATTRGROUP) fldgroup = HE5_GDXGrid[idx].data_id; else { sprintf(errbuf, "Group \"%d\" unknown.\n", fieldgroup); H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_FUNC, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Call HDF 5 routines */ /* =================== */ if(fieldgroup == HE5_HDFE_DATAGROUP) { datasetid = H5Dopen(fldgroup, fieldname); if (datasetid == FAIL) { sprintf(errbuf, "Cannot open the dataset for the \"%s\" field.\n", fieldname); H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_DATASET, H5E_NOTFOUND , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } *dtype = H5Dget_type(datasetid); if (*dtype == FAIL) { sprintf(errbuf, "Cannot get the datatype for the \"%s\" field.\n", fieldname); H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_DATATYPE, H5E_NOTFOUND , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } *classID = H5Tget_class(*dtype); if (*classID == H5T_NO_CLASS) { sprintf(errbuf, "Cannot get the data type class ID for the \"%s\" field.\n", fieldname); H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } *Order = H5Tget_order(*dtype); if (*Order == H5T_ORDER_ERROR) { sprintf(errbuf, "Cannot get the data type order for the \"%s\" field.\n", fieldname); H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } if (*classID == H5T_STRING) { *size = H5Tget_size(*dtype); } else { *size = H5Tget_size(*dtype); if (*size == 0) { sprintf(errbuf, "Cannot get the data type size for the \"%s\" field.\n", fieldname); H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } } status = H5Dclose(datasetid); if (status == FAIL) { sprintf(errbuf, "Cannot release the dataset ID for the \"%s\" field.\n", fieldname); H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_DATASET, H5E_CLOSEERROR , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } } else if(fieldgroup == HE5_HDFE_ATTRGROUP || fieldgroup == HE5_HDFE_GRPATTRGROUP) { attr = H5Aopen_name(fldgroup, attrname); if (attr == FAIL) { sprintf(errbuf, "Cannot open the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } *dtype = H5Aget_type(attr); if (*dtype == FAIL) { sprintf(errbuf, "Cannot get the data type for the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } *classID = H5Tget_class(*dtype); if (*classID == H5T_NO_CLASS) { sprintf(errbuf, "Cannot get the data type class ID for the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } *Order = H5Tget_order(*dtype); if (*Order == H5T_ORDER_ERROR) { sprintf(errbuf, "Cannot get the data type order for the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } if (*classID == H5T_STRING) { *size = H5Tget_size(*dtype); } else { *size = H5Tget_size(*dtype); if (*size == 0) { sprintf(errbuf, "Cannot get the data type size for the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } } status = H5Aclose(attr); if (status == FAIL) { sprintf(errbuf, "Cannot release the dataset ID for the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_DATASET, H5E_CLOSEERROR , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } } else if(fieldgroup == HE5_HDFE_LOCATTRGROUP) { fieldID = H5Dopen(fldgroup, fieldname); if (fieldID == FAIL) { sprintf(errbuf,"Cannot open the \"%s\" field dataset.\n", fieldname); H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } attr = H5Aopen_name(fieldID, attrname); if (attr == FAIL) { sprintf(errbuf, "Cannot open the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } *dtype = H5Aget_type(attr); if (*dtype == FAIL) { sprintf(errbuf, "Cannot get the data type for the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } *classID = H5Tget_class(*dtype); if (*classID == H5T_NO_CLASS) { sprintf(errbuf, "Cannot get the data type class ID for the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } *Order = H5Tget_order(*dtype); if (*Order == H5T_ORDER_ERROR) { sprintf(errbuf, "Cannot get the data type order for the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } if (*classID == H5T_STRING) { *size = H5Tget_size(*dtype); } else { *size = H5Tget_size(*dtype); if (*size == 0) { sprintf(errbuf, "Cannot get the data type size for the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } } status = H5Aclose(attr); if (status == FAIL) { sprintf(errbuf, "Cannot release the dataset ID for the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_DATASET, H5E_CLOSEERROR , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } status = H5Dclose(fieldID); if (status == FAIL) { sprintf(errbuf, "Cannot release the dataset ID for the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_GDinqdatatype", __LINE__, H5E_DATASET, H5E_CLOSEERROR , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } } free(errbuf); return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDnentries | | | | DESCRIPTION: Returns number of entries and descriptive string buffer | | size for a specified entity. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nEntries long Number of entries | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | entrycode int None Entry code | | HDFE_NENTDIM (0) | | HDFE_NENTDFLD (4) | | | | OUTPUTS: | | strbufsize long Length of comma-separated list | | (Does not include null-terminator) | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 9/21/99 A.Muslimov In the call to EHmetagroup() replaced the argument | | gid by fid. | | 9/28/99 A.Muslimov Added proper error handlings after function calls. | | 07/12/00 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_GDnentries(hid_t gridID, int entrycode, long *strbufsize) { herr_t status = FAIL;/* routine return status variable */ int metaflag = FAIL;/* Old (0), New (1) metadata flag) */ int nVal = FAIL;/* Number of strings to search for */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ long i; /* Loop index */ long idx = FAIL;/* Grid index */ long nEntries = 0; /* Number of entries */ char *metabuf=(char *)NULL; /* Ptr to structural metadata (SM) */ char *metaptrs[2] = {NULL,NULL};/* Ptrs to begin/end of SM section */ char *utlstr = (char *)NULL; /* Utility string */ char valName[2][32]; /* Strings to search for */ char *errbuf = (char *)NULL; /* buffer for error message */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char *)calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDnentries", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDnentries", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for grid ID failed.\n"); H5Epush(__FILE__, "HE5_GDnentries", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Allocate memory for utility string */ /* ---------------------------------- */ utlstr = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) ); if(utlstr == NULL) { sprintf(errbuf, "Cannot allocate memory for utility string.\n"); H5Epush(__FILE__, "HE5_GDnentries", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Zero out string buffer size */ /* --------------------------- */ *strbufsize = 0; /* * Get pointer to relevant section within SM and Get names of * metadata strings to inquire about */ switch (entrycode) { case HE5_HDFE_NENTDIM: { metabuf = (char *)HE5_EHmetagroup(fid, HE5_GDXGrid[idx].gdname, "g", "Dimension", metaptrs); if(metabuf == NULL) { sprintf(errbuf, "Cannot allocate memory for metabuffer.\n"); H5Epush(__FILE__, "HE5_GDnentries", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlstr); return(FAIL); } nVal = 1; strcpy(&valName[0][0], "DimensionName"); } break; case HE5_HDFE_NENTDFLD: { metabuf = (char *)HE5_EHmetagroup(fid, HE5_GDXGrid[idx].gdname, "g", "DataField", metaptrs); if(metabuf == NULL) { sprintf(errbuf, "Cannot allocate memory for metabuffer.\n"); H5Epush(__FILE__, "HE5_GDnentries", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlstr); return(FAIL); } nVal = 1; strcpy(&valName[0][0], "DataFieldName"); } break; default: { sprintf(errbuf, "Unknown entry code.\n"); H5Epush(__FILE__, "HE5_GDnentries", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } break; } /* * Check for presence of 'GROUP="' string If found then old metadata, * search on OBJECT string */ metaflag = (strstr(metabuf, "GROUP=\"") == NULL) ? 1 : 0; if (metaflag == 0) { nVal = 1; strcpy(&valName[0][0], "\t\tOBJECT"); } /* Begin loop through entries in metadata */ /* -------------------------------------- */ while (1) { /* Search for first string */ strcpy(utlstr, &valName[0][0]); strcat(utlstr, "="); metaptrs[0] = strstr(metaptrs[0], utlstr); /* If found within relevant metadata section ... */ if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL) { for (i = 0; i < nVal; i++) { /* * Get all string values Don't count quotes */ status = HE5_EHgetmetavalue(metaptrs, &valName[i][0], utlstr); if ( status == FAIL ) { sprintf(errbuf, "Cannot get metadata string.\n"); H5Epush(__FILE__, "HE5_GDnentries", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlstr); free(metabuf); return(FAIL); } *strbufsize += strlen(utlstr) - 2; } /* Increment number of entries */ nEntries++; /* Go to end of OBJECT */ metaptrs[0] = strstr(metaptrs[0], "END_OBJECT"); } else /* No more entries found */ { break; } } if (metabuf != NULL) free(metabuf); /* Count comma separators & slashes (if mappings) */ /* ---------------------------------------------- */ if (nEntries > 0) { *strbufsize += nEntries - 1; *strbufsize += (nVal - 1) * nEntries; } free(errbuf); free(utlstr); errbuf = NULL; utlstr = NULL; return (nEntries); } #define REMQUOTE \ \ memmove(utlstr, utlstr + 1, strlen(utlstr) - 2); \ utlstr[strlen(utlstr) - 2] = 0; /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDinqdims | | | | DESCRIPTION: Retrieve information about all dimensions defined in a grid. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nDim int Number of defined dimensions | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | | | OUTPUTS: | | dimnames char Dimension names (comma-separated) | | dims hsize_t Dimension values | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 9/21/99 A.Muslimov In the call to EHmetagroup() replaced the argument | | gid by fid. | | 9/28/99 A.Muslimov Added proper error handlings after function calls. | | 10/18/99 A.Muslimov Replace memcpy() by memmove() to avoid a problem | | when arguments 1 and 2 overlap in memory. | | 07/12/00 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDinqdims(hid_t gridID, char *dimnames, hsize_t dims[]) { int nDim = 0; /* Number of dimensions (return) */ herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ long idx = FAIL;/* Grid index */ hsize_t size = 0; /* Dimension size */ char *metabuf = (char *)NULL; /* Ptr to structural metadata (SM) */ char *metaptrs[2] = {NULL,NULL}; /* Ptrs to begin/end of SM section */ char *utlstr = (char *)NULL; /* Utility string */ char *errbuf = (char *)NULL; /* Buffer for error message */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDinqdims", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDinqdims", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for grid ID failed.\n"); H5Epush(__FILE__, "HE5_GDinqdims", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } utlstr = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) ); if(utlstr == NULL) { sprintf(errbuf, "Cannot allocate memory for utility string.\n"); H5Epush(__FILE__, "HE5_GDinqdims", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* If dimension names or sizes are requested */ /* ----------------------------------------- */ if (dimnames != NULL || dims != NULL) { /* Get pointers to "Dimension" section within SM */ /* --------------------------------------------- */ metabuf = (char *)HE5_EHmetagroup(fid, HE5_GDXGrid[idx].gdname, "g","Dimension", metaptrs); if(metabuf == NULL) { sprintf(errbuf, "Cannot allocate memory for metabuffer.\n"); H5Epush(__FILE__, "HE5_GDinqdims", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlstr); return(FAIL); } /* If dimension names are requested then "clear" name buffer */ /* --------------------------------------------------------- */ if (dimnames != NULL) { dimnames[0] = 0; } while (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL) { strcpy(utlstr, "\t\tOBJECT="); metaptrs[0] = strstr(metaptrs[0], utlstr); if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL) { /* Get Dimension Name */ /* ------------------ */ if (dimnames != NULL) { /* Check 1st for old meta data then new */ /* ------------------------------------ */ status = HE5_EHgetmetavalue(metaptrs, "OBJECT", utlstr); if (status == FAIL) { sprintf(errbuf, "\"OBJECT\" string not found in metadata."); H5Epush(__FILE__, "HE5_GDinqdims", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlstr); free(metabuf); return(FAIL); } if (utlstr[0] != '"') { metaptrs[0] = strstr(metaptrs[0], "\t\t\t\tDimensionName="); status = HE5_EHgetmetavalue(metaptrs, "DimensionName", utlstr); if (status == FAIL) { sprintf(errbuf, "\"DimensionName\" string not found in metadata."); H5Epush(__FILE__, "HE5_GDinqdims", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlstr); free(metabuf); return(FAIL); } } /* Strip off double quotes */ /* ----------------------- */ memmove(utlstr, utlstr + 1, strlen(utlstr) - 2); utlstr[strlen(utlstr) - 2] = 0; if (nDim > 0) { strcat(dimnames, ","); } strcat(dimnames, utlstr); } /* Get Dimension Size */ /* ------------------ */ if (dims != NULL) { status = HE5_EHgetmetavalue(metaptrs, "Size", utlstr); if (status == FAIL) { sprintf(errbuf, "\"Size\" string not found in metadata."); H5Epush(__FILE__, "HE5_GDinqdims", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlstr); free(metabuf); return(FAIL); } size = (hsize_t)atol(utlstr); dims[ nDim ] = size; } nDim++; } } if (metabuf != NULL) free(metabuf); } free(utlstr); free(errbuf); utlstr = NULL; errbuf = NULL; return (nDim); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDattrinfo | | | | DESCRIPTION: | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | attrname char* attribute name | | | | OUTPUTS: | | ntype hid_t Data type ID | | count hsize_t Number of attribute elements | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 9/28/99 A.Muslimov Changed the type of return value from intn | | to int . | | 5/10/00 A.Muslimov Changed 'H5T_class_t' type to 'int' data type. | | 7/12/00 A.Muslimov Unmasked hdf5 data types. | | Feb 03 S.Zhao Changed the type of 'ntype' from an H5T_class_t to | | an hid_t. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDattrinfo(hid_t gridID, const char *attrname, hid_t *ntype, hsize_t *count) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ long idx = FAIL;/* Grid index */ CHECKPOINTER(attrname); /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDattrinfo", &fid, &gid, &idx); if (status == SUCCEED) { /* Get attribute group ID and call EHattrinfo */ /* ------------------------------------------ */ status = HE5_EHattrinfo( HE5_GDXGrid[idx].gd_id, attrname, ntype, count); } COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDattrinfo2 | | | | DESCRIPTION: | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | attrname char* attribute name | | | | OUTPUTS: | | ntype hid_t Data type ID | | count hsize_t Number of attribute elements | | size hsize_t * buf size of attribute elements | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 9/28/99 A.Muslimov Changed the type of return value from intn | | to int . | | 5/10/00 A.Muslimov Changed 'H5T_class_t' type to 'int' data type. | | 7/12/00 A.Muslimov Unmasked hdf5 data types. | | Feb 03 S.Zhao Changed the type of 'ntype' from an H5T_class_t to | | an hid_t. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDattrinfo2(hid_t gridID, const char *attrname, hid_t *ntype, hsize_t *count, hsize_t *size) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ long idx = FAIL;/* Grid index */ CHECKPOINTER(attrname); /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDattrinfo2", &fid, &gid, &idx); if (status == SUCCEED) { /* Get attribute group ID and call EHattrinfo */ /* ------------------------------------------ */ status = HE5_EHattrinfo2( HE5_GDXGrid[idx].gd_id, attrname, ntype, count, size); } COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDinqattrs | | | | DESCRIPTION: | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nattr long number of attributes (-1 if fails) | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | | | OUTPUTS: | | attrnames char attribute name(s) | | strbufsize long String length of attribute (in bytes) | | | | NOTES: | | | | None | | | | Date Programmer Description | | ====== ============ ================================================= | | 9/21/99 A.Muslimov Changed the data type of status variable from intn | | to int . Added error handling after the call to | | GDchkgdid(). | | 7/12/00 A.Muslimov Unmasked hdf5 data types. | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_GDinqattrs(hid_t gridID, char *attrnames, long *strbufsize) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ long nattr = 0; /* Number of attributes */ long idx = FAIL;/* Grid index */ char *grpname = (char *)NULL;/* Buffer for group name */ char *errbuf = (char *)NULL;/* error message buffer */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDinqattrs", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDinqattrs", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf,"Checking for grid ID failed.\n" ); H5Epush(__FILE__, "HE5_GDinqattrs", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Allocate memory for the group name string */ /* ----------------------------------------- */ grpname = (char *) calloc( (strlen(HE5_GDXGrid[idx].gdname)+40), sizeof(char)); if( grpname == NULL) { sprintf(errbuf, "Cannot allocate memory for the group name string.\n"); H5Epush(__FILE__, "HE5_GDinqattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } strcpy(grpname,"/HDFEOS/GRIDS/"); strcat(grpname, HE5_GDXGrid[idx].gdname); nattr = HE5_EHattrcat(fid, grpname, attrnames, strbufsize); if (grpname != NULL) free(grpname); free(errbuf); errbuf = NULL; return (nattr); } /*----------------------------------------------------------------------------r | BEGIN_PROLOG | | | | FUNCTION: HE5_GDinqfields | | | | DESCRIPTION: Retrieve information about all data fields defined in a grid. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nFld int Number of fields in grid | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | | | OUTPUTS: | | fieldlist char* Field names (comma-separated) | | rank int Array of ranks | | ntype hid_t Array of field number types | | | | NOTES: | | | | HDF5 Library Functions Called: | | H5Dopen | | H5Dget_type | | H5Tget_class | | H5Dclose | | | | Date Programmer Description | | ====== ============ ================================================= | | 9/21/99 A.Muslimov In the call to EHmetagroup() replaced the argument | | gid by fid. Added propere error handling after the | | function calls. | | Mar 00 A.Muslimov Changed the ID of field group from gd_id to data_id.| | Apr 00 A.Muslimvo Changed type of 'slen', 'fldnmlen' from long to | | size_t. | | May 00 A.Muslimov Changed 'H5T_class_t" type to 'int' data type. | | 7/12/00 A.Muslimov Unmasked hdf5 data types. | | Jan 03 S.Zhao Changed the type of 'ntype' from an H5T_class_t to | | an hid_t. | | Oct. 03 S.Zhao Added the H5Tclose(datatype) call. | | Jan. 04 S.Zhao Modified to enable a character string dataset. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDinqfields(hid_t gridID, char *fieldlist, int rank[], hid_t ntype[]) { int nFld = 0; /* Number of fields (return) */ int i; /* loop index */ herr_t status = FAIL;/* routine return status variable */ herr_t Dstatus = FAIL;/* Status for H5Dclose */ long ntflds = 0; /* Number of entries in field list*/ long idx = FAIL;/* Grid index */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t datasetid = FAIL;/* Dataset ID */ hid_t datatype = FAIL;/* Datatype ID */ size_t slen[HE5_DTSETRANKMAX]; /* String length array */ size_t fldnmlen[HE5_HDFE_NAMBUFSIZE]; char *tempfield = (char *)NULL; char *fldnm[HE5_HDFE_NAMBUFSIZE]; char *metabuf = (char *)NULL;/* Pointer to structural metadata (SM) */ char *metaptrs[2]; /* Pointers to begin and end of SM section */ char *utlstr = (char *)NULL; /* Utility string */ char *ptr[HE5_DTSETRANKMAX]; /* String pointer array */ char *errbuf = (char *)NULL; /* error message buffer */ H5T_class_t classid = H5T_NO_CLASS; /* Data type class ID */ htri_t str_is_variable; /* boolean: TRUE if string is variable lengeth FALSE if string is fixed length -1 if error in H5Tis_variavle_str() */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDinqfields", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDinqfields", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for grid ID failed.\n"); H5Epush(__FILE__, "HE5_GDinqfields", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } utlstr = (char *)calloc( HE5_HDFE_UTLBUFSIZE, sizeof(char) ); if(utlstr == NULL) { sprintf(errbuf, "Cannot allocate memory for utility string.\n"); H5Epush(__FILE__, "HE5_GDinqfields", __LINE__, H5E_FILE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* If field names, ranks, or number types desired ... */ /* --------------------------------------------------- */ if (fieldlist != NULL || rank != NULL || ntype != NULL) { /* Get pointers to "DataField" section within SM */ /* --------------------------------------------- */ metabuf = (char *)HE5_EHmetagroup(fid, HE5_GDXGrid[idx].gdname,"g","DataField", metaptrs); if(metabuf == NULL) { sprintf(errbuf, "Cannot allocate memory for metabuffer.\n"); H5Epush(__FILE__, "HE5_GDinqfields", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlstr); return(FAIL); } /* If field names are desired then "clear" name buffer */ /* --------------------------------------------------- */ if (fieldlist != NULL) fieldlist[0] = 0; /* Begin loop through mapping entries in metadata */ /* ---------------------------------------------- */ while (1) { /* Search for OBJECT string */ /* ------------------------ */ metaptrs[0] = strstr(metaptrs[0], "\t\tOBJECT="); /* If found within "Data" Field metadata section .. */ /* ------------------------------------------------ */ if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL) { /* Get Fieldnames (if desired) */ /* --------------------------- */ if (fieldlist != NULL) { /* Check 1st for old meta data then new */ /* ------------------------------------ */ status = HE5_EHgetmetavalue(metaptrs, "OBJECT", utlstr); if (status == FAIL) { sprintf(errbuf, "\"OBJECT\" string not found in metadata."); H5Epush(__FILE__, "HE5_GDinqfields", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlstr); free(metabuf); return(FAIL); } /* * If OBJECT value begins with double quote then old * metadata, field name is OBJECT value. Otherwise * search for "DataFieldName" string */ if (utlstr[0] != '"') { strcpy(utlstr, "\t\t\t\t"); strcat(utlstr, "DataFieldName"); strcat(utlstr, "="); metaptrs[0] = strstr(metaptrs[0], utlstr); status = HE5_EHgetmetavalue(metaptrs, "DataFieldName", utlstr); if (status == FAIL) { sprintf(errbuf, "\"DataFieldName\" string not found in metadata."); H5Epush(__FILE__, "HE5_GDinqfields", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(utlstr); free(metabuf); return(FAIL); } } /* Strip off double quotes */ /* ----------------------- */ REMQUOTE /* Add to fieldlist */ /* ---------------- */ if (nFld > 0) { strcat(fieldlist, ","); } strcat(fieldlist, utlstr); } if (ntype != NULL) { ntflds = HE5_EHparsestr(fieldlist, ',', fldnm, fldnmlen); if(ntflds != FAIL) { for( i = 0; i < ntflds; i++) { tempfield = (char *)calloc(fldnmlen[i] + 1, sizeof(char)); if (tempfield == NULL) { sprintf(errbuf, "Cannot allocate memory."); H5Epush(__FILE__, "HE5_GDinqfields", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (errbuf != NULL) free(errbuf); if (utlstr != NULL) free(utlstr); if (metabuf != NULL) free(metabuf); return(FAIL); } memmove(tempfield,fldnm[i],fldnmlen[i]); datasetid = H5Dopen(HE5_GDXGrid[idx].data_id, tempfield); if (datasetid == FAIL) { sprintf(errbuf, "Cannot open the dataset."); H5Epush(__FILE__, "HE5_GDinqfields", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (errbuf != NULL) free(errbuf); if (utlstr != NULL) free(utlstr); if (metabuf != NULL) free(metabuf); free(tempfield); return(FAIL); } datatype = H5Dget_type(datasetid); if (datatype == FAIL) { sprintf(errbuf, "Cannot get the data type."); H5Epush(__FILE__, "HE5_GDinqfields", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (errbuf != NULL) free(errbuf); if (utlstr != NULL) free(utlstr); if (metabuf != NULL) free(metabuf); free(tempfield); return(FAIL); } classid = H5Tget_class(datatype); if (classid == H5T_NO_CLASS) { sprintf(errbuf, "Cannot get the data type class."); H5Epush(__FILE__, "HE5_GDinqfields", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (errbuf != NULL) free(errbuf); if (utlstr != NULL) free(utlstr); if (metabuf != NULL) free(metabuf); free(tempfield); return(FAIL); } if (classid == H5T_STRING) { /* HE5T_CHARSTRING has variable length for data fields */ str_is_variable = H5Tis_variable_str(datatype); if(str_is_variable == TRUE) { ntype[i] = HE5T_CHARSTRING; } else if(str_is_variable == FALSE) { ntype[i] = HE5T_NATIVE_CHAR; } else { status = FAIL; sprintf(errbuf, "Failed to see if string field is varaible or fixed length.\n"); H5Epush(__FILE__, "HE5_GDinqfields", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (errbuf != NULL) free(errbuf); if (utlstr != NULL) free(utlstr); if (metabuf != NULL) free(metabuf); free(tempfield); return(status); } /*ntype[i] = HE5T_CHARSTRING;*/ } else { ntype[i] = HE5_EHdtype2numtype(datatype); if (ntype[i] == FAIL) { sprintf(errbuf, "Cannot get the number type.\n"); H5Epush(__FILE__, "HE5_GDinqfields", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (errbuf != NULL) free(errbuf); if (utlstr != NULL) free(utlstr); if (metabuf != NULL) free(metabuf); free(tempfield); return(FAIL); } } status = H5Tclose(datatype); if ( status == FAIL ) { sprintf(errbuf, "Cannot close the datatype."); H5Epush(__FILE__, "HE5_GDinqfields", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (errbuf != NULL) free(errbuf); if (utlstr != NULL) free(utlstr); if (metabuf != NULL) free(metabuf); free(tempfield); return(FAIL); } Dstatus = H5Dclose(datasetid); if (Dstatus == FAIL) { sprintf(errbuf, "Cannot close the dataset."); H5Epush(__FILE__, "HE5_GDinqfields", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (errbuf != NULL) free(errbuf); if (utlstr != NULL) free(utlstr); if (metabuf != NULL) free(metabuf); free(tempfield); return(FAIL); } free(tempfield); } } } /* * Get Rank (if desired) by counting # of dimensions in * "DimList" string */ if (rank != NULL) { status = HE5_EHgetmetavalue(metaptrs, "DimList", utlstr); if (status == FAIL) { sprintf(errbuf, "\"DimList\" string not found in metadata."); H5Epush(__FILE__, "HE5_GDinqfields", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (errbuf != NULL) free(errbuf); if (utlstr != NULL) free(utlstr); if (metabuf != NULL) free(metabuf); return(FAIL); } rank[ nFld ] = (int)HE5_EHparsestr(utlstr, ',', ptr, slen); } /* Increment number of fields */ nFld++; } else /* No more fields found */ { break; } } if (metabuf != NULL) free(metabuf); } free(utlstr); free(errbuf); return (nFld); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDdetach | | | | DESCRIPTION: Detaches from grid interface and performs file housekeeping. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | HDF5 Library Functions Called: | | H5Dclose | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 8/24/99 A.Muslimov Changed the return type from intn to int . | | 9/9/99 A.Muslimov Checked for the statuses returned by H5Dclose() and | | H5Gclose(). Cleaned up minor things. | | Feb,2000 A.Muslimov Fixed bug-prone release of IDs. | | Mar,2000 A.Muslimov Added detaching from the "Data Fields" group. | | 7/12/00 A.Muslimov Unmasked hdf5 data types. | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDdetach(hid_t gridID) { herr_t status = FAIL;/* routine return status variable */ int i, k; /* loop indices */ long idx = FAIL;/* Grid index */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ char *errbuf = (char *)NULL;/*Error message buffer */ HE5_LOCK; /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDdetach", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDdetach", &fid, &gid, &idx); if( status == FAIL) { sprintf(errbuf, "Checking for grid ID failed.\n"); H5Epush(__FILE__, "HE5_GDdetach", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } /* "Detach" from previously attached datasets */ /* ------------------------------------------ */ if( HE5_GDXGrid[ idx ].nDFLD > 0 ) { for (k = 0; k < HE5_GDXGrid[ idx ].nDFLD; k++) { if ( HE5_GDXGrid[ idx ].ddataset[ k ].ID > 0 ) { status = H5Dclose(HE5_GDXGrid[ idx ].ddataset[ k ].ID); if( status == FAIL) { sprintf(errbuf, "Cannot close the dataset."); H5Epush(__FILE__, "HE5_GDdetach", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } } if (HE5_GDXGrid[ idx ].ddataset[ k ].name != NULL) free(HE5_GDXGrid[ idx ].ddataset[ k ].name); } if ( HE5_GDXGrid[ idx ].ddataset != NULL ) free(HE5_GDXGrid[ idx ].ddataset); } /* Detach from "Data Fields" groups */ /* -------------------------------- */ if ( HE5_GDXGrid[ idx ].data_id > 0 ) { status = H5Gclose(HE5_GDXGrid[ idx ].data_id); if( status == FAIL) { sprintf(errbuf,"Cannot close the group."); H5Epush(__FILE__, "HE5_GDdetach", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } } /* Detach from Grid groups */ /* ----------------------- */ if ( HE5_GDXGrid[ idx ].gd_id > 0 ) { status = H5Gclose(HE5_GDXGrid[ idx ].gd_id); if( status == FAIL) { sprintf(errbuf,"Cannot close the group."); H5Epush(__FILE__, "HE5_GDdetach", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } } /* Delete entries from External Arrays */ /* ----------------------------------- */ HE5_GDXGrid[ idx ].active = 0; HE5_GDXGrid[ idx ].fid = 0; HE5_GDXGrid[ idx ].gd_id = 0; HE5_GDXGrid[ idx ].data_id = 0; HE5_GDXGrid[ idx ].obj_id = 0; HE5_GDXGrid[ idx ].ddataset = NULL; HE5_GDXGrid[ idx ].nDFLD = 0; /* Free Region Pointers */ /* -------------------- */ for (k = 0; k < HE5_NGRIDREGN; k++) { if (HE5_GDXRegion[ k ] != NULL && HE5_GDXRegion[ k ]->gridID == gridID) { for (i = 0; i < HE5_DTSETRANKMAX; i++) { if (HE5_GDXRegion[ k ]->DimNamePtr[ i ] != NULL) { if( HE5_GDXRegion[ k ]->DimNamePtr[ i ] != NULL ) { free(HE5_GDXRegion[ k ]->DimNamePtr[ i ]); HE5_GDXRegion[ k ]->DimNamePtr[ i ] = NULL; } } } if ( HE5_GDXRegion[ k ] != NULL ) { free(HE5_GDXRegion[ k ]); HE5_GDXRegion[ k ] = NULL; } } } free(errbuf); errbuf = (char *)NULL; COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDclose | | | | DESCRIPTION: Closes file. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | fid hid_t HDF-EOS type file ID | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 7/12/00 A.Muslimov Unmasked hdf5 data types. | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDclose(hid_t fid) { herr_t status = FAIL;/* routine return status variable */ /* Call HE5_EHclose to perform file close */ /* -------------------------------------- */ status = HE5_EHclose(fid); return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDgetdefaults | | | | DESCRIPTION: | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | projcode int GCTP projection code | | zonecode int UTM zone code | | projparm double Projection parameters | | spherecode int GCTP spheriod code | | upleftpt double upper left corner coordinates | | lowrightpt double lower right corner coordinates | | | | OUTPUTS: | | upleftpt double upper left corner coordinates | | lowrightpt double lower right corner coordinates | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 8/24/99 A.Muslimov Changed the return type from intn to int . | | 9/28/99 A.Muslimov Added proper error handlings after the function | | calls. | | 7/12/00 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDgetdefaults(int projcode, int zonecode, double projparm[], int spherecode, double upleftpt[], double lowrightpt[]) { herr_t status = SUCCEED;/* routine return status variable */ int (*for_trans[100]) (double, double, double*, double*); int errorcode = 0; double lon = 0.; double lat = 0.; double plat = 0.; double x = 0.; double y = 0.; double plon = 0.; double tlon = 0.; double llon = 0.; double rlon = 0.; double pplon = 0.; double RLon = 0.; double RLat = 0.; double LLon = 0.; double LLat = 0.; char *errbuf; /* buffer for error message */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* invoke GCTP initialization routine */ /* ---------------------------------- */ for_init(projcode, zonecode, projparm, spherecode, NULL, NULL,&errorcode, for_trans); /* Report error if any */ /* ------------------- */ if (errorcode != 0) { status = FAIL; sprintf(errbuf, "GCTP Error: %li \n", (long)errorcode); H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return (status); } /* Compute Default Boundary Points for EASE Grid */ /* Use Global coverage */ /* ------------------------------------------------------ */ if (projcode == HE5_GCTP_BCEA && upleftpt[0] == 0 && upleftpt[1] == 0 && lowrightpt[0] == 0 && lowrightpt[1] == 0) { upleftpt[0] = HE5_EHconvAng(EASE_GRID_DEFAULT_UPLEFT_LON, HE5_HDFE_DEG_DMS); upleftpt[1] = HE5_EHconvAng(EASE_GRID_DEFAULT_UPLEFT_LAT, HE5_HDFE_DEG_DMS); lowrightpt[0] = HE5_EHconvAng(EASE_GRID_DEFAULT_LOWRGT_LON, HE5_HDFE_DEG_DMS); lowrightpt[1] = HE5_EHconvAng(EASE_GRID_DEFAULT_LOWRGT_LAT, HE5_HDFE_DEG_DMS); } /* Compute Default Boundary Points for CEA */ /* --------------------------------------------*/ if (projcode ==HE5_GCTP_CEA && upleftpt[0] == 0 && upleftpt[1] == 0 && lowrightpt[0] == 0 && lowrightpt[1] == 0) { LLon = HE5_EHconvAng(EASE_GRID_DEFAULT_UPLEFT_LON, HE5_HDFE_DEG_RAD); LLat = HE5_EHconvAng(EASE_GRID_DEFAULT_UPLEFT_LAT, HE5_HDFE_DEG_RAD); RLon = HE5_EHconvAng(EASE_GRID_DEFAULT_LOWRGT_LON, HE5_HDFE_DEG_RAD); RLat = HE5_EHconvAng(EASE_GRID_DEFAULT_LOWRGT_LAT, HE5_HDFE_DEG_RAD); errorcode = for_trans[projcode] (LLon, LLat, &x, &y); if (errorcode != 0) { status = FAIL; sprintf(errbuf, "GCTP Error: %li \n", (long)errorcode); H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return (status); } upleftpt[0] = x; upleftpt[1] = y; errorcode = for_trans[projcode] (RLon, RLat, &x, &y); if (errorcode != 0) { status = FAIL; sprintf(errbuf, "GCTP Error: %li \n", (long)errorcode); H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return (status); } lowrightpt[0] = x; lowrightpt[1] = y; } /* Compute Default Boundary Points for Polar Sterographic */ /* ------------------------------------------------------ */ if (projcode == HE5_GCTP_PS && upleftpt[0] == 0 && upleftpt[1] == 0 && lowrightpt[0] == 0 && lowrightpt[1] == 0) { /* * Convert the longitude and latitude from the DMS to decimal degree * format. */ plon = HE5_EHconvAng(projparm[4], HE5_HDFE_DMS_DEG); plat = HE5_EHconvAng(projparm[5], HE5_HDFE_DMS_DEG); /* * Compute the longitudes at 90, 180 and 270 degrees from the central * longitude. */ if (plon <= 0.0) { tlon = 180.0 + plon; pplon = plon + 360.0; } else { tlon = plon - 180.0; pplon = plon; } rlon = pplon + 90.0; if (rlon > 360.0) rlon = rlon - 360.; if (rlon > 180.0) rlon = rlon - 360.0; if (rlon <= 0.0) llon = 180.0 + rlon; else llon = rlon - 180.0; /* Convert all four longitudes from decimal degrees to radians */ plon = HE5_EHconvAng(plon, HE5_HDFE_DEG_RAD); tlon = HE5_EHconvAng(tlon, HE5_HDFE_DEG_RAD); llon = HE5_EHconvAng(llon, HE5_HDFE_DEG_RAD); rlon = HE5_EHconvAng(rlon, HE5_HDFE_DEG_RAD); errorcode = for_trans[projcode] (llon, 0., &x, &y); if (errorcode != 0) { status = FAIL; sprintf(errbuf, "GCTP Error: %li \n", (long)errorcode); H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return (status); } upleftpt[0] = x; errorcode = for_trans[projcode](rlon, 0.0, &x, &y); if (errorcode != 0) { status = FAIL; sprintf(errbuf, "GCTP Error: %li \n", (long)errorcode); H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return (status); } lowrightpt[0] = x; /* * Compute the upperleft and lowright y values based on the south or * north polar projection */ if (plat < 0.0) { errorcode = for_trans[projcode] (plon, 0.0, &x, &y); if (errorcode != 0) { status = FAIL; sprintf(errbuf, "GCTP Error: %li \n", (long)errorcode); H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return (status); } upleftpt[1] = y; errorcode = for_trans[projcode] (tlon, 0.0, &x, &y); if (errorcode != 0) { status = FAIL; sprintf(errbuf, "GCTP Error: %li \n", (long)errorcode); H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return (status); } lowrightpt[1] = y; } else { errorcode = for_trans[projcode] (tlon, 0.0, &x, &y); if (errorcode != 0) { status = FAIL; sprintf(errbuf, "GCTP Error: %li \n", (long)errorcode); H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return (status); } upleftpt[1] = y; errorcode = for_trans[projcode](plon, 0., &x, &y); if (errorcode != 0) { status = FAIL; sprintf(errbuf, "GCTP Error: %li \n", (long)errorcode); H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return (status); } lowrightpt[1] = y; } } /* Compute Default Boundary Points for Goode Homolosine */ /* ---------------------------------------------------- */ if (projcode == HE5_GCTP_GOOD && upleftpt[0] == 0 && upleftpt[1] == 0 && lowrightpt[0] == 0 && lowrightpt[1] == 0) { lon = HE5_EHconvAng(-180, HE5_HDFE_DEG_RAD); lat = 0.0; errorcode = for_trans[projcode] (lon, lat, &x, &y); if (errorcode != 0) { status = FAIL; sprintf(errbuf, "GCTP Error: %li \n", (long)errorcode); H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return (status); } upleftpt[0] = -fabs(x); lowrightpt[0] = +fabs(x); lat = HE5_EHconvAng(90, HE5_HDFE_DEG_RAD); errorcode = for_trans[projcode] (lon, lat, &x, &y); if (errorcode != 0) { status = FAIL; sprintf(errbuf, "GCTP Error: %li \n", (long)errorcode); H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return (status); } upleftpt[1] = +fabs(y); lowrightpt[1] = -fabs(y); } /* Compute Default Boundary Points for Lambert Azimuthal */ /* ----------------------------------------------------- */ if (projcode == HE5_GCTP_LAMAZ && upleftpt[0] == 0 && upleftpt[1] == 0 && lowrightpt[0] == 0 && lowrightpt[1] == 0) { /* * Convert the longitude and latitude from the DMS to decimal degree * format. */ plon = HE5_EHconvAng(projparm[4], HE5_HDFE_DMS_DEG); plat = HE5_EHconvAng(projparm[5], HE5_HDFE_DMS_DEG); /* * Compute the longitudes at 90, 180 and 270 degrees from the central * longitude. */ if (plon <= 0.0) { tlon = 180.0 + plon; pplon = plon + 360.0; } else { tlon = plon - 180.0; pplon = plon; } rlon = pplon + 90.0; if (rlon > 360.0) rlon = rlon - 360.; if (rlon > 180.0) rlon = rlon - 360.0; if (rlon <= 0.0) llon = 180.0 + rlon; else llon = rlon - 180.0; /* Convert all four longitudes from decimal degrees to radians */ plon = HE5_EHconvAng(plon, HE5_HDFE_DEG_RAD); tlon = HE5_EHconvAng(tlon, HE5_HDFE_DEG_RAD); llon = HE5_EHconvAng(llon, HE5_HDFE_DEG_RAD); rlon = HE5_EHconvAng(rlon, HE5_HDFE_DEG_RAD); errorcode = for_trans[projcode] (llon, 0.0, &x, &y); if (errorcode != 0) { status = FAIL; sprintf(errbuf, "GCTP Error: %li \n", (long)errorcode); H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return (status); } upleftpt[0] = x; errorcode = for_trans[projcode] (rlon, 0.0, &x, &y); if (errorcode != 0) { status = FAIL; sprintf(errbuf, "GCTP Error: %li \n", (long)errorcode); H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return (status); } lowrightpt[0] = x; /* * Compute upperleft and lowerright values based on whether the * projection is south polar, north polar or equitorial */ if (plat == -90.0) { errorcode = for_trans[projcode] (plon, 0.0, &x, &y); if (errorcode != 0) { status = FAIL; sprintf(errbuf, "GCTP Error: %li \n", (long)errorcode); H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return (status); } upleftpt[1] = y; errorcode = for_trans[projcode] (tlon, 0.0, &x, &y); if (errorcode != 0) { status = FAIL; sprintf(errbuf, "GCTP Error: %li \n", (long)errorcode); H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return (status); } lowrightpt[1] = y; } else if (plat == 90.0) { errorcode = for_trans[projcode] (tlon, 0.0, &x, &y); if (errorcode != 0) { status = FAIL; sprintf(errbuf, "GCTP Error: %li\n", (long)errorcode); H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return (status); } upleftpt[1] = y; errorcode = for_trans[projcode] (plon, 0.0, &x, &y); if (errorcode != 0) { status = FAIL; sprintf(errbuf, "GCTP Error: %li \n", (long)errorcode); H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return (status); } lowrightpt[1] = y; } else { lat = HE5_EHconvAng(90, HE5_HDFE_DEG_RAD); errorcode = for_trans[projcode] (plon, lat, &x, &y); if (errorcode != 0) { status = FAIL; sprintf(errbuf, "GCTP Error: %li \n", (long)errorcode); H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return (status); } upleftpt[1] = y; lat = HE5_EHconvAng(-90, HE5_HDFE_DEG_RAD); errorcode = for_trans[projcode] (plon, lat, &x, &y); if (errorcode != 0) { status = FAIL; sprintf(errbuf, "GCTP Error: %li \n", (long)errorcode); H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return (status); } lowrightpt[1] = y; } } /* Compute Default Boundary Points for Integerized Sinusoidal Grid */ /* --------------------------------------------------------------- */ if (projcode == HE5_GCTP_ISINUS && upleftpt[0] == 0 && upleftpt[1] == 0 && lowrightpt[0] == 0 && lowrightpt[1] == 0) { /* * Convert the longitude and latitude from the DMS to decimal degree * format. */ plon = HE5_EHconvAng(projparm[4], HE5_HDFE_DMS_DEG); plat = HE5_EHconvAng(projparm[5], HE5_HDFE_DMS_DEG); /* * Compute the longitudes at 90, 180 and 270 degrees from the central * longitude. */ if (plon <= 0.0) { tlon = 180.0 + plon; pplon = plon + 360.0; } else { tlon = plon - 180.0; pplon = plon; } rlon = pplon + 90.0; if (rlon > 360.0) rlon = rlon - 360.; if (rlon > 180.0) rlon = rlon - 360.0; if (rlon <= 0.0) llon = 180.0 + rlon; else llon = rlon - 180.0; /* Convert all four longitudes from decimal degrees to radians */ plon = HE5_EHconvAng(plon, HE5_HDFE_DEG_RAD); tlon = HE5_EHconvAng(tlon, HE5_HDFE_DEG_RAD); llon = HE5_EHconvAng(llon, HE5_HDFE_DEG_RAD); rlon = HE5_EHconvAng(rlon, HE5_HDFE_DEG_RAD); errorcode = for_trans[projcode] (llon, 0.0, &x, &y); if (errorcode != 0) { status = FAIL; sprintf(errbuf, "GCTP Error: %li \n", (long)errorcode); H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return (status); } upleftpt[0] = x; errorcode = for_trans[projcode] (rlon, 0.0, &x, &y); if (errorcode != 0) { status = FAIL; sprintf(errbuf, "GCTP Error: %li \n", (long)errorcode); H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return (status); } lowrightpt[0] = x; lat = HE5_EHconvAng(90, HE5_HDFE_DEG_RAD); errorcode = for_trans[projcode] (plon, lat, &x, &y); if (errorcode != 0) { status = FAIL; sprintf(errbuf, "GCTP Error: %li \n", (long)errorcode); H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return (status); } upleftpt[1] = y; lat = HE5_EHconvAng(-90, HE5_HDFE_DEG_RAD); errorcode = for_trans[projcode] (plon, lat, &x, &y); if (errorcode != 0) { status = FAIL; sprintf(errbuf, "GCTP Error: %li \n", (long)errorcode); H5Epush(__FILE__, "HE5_GDgetdefaults", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return (status); } lowrightpt[1] = y; } free(errbuf); errbuf = NULL; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDll2ij | | | | DESCRIPTION: | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | projcode int GCTP projection code | | zonecode int UTM zone code | | projparm double Projection parameters | | spherecode int GCTP spheriod code | | xdimsize long xdimsize from GDcreate | | ydimsize long ydimsize from GDcreate | | upleftpt double upper left corner coordinates | | lowrightpt double lower right corner coordinates | | npnts long number of lon-lat points | | longitude double longitude array (decimal degrees) | | latitude double latitude array (decimal degrees) | | | | OUTPUTS: | | row long Row array | | col long Column array | | xval double X value array | | yval double Y value array | | | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 8/24/99 A.Muslimov Changed the return type from intn to int . | | Added proper error handlings. | | 7/12/00 A.Muslimov Unmasked hdf5 data types. | | 2/02/08 Abe Taaheri Created Fortran Wrapper, and made it an API | | Jun 11 Abe Taaher Modified for State Plane Files inclusion | | | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDll2ij(int projcode, int zonecode, double projparm[], int spherecode, long xdimsize, long ydimsize, double upleftpt[], double lowrightpt[], long npnts, double longitude[], double latitude[], long row[], long col[], double xval[], double yval[]) { herr_t status = SUCCEED; /* routine return status variable */ long i; /* Loop index */ int (*for_trans[100]) (double, double, double *, double *); int errorcode = 0; /* GCTP error code */ double xVal = 0.; /* Scaled x distance */ double yVal = 0.; /* Scaled y distance */ double xMtr = 0.; /* X value in meters from GCTP */ double yMtr = 0.; /* Y value in meters from GCTP */ double lonrad0 = 0.; /* Longitude in radians of upleft point */ double latrad0 = 0.; /* Latitude in radians of upleft point */ double lonrad = 0.; /* Longitude in radians of point */ double latrad = 0.; /* Latitude in radians of point */ double scaleX = 0.; /* X scale factor */ double scaleY = 0.; /* Y scale factor */ double HE5_EHconvAng(double, int);/* Angle conversion routine */ double xMtr0, xMtr1, yMtr0, yMtr1; char *errbuf; /* Buffer for error message */ char *eastFile = NULL; char *northFile = NULL; CHECKPOINTER(upleftpt); CHECKPOINTER(lowrightpt); CHECKPOINTER(longitude); CHECKPOINTER(latitude); /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDll2ij", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* If projection not GEO call GCTP initialization routine */ /* ------------------------------------------------------ */ if (projcode != HE5_GCTP_GEO) { eastFile = (char *) malloc(300*sizeof(char)); northFile = (char *) malloc(300*sizeof(char)); HE5_GDgetEastAndNorthFiles(eastFile,northFile); for_init(projcode, zonecode, projparm, spherecode, eastFile, northFile, &errorcode, for_trans); free (eastFile); free (northFile); eastFile = NULL; northFile = NULL; /* Report error if any */ /* ------------------- */ if (errorcode != 0) { status = FAIL; sprintf(errbuf, "GCTP Error: %li\n", (long)errorcode); H5Epush(__FILE__, "HE5_GDll2ij", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return (status); } } if (status == SUCCEED) { /* GEO projection */ /* -------------- */ if (projcode == HE5_GCTP_GEO) { /* Convert upleft and lowright X coords from DMS to radians */ /* -------------------------------------------------------- */ lonrad0 = HE5_EHconvAng(upleftpt[0], HE5_HDFE_DMS_RAD); lonrad = HE5_EHconvAng(lowrightpt[0], HE5_HDFE_DMS_RAD); /* Compute x scale factor */ /* ---------------------- */ scaleX = (lonrad - lonrad0) / xdimsize; /* Convert upleft and lowright Y coords from DMS to radians */ /* -------------------------------------------------------- */ latrad0 = HE5_EHconvAng(upleftpt[1], HE5_HDFE_DMS_RAD); latrad = HE5_EHconvAng(lowrightpt[1], HE5_HDFE_DMS_RAD); /* Compute y scale factor */ /* ---------------------- */ scaleY = (latrad - latrad0) / ydimsize; } /* BCEA projection */ /* -------------- */ else if ( projcode == HE5_GCTP_BCEA) { /* Convert upleft and lowright X coords from DMS to radians */ /* ----------------------------------------------------------*/ lonrad0 = HE5_EHconvAng(upleftpt[0], HE5_HDFE_DMS_RAD); lonrad = HE5_EHconvAng(lowrightpt[0],HE5_HDFE_DMS_RAD); /* Convert upleft and lowright Y coords from DMS to radians */ /* ----------------------------------------------------------*/ latrad0 = HE5_EHconvAng(upleftpt[1], HE5_HDFE_DMS_RAD); latrad = HE5_EHconvAng(lowrightpt[1], HE5_HDFE_DMS_RAD); /* Convert from lon/lat to meters(or whatever unit is, i.e unit of r_major and r_minor) using GCTP */ /* ----------------------------------------- */ errorcode = for_trans[projcode] (lonrad0, latrad0, &xMtr0, &yMtr0); /* Report error if any */ /* ------------------- */ if (errorcode != 0) { status = FAIL; sprintf(errbuf, "GCTP Error: %li\n", (long)errorcode); H5Epush(__FILE__, "HE5_GDll2ij", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return (status); } /* Convert from lon/lat to meters(or whatever unit is, i.e unit of r_major and r_minor) using GCTP */ /* ----------------------------------------- */ errorcode = for_trans[projcode] (lonrad, latrad, &xMtr1, &yMtr1); /* Report error if any */ /* ------------------- */ if (errorcode != 0) { status = FAIL; sprintf(errbuf, "GCTP Error: %li\n", (long)errorcode); H5Epush(__FILE__, "HE5_GDll2ij", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return (status); } /* Compute x scale factor */ /* ---------------------- */ scaleX = (xMtr1 - xMtr0) / xdimsize; /* Compute y scale factor */ /* ---------------------- */ scaleY = (yMtr1 - yMtr0) / ydimsize; } else { /* Non-GEO, Non-BCEA projections */ /* ------------------ */ /* Compute x & y scale factors */ /* --------------------------- */ scaleX = (lowrightpt[0] - upleftpt[0]) / xdimsize; scaleY = (lowrightpt[1] - upleftpt[1]) / ydimsize; } /* Loop through all points */ /* ----------------------- */ for (i = 0; i < npnts; i++) { /* Convert lon & lat from decimal degrees to radians */ /* ------------------------------------------------- */ lonrad = HE5_EHconvAng(longitude[i], HE5_HDFE_DEG_RAD); latrad = HE5_EHconvAng(latitude[i], HE5_HDFE_DEG_RAD); /* GEO projection */ /* -------------- */ if (projcode == HE5_GCTP_GEO) { /* Compute scaled distance to point from origin */ /* -------------------------------------------- */ xVal = (lonrad - lonrad0) / scaleX; yVal = (latrad - latrad0) / scaleY; } else { /* Convert from lon/lat to meters using GCTP */ /* ----------------------------------------- */ errorcode = for_trans[projcode](lonrad, latrad, &xMtr, &yMtr); /* Report error if any */ /* ------------------- */ if (errorcode != 0) { status = FAIL; sprintf(errbuf, "GCTP Error: %li\n", (long)errorcode); H5Epush(__FILE__, "HE5_GDll2ij", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } else { /* if projection is BCEA normalize x and y by cell size and measure it from the uperleft corner of the grid */ /* Compute scaled distance to point from origin */ /* -------------------------------------------- */ if( projcode == HE5_GCTP_BCEA) { xVal = (xMtr - xMtr0) / scaleX; yVal = (yMtr - yMtr0) / scaleY; } else { xVal = (xMtr - upleftpt[0]) / scaleX; yVal = (yMtr - upleftpt[1]) / scaleY; } } } /* Compute row and col from scaled distance */ /* ---------------------------------------- */ col[i] = (long)xVal; row[i] = (long)yVal; /* Store scaled distances if requested */ /* ----------------------------------- */ if (xval != NULL) { xval[i] = xVal; } if (yval != NULL) { yval[i] = yVal; } } } if (errbuf != NULL) free(errbuf); COMPLETION: return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDij2ll | | | | DESCRIPTION: | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | projcode int GCTP projection code | | zonecode int UTM zone code | | projparm double Projection parameters | | spherecode int GCTP spheriod code | | xdimsize long xdimsize from GDcreate | | ydimsize long ydimsize from GDcreate | | upleftpt double upper left corner coordinates | | lowrightpt double lower right corner coordinates | | pixcen int pixel center code | | npnts long number of lon-lat points | | row long Row array | | col long Column array | | pixcen int Code from GDpixreginfo | | pixcnr int Code from GDorigininfo | | | | OUTPUTS: | | longitude double longitude array (decimal degrees) | | latitude double latitude array (decimal degrees) | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 8/24/99 A.Muslimov Changed the return type from intn to int . | | Added proper error handling after the function calls| | 7/12/00 A.Muslimov Unmasked hdf5 data types. | | 2/02/08 Abe Taaheri Created Fortran Wrapper, and made it an API | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDij2ll(int projcode, int zonecode, double projparm[], int spherecode, long xdimsize, long ydimsize, double upleftpt[], double lowrightpt[], long npnts, long row[], long col[], double longitude[], double latitude[], int pixcen, int pixcnr) { herr_t status = FAIL;/* routine return status variable */ long i; /* Loop index */ int (*inv_trans[100]) (double, double, double*, double*); int errorcode = 0; /* GCTP error code */ int (*for_trans[100]) (double, double, double*, double*); double arg1, arg2; double pixadjX = 0.; /* Pixel adjustment (x) */ double pixadjY = 0.; /* Pixel adjustment (y) */ double lonrad0 = 0.; /* Longitude in radians of upleft point */ double latrad0 = 0.; /* Latitude in radians of upleft point */ double scaleX = 0.; /* X scale factor */ double scaleY = 0.; /* Y scale factor */ double lonrad = 0.; /* Longitude in radians of point */ double latrad = 0.; /* Latitude in radians of point */ double HE5_EHconvAng(double, int);/* Angle conversion routine */ double xMtr0, yMtr0, xMtr1, yMtr1; char *errbuf; /* buffer for error message */ char *eastFile = NULL; char *northFile = NULL; CHECKPOINTER(upleftpt); CHECKPOINTER(lowrightpt); CHECKPOINTER(row); CHECKPOINTER(col); /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDij2ll", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Compute adjustment of position within pixel */ /* ------------------------------------------- */ if (pixcen == HE5_HDFE_CENTER) { /* Pixel defined at center */ /* ----------------------- */ pixadjX = 0.5; pixadjY = 0.5; } else { switch (pixcnr) { case HE5_HDFE_GD_UL: { /* Pixel defined at upper left corner */ /* ---------------------------------- */ pixadjX = 0.0; pixadjY = 0.0; break; } case HE5_HDFE_GD_UR: { /* Pixel defined at upper right corner */ /* ----------------------------------- */ pixadjX = 1.0; pixadjY = 0.0; break; } case HE5_HDFE_GD_LL: { /* Pixel defined at lower left corner */ /* ---------------------------------- */ pixadjX = 0.0; pixadjY = 1.0; break; } case HE5_HDFE_GD_LR: { /* Pixel defined at lower right corner */ /* ----------------------------------- */ pixadjX = 1.0; pixadjY = 1.0; break; } default: { sprintf(errbuf, "Unknown pixel corner.\n"); H5Epush(__FILE__, "HE5_GDij2ll", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } } } /* If projection not GEO or BCEA call GCTP initialization routine */ /* ------------------------------------------------------ */ if (projcode != HE5_GCTP_GEO && projcode != HE5_GCTP_BCEA) { eastFile = (char *) malloc(300*sizeof(char)); northFile = (char *) malloc(300*sizeof(char)); HE5_GDgetEastAndNorthFiles(eastFile,northFile); scaleX = (lowrightpt[0] - upleftpt[0]) / xdimsize; scaleY = (lowrightpt[1] - upleftpt[1]) / ydimsize; inv_init(projcode, zonecode, projparm, spherecode, eastFile, northFile, &errorcode, inv_trans); free (eastFile); free (northFile); eastFile = NULL; northFile = NULL; /* Report error if any */ /* ------------------- */ if (errorcode != 0) { status = FAIL; sprintf(errbuf, "GCTP Error: %li\n", (long)errorcode); H5Epush(__FILE__, "HE5_GDij2ll", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } else { /* For each point ... */ /* ------------------ */ for (i = 0; i < npnts; i++) { /* Convert from meters to lon/lat (radians) using GCTP */ /* --------------------------------------------------- */ /*errorcode = inv_trans[projcode] ((col[i] + pixadjX) * scaleX + upleftpt[0], (row[i] + pixadjY) * scaleY + upleftpt[1], &lonrad, &latrad);*/ /* modified previous line to the following for the linux64 with -fPIC in cmpilation. Whithout the change col[] and row[] values are ridiclous numbers, resulting a strange number (very big) for arg1 and arg2. But with (int) typecast they become normal integers, resulting in a acceptable values for arg1 and arg2. The problem was discovered during the lat/lon geolocating of an hdfeos5 file with 64-bit hadview plug-in, developped for linux64. */ arg1 = (((int)col[i] + pixadjX) * scaleX + upleftpt[0]); arg2 = (((int)row[i] + pixadjY) * scaleY + upleftpt[1]); errorcode = inv_trans[projcode] (arg1, arg2, &lonrad, &latrad); /* Report error if any */ /* ------------------- */ if (errorcode != 0) { status = FAIL; sprintf(errbuf, "GCTP Error: %li\n", (long)errorcode); H5Epush(__FILE__, "HE5_GDij2ll", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } else { /* Convert from radians to decimal degrees */ /* --------------------------------------- */ longitude[i] = HE5_EHconvAng(lonrad, HE5_HDFE_RAD_DEG); latitude[i] = HE5_EHconvAng(latrad, HE5_HDFE_RAD_DEG); } } } } else if (projcode == HE5_GCTP_BCEA) { /* BCEA projection */ /* -------------- */ /* Note: upleftpt and lowrightpt are in packed degrees, so they must be converted to meters for this projection */ /* Initialize forward transformation */ /* --------------------------------- */ for_init(projcode, zonecode, projparm, spherecode, NULL, NULL,&errorcode, for_trans); /* Report error if any */ /* ------------------- */ if (errorcode != 0) { status = FAIL; sprintf(errbuf, "GCTP Error: %li\n", (long)errorcode); H5Epush(__FILE__, "HE5_GDij2ll", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return (-1); } /* Convert upleft and lowright X coords from DMS to radians */ /* -------------------------------------------------------- */ lonrad0 =HE5_EHconvAng(upleftpt[0], HE5_HDFE_DMS_RAD); lonrad = HE5_EHconvAng(lowrightpt[0], HE5_HDFE_DMS_RAD); /* Convert upleft and lowright Y coords from DMS to radians */ /* -------------------------------------------------------- */ latrad0 = HE5_EHconvAng(upleftpt[1], HE5_HDFE_DMS_RAD); latrad = HE5_EHconvAng(lowrightpt[1], HE5_HDFE_DMS_RAD); /* Convert form lon/lat to meters(or whatever unit is, i.e unit of r_major and r_minor) using GCTP */ /* ----------------------------------------- */ errorcode = for_trans[projcode] (lonrad0, latrad0, &xMtr0, &yMtr0); /* Report error if any */ if (errorcode != 0) { status = FAIL; sprintf(errbuf, "GCTP Error: %li\n", (long)errorcode); H5Epush(__FILE__, "HE5_GDij2ll", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return (status); } /* Convert from lon/lat to meters or whatever unit is, i.e unit of r_major and r_minor) using GCTP */ /* ----------------------------------------- */ errorcode = for_trans[projcode] (lonrad, latrad, &xMtr1, &yMtr1); /* Report error if any */ if (errorcode != 0) { status = FAIL; sprintf(errbuf, "GCTP Error: %li\n", (long)errorcode); H5Epush(__FILE__, "HE5_GDij2ll", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return (status); } /* Compute x scale factor */ /* ---------------------- */ scaleX = (xMtr1 - xMtr0) / xdimsize; /* Compute y scale factor */ /* ---------------------- */ scaleY = (yMtr1 - yMtr0) / ydimsize; /* Initialize inverse transformation */ /* --------------------------------- */ inv_init(projcode, zonecode, projparm, spherecode, NULL, NULL, &errorcode, inv_trans); /* Report error if any */ /* ------------------- */ if (errorcode != 0) { status = FAIL; sprintf(errbuf, "GCTP Error: %li\n", (long)errorcode); H5Epush(__FILE__, "HE5_GDij2ll", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return (-1); } /* For each point ... */ /* ------------------ */ for (i = 0; i < npnts; i++) { /* Convert from meters (or any units that r_major and r_minor has) to lon/lat (radians) using GCTP */ /* --------------------------------------------------- */ errorcode = inv_trans[projcode] ( (col[i] + pixadjX) * scaleX + xMtr0, (row[i] + pixadjY) * scaleY + yMtr0, &lonrad, &latrad); /* Report error if any */ /* ------------------- */ if (errorcode != 0) { /* status = -1; sprintf(errbuf, "GCTP Error: %li\n", (long)errorcode); H5Epush(__FILE__, "HE5_GDij2ll", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return (status); */ longitude[i] = 1.0e51; /* PGSd_GCT_IN_ERROR */ latitude[i] = 1.0e51; /* PGSd_GCT_IN_ERROR */ } /* Convert from radians to decimal degrees */ /* --------------------------------------- */ longitude[i] = HE5_EHconvAng(lonrad, HE5_HDFE_RAD_DEG); latitude[i] = HE5_EHconvAng(latrad, HE5_HDFE_RAD_DEG); } } else if (projcode == HE5_GCTP_GEO) { /* GEO projection */ /* -------------- */ /* * Note: lonrad, lonrad0, latrad, latrad0 are actually in degrees for * the GEO projection case. */ /* Convert upleft and lowright X coords from DMS to degrees */ /* -------------------------------------------------------- */ lonrad0 = HE5_EHconvAng(upleftpt[0], HE5_HDFE_DMS_DEG); lonrad = HE5_EHconvAng(lowrightpt[0], HE5_HDFE_DMS_DEG); /* Compute x scale factor */ /* ---------------------- */ scaleX = (lonrad - lonrad0) / xdimsize; /* Convert upleft and lowright Y coords from DMS to degrees */ /* -------------------------------------------------------- */ latrad0 = HE5_EHconvAng(upleftpt[1], HE5_HDFE_DMS_DEG); latrad = HE5_EHconvAng(lowrightpt[1], HE5_HDFE_DMS_DEG); /* Compute y scale factor */ /* ---------------------- */ scaleY = (latrad - latrad0) / ydimsize; /* For each point ... */ /* ------------------ */ for (i = 0; i < npnts; i++) { /* Convert to lon/lat (decimal degrees) */ /* ------------------------------------ */ longitude[i] = (col[i] + pixadjX) * scaleX + lonrad0; latitude[i] = (row[i] + pixadjY) * scaleY + latrad0; } } if (errbuf != NULL) free(errbuf); COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: GDrs2ll | | | | DESCRIPTION: Converts EASE grid's (r,s) coordinates to longitude and | | latitude (in decimal degrees). | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status intn return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | projcode int GCTP projection code | | projparm double Projection parameters | | xdimsize long xdimsize from GDcreate | | ydimsize long ydimsize from GDcreate | | pixcen int pixel center code | | npnts long number of lon-lat points | | s long s coordinate | | r long r coordinate | | pixcen int Code from GDpixreginfo | | pixcnr int Code from GDorigininfo | | upleft double upper left corner coordinates (DMS) | | lowright double lower right corner coordinates (DMS) | | | | OUTPUTS: | | longitude double longitude array (decimal degrees) | | latitude double latitude array (decimal degrees) | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Dec 04 Adura Adekunjo Added function to hdfeos5 | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDrs2ll(int projcode, double projparm[], long xdimsize, long ydimsize, double upleft[], double lowright[], int npnts, double r[], double s[], double longitude[], double latitude[], int pixcen, int pixcnr) { herr_t status = SUCCEED;/* routine return status variable */ long i; /* Loop index */ int (*inv_trans[100]) (double, double, double*, double*); int errorcode = 0; /* GCTP error code */ double pixadjX; /* Pixel adjustment (x) */ double pixadjY; /* Pixel adjustment (y) */ double lonrad; /* Longitude in radians of point */ double latrad; /* Latitude in radians of point */ double HE5_EHconvAng(double, int);/* Angle conversion routine */ double xMtr; /* X value in meters from GCTP */ double yMtr; /* Y value in meters from GCTP */ double epsilon; double beta; double qp_cea; double kz_cea; double eccen, eccen_sq; double phi1, sinphi1, cosphi1; double scaleX, scaleY; int zonecode=0; int spherecode=0; double lon[2],lat[2]; double xcor[2], ycor[2]; int nlatlon; char *errbuf; /* buffer for error message */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDrs2ll", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* If projection is BCEA define scale, r0 and s0 */ if (projcode == HE5_GCTP_BCEA) { eccen_sq = 1.0 - SQUARE(projparm[1]/projparm[0]); eccen = sqrt(eccen_sq); if(eccen < 0.00001) { qp_cea = 2.0; } else { qp_cea = (1.0 - eccen_sq)*((1.0/(1.0 - eccen_sq))-(1.0/(2.0*eccen))* log((1.0 - eccen)/(1.0 + eccen))); } phi1 = HE5_EHconvAng(projparm[5],HE5_HDFE_DMS_RAD); cosphi1 = cos(phi1); sinphi1 = sin(phi1); kz_cea = cosphi1/(sqrt(1.0 - (eccen_sq*sinphi1*sinphi1))); } else /* fail for all other projections */ { sprintf(errbuf, "Error: HE5_GDrs2ll can be called only for HE5_GCTP_BCEA projection."); H5Epush(__FILE__, "HE5_GDrs2ll", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Compute adjustment of position within pixel */ /* ------------------------------------------- */ if (pixcen == HE5_HDFE_CENTER) { /* Pixel defined at center */ /* ----------------------- */ pixadjX = 0.5; pixadjY = 0.5; } else { switch (pixcnr) { case HE5_HDFE_GD_UL: { /* Pixel defined at upper left corner */ /* ---------------------------------- */ pixadjX = 0.0; pixadjY = 0.0; break; } case HE5_HDFE_GD_UR: { /* Pixel defined at upper right corner */ /* ----------------------------------- */ pixadjX = 1.0; pixadjY = 0.0; break; } case HE5_HDFE_GD_LL: { /* Pixel defined at lower left corner */ /* ---------------------------------- */ pixadjX = 0.0; pixadjY = 1.0; break; } case HE5_HDFE_GD_LR: { /* Pixel defined at lower right corner */ /* ----------------------------------- */ pixadjX = 1.0; pixadjY = 1.0; break; } default: { sprintf(errbuf, "Unknown pixel corner.\n"); H5Epush(__FILE__, "HE5_GDrs2ll", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } } } /* If projection is BCEA call GCTP initialization routine */ /* ------------------------------------------------------ */ if (projcode == HE5_GCTP_BCEA) { inv_init(projcode, 0, projparm, 0, NULL, NULL, &errorcode, inv_trans); /* Report error if any */ /* ------------------- */ if (errorcode != 0) { status = FAIL; sprintf(errbuf, "GCTP Error: %li\n", (long)errorcode); H5Epush(__FILE__, "HE5_GDrs2ll", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } else { /* For each point ... */ /* ------------------ */ for (i = 0; i < npnts; i++) { /* Convert from EASE grid's (r,s) to lon/lat (radians) using GCTP */ /* --------------------------------------------------- */ nlatlon = 2; lon[0] = upleft[0]; lon[1] = lowright[0]; lat[0] = upleft[1]; lat[1] = lowright[1]; status = HE5_GDll2mm_cea(projcode,zonecode,spherecode,projparm, xdimsize, ydimsize, upleft, lowright, nlatlon, lon, lat, xcor, ycor, &scaleX, &scaleY); if (status == FAIL) { sprintf(errbuf, "GCTP Error: %li\n", (long)errorcode); H5Epush(__FILE__, "HE5_GDrs2ll", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } xMtr = (r[i]/ scaleX + pixadjX - 0.5)* scaleX; yMtr = - (s[i]/fabs(scaleY) + pixadjY - 0.5)* fabs(scaleY); /* allow .5 cell tolerance in arcsin function (used in bceainv function) so that grid coordinates which are less than .5 cells above 90.00N or below 90.00S are given lat of 90.00 */ epsilon = 1 + 0.5 * (fabs(scaleY)/projparm[0]); beta = 2.0 * (yMtr - projparm[7]) * kz_cea/(projparm[0] * qp_cea); if( fabs (beta) > epsilon) { status = FAIL; sprintf(errbuf, "GCTP Error: %s %s %s\n", "grid coordinates", "are more than .5 cells", "above 90.00N or below 90.00S. "); H5Epush(__FILE__, "HE5_GDrs2ll", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } else if( beta <= -1) { errorcode = inv_trans[projcode] (xMtr, 0.0, &lonrad, &latrad); latrad = - M_PI1/2; } else if( beta >= 1) { errorcode = inv_trans[projcode] (xMtr, 0.0, &lonrad, &latrad); latrad = M_PI1/2; } else { errorcode = inv_trans[projcode] (xMtr, yMtr, &lonrad, &latrad); } /* Report error if any */ /* ------------------- */ if (errorcode != 0) { status = FAIL; sprintf(errbuf, "GCTP Error: %li\n", (long)errorcode); H5Epush(__FILE__, "HE5_GDrs2ll", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return (status); } /* Convert from radians to decimal degrees */ /* --------------------------------------- */ longitude[i] = HE5_EHconvAng(lonrad, HE5_HDFE_RAD_DEG); latitude[i] = HE5_EHconvAng(latrad, HE5_HDFE_RAD_DEG); } } } if (errbuf != NULL) free(errbuf); COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_lamazDxDtheta | | | | DESCRIPTION: Partial derivative along longitude line for Lambert Azimuthal | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | double Dx/D(theta) for LAMAZ projection | | | | INPUTS: | | parms double Parameters defining partial derivative | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | | | END_PROLOG | -----------------------------------------------------------------------------*/ double HE5_lamazDxDtheta(double parms[]) { double ans = 0.; double snTheta = 0.; double sn2Theta = 0.; double snTheta1 = 0.; double csTheta1 = 0.; double csLamda = 0.; herr_t status = FAIL; CHECKPOINTER(parms); snTheta = sin(HE5_EHconvAng(parms[0], HE5_HDFE_DEG_RAD)); sn2Theta = sin(2. * HE5_EHconvAng(parms[0], HE5_HDFE_DEG_RAD)); snTheta1 = sin(HE5_EHconvAng(parms[1], HE5_HDFE_DEG_RAD)); csTheta1 = cos(HE5_EHconvAng(parms[1], HE5_HDFE_DEG_RAD)); csLamda = cos(HE5_EHconvAng(parms[2], HE5_HDFE_DEG_RAD) - HE5_EHconvAng(parms[3], HE5_HDFE_DEG_RAD)); ans = 4. * snTheta + (csTheta1 * csLamda * sn2Theta) + (2. * snTheta1 * (1. + (snTheta * snTheta))); COMPLETION: return(ans); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_lamazDxDlamda | | | | DESCRIPTION: Partial derivative along latitude line for Lambert Azimuthal | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | double Dx/D(lamda) for LAMAZ projection | | | | INPUTS: | | parms double Parameters defining partial derivative | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | | | END_PROLOG | -----------------------------------------------------------------------------*/ double HE5_lamazDxDlamda(double parms[]) { double ans = 0.; double snTheta = 0.; double csTheta = 0.; double snTheta1 = 0.; double csTheta1 = 0.; double csLamda = 0.; double cs = 0.; double sn = 0.; herr_t status = FAIL; CHECKPOINTER(parms); snTheta = sin(HE5_EHconvAng(parms[2], HE5_HDFE_DEG_RAD)); csTheta = cos(HE5_EHconvAng(parms[2], HE5_HDFE_DEG_RAD)); snTheta1 = sin(HE5_EHconvAng(parms[1], HE5_HDFE_DEG_RAD)); csTheta1 = cos(HE5_EHconvAng(parms[1], HE5_HDFE_DEG_RAD)); csLamda = cos(HE5_EHconvAng(parms[0], HE5_HDFE_DEG_RAD) - HE5_EHconvAng(parms[3], HE5_HDFE_DEG_RAD)); cs = csTheta * csTheta1; sn = snTheta * snTheta1; ans = cs + (2. * (1. + sn) + (cs * csLamda)) * csLamda; COMPLETION: return(ans); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_lamazDyDtheta | | | | DESCRIPTION: Partial derivative along longitude line for Lambert Azimuthal | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | double Dy/D(theta) for LAMAZ projection | | | | INPUTS: | | parms double Parameters defining partial derivative | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | END_PROLOG | -----------------------------------------------------------------------------*/ double HE5_lamazDyDtheta(double parms[]) { double ans = 0.; double snTheta = 0.; double csTheta = 0.; double snTheta1 = 0.; double csTheta1 = 0.; double csLamda = 0.; double sn2 = 0.; double cs2 = 0.; double sndiff = 0.; herr_t status = FAIL; CHECKPOINTER(parms); snTheta = sin(HE5_EHconvAng(parms[0], HE5_HDFE_DEG_RAD)); csTheta = cos(HE5_EHconvAng(parms[0], HE5_HDFE_DEG_RAD)); snTheta1 = sin(HE5_EHconvAng(parms[1], HE5_HDFE_DEG_RAD)); csTheta1 = cos(HE5_EHconvAng(parms[1], HE5_HDFE_DEG_RAD)); csLamda = cos(HE5_EHconvAng(parms[2], HE5_HDFE_DEG_RAD) - HE5_EHconvAng(parms[3], HE5_HDFE_DEG_RAD)); sn2 = snTheta1 * snTheta; cs2 = csTheta1 * csTheta; sndiff = snTheta1 - snTheta; ans = cs2 * (sn2 * (1. + (csLamda * csLamda)) + 2.) + csLamda * (2. * (1. + sn2 * sn2) - (sndiff * sndiff)); COMPLETION: return(ans); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_homDyDtheta | | | | DESCRIPTION: Partial derivative along longitude line for Oblique Mercator | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | double Dx/D(theta) for HOM projection | | | | INPUTS: | | parms double Parameters defining partial derivative | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | END_PROLOG | -----------------------------------------------------------------------------*/ double HE5_homDyDtheta(double parms[]) { double ans = 0.; double tnTheta = 0.; double tnTheta1 = 0.; double snLamda = 0.; herr_t status = FAIL; CHECKPOINTER(parms); tnTheta = tan(HE5_EHconvAng(parms[0], HE5_HDFE_DEG_RAD)); tnTheta1 = tan(HE5_EHconvAng(parms[1], HE5_HDFE_DEG_RAD)); snLamda = cos(HE5_EHconvAng(parms[2], HE5_HDFE_DEG_RAD) - HE5_EHconvAng(parms[3], HE5_HDFE_DEG_RAD)); ans = tnTheta * snLamda + tnTheta1; COMPLETION: return(ans); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDtangentpnts | | | | DESCRIPTION: Finds tangent points along lon/lat lines | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | projcode int Projection code | | projparm double Projection parameters | | cornerlon double dec deg Longitude of opposite corners of box | | cornerlat double dec deg Latitude of opposite corners of box | | longitude double dec deg Longitude of points to check | | latitude double dec deg Latitude of points to check | | | | OUTPUTS: | | npnts long Number of points to check in subset | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 8/24/99 A.Muslimov Changed the return type from intn to int . | | 3/16/00 A.Muslimov Added Abe Taaheri's update (MERCATOR and ALBERS | | projections) from HDF-EOSv2. | | 7/12/00 A.Muslimov Unmasked hdf5 data types. | | May 04 S.Zhao Added a case for GEO projections. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ static herr_t HE5_GDtangentpnts(int projcode, double projparm[], double cornerlon[], double cornerlat[], double longitude[], double latitude[], long *npnts) { herr_t status = FAIL;/* return status variable */ int i; /* Loop index */ double lonrad = 0.;/* Longitude (radians) */ double latrad = 0.;/* Latitude (radians) */ double cs[4]={0.,0.,0.,0.};/* Cosine array */ double sn[4]={0.,0.,0.,0.};/* Sine array */ double csTest = 0.;/* Cosine test value */ double snTest = 0.;/* Sine test value */ double crs01 = 0.;/* Cross product */ double crsTest[2]= {0.,0.};/* Cross product array */ double longPol = 0.;/* Longitude beneath pole */ double minLat = 0.;/* Minimum latitude */ double bisectParm[4]={0.,0.,0.,0.};/* Bisection parms */ double tanLat = 0.;/* Tangent latitude */ double tanLon = 0.;/* Tangent lontitude */ double dotPrd = 0.;/* Dot product */ double centMerd = 0.;/* Central Meridian */ double orgLat = 0.;/* Latitude of origin */ double dpi = 0.;/* Double precision pi */ double HE5_lamazDxDtheta(double *);/* Lambert Azimuthal Dx/Dtheta */ double HE5_lamazDxDlamda(double *);/* Lambert Azimuthal Dx/Dlamda */ double HE5_lamazDyDtheta(double *);/* Lambert Azimuthal Dy/Dtheta */ double HE5_homDyDtheta(double *); /* Oblique Mercator Dy/Dtheta */ char *errbuf; /* Buffer for error message */ CHECKPOINTER(projparm); CHECKPOINTER(cornerlon); CHECKPOINTER(cornerlat); CHECKPOINTER(longitude); CHECKPOINTER(latitude); /* Allocate memory for error message buffer */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDtangentpnts", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Conpute pi (double precsion) */ /* ---------------------------- */ dpi = atan(1.) * 4.; switch (projcode) { case HE5_GCTP_GEO: { /* No need for tangent points, since GEO projection is rectangular */ } break; case HE5_GCTP_MERCAT: { /* No need for tangent points, since MERCAT projection is rectangular */ } break; case HE5_GCTP_BCEA: { /* No need for tangent points, since BCEA projection is rectangular */ } break; case HE5_GCTP_CEA: { /* No need for tangent points, since CEA projection is rectangular */ } break; case HE5_GCTP_PS: { /* Add "xy axis" points for Polar Stereographic if necessary */ /* --------------------------------------------------------- */ /* Get minimum of corner latitudes */ /* ------------------------------- */ minLat = (fabs(cornerlat[0]) <= fabs(cornerlat[1])) ? cornerlat[0] : cornerlat[1]; /* Compute sine and cosine of corner longitudes */ /* -------------------------------------------- */ for (i = 0; i < 2; i++) { lonrad = HE5_EHconvAng(cornerlon[i], HE5_HDFE_DEG_RAD); cs[i] = cos(lonrad); sn[i] = sin(lonrad); } /* Compute cross product */ /* --------------------- */ crs01 = cs[0] * sn[1] - cs[1] * sn[0]; /* Convert longitude beneath pole from DMS to DEG */ /* ---------------------------------------------- */ longPol = HE5_EHconvAng(projparm[4], HE5_HDFE_DMS_RAD); for (i = 0; i < 4; i++) { csTest = cos(longPol); snTest = sin(longPol); crsTest[0] = cs[0] * snTest - csTest * sn[0]; crsTest[1] = cs[1] * snTest - csTest * sn[1]; if ((crs01 > 0 && crsTest[0] > 0 && crsTest[1] < 0) || (crs01 < 0 && crsTest[0] < 0 && crsTest[1] < 0) || (crs01 < 0 && crsTest[0] > 0 && crsTest[1] < 0) || (crs01 < 0 && crsTest[0] > 0 && crsTest[1] > 0)) { longitude[*npnts] = HE5_EHconvAng(longPol, HE5_HDFE_RAD_DEG); latitude[*npnts] = minLat; (*npnts)++; } longPol += 0.5 * dpi; } } break; case HE5_GCTP_LAMAZ: { if ((long)projparm[5] == +90000000 || (long)projparm[5] == -90000000) { /* Add "xy axis" points for Polar Lambert Azimuthal */ /* ------------------------------------------------ */ minLat = (fabs(cornerlat[0]) <= fabs(cornerlat[1])) ? cornerlat[0] : cornerlat[1]; for (i = 0; i < 2; i++) { lonrad = HE5_EHconvAng(cornerlon[i], HE5_HDFE_DEG_RAD); cs[i] = cos(lonrad); sn[i] = sin(lonrad); } crs01 = cs[0] * sn[1] - cs[1] * sn[0]; longPol = HE5_EHconvAng(projparm[4], HE5_HDFE_DMS_RAD); for (i = 0; i < 4; i++) { csTest = cos(longPol); snTest = sin(longPol); crsTest[0] = cs[0] * snTest - csTest * sn[0]; crsTest[1] = cs[1] * snTest - csTest * sn[1]; if ((crs01 > 0 && crsTest[0] > 0 && crsTest[1] < 0) || (crs01 < 0 && crsTest[0] < 0 && crsTest[1] < 0) || (crs01 < 0 && crsTest[0] > 0 && crsTest[1] < 0) || (crs01 < 0 && crsTest[0] > 0 && crsTest[1] > 0)) { longitude[*npnts] = HE5_EHconvAng(longPol, HE5_HDFE_RAD_DEG); latitude[*npnts] = minLat; (*npnts)++; } longPol += 0.5 * dpi; } } else if ((long)projparm[5] == 0) { /* Add "Equator" points for Equatorial Lambert Azimuthal */ /* ----------------------------------------------------- */ if (cornerlat[0] * cornerlat[1] < 0) { longitude[4] = cornerlon[0]; latitude[4] = 0; longitude[5] = cornerlon[1]; latitude[5] = 0; *npnts = 6; } } else { /* Add tangent points for Oblique Lambert Azimuthal */ /* ------------------------------------------------ */ bisectParm[0] = HE5_EHconvAng(projparm[5], HE5_HDFE_DMS_DEG); bisectParm[2] = HE5_EHconvAng(projparm[4], HE5_HDFE_DMS_DEG); /* Tangent to y-axis along longitude */ /* --------------------------------- */ for (i = 0; i < 2; i++) { bisectParm[1] = cornerlon[i]; if (HE5_EHbisect(HE5_lamazDxDtheta, bisectParm, 3, cornerlat[0], cornerlat[1], 0.0001, &tanLat) == 0) { longitude[*npnts] = cornerlon[i]; latitude[*npnts] = tanLat; (*npnts)++; } } /* Tangent to y-axis along latitude */ /* -------------------------------- */ for (i = 0; i < 2; i++) { bisectParm[1] = cornerlat[i]; if (HE5_EHbisect(HE5_lamazDxDlamda, bisectParm, 3, cornerlon[0], cornerlon[1], 0.0001, &tanLon) == 0) { longitude[*npnts] = tanLon; latitude[*npnts] = cornerlat[i]; (*npnts)++; } } /* Tangent to x-axis along longitude */ /* --------------------------------- */ for (i = 0; i < 2; i++) { bisectParm[1] = cornerlon[i]; if (HE5_EHbisect(HE5_lamazDyDtheta, bisectParm, 3, cornerlat[0], cornerlat[1], 0.0001, &tanLat) == 0) { longitude[*npnts] = cornerlon[i]; latitude[*npnts] = tanLat; (*npnts)++; } } /* Tangent to x-axis along latitude */ /* -------------------------------- */ for (i = 0; i < 2; i++) { lonrad = HE5_EHconvAng(cornerlon[i], HE5_HDFE_DEG_RAD); cs[i] = cos(lonrad); sn[i] = sin(lonrad); } crs01 = cs[0] * sn[1] - cs[1] * sn[0]; longPol = HE5_EHconvAng(projparm[4], HE5_HDFE_DMS_RAD); for (i = 0; i < 2; i++) { csTest = cos(longPol); snTest = sin(longPol); crsTest[0] = cs[0] * snTest - csTest * sn[0]; crsTest[1] = cs[1] * snTest - csTest * sn[1]; if ((crs01 > 0 && crsTest[0] > 0 && crsTest[1] < 0) || (crs01 < 0 && crsTest[0] < 0 && crsTest[1] < 0) || (crs01 < 0 && crsTest[0] > 0 && crsTest[1] < 0) || (crs01 < 0 && crsTest[0] > 0 && crsTest[1] > 0)) { longitude[*npnts] = HE5_EHconvAng(longPol, HE5_HDFE_RAD_DEG); latitude[*npnts] = cornerlat[0]; (*npnts)++; longitude[*npnts] = HE5_EHconvAng(longPol, HE5_HDFE_RAD_DEG); latitude[*npnts] = cornerlat[1]; (*npnts)++; } longPol += dpi; } } } break; case HE5_GCTP_GOOD: { /* Add "Equator" points for Goode Homolosine if necessary */ /* ------------------------------------------------------ */ if (cornerlat[0] * cornerlat[1] < 0) { longitude[4] = cornerlon[0]; latitude[4] = 0; longitude[5] = cornerlon[1]; latitude[5] = 0; *npnts = 6; } } break; case HE5_GCTP_LAMCC: { /* Compute sine and cosine of corner longitudes */ /* -------------------------------------------- */ for (i = 0; i < 2; i++) { lonrad = HE5_EHconvAng(cornerlon[i], HE5_HDFE_DEG_RAD); cs[i] = cos(lonrad); sn[i] = sin(lonrad); } /* Compute dot product */ /* ------------------- */ dotPrd = cs[0] * cs[1] + sn[0] * sn[1]; /* Convert central meridian (DMS to DEG) & compute sin & cos */ /* --------------------------------------------------------- */ centMerd = HE5_EHconvAng(projparm[4], HE5_HDFE_DMS_DEG); lonrad = HE5_EHconvAng(centMerd, HE5_HDFE_DEG_RAD); cs[1] = cos(lonrad); sn[1] = sin(lonrad); /* If box brackets central meridian ... */ /* ------------------------------------ */ if (cs[0] * cs[1] + sn[0] * sn[1] > dotPrd) { latitude[4] = cornerlat[0]; longitude[4] = centMerd; latitude[5] = cornerlat[1]; longitude[5] = centMerd; *npnts = 6; } } break; case HE5_GCTP_ALBERS: { /* Compute sine and cosine of corner longitudes */ /* -------------------------------------------- */ for (i = 0; i < 2; i++) { lonrad = HE5_EHconvAng(cornerlon[i], HE5_HDFE_DEG_RAD); cs[i] = cos(lonrad); sn[i] = sin(lonrad); } /* Compute dot product */ /* ------------------- */ dotPrd = cs[0] * cs[1] + sn[0] * sn[1]; /* Convert central meridian (DMS to DEG) & compute sin & cos */ /* --------------------------------------------------------- */ centMerd = HE5_EHconvAng(projparm[4], HE5_HDFE_DMS_DEG); lonrad = HE5_EHconvAng(centMerd, HE5_HDFE_DEG_RAD); cs[1] = cos(lonrad); sn[1] = sin(lonrad); /* If box brackets central meridian ... */ /* ------------------------------------ */ if (cs[0] * cs[1] + sn[0] * sn[1] > dotPrd) { latitude[4] = cornerlat[0]; longitude[4] = centMerd; latitude[5] = cornerlat[1]; longitude[5] = centMerd; *npnts = 6; } } break; case HE5_GCTP_POLYC: { /* Compute sine and cosine of corner longitudes */ /* -------------------------------------------- */ for (i = 0; i < 2; i++) { lonrad = HE5_EHconvAng(cornerlon[i], HE5_HDFE_DEG_RAD); cs[i] = cos(lonrad); sn[i] = sin(lonrad); } /* Compute dot product */ /* ------------------- */ dotPrd = cs[0] * cs[1] + sn[0] * sn[1]; /* Convert central meridian (DMS to DEG) & compute sin & cos */ /* --------------------------------------------------------- */ centMerd = HE5_EHconvAng(projparm[4], HE5_HDFE_DMS_DEG); lonrad = HE5_EHconvAng(centMerd, HE5_HDFE_DEG_RAD); cs[1] = cos(lonrad); sn[1] = sin(lonrad); /* If box brackets central meridian ... */ /* ------------------------------------ */ if (cs[0] * cs[1] + sn[0] * sn[1] > dotPrd) { latitude[4] = cornerlat[0]; longitude[4] = centMerd; latitude[5] = cornerlat[1]; longitude[5] = centMerd; *npnts = 6; } } break; case HE5_GCTP_TM: { /* Compute sine and cosine of corner longitudes */ /* -------------------------------------------- */ for (i = 0; i < 2; i++) { lonrad = HE5_EHconvAng(cornerlon[i], HE5_HDFE_DEG_RAD); cs[i] = cos(lonrad); sn[i] = sin(lonrad); } /* Compute dot product */ /* ------------------- */ dotPrd = cs[0] * cs[1] + sn[0] * sn[1]; for (i = -1; i <= 1; i++) { centMerd = HE5_EHconvAng(projparm[4], HE5_HDFE_DMS_DEG); lonrad = HE5_EHconvAng(centMerd + 90 * i, HE5_HDFE_DEG_RAD); csTest = cos(lonrad); snTest = sin(lonrad); /* If box brackets meridian ... */ /* ---------------------------- */ if (csTest * cs[1] + snTest * sn[1] > dotPrd) { latitude[*npnts] = cornerlat[0]; longitude[*npnts] = centMerd; (*npnts)++; latitude[*npnts] = cornerlat[1]; longitude[*npnts] = centMerd; (*npnts)++; } } /* Compute sine and cosine of corner latitudes */ /* ------------------------------------------- */ for (i = 0; i < 2; i++) { latrad = HE5_EHconvAng(cornerlat[i], HE5_HDFE_DEG_RAD); cs[i] = cos(latrad); sn[i] = sin(latrad); } /* Compute dot product */ /* ------------------- */ dotPrd = cs[0] * cs[1] + sn[0] * sn[1]; /* Convert origin latitude (DMS to DEG) & compute sin & cos */ /* -------------------------------------------------------- */ orgLat = HE5_EHconvAng(projparm[5], HE5_HDFE_DMS_DEG); latrad = HE5_EHconvAng(orgLat, HE5_HDFE_DEG_RAD); cs[1] = cos(latrad); sn[1] = sin(latrad); /* If box brackets origin latitude ... */ /* ----------------------------------- */ if (cs[0] * cs[1] + sn[0] * sn[1] > dotPrd) { latitude[*npnts] = orgLat; longitude[*npnts] = cornerlon[0]; (*npnts)++; latitude[*npnts] = orgLat; longitude[*npnts] = cornerlon[1]; (*npnts)++; } } break; case HE5_GCTP_HOM: { /* Tangent to y-axis along longitude */ /* --------------------------------- */ if (projparm[12] == 0) { cs[0] = cos(HE5_EHconvAng(projparm[8], HE5_HDFE_DMS_RAD)); sn[0] = sin(HE5_EHconvAng(projparm[8], HE5_HDFE_DMS_RAD)); cs[1] = cos(HE5_EHconvAng(projparm[9], HE5_HDFE_DMS_RAD)); sn[1] = sin(HE5_EHconvAng(projparm[9], HE5_HDFE_DMS_RAD)); cs[2] = cos(HE5_EHconvAng(projparm[10], HE5_HDFE_DMS_RAD)); sn[2] = sin(HE5_EHconvAng(projparm[10], HE5_HDFE_DMS_RAD)); cs[3] = cos(HE5_EHconvAng(projparm[11], HE5_HDFE_DMS_RAD)); sn[3] = sin(HE5_EHconvAng(projparm[11], HE5_HDFE_DMS_RAD)); bisectParm[2] = atan2( (cs[1] * sn[3] * cs[0] - sn[1] * cs[3] * cs[2]), (sn[1] * cs[3] * sn[2] - cs[1] * sn[3] * sn[0])); bisectParm[0] = atan( (sin(bisectParm[3]) * sn[0] - cos(bisectParm[3]) * cs[0]) / (sn[1] / cs[1])); bisectParm[2] = bisectParm[3] + 0.5 * dpi; } else { cs[0] = cos(HE5_EHconvAng(projparm[3], HE5_HDFE_DMS_RAD)); sn[0] = sin(HE5_EHconvAng(projparm[3], HE5_HDFE_DMS_RAD)); cs[1] = cos(HE5_EHconvAng(projparm[4], HE5_HDFE_DMS_RAD)); sn[1] = sin(HE5_EHconvAng(projparm[4], HE5_HDFE_DMS_RAD)); bisectParm[0] = asin(cs[1] * sn[0]); bisectParm[2] = atan2(-cs[0], (-sn[1] * sn[0])) + 0.5 * dpi; } for (i = 0; i < 2; i++) { bisectParm[1] = cornerlon[i]; if (HE5_EHbisect(HE5_homDyDtheta, bisectParm, 3, cornerlat[0], cornerlat[1], 0.0001, &tanLat) == 0) { longitude[*npnts] = cornerlon[i]; latitude[*npnts] = tanLat; (*npnts)++; } } } break; default: { if(projcode != HE5_GCTP_UTM) { status = FAIL; H5Epush(__FILE__, "HE5_GDtangentpnts", __LINE__, H5E_ARGS, H5E_BADVALUE, "Unknown projection code."); HE5_EHprint("Error: Unknown projection code, occured", __FILE__, __LINE__); } } break; } free(errbuf); COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDdefboxregion | | | | DESCRIPTION: Defines region for subsetting in a grid. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | regionID hid_t None Region ID | | | | INPUTS: | | gridID hid_t Grid structure ID | | cornerlon double dec deg Longitude of opposite corners of box | | cornerlat double dec deg Latitude of opposite corners of box | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 9/22/99 A.Muslimov Changed the type of return value from intn to hid_t.| | Added error handling after the function calls. | | 7/12/00 A.Muslimov Unmasked hdf5 data types. | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ hid_t HE5_GDdefboxregion(hid_t gridID, double cornerlon[], double cornerlat[]) { hid_t regionID = FAIL;/* Region ID (return value) */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t i; /* Loop index */ herr_t status = FAIL;/* routine return status variable */ int j; /* Loop index */ int projcode = FAIL;/* Projection code */ int zonecode = FAIL;/* Zone code */ int spherecode=FAIL;/* Sphere code */ long idx = FAIL;/* Grid index */ long xdimsize = 0; /* XDim size */ long ydimsize = 0; /* YDim size */ long row[32]; /* Row array */ long col[32]; /* Column array */ long minCol = 0; /* Minimun column value */ long minRow = 0; /* Minimun row value */ long maxCol = 0; /* Maximun column value */ long maxRow = 0; /* Maximun row value */ long npnts = 4; /* No. of boundary (edge & tangent) pnts */ double longitude[32]; /* Longitude array */ double latitude[32]; /* Latitude array */ double upleftpt[2]={0.,0.}; /* Upper left pt coordinates */ double lowrightpt[2]={0.,0.};/* Lower right pt coordinates */ double projparm[16]; /* Projection parameters */ double xscale = 0.0;/* X scale */ double yscale = 0.0;/* Y scale */ double lonrad0 = 0.0;/* Longitude of upper left point (radians) */ double latrad0 = 0.0;/* Latitude of upper left point (radians) */ double lonrad2 = 0.0;/* Longitude of point (radians) */ double latrad2 = 0.0;/* Latitude of point (radians) */ double lon[2], lat[2]; double xcor[2], ycor[2]; double upleftpt_m[2]; double xmtr[2], ymtr[2]; int nlatlon; /* Used for SOM projection */ long blockindexstart = -1; long blockindexstop = -1; double offset[180]; char *errbuf=(char *)NULL; /* Buffer for error message */ HE5_LOCK; CHECKPOINTER(cornerlat); CHECKPOINTER(cornerlon); /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDdefboxregion", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDdefboxregion", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for grid ID failed.\n"); H5Epush(__FILE__, "HE5_GDdefboxregion", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Get grid info */ /* ------------- */ status = HE5_GDgridinfo(gridID, &xdimsize, &ydimsize, upleftpt, lowrightpt); if (status == FAIL) { regionID = FAIL; sprintf(errbuf, "Failed to get grid information.\n" ); H5Epush(__FILE__, "HE5_GDdefboxregion", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return (regionID); } /* Make sure that xdimsize or ydimsize != 0 */ /* ---------------------------------------- */ if ( xdimsize == 0 || ydimsize == 0) { regionID = FAIL; sprintf(errbuf, "Zero values of \"xdimsize\" and \"ydimsize\".\n" ); H5Epush(__FILE__, "HE5_GDdefboxregion", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return (regionID); } /* Initialize projparm[] array */ /* --------------------------- */ for (j = 0; j < 16; j++) projparm[ j ] = 0.; /* Get proj info */ /* ------------- */ status = HE5_GDprojinfo(gridID, &projcode, &zonecode, &spherecode, projparm); /* If no projection code defined then bail */ /* --------------------------------------- */ if (projcode == FAIL) { regionID = FAIL; sprintf(errbuf,"No projection code is defined.\n" ); H5Epush(__FILE__, "HE5_GDdefboxregion", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return (regionID); } /* Get default values for upleft and lowright if necessary */ /* ------------------------------------------------------- */ if (upleftpt[0] == 0 && upleftpt[1] == 0 && lowrightpt[0] == 0 && lowrightpt[1] == 0) { status = HE5_GDgetdefaults(projcode, zonecode, projparm, spherecode, upleftpt, lowrightpt); if (status == FAIL) { regionID = FAIL; sprintf(errbuf,"Failed to get default values for uplft and lowrght points.\n" ); H5Epush(__FILE__, "HE5_GDdefboxregion", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return (regionID); } } /* Fill-up longitude and latitude arrays */ /* ------------------------------------- */ longitude[0] = cornerlon[0]; latitude[0] = cornerlat[0]; longitude[1] = cornerlon[0]; latitude[1] = cornerlat[1]; longitude[2] = cornerlon[1]; latitude[2] = cornerlat[0]; longitude[3] = cornerlon[1]; latitude[3] = cornerlat[1]; /* Find additional tangent points from GDtangentpnts */ /* ------------------------------------------------- */ status = HE5_GDtangentpnts(projcode, projparm, cornerlon, cornerlat, longitude, latitude, &npnts); if ( status == FAIL ) { sprintf(errbuf,"Failed to find additional tangent points.\n" ); H5Epush(__FILE__, "HE5_GDdefboxregion", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Initialize row[]/col[] arrays */ /* ----------------------------- */ for (j = 0; j < 32; j++) { row[j] = 0; col[j] = 0; } /* Convert from lon/lat to row/col */ /* ------------------------------- */ status = HE5_GDll2ij(projcode, zonecode, projparm, spherecode,xdimsize, ydimsize, upleftpt, lowrightpt,npnts, longitude, latitude, row, col, NULL, NULL); if ( status == FAIL ) { sprintf(errbuf, "Cannot convert from lon/lat to row/col.\n" ); H5Epush(__FILE__, "HE5_GDdefboxregion", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Find min/max values for row & col */ /* --------------------------------- */ minCol = col[0]; minRow = row[0]; maxCol = col[0]; maxRow = row[0]; for (i = 1; i < npnts; i++) { if (col[i] < minCol) { minCol = col[i]; } if (col[i] > maxCol) { maxCol = col[i]; } if (row[i] < minRow) { minRow = row[i]; } if (row[i] > maxRow) { maxRow = row[i]; } } /* "Clamp" if outside Grid */ /* ----------------------- */ minCol = (minCol < 0) ? 0 : minCol; minRow = (minRow < 0) ? 0 : minRow; maxCol = (maxCol >= xdimsize) ? xdimsize - 1 : maxCol; maxRow = (maxRow >= ydimsize) ? ydimsize - 1 : maxRow; /* Check whether subset region is outside grid region */ /* -------------------------------------------------- */ if (minCol >= xdimsize || minRow >= ydimsize || maxCol < 0 || maxRow < 0 ) { regionID = FAIL; sprintf(errbuf, "Subset Region outside of Grid Region."); H5Epush(__FILE__, "HE5_GDdefboxregion", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(regionID); } else { /* Store grid region info */ /* ---------------------- */ for (i = 0; i < HE5_NGRIDREGN; i++) { /* Find first empty grid region */ /* ---------------------------- */ if (HE5_GDXRegion[i] == 0) { /* Allocate space for grid region entry */ /* ------------------------------------ */ HE5_GDXRegion[i] = (struct HE5_gridRegion *)calloc(1, sizeof(struct HE5_gridRegion)); if(HE5_GDXRegion[i] == NULL) { regionID = FAIL; sprintf(errbuf, "Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_GDdefboxregion", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(regionID); } /* Store file and grid ID */ /* ---------------------- */ HE5_GDXRegion[i]->fid = fid; HE5_GDXRegion[i]->gridID = gridID; /* Initialize vertical subset entries to FAIL */ /* ------------------------------------------ */ for (j = 0; j < HE5_DTSETRANKMAX; j++) { HE5_GDXRegion[ i ]->StartVertical[j] = FAIL; HE5_GDXRegion[ i ]->StopVertical[j] = FAIL; } /* Store start & count along x & y */ /* ------------------------------- */ HE5_GDXRegion[ i ]->xStart = minCol; HE5_GDXRegion[ i ]->xCount = maxCol - minCol + 1; HE5_GDXRegion[ i ]->yStart = minRow; HE5_GDXRegion[ i ]->yCount = maxRow - minRow + 1; /* Store upleft and lowright points of subset region */ /* ------------------------------------------------- */ if (projcode == HE5_GCTP_GEO) { /* GEO projection */ /* -------------- */ /* Convert upleft & lowright lon from DMS to radians */ /* ------------------------------------------------- */ lonrad0 = HE5_EHconvAng(upleftpt[0], HE5_HDFE_DMS_RAD); lonrad2 = HE5_EHconvAng(lowrightpt[0], HE5_HDFE_DMS_RAD); /* Compute X scale */ /* --------------- */ xscale = (lonrad2 - lonrad0) / xdimsize; /* Convert upleft & lowright lat from DMS to radians */ /* ------------------------------------------------- */ latrad0 = HE5_EHconvAng(upleftpt[1], HE5_HDFE_DMS_RAD); latrad2 = HE5_EHconvAng(lowrightpt[1], HE5_HDFE_DMS_RAD); /* Compute Y scale */ /* --------------- */ yscale = (latrad2 - latrad0) / ydimsize; /* MinCol -> radians -> DMS -> upleftpt[0] */ /* --------------------------------------- */ HE5_GDXRegion[i]->upleftpt[0] = HE5_EHconvAng(lonrad0 + xscale * minCol, HE5_HDFE_RAD_DMS); /* MinRow -> radians -> DMS -> upleftpt[1] */ /* --------------------------------------- */ HE5_GDXRegion[i]->upleftpt[1] = HE5_EHconvAng(latrad0 + yscale * minRow, HE5_HDFE_RAD_DMS); /* MinCol + 1 -> radians -> DMS -> lowrightpt[0] */ /* --------------------------------------------- */ HE5_GDXRegion[i]->lowrightpt[0] = HE5_EHconvAng(lonrad0 + xscale * (maxCol + 1), HE5_HDFE_RAD_DMS); /* MinRow + 1 -> radians -> DMS -> lowrightpt[1] */ /* --------------------------------------------- */ HE5_GDXRegion[i]->lowrightpt[1] = HE5_EHconvAng(latrad0 + yscale * (maxRow + 1), HE5_HDFE_RAD_DMS); } else if (projcode == HE5_GCTP_BCEA) { /* BCEA projection */ /* -------------- */ nlatlon = 2; lon[0] = upleftpt[0]; lon[1] = lowrightpt[0]; lat[0] = upleftpt[1]; lat[1] = lowrightpt[1]; status = HE5_GDll2mm_cea(projcode,zonecode,spherecode,projparm, xdimsize, ydimsize,upleftpt, lowrightpt,nlatlon, lon, lat, xcor, ycor, &xscale, &yscale); upleftpt_m[0] = xcor[0]; upleftpt_m[1] = ycor[0]; if (status == FAIL) { sprintf(errbuf, "Error converting ."); H5Epush(__FILE__, "HE5_GDdefboxregion", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* MinCol -> meters -> upleftpt[0] */ /* ------------------------------- */ xmtr[0] = upleftpt_m[0] + xscale * minCol; /* MinRow -> meters -> upleftpt[1] */ /* ------------------------------- */ ymtr[0] = upleftpt_m[1] + yscale * minRow; /* MinCol + 1 -> meters -> lowrightpt[0] */ /* ------------------------------------- */ xmtr[1] = upleftpt_m[0] + xscale * (maxCol + 1); /* MinRow + 1 -> meters -> lowrightpt[1] */ /* ------------------------------------- */ ymtr[1] = upleftpt_m[1] + yscale * (maxRow + 1); /* Convert upleft & lowright lon from DMS to radians */ /* ------------------------------------------------- */ npnts = 2; status = HE5_GDmm2ll_cea(projcode, zonecode, spherecode, projparm, xdimsize, ydimsize, upleftpt, lowrightpt, npnts, xmtr, ymtr, longitude, latitude); if (status == -1) { sprintf(errbuf, "Subsetting failed "); H5Epush(__FILE__, "HE5_GDdefboxregion", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return (status); } HE5_GDXRegion[i]->upleftpt[0] = longitude[0]; HE5_GDXRegion[i]->upleftpt[1] = latitude[0]; HE5_GDXRegion[i]->lowrightpt[0] = longitude[1]; HE5_GDXRegion[i]->lowrightpt[1] = latitude[1]; } else if (projcode == HE5_GCTP_SOM) { /* Store start & count along x & y */ /* ------------------------------- */ HE5_GDXRegion[i]->xStart = 0; HE5_GDXRegion[i]->xCount = xdimsize; HE5_GDXRegion[i]->yStart = 0; HE5_GDXRegion[i]->yCount = ydimsize; HE5_GDXRegion[i]->somStart = blockindexstart; HE5_GDXRegion[i]->somCount = blockindexstop - blockindexstart + 1; /* Store upleft and lowright points of subset region */ /* ------------------------------------------------- */ if (blockindexstart == 0) { HE5_GDXRegion[i]->upleftpt[0] = upleftpt[0]; HE5_GDXRegion[i]->upleftpt[1] = upleftpt[1]; HE5_GDXRegion[i]->lowrightpt[0] = lowrightpt[0]; HE5_GDXRegion[i]->lowrightpt[1] = lowrightpt[1]; } else { HE5_GDXRegion[i]->upleftpt[0] = (lowrightpt[0] - upleftpt[0])* (offset[blockindexstart-1]/xdimsize) + upleftpt[0]; HE5_GDXRegion[i]->upleftpt[1] = (lowrightpt[1] - upleftpt[1])* (blockindexstart+1-1) + upleftpt[1]; HE5_GDXRegion[i]->lowrightpt[0] = (lowrightpt[0] - upleftpt[0])* (offset[blockindexstart-1]/xdimsize) + lowrightpt[0]; HE5_GDXRegion[i]->lowrightpt[1] = (lowrightpt[1] - upleftpt[1])* (blockindexstart+1-1) + lowrightpt[1]; } } else { /* Non-GEO, Non-BCEA projections */ /* ------------------------------ */ /* Compute X & Y scale */ /* ------------------- */ xscale = (lowrightpt[0] - upleftpt[0]) / xdimsize; yscale = (lowrightpt[1] - upleftpt[1]) / ydimsize; /* MinCol -> meters -> upleftpt[0] */ /* ------------------------------- */ HE5_GDXRegion[i]->upleftpt[0] = upleftpt[0] + xscale * minCol; /* MinRow -> meters -> upleftpt[1] */ /* ------------------------------- */ HE5_GDXRegion[i]->upleftpt[1] = upleftpt[1] + yscale * minRow; /* MinCol + 1 -> meters -> lowrightpt[0] */ /* ------------------------------------- */ HE5_GDXRegion[i]->lowrightpt[0] = upleftpt[0] + xscale * (maxCol + 1); /* MinRow + 1 -> meters -> lowrightpt[1] */ /* ------------------------------------- */ HE5_GDXRegion[i]->lowrightpt[1] = upleftpt[1] + yscale * (maxRow + 1); } /* Store region ID */ /* --------------- */ regionID = i; break; } } } free(errbuf); errbuf = NULL; COMPLETION: HE5_UNLOCK; return (regionID); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDregioninfo | | | | DESCRIPTION: Retrieves size of region in bytes. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | regionID hid_t Region ID | | fieldname char* Fieldname | | | | OUTPUTS: | | ntype hid_t field number types | | rank int field rank | | dims hsize_t dimensions of field region | | size long size in bytes of field region | | upleftpt double Upper left corner coord for region | | lowrightpt double Lower right corner coord for region | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | 8/24/99 A.Muslimov Changed the return type from intn to int . | | 9/23/99 A.Muslimov Changed the type of gridID, regionID from int32_t | | to hid_t.Removed redundant if(status == 0){} blocks.| | Added error handling after the function calls. | | Cleaned up minor things. | | 5/10/00 A.Muslimov Changed 'H5T_class_t' type to 'int' data type. | | 7/12/00 A.Muslimov Unmasked hdf5 data types. | | Jan 03 S.Zhao Changed the type of 'ntype' from an H5T_class_t to | | an hid_t. | | June 04 S.Zhao Enabled to subset on a one-dimensional field. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDregioninfo(hid_t gridID, hid_t regionID, const char *fieldname, hid_t *ntype, int *rank, hsize_t dims[], long *size, double upleftpt[], double lowrightpt[]) { herr_t status = FAIL;/* routine return status variable */ int j; /* Loop index */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ long idx = FAIL;/* Grid index */ long index = FAIL;/* Dimension index */ char dimlist[HE5_HDFE_DIMBUFSIZE];/* Dimension list */ char *errMesg = "Vertical Dimension Not Found: \"%s\".\n"; char *errM1 = "Both \"XDim\" and \"YDim\" must be present "; char *errM2 = "in the dimension list for \"%s\".\n"; char *errbuf= (char *)NULL; /* Error buffer */ CHECKPOINTER(fieldname); /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDregioninfo", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDregioninfo", &fid, &gid, &idx); if(status == FAIL) { sprintf(errbuf,"Checking for grid ID failed.\n"); H5Epush(__FILE__, "HE5_GDregioninfo", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); free(errbuf); return(status); } /* Check for valid region ID */ /* ------------------------- */ if (regionID < 0 || regionID >= HE5_NGRIDREGN) { status = FAIL; sprintf(errbuf, "Invalid Region ID: %d.\n", regionID); H5Epush(__FILE__, "HE5_GDregioninfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } /* Check for active region ID */ /* -------------------------- */ if (HE5_GDXRegion[regionID] == 0) { status = FAIL; sprintf(errbuf, "Inactive Region ID: %d.\n", regionID); H5Epush(__FILE__, "HE5_GDregioninfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } /* Check that region defined for this file */ /* --------------------------------------- */ if (HE5_GDXRegion[regionID]->fid != fid) { status = FAIL; sprintf(errbuf, "Region is not defined for this file.\n"); H5Epush(__FILE__, "HE5_GDregioninfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } /* Check that region defined for this grid */ /* --------------------------------------- */ if (HE5_GDXRegion[regionID]->gridID != gridID) { status = FAIL; sprintf(errbuf, "Region is not defined for this Grid.\n"); H5Epush(__FILE__, "HE5_GDregioninfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } /* Check for valid fieldname */ /* ------------------------- */ status = HE5_GDfieldinfo(gridID, fieldname, rank, dims, ntype, dimlist, NULL); if (status == FAIL) { /* Fieldname not found in grid */ /* --------------------------- */ sprintf(errbuf, "Fieldname \"%s\" not found.\n", fieldname); H5Epush(__FILE__, "HE5_GDregioninfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } else if (*rank > 1) { /* "XDim" and/or "YDim" not found */ /* ------------------------------ */ if ( HE5_EHstrwithin("XDim", dimlist, ',') == FAIL || HE5_EHstrwithin("YDim", dimlist, ',') == FAIL) { status = FAIL; sprintf(errbuf, "%s%s%s", errM1, errM2, fieldname); H5Epush(__FILE__, "HE5_GDregioninfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } } /* If no problems ... */ /* ------------------ */ if (*rank > 1) { /* Load XDim dimension from region entry */ /* ------------------------------------- */ if (HE5_GDXRegion[regionID]->xCount != 0) { dims[ HE5_EHstrwithin("XDim", dimlist, ',') ] = (hsize_t)HE5_GDXRegion[regionID]->xCount; } /* Load YDim dimension from region entry */ /* ------------------------------------- */ if (HE5_GDXRegion[regionID]->yCount != 0) { dims[ HE5_EHstrwithin("YDim", dimlist, ',') ] = (hsize_t)HE5_GDXRegion[regionID]->yCount; } } /* Vertical Subset */ /* --------------- */ for (j = 0; j < HE5_DTSETRANKMAX; j++) { /* If active vertical subset ... */ /* ----------------------------- */ if (HE5_GDXRegion[regionID]->StartVertical[j] != FAIL) { /* Find vertical dimension within dimlist */ /* -------------------------------------- */ index = HE5_EHstrwithin(HE5_GDXRegion[regionID]->DimNamePtr[j], dimlist, ','); /* If dimension found ... */ /* ---------------------- */ if (index != FAIL) { /* Compute dimension size */ /* ---------------------- */ dims[ index ] = HE5_GDXRegion[regionID]->StopVertical[j] - HE5_GDXRegion[regionID]->StartVertical[j] + 1; } else { /* Vertical dimension not found */ /* ---------------------------- */ status = FAIL; *size = FAIL; sprintf( errbuf, errMesg, HE5_GDXRegion[regionID]->DimNamePtr[j]); H5Epush(__FILE__, "HE5_GDregioninfo", __LINE__, H5E_IO, H5E_SEEKERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } } } /* Compute number of total elements */ /* -------------------------------- */ *size = (long)dims[ 0 ]; for (j = 1; j < *rank; j++) *size *= (long)dims[j]; /* Multiply by size in bytes of numbertype */ /* --------------------------------------- */ *size *= (long)HE5_GDfielddatasize(gridID,fieldname); if(*size == 0) { status = FAIL; sprintf(errbuf, "Cannot get the data size of the data field.\n"); H5Epush(__FILE__, "HE5_GDregioninfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); free(errbuf); return(status); } /* Return upper left and lower right subset values */ /* ----------------------------------------------- */ upleftpt[0] = HE5_GDXRegion[regionID]->upleftpt[0]; upleftpt[1] = HE5_GDXRegion[regionID]->upleftpt[1]; lowrightpt[0] = HE5_GDXRegion[regionID]->lowrightpt[0]; lowrightpt[1] = HE5_GDXRegion[regionID]->lowrightpt[1]; free(errbuf); errbuf = NULL; COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDgetfieldID | | | | DESCRIPTION: Return a data field ID | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | | | OUTPUTS: | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 9/21/99 A.Muslimov Added error handling after the call to GDchkgdid(). | | 7/12/00 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ static herr_t HE5_GDgetfieldID(hid_t gridID, const char *fieldname, hid_t *fieldID) { herr_t status = FAIL;/* routine return status variable */ int i; /* Loop index */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ long idx = FAIL;/* Grid index */ /* char *errbuf=(char *)NULL;*//* error message buffer */ char errbuf[HE5_HDFE_ERRBUFSIZE]; CHECKPOINTER(fieldname); /* Allocate memory for error message buffer */ /* ---------------------------------------- */ /* errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDgetfieldID", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } */ /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDgetfieldID", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for grid ID failed.\n"); H5Epush(__FILE__, "HE5_GDgetfieldID", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); /*free(errbuf);*/ return(FAIL); } /* Loop through all data datasets in grid and get dataset name */ /* ----------------------------------------------------------- */ for (i = 0; i < HE5_GDXGrid[idx].nDFLD; i++) { if( strcmp(fieldname, HE5_GDXGrid[idx].ddataset[i].name) == 0 ) break; } /* Get field-related dataset ID */ /* ============================= */ *fieldID = HE5_GDXGrid[idx].ddataset[i].ID; /*free(errbuf);*/ COMPLETION: return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDfielddatasize | | | | DESCRIPTION: Return size in bytes of a data field | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | size size_t data type size in bytes | | | | INPUTS: | | | | OUTPUTS: | | | | NOTES: | | | | | | HDF5 Library Functions Called: | | H5Dget_type | | H5Tget_size | | H5Tclose | | | | Date Programmer Description | | ====== ============ ================================================= | | 9/28/99 A.Muslimov Added proper error handlings after the function | | calls. | | 7/12/00 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ static size_t HE5_GDfielddatasize(hid_t gridID, const char *fieldname) { size_t size = 0; /* return value, data type size in bytes */ herr_t status = FAIL;/* routine return status variable */ int i; /* Loop index */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t dtype = FAIL;/* datatype ID */ hid_t datasetid = FAIL;/* field dataset ID */ long idx = FAIL;/* Grid index */ char *errbuf=(char *)NULL;/* error message buffer */ CHECKPOINTER(fieldname); /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { size = 0; H5Epush(__FILE__, "HE5_GDfielddatasize", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(size); } /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDfielddatasize", &fid, &gid, &idx); if ( status == FAIL ) { size = 0; sprintf(errbuf, "Checking for grid ID failed.\n"); H5Epush(__FILE__, "HE5_GDfielddatasize", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(size); } /* Loop through all data datasets in grid */ /* -------------------------------------- */ for (i = 0; i < HE5_GDXGrid[idx].nDFLD; i++) { /* Get dataset name */ /* ---------------- */ if( strcmp(fieldname, HE5_GDXGrid[idx].ddataset[i].name) == 0 ) break; } /* Get dataset ID */ /* -------------- */ datasetid = HE5_GDXGrid[idx].ddataset[i].ID; dtype = H5Dget_type(datasetid); if ( dtype == FAIL ) { size = 0; sprintf(errbuf, "Cannot get data type ID.\n"); H5Epush(__FILE__, "HE5_GDfielddatasize", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(size); } /* Get data type size (bytes) */ /* -------------------------- */ size = H5Tget_size(dtype); if ( size == 0 ) { sprintf(errbuf, "Cannot retrieve data size.\n"); H5Epush(__FILE__, "HE5_GDfielddatasize", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(size); } /* Release the data type ID */ /* ------------------------ */ status = H5Tclose(dtype); if ( status == FAIL ) { size = 0; sprintf(errbuf, "Cannot release datatype ID.\n"); H5Epush(__FILE__, "HE5_GDfielddatasize", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } free(errbuf); errbuf = NULL; COMPLETION: return(size); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDextractregion | | | | DESCRIPTION: Retrieves data from specified region. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | regionID hid_t Region ID | | fieldname char* Fieldname | | | | OUTPUTS: | | buffer void Data buffer containing subsetted region | | | | | | NOTES: | | | | | | HDF5 Library Functions Called: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 9/23/99 A.Muslimov Changed the data type of gridID and regionID from | | int32_t to hid_t. Added proper error handling after | | the function calls. Removed redundant | | if(status==0){} brackets. | | 7/12/00 A.Muslimov Unmasked hdf5 data types. | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | June 04 S.Zhao Enabled to subset on a one-dimensional field. | | July 04 S.Zhao Set a default origin if HE5_GDorigininfo fails. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDextractregion(hid_t gridID, hid_t regionID, const char *fieldname, void *buffer) { herr_t status = FAIL; /* routine return status variable */ int i, j; /* Loop indices */ int rank = FAIL; /* Field rank */ int origincode=FAIL; /* Pixel origin code */ hid_t *ntype = (hid_t *)NULL; /* number types */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ long idx = FAIL; /* Grid index */ long index = FAIL; /* Dimension index */ hssize_t start[HE5_DTSETRANKMAX]; /* Start array for data to read */ hsize_t edge[HE5_DTSETRANKMAX]; /* Edge array for data to read */ hsize_t dims[HE5_DTSETRANKMAX]; /* Dimensions */ char dimlist[HE5_HDFE_DIMBUFSIZE]; /* Dimension list */ char *errMesg = "Vertical Dimension Not Found: \"%s\".\n"; char *errM1 = "Both \"XDim\" and \"YDim\" must be present "; char *errM2 = "in the dimension list for \"%s\".\n"; char *errbuf = (char *)NULL; /* error message buffer */ HE5_LOCK; CHECKPOINTER(fieldname); /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDextractregion", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDextractregion", &fid, &gid, &idx); if (status == FAIL) { sprintf(errbuf, "Checking for grid ID failed.\n"); H5Epush(__FILE__, "HE5_GDextractregion", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } /* Check for valid region ID */ /* ------------------------- */ if (regionID < 0 || regionID >= HE5_NGRIDREGN) { status = FAIL; sprintf(errbuf, "Invalid Region id: %d.\n", regionID); H5Epush(__FILE__, "HE5_GDextractregion", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } /* Check for active region ID */ /* -------------------------- */ if (HE5_GDXRegion[regionID] == 0) { status = FAIL; sprintf(errbuf, "Inactive Region ID: %d.\n", regionID); H5Epush(__FILE__, "HE5_GDextractregion", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } /* Check that region defined for this file */ /* --------------------------------------- */ if (HE5_GDXRegion[regionID]->fid != fid) { status = FAIL; sprintf(errbuf, "Region is not defined for this file.\n"); H5Epush(__FILE__, "HE5_GDextractregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } /* Check that region defined for this grid */ /* --------------------------------------- */ if (HE5_GDXRegion[regionID]->gridID != gridID) { status = FAIL; sprintf(errbuf, "Region is not defined for this Grid.\n"); H5Epush(__FILE__, "HE5_GDextractregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } /* Initialize dims[] array */ /* ----------------------- */ for (i = 0; i < HE5_DTSETRANKMAX; i++) dims[ i ] = 0; /* Check for valid fieldname */ /* ------------------------- */ ntype = (hid_t *)calloc(1, sizeof(hid_t)); status = HE5_GDfieldinfo(gridID, fieldname, &rank, dims, ntype, dimlist, NULL); if (status == FAIL) { /* Fieldname not found in grid */ /* --------------------------- */ sprintf(errbuf, "Fieldname \"%s\" not found.\n", fieldname); H5Epush(__FILE__, "HE5_GDextractregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(ntype); return(status); } else if (rank > 1) { /* "XDim" and/or "YDim" not found */ /* ------------------------------ */ if ( HE5_EHstrwithin("XDim", dimlist, ',') == FAIL || HE5_EHstrwithin("YDim", dimlist, ',') == FAIL) { status = FAIL; sprintf(errbuf, "%s%s%s", errM1, errM2, fieldname); H5Epush(__FILE__, "HE5_GDextractregion", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(ntype); return(status); } } /* Get origin order info */ /* --------------------- */ status = HE5_GDorigininfo(gridID, &origincode); if (status == FAIL) { /* Set a default origin code */ /* ------------------------- */ origincode = HE5_HDFE_GD_UL; } /* Initialize start & edge arrays */ /* ------------------------------ */ for (i = 0; i < HE5_DTSETRANKMAX; i++) { start[ i ] = 0; edge[ i ] = dims[ i ]; } if (rank > 1) { /* Set start & edge arrays for XDim */ /* -------------------------------- */ index = HE5_EHstrwithin("XDim", dimlist, ','); if (HE5_GDXRegion[regionID]->xCount != 0) { edge[index] = (hsize_t)HE5_GDXRegion[regionID]->xCount; start[index] = (hssize_t)HE5_GDXRegion[regionID]->xStart; } /* Adjust X-dim start if origin on right edge */ /* ------------------------------------------ */ if ((origincode & 1) == 1) { start[index] = dims[index] - (start[index] + edge[index]); } /* Set start & edge arrays for YDim */ /* -------------------------------- */ index = HE5_EHstrwithin("YDim", dimlist, ','); if (HE5_GDXRegion[regionID]->yCount != 0) { start[index] = (hssize_t)HE5_GDXRegion[regionID]->yStart; edge[index] = (hsize_t)HE5_GDXRegion[regionID]->yCount; } /* Adjust Y-dim start if origin on lower edge */ /* ------------------------------------------ */ if ((origincode & 2) == 2) { start[index] = dims[index] - (start[index] + edge[index]); } } /* Vertical Subset */ /* --------------- */ for (j = 0; j < HE5_DTSETRANKMAX; j++) { /* If active vertical subset ... */ /* ----------------------------- */ if (HE5_GDXRegion[regionID]->StartVertical[j] != FAIL) { /* Find vertical dimension within dimlist */ /* -------------------------------------- */ index = HE5_EHstrwithin(HE5_GDXRegion[regionID]->DimNamePtr[j], dimlist, ','); /* If dimension found ... */ /* ---------------------- */ if (index != FAIL) { /* Compute start and edge for vertical dimension */ /* --------------------------------------------- */ start[index] = (hssize_t)HE5_GDXRegion[regionID]->StartVertical[j]; edge[index] = (hsize_t)(HE5_GDXRegion[regionID]->StopVertical[j] - HE5_GDXRegion[regionID]->StartVertical[j] + 1); } else { /* Vertical dimension not found */ /* ---------------------------- */ status = FAIL; sprintf(errbuf, errMesg, HE5_GDXRegion[regionID]->DimNamePtr[j]); H5Epush(__FILE__, "HE5_GDextractregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(ntype); return(status); } } } /* Read into data buffer */ /* --------------------- */ status = HE5_GDreadfield(gridID, fieldname, start, NULL, edge, buffer); if (status == FAIL) { sprintf(errbuf, "Cannot read data for the \"%s\" data field into data buffer.\n", fieldname); H5Epush(__FILE__, "HE5_GDextractregion", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } free(errbuf); errbuf = NULL; free(ntype); COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDdupregion | | | | DESCRIPTION: Duplicates a region | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | newRegionID hid_t New region ID | | | | INPUTS: | | oldRegionID hid_t Old region ID | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Oct 98 Abe Taaheri changed *GDXRegion[i] = *GDXRegion[oldregionID]; | | to copy elements of structure one by one to avoid | | copying pointer for DimNamePtr to another place that| | causes "Freeing Unallocated Memory" in purify when | | using GDdetach | | 9/23/99 A.Muslimov Changed the data type for newregionID(return value) | | and oldregionID from int32_t to hid_t. | | 4/19/00 A.Muslimov Changed type of 'slendupregion' from long to size_t.| | 7/12/00 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ hid_t HE5_GDdupregion(hid_t oldRegionID) { hid_t newRegionID = FAIL;/* New region ID (return value) */ hid_t i, j; /* Loop indices */ size_t slendupregion = 0;/* length of dimension name string */ /* Find first empty (inactive) region */ /* ---------------------------------- */ for (i = 0; i < HE5_NGRIDREGN; i++) { if (HE5_GDXRegion[i] == 0) { /* Allocate space for new grid region entry */ /* ---------------------------------------- */ HE5_GDXRegion[i] = (struct HE5_gridRegion *)calloc(1, sizeof(struct HE5_gridRegion)); if(HE5_GDXRegion[i] == NULL) { H5Epush(__FILE__, "HE5_GDdupregion", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory"); HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__); return(FAIL); } /* Copy old region structure data to new region */ /* -------------------------------------------- */ HE5_GDXRegion[i]->fid = HE5_GDXRegion[oldRegionID]->fid; HE5_GDXRegion[i]->gridID = HE5_GDXRegion[oldRegionID]->gridID; HE5_GDXRegion[i]->xStart = HE5_GDXRegion[oldRegionID]->xStart; HE5_GDXRegion[i]->xCount = HE5_GDXRegion[oldRegionID]->xCount; HE5_GDXRegion[i]->yStart = HE5_GDXRegion[oldRegionID]->yStart; HE5_GDXRegion[i]->yCount = HE5_GDXRegion[oldRegionID]->yCount; HE5_GDXRegion[i]->upleftpt[0] = HE5_GDXRegion[oldRegionID]->upleftpt[0]; HE5_GDXRegion[i]->upleftpt[1] = HE5_GDXRegion[oldRegionID]->upleftpt[1]; HE5_GDXRegion[i]->lowrightpt[0] = HE5_GDXRegion[oldRegionID]->lowrightpt[0]; HE5_GDXRegion[i]->lowrightpt[1] = HE5_GDXRegion[oldRegionID]->lowrightpt[1]; for (j = 0; j < HE5_DTSETRANKMAX; j++) { HE5_GDXRegion[i]->StartVertical[j] = HE5_GDXRegion[oldRegionID]->StartVertical[j]; HE5_GDXRegion[i]->StopVertical[j] = HE5_GDXRegion[oldRegionID]->StopVertical[j]; } for (j = 0; j < HE5_DTSETRANKMAX; j++) { if(HE5_GDXRegion[oldRegionID]->DimNamePtr[j] != NULL) { slendupregion = strlen(HE5_GDXRegion[oldRegionID]->DimNamePtr[j]); HE5_GDXRegion[i]->DimNamePtr[j] = (char *) calloc( (slendupregion + 1), sizeof(char) ); strcpy(HE5_GDXRegion[i]->DimNamePtr[j],HE5_GDXRegion[oldRegionID]->DimNamePtr[j]); } } /* Define new region ID */ /* -------------------- */ newRegionID = i; break; } } return (newRegionID); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDdefvrtregion | | | | DESCRIPTION: Finds elements of a monotonic field within a vertical subset | | region. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | regionID hid_t None Region ID | | | | INPUTS: | | gridID hid_t Grid structure ID | | regionID hid_t Region ID | | vertObj char Vertical object to subset | | range double Vertical subsetting range | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 9/23/99 A.Muslimov Changed the data types of return value, gridID, and | | RegionID from int32_t to hid_t. Added error handling| | after the function calls. | | 10/18/99 A.Muslimov Replace memcpy() by memmove() to avoid a problem | | when arguments 1 and 2 overlap in memory. | | 11/10/99 A.Muslimov In the call to GDreadfield() 3d and 5th arguments | | were passed as "NULL"s, which resulted in a core | | dump. To fix this bug, replaced them by start and | | edge, respectively. | | 04/19/00 A.Muslimov Changed type of 'slen' from long to size_t. | | 7/12/00 A.Muslimov Unmasked hdf5 data types. | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | Mar 04 S.Zhao Modified for supported field type. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ #define HE5_SETGRIDREG \ \ status = HE5_GDgridinfo(gridID, &xdimsize, &ydimsize, upleftpt, lowrightpt); \ for (k = 0; k < HE5_NGRIDREGN; k++) \ { \ if (HE5_GDXRegion[k] == 0) \ { \ HE5_GDXRegion[k] = (struct HE5_gridRegion *)calloc(1, sizeof(struct HE5_gridRegion)); \ HE5_GDXRegion[k]->fid = fid; \ HE5_GDXRegion[k]->gridID = gridID; \ HE5_GDXRegion[k]->xStart = 0; \ HE5_GDXRegion[k]->xCount = xdimsize; \ HE5_GDXRegion[k]->yStart = 0; \ HE5_GDXRegion[k]->yCount = ydimsize; \ HE5_GDXRegion[k]->upleftpt[0] = upleftpt[0]; \ HE5_GDXRegion[k]->upleftpt[1] = upleftpt[1]; \ HE5_GDXRegion[k]->lowrightpt[0] = lowrightpt[0]; \ HE5_GDXRegion[k]->lowrightpt[1] = lowrightpt[1]; \ regionID = k; \ for (j = 0; j < HE5_DTSETRANKMAX; j++) \ { \ HE5_GDXRegion[k]->StartVertical[j] = FAIL; \ HE5_GDXRegion[k]->StopVertical[j] = FAIL; \ } \ break; \ } \ } #define HE5_FILLVERTREG \ for (j = 0; j < HE5_DTSETRANKMAX; j++) \ { \ if (HE5_GDXRegion[regionID]->StartVertical[j] == FAIL) \ { \ HE5_GDXRegion[regionID]->StartVertical[j] = i; \ HE5_GDXRegion[regionID]->DimNamePtr[j] = (char *) calloc( (slen + 1),sizeof(char) ); \ memmove(HE5_GDXRegion[regionID]->DimNamePtr[j], dimlist, slen + 1); \ break; \ } \ } hid_t HE5_GDdefvrtregion(hid_t gridID, hid_t regionID, char *vertObj, double range[]) { herr_t status = FAIL; /* Return status variable */ int tmp = 999; /* Temporary flag */ int rank = FAIL; /* Dataset rank */ int vertINT= 0; int j; /* Loop index */ hid_t *nt = (hid_t *)NULL; /* number types */ unsigned char found = 0; /* "Found" flag */ hid_t k; /* loop index */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t dtype = FAIL; /* Datatype ID */ hid_t fieldID= FAIL; /* Data field dataset ID */ size_t slen = 0; /* String length value */ size_t size = 0; /* Field datasize (bytes) */ long i; /* loop index */ long idx = FAIL; /* Grid index */ long xdimsize = 0; /* Size of "XDim" */ long ydimsize = 0; /* Size of "YDim" */ short vertSHORT= 0; /* Temp "short" variable */ float vertFLT = 0.; /* Temp "float" variable */ double vertDBL = 0.; /* Temp "double" variable */ double upleftpt[2]={0.,0.}; /* Upper left point */ double lowrightpt[2]={0.,0.}; /* Lower right point */ hsize_t dims[HE5_DTSETRANKMAX]; /* Dimension sizes array */ hssize_t start[HE5_DTSETRANKMAX]; /* Start array */ hsize_t edge[HE5_DTSETRANKMAX]; /* Edge array */ char *vertArr = (char *)NULL; /* Temp "char" variable */ char dimlist[HE5_HDFE_DIMBUFSIZE]; /* Dimension list */ char *errbuf = (char *)NULL; /* Error message buffer */ HE5_LOCK; CHECKPOINTER(vertObj); CHECKPOINTER(range); /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDdefvrtregion", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Initialize arrays */ /* ----------------- */ for (j = 0; j < HE5_DTSETRANKMAX; j++) { dims[ j ] = 0; start[ j ] = 0; edge[ j ] = 0; } /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDdefvrtregion", &fid, &gid, &idx); if ( status == FAIL ) { regionID = FAIL; sprintf(errbuf, "Checking for grid ID failed.\n"); H5Epush(__FILE__, "HE5_GDdefvrtregion", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return( regionID ); } memmove(dimlist, vertObj, 4); dimlist[4] = 0; if (strcmp(dimlist, "DIM:") == 0) { slen = strlen(vertObj) - 4; if (regionID == FAIL) { HE5_SETGRIDREG; } for (j = 0; j < HE5_DTSETRANKMAX; j++) { if (HE5_GDXRegion[regionID]->StartVertical[j] == FAIL) { HE5_GDXRegion[regionID]->StartVertical[j] = (long)range[0]; HE5_GDXRegion[regionID]->StopVertical[j] = (long)range[1]; HE5_GDXRegion[regionID]->DimNamePtr[j] = (char *) calloc( (slen + 1),sizeof(char) ); if(HE5_GDXRegion[regionID]->DimNamePtr[j] == NULL) { sprintf(errbuf,"Cannot allocate memory\n") ; H5Epush(__FILE__, "HE5_GDdefvrtregion", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf) ; HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } memmove(HE5_GDXRegion[regionID]->DimNamePtr[j],vertObj + 4, slen + 1); break; } } } else { nt = (hid_t *)calloc(1, sizeof(hid_t)); if (nt == (hid_t *)NULL ) { regionID = FAIL; sprintf(errbuf, "Cannot allocate memory for data type class ID.\n"); H5Epush(__FILE__, "HE5_GDdefvrtregion", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(regionID); } status = HE5_GDfieldinfo(gridID, vertObj, &rank, dims, nt, dimlist,NULL); if (status == FAIL) { regionID = FAIL; sprintf(errbuf, "Vertical Field: \"%s\" not found.\n", vertObj); H5Epush(__FILE__, "HE5_GDdefvrtregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(nt); return(regionID); } else { if (rank != 1) { regionID = FAIL; sprintf(errbuf, "Vertical Field: \"%s\" must be 1-dim.\n", vertObj); H5Epush(__FILE__, "HE5_GDdefvrtregion", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(nt); return(regionID); } else { slen = strlen(dimlist); size = HE5_GDfielddatasize(gridID, vertObj); vertArr = (char *)calloc(dims[0], size); if(vertArr == NULL) { regionID = FAIL; sprintf(errbuf,"Cannot allocate memory\n"); H5Epush(__FILE__, "HE5_GDdefvrtregion", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); free(errbuf); free(nt); return(regionID); } /* ------------------------------------------------ */ /* Generate start[] and edge[] arrays to pass to the */ /* GDreadfield(). The NULL values are not */ /* allowed for the 3d and 5th argument */ /* of this function. (A.M) */ /* ------------------------------------------------ */ for( k = 0; k < rank; k++ ) { start[k] = 0; edge[k] = dims[k]; } status = HE5_GDreadfield(gridID, vertObj, start, NULL, edge, vertArr); if(status == FAIL) { regionID = FAIL; sprintf(errbuf, "Cannot read out data from the data field.\n"); H5Epush(__FILE__, "HE5_GDdefvrtregion", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); free(errbuf); free(vertArr); free(nt); return(regionID); } /* Get field ID and field data type */ /* ------------------------------- */ status = HE5_GDgetfieldID(gridID, vertObj, &fieldID); if(status == FAIL) { regionID = FAIL; sprintf(errbuf, "Cannot get the data field ID.\n"); H5Epush(__FILE__, "HE5_GDdefvrtregion", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); free(errbuf); free(vertArr); free(nt); return(regionID); } dtype = H5Dget_type(fieldID); if(dtype == FAIL) { regionID = FAIL; sprintf(errbuf, "Cannot get the data type of the data field.\n"); H5Epush(__FILE__, "HE5_GDdefvrtregion", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); free(errbuf); free(vertArr); free(nt); return(regionID); } if ( H5Tequal( dtype, H5T_NATIVE_SHORT) || H5Tequal( dtype, H5T_STD_I16BE) || H5Tequal( dtype, H5T_STD_I16LE) ) tmp = 1; else if ( H5Tequal(dtype, H5T_NATIVE_INT) || H5Tequal(dtype, H5T_STD_I32BE) || H5Tequal(dtype, H5T_STD_I32LE) ) tmp = 2; else if ( H5Tequal( dtype, H5T_NATIVE_FLOAT) || H5Tequal( dtype, H5T_IEEE_F32BE) || H5Tequal( dtype, H5T_IEEE_F32LE) ) tmp = 3; else if ( H5Tequal(dtype, H5T_NATIVE_DOUBLE) || H5Tequal(dtype, H5T_IEEE_F64BE) || H5Tequal(dtype, H5T_IEEE_F64LE) ) tmp = 4; status = H5Tclose(dtype); if(status == FAIL) { regionID = FAIL; sprintf(errbuf, "Cannot release the data type ID.\n"); H5Epush(__FILE__, "HE5_GDdefvrtregion", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); free(errbuf); free(vertArr); free(nt); return(regionID); } switch (tmp ) { case 1: for (i = 0; i < dims[0]; i++) { memmove(&vertINT, vertArr + i * size, size); if (vertINT >= range[0] && vertINT <= range[1]) { found = 1; if (regionID == FAIL) { HE5_SETGRIDREG; } HE5_FILLVERTREG; break; } } if (found == 1) { for (i = dims[0] - 1; i >= 0; i--) { memmove(&vertINT, vertArr + i * size, size); if (vertINT >= range[0] && vertINT <= range[1]) { HE5_GDXRegion[regionID]->StopVertical[j] = i; break; } } } else { regionID = FAIL; sprintf(errbuf,"Data field not found.\n"); H5Epush(__FILE__, "HE5_GDdefvrtregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); free(errbuf); free(vertArr); free(nt); return(regionID); } break; case 2: for (i = 0; i < dims[0]; i++) { memmove(&vertSHORT, vertArr + i * size, size); if (vertSHORT >= range[0] && vertSHORT <= range[1]) { found = 1; if (regionID == FAIL) { HE5_SETGRIDREG; } HE5_FILLVERTREG; break; } } if (found == 1) { for (i = dims[0] - 1; i >= 0; i--) { memmove(&vertSHORT, vertArr + i * size, size); if (vertSHORT >= range[0] && vertSHORT <= range[1]) { HE5_GDXRegion[regionID]->StopVertical[j] = i; break; } } } else { status = FAIL; } break; case 3: for (i = 0; i < dims[0]; i++) { memmove(&vertFLT, vertArr + i * size, size); if (vertFLT >= range[0] && vertFLT <= range[1]) { found = 1; if (regionID == FAIL) { HE5_SETGRIDREG; } HE5_FILLVERTREG; break; } } if (found == 1) { for (i = dims[0] - 1; i >= 0; i--) { memmove(&vertFLT, vertArr + i * size, size); if (vertFLT >= range[0] && vertFLT <= range[1]) { HE5_GDXRegion[regionID]->StopVertical[j] = i; break; } } } else { regionID = FAIL; sprintf(errbuf, "Data field not found.\n"); H5Epush(__FILE__, "HE5_GDdefvrtregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); free(errbuf); free(vertArr); free(nt); return(regionID); } break; case 4: for (i = 0; i < dims[0]; i++) { memmove(&vertDBL, vertArr + i * size, size); if (vertDBL >= range[0] && vertDBL <= range[1]) { found = 1; if (regionID == FAIL) { HE5_SETGRIDREG; } HE5_FILLVERTREG; break; } } if (found == 1) { for (i = dims[0] - 1; i >= 0; i--) { memmove(&vertDBL, vertArr + i * size, size); if (vertDBL >= range[0] && vertDBL <= range[1]) { HE5_GDXRegion[regionID]->StopVertical[j] = i; break; } } } else { regionID = FAIL; sprintf(errbuf, "Data field not found.\n"); H5Epush(__FILE__, "HE5_GDdefvrtregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); free(errbuf); free(vertArr); free(nt); return(regionID); } break; default: { regionID = FAIL; sprintf(errbuf, "Unknown Data type.\n"); H5Epush(__FILE__, "HE5_GDdefvrtregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); free(errbuf); free(vertArr); free(nt); } break; } if (vertArr != NULL) free(vertArr); } } } free(errbuf); errbuf = NULL; if (nt != NULL) free(nt); COMPLETION: HE5_UNLOCK; return (regionID); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDdeftimeperiod | | | | DESCRIPTION: Finds elements of the "Time" field within a given time | | period. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | periodID hid_t Period ID | | | | INPUTS: | | gridID hid_t Grid structure ID | | periodID hid_t Period ID | | starttime double TAI sec Start of time period | | stoptime double TAI sec Stop of time period | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 9/23/99 A.Muslimov Changed the data type of periodID, gridID from | | int32_t| to hid_t. | | 7/12/00 A.Muslimov Unmasked hdf5 data types. | | END_PROLOG | -----------------------------------------------------------------------------*/ hid_t HE5_GDdeftimeperiod(hid_t gridID, hid_t periodID, double starttime, double stoptime) { double timerange[2]={0.,0.};/* Range of periods */ timerange[0] = starttime; timerange[1] = stoptime; periodID = HE5_GDdefvrtregion(gridID, periodID, "Time", timerange); return (periodID); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDgetpixels | | | | DESCRIPTION: Finds row and columns for specified lon/lat values | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t Grid structure ID | | nLonLat long Number of lonlat values | | lonVal double dec deg Longitude values | | latVal double dec deg Latitude values | | | | OUTPUTS: | | pixRow long Pixel rows | | pixCol long Pixel columns | | | | NOTES: | | | | HDF5 Library Functions Called: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 9/23/99 A.Muslimov Added proper error handling after function calls. | | Removed redundant if(status==0){} brackets. | | 7/12/00 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDgetpixels(hid_t gridID, long nLonLat, double lonVal[], double latVal[], long pixRow[], long pixCol[]) { herr_t status = FAIL;/* routine return status variable */ int projcode = FAIL;/* GCTP projection code */ int zonecode = FAIL;/* Zone code */ int spherecode = FAIL;/* Sphere code */ int origincode = FAIL;/* Origin code */ int pixregcode = FAIL;/* Pixel registration code */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ long i; /* Loop index */ long idx = FAIL;/* Grid index */ long xdimsize = 0;/* Size of "XDim" */ long ydimsize = 0;/* Size of "YDim" */ double upleftpt[2]={0.,0.}; /* Upper left point */ double lowrightpt[2]={0.,0.};/* Lower right point */ double projparm[16]; /* Projection parameters */ double *xVal=(double *)NULL;/* Ptr to x location values */ double *yVal=(double *)NULL;/* Ptr to y location values */ char *errbuf; /* buffer for error message */ CHECKPOINTER(lonVal); CHECKPOINTER(latVal); /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDgetpixels", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDgetpixels", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf,"Checking for grid ID failed.\n" ); H5Epush(__FILE__, "HE5_GDgetpixels", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } /* Get grid info */ /* ------------- */ status = HE5_GDgridinfo(gridID, &xdimsize, &ydimsize, upleftpt, lowrightpt); if ( status == FAIL ) { sprintf(errbuf,"Cannot get information about Grid.\n"); H5Epush(__FILE__, "HE5_GDgetpixels", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } /* Initialize projparm[] array */ /* --------------------------- */ for (i = 0; i < 16; i++) projparm[i] = 0.; /* Get projection info */ /* ------------------- */ status = HE5_GDprojinfo(gridID, &projcode, &zonecode, &spherecode, projparm); if ( status == FAIL ) { sprintf(errbuf, "Cannot get projection information.\n"); H5Epush(__FILE__, "HE5_GDgetpixels", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } /* Get explicit upleftpt & lowrightpt if defaults are used */ /* ------------------------------------------------------- */ status = HE5_GDgetdefaults(projcode, zonecode, projparm, spherecode, upleftpt, lowrightpt); if ( status == FAIL ) { sprintf(errbuf, "Cannot get explicit upleftpt and lowrghtpt values.\n"); H5Epush(__FILE__, "HE5_GDgetpixels", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } /* Get pixel registration and origin info */ /* -------------------------------------- */ status = HE5_GDorigininfo(gridID, &origincode); if ( status == FAIL ) { sprintf(errbuf,"Cannot get pixel registration information.\n"); H5Epush(__FILE__, "HE5_GDgetpixels", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } status = HE5_GDpixreginfo(gridID, &pixregcode); if ( status == FAIL ) { sprintf(errbuf,"Cannot get pixel origin information.\n"); H5Epush(__FILE__, "HE5_GDgetpixels", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } /* Allocate space for x & y locations */ /* ---------------------------------- */ xVal = (double *) calloc(nLonLat, sizeof(double)); if(xVal == NULL) { status = FAIL; sprintf(errbuf, "Cannot allocate memory"); H5Epush(__FILE__, "HE5_GDgetpixels", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } yVal = (double *) calloc(nLonLat, sizeof(double)); if(yVal == NULL) { status = FAIL; sprintf(errbuf,"Cannot allocate memory"); H5Epush(__FILE__, "HE5_GDgetpixels", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(xVal); return(status); } /* Get pixRow, pixCol, xVal, & yVal */ /* -------------------------------- */ status = HE5_GDll2ij(projcode, zonecode, projparm, spherecode, xdimsize, ydimsize, upleftpt, lowrightpt, nLonLat, lonVal, latVal, pixRow, pixCol, xVal, yVal); if ( status == FAIL ) { sprintf(errbuf, "Cannot get pixRow, pixCol, xVal, and yVal.\n"); H5Epush(__FILE__, "HE5_GDgetpixels", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(xVal); free(yVal); return(status); } /* Loop through all lon/lat values */ /* ------------------------------- */ for (i = 0; i < nLonLat; i++) { /* Adjust columns & rows for "corner" registered grids */ /* --------------------------------------------------- */ if (pixregcode == HE5_HDFE_CORNER) { if (origincode == HE5_HDFE_GD_UL) { if (xVal[i] - pixCol[i] > 0.5) { ++pixCol[i]; } if (yVal[i] - pixRow[i] > 0.5) { ++pixRow[i]; } } else if (origincode == HE5_HDFE_GD_UR) { if (xVal[i] - pixCol[i] <= 0.5) { --pixCol[i]; } if (yVal[i] - pixRow[i] > 0.5) { ++pixRow[i]; } } else if (origincode == HE5_HDFE_GD_LL) { if (xVal[i] - pixCol[i] > 0.5) { ++pixCol[i]; } if (yVal[i] - pixRow[i] <= 0.5) { --pixRow[i]; } } else if (origincode == HE5_HDFE_GD_LR) { if (xVal[i] - pixCol[i] <= 0.5) { --pixCol[i]; } if (yVal[i] - pixRow[i] <= 0.5) { --pixRow[i]; } } } /* If outidxe grid boundaries then set to FAIL */ /* ------------------------------------------- */ if (pixCol[i] < 0 || pixCol[i] >= xdimsize || pixRow[i] < 0 || pixRow[i] >= ydimsize) { pixCol[i] = FAIL; pixRow[i] = FAIL; } } if (xVal != NULL) free(xVal); if (yVal != NULL) free(yVal); free(errbuf); errbuf = NULL; COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDgetpixvalues | | | | DESCRIPTION: Retrieves data from specified pixels. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | size*nPixels long bytes Size of data buffer | | | | INPUTS: | | gridID hid_t Grid structure ID | | nPixels long Number of pixels | | pixRow long Pixel row numbers | | pixCol long Pixel column numbers | | fieldname char* Fieldname | | | | OUTPUTS: | | buffer void Data buffer | | | | | | NOTES: | | | | | | HDF5 Library Functions Called: | | H5Screate_simple | | H5Dget_space | | H5Dget_type | | H5Sselect_elements | | H5Dread | | H5Tclose | | H5Sclose | | | | Date Programmer Description | | ====== ============ ================================================= | | Mar 98 Abe Taaheri revised to reduce overhead for rechecking | | for gridid, fieldname, etc in GDreadfield. | | June 98 AT fixed bug with 2-dim field merged in 3-dim field | | (for offset and count) | | 9/23/99 A.Muslimov Added proper error handling after function calls. | | Removed redundant if(status==0){} brackets. Dynami- | | cally allocated memory for dimlist, ntype, and | | errbuf strings. | | 12/7/99 A.Muslimov Modified a block that reads out the pixel values | | from the dataset. This fixes a bug resulted in | | a failure of getting the pixel values. | | 7/12/00 A.Muslimov Unmasked hdf5 data types. | | 7/17/00 A.Muslimov Added EHdtype2mtype() before the call to H5Dread(). | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_GDgetpixvalues(hid_t gridID, long nPixels, long pixRow[], long pixCol[], const char *fieldname, void *buffer) { herr_t status = FAIL; /* routine return status variable */ int j; /* Loop indices */ int rank = FAIL; /* Field rank */ int mrank = 1; /* Rank of dataspace in memory */ int origincode = FAIL; /* Origin code */ hid_t *ntype = (hid_t *)NULL; /* number types */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t dataID = FAIL; /* dataset ID */ hid_t dtype = FAIL; /* data type ID */ hid_t mtype = FAIL; /* memory data type ID */ hid_t fspace = FAIL; /* file data space ID */ hid_t mspace = FAIL; /* memory data space ID */ long i; /* loop index */ long idx = FAIL; /* Grid index */ long xdim = FAIL; /* Location of "XDim" within field list */ long ydim = FAIL; /* Location of "YDim" within field list */ hssize_t *coord; /* Array of pixel coordinates */ hsize_t dims[HE5_DTSETRANKMAX]; /* Field dimensions */ hsize_t mdims[1] = {0}; /* Dimension of dataspace in memory */ size_t npoints = 0; /* Number of points/pixels to read */ size_t size = 0; /* Size of data buffer (bytes) */ char *dimlist=(char *)NULL; /* Dimension list string */ char *errbuf = (char *)NULL; /* buffer for error message */ CHECKPOINTER(fieldname); CHECKPOINTER(pixRow); CHECKPOINTER(pixCol); /* Allocate memory for error buffer */ /* -------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Initialize dims[] array */ /* ----------------------- */ for ( j = 0; j < HE5_DTSETRANKMAX; j++) dims[j] = 0; dimlist = (char *)calloc( HE5_HDFE_DIMBUFSIZE, sizeof(char )); if ( dimlist == NULL ) { sprintf(errbuf,"Cannot allocate memory for dimension list string.\n"); H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDgetpixvalues", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf,"Checking for grid ID failed.\n"); H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); return(FAIL); } /* Get field list */ /* -------------- */ ntype = (hid_t *)calloc(1, sizeof(hid_t)); if ( ntype == (hid_t *)NULL ) { sprintf(errbuf, "Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); return(FAIL); } status = HE5_GDfieldinfo(gridID, fieldname, &rank, dims, ntype, dimlist, NULL); if ( status == FAIL ) { sprintf(errbuf, "Fieldname \"%s\" not found.\n", fieldname); H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(ntype); return(FAIL); } /* Check for "XDim" & "YDim" in dimension list */ /* ------------------------------------------- */ xdim = HE5_EHstrwithin("XDim", dimlist, ','); if (xdim == FAIL) { sprintf( errbuf,"\"XDim\" not present in dimlist for field \"%s\".\n",fieldname); H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(ntype); return(FAIL); } ydim = HE5_EHstrwithin("YDim", dimlist, ','); if (ydim == FAIL) { sprintf( errbuf,"\"YDim\" not present in dimlist for field \"%s\".\n",fieldname); H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(ntype); return(FAIL); } /* Get origin order info */ /* --------------------- */ status = HE5_GDorigininfo(gridID, &origincode); if ( status == FAIL ) { sprintf(errbuf,"Cannot get origin order information.\n"); H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(ntype); return(FAIL); } /* Compute size of data buffer for each pixel */ /* ------------------------------------------ */ size = (size_t)dims[ 0 ]; for (j = 1; j < rank; j++) size *= dims[ j ]; /* Calculate size of a whole data buffer */ /* ------------------------------------- */ size *= HE5_GDfielddatasize(gridID,fieldname); if (size == 0) { sprintf(errbuf,"Cannot get the field data size.\n"); H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(ntype); return(FAIL); } /* If data values are requested ... */ /* -------------------------------- */ if (buffer != NULL) { status = HE5_GDgetfieldID( gridID, fieldname, &dataID); if ( status == FAIL ) { sprintf(errbuf,"Cannot get data field ID.\n"); H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(ntype); return(FAIL); } mdims[0] = (hsize_t)nPixels; npoints = (size_t)nPixels; /* Create a data space in memory */ /* ----------------------------- */ mspace = H5Screate_simple(mrank, (const hsize_t *)mdims, NULL); if ( mspace == FAIL ) { sprintf(errbuf,"Cannot create the data space.\n"); H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_DATASPACE, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(ntype); return(FAIL); } /* Allocate memory for pixel coordinates array */ /* ------------------------------------------- */ coord = (hssize_t *)calloc((unsigned)(rank * nPixels), sizeof(hssize_t)); if ( coord == (hssize_t *)NULL ) { sprintf(errbuf,"Cannot allocate memory for pixel coordinates array.\n"); H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(ntype); return(FAIL); } /* Loop through all pixels */ /* ----------------------- */ for (i = 0; i < nPixels; i++) { /* If pixel row & column OK ... */ /* ---------------------------- */ if (pixCol[i] != FAIL && pixRow[i] != FAIL) { /* Fill out the array of pixel coordinates */ /* --------------------------------------- */ coord[2 * i] = (hssize_t)pixRow[i]; coord[2 * i + 1] = (hssize_t)pixCol[i]; } } fspace = H5Dget_space(dataID); if ( fspace == FAIL) { sprintf(errbuf,"Cannot get the file data space ID.\n"); H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(ntype); free(coord); return(FAIL); } dtype = H5Dget_type(dataID); if ( dtype == FAIL ) { sprintf(errbuf,"Cannot get the datatype ID.\n"); H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(ntype); free(coord); return(FAIL); } /* Select the points/pixels to read */ /* -------------------------------- */ status = H5Sselect_elements(fspace, H5S_SELECT_SET, npoints, (const hsize_t *)coord); if ( status == FAIL ) { sprintf(errbuf,"Cannot select the pixels to read.\n"); H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(ntype); free(coord); return(FAIL); } /* Get the memory data type ID */ /* --------------------------- */ mtype = HE5_EHdtype2mtype(dtype); if ( mtype == FAIL ) { sprintf(errbuf,"Cannot get the memory data type.\n"); H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(ntype); free(coord); return(FAIL); } /* Read the selected points into the buffer */ /* --------------------------------------- */ status = H5Dread(dataID, mtype, mspace, fspace, H5P_DEFAULT, buffer); if ( status == FAIL ) { sprintf(errbuf,"Cannot read out the data from the dataset.\n"); H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(ntype); free(coord); return(FAIL); } status = H5Tclose(dtype); if ( status == FAIL ) { sprintf(errbuf,"Cannot release the datatype ID.\n"); H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(ntype); free(coord); return(FAIL); } status = H5Sclose(mspace); if ( status == FAIL ) { sprintf(errbuf,"Cannot release the memory data space ID.\n"); H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(ntype); free(coord); return(FAIL); } status = H5Sclose(fspace); if ( status == FAIL ) { sprintf(errbuf,"Cannot release the file data space ID.\n"); H5Epush(__FILE__, "HE5_GDgetpixvalues", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(ntype); free(coord); return(FAIL); } free(coord); } /* If successful return size of returned data in bytes */ /* --------------------------------------------------- */ if (dimlist != NULL) free(dimlist); free(errbuf); free(ntype); COMPLETION: return( (long)(size * nPixels) ); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDinterpolate | | | | DESCRIPTION: Performs bilinear interpolate on a set of xy values | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nRetn*nValues* long Size of data buffer (bytes) | | sizeof(double) | | | | INPUTS: | | gridID hid_t Grid structure ID | | nValues long Number of lon/lat points to interpolate | | xyValues double XY values of points to interpolate | | fieldname char* Fieldname | | | | OUTPUTS: | | interpVal double Interpolated Data Values | | | | | | NOTES: | | | | | | HDF5 Library Functions Called: | | H5Dget_type | | H5Tequal | | H5Tclose | | | | Date Programmer Description | | ====== ============ ================================================= | | Jun 98 Abe Taaheri changed the return value so that the Return Value | | is size in bytes for the data buffer which is | | float64. | | 8/24/99 A.Muslimov Changed the return type from intn to int . | | 9/23/99 A.Muslimov Added proper error handling after function calls. | | Removed redundant if(status==0){} brackets. | | 10/18/99 A.Muslimov Replace memcpy() by memmove() to avoid a problem | | when arguments 1 and 2 overlap in memory. | | 7/12/00 A.Muslimov Unmasked hdf5 data types. | | Mar 04 S.Zhao Modified for supported field type. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_GDinterpolate(hid_t gridID, long nValues, double lonVal[], double latVal[], const char *fieldname, double interpVal[]) { long nRetn = 0; /* Number of data values returned */ long i, j; /* loop indices */ long idx = FAIL;/* Grid index */ long xdimsize = 0; /* XDim size */ long ydimsize = 0; /* YDim size */ long numsize = 0; /* Size in bytes of number type */ long xdim = FAIL;/* Location of "XDim" in a list */ long ydim = FAIL;/* Location of "YDim" in a list */ long dum = 0; /* Dummy variable */ long size = 0; /* Size of buffer in bytes */ long pixCol[4]; /* Pixel columns for 4 nearest neighbors */ long pixRow[4]; /* Pixel rows for 4 nearest neighbors */ long tDen = 0;/*Interpolation denominator value 1 */ long uDen = 0;/*Interpolation denominator value 2 */ herr_t status = FAIL; /* routine return status variable */ int k; /* Loop indices */ int rank = FAIL; /* Field rank */ int iINT[4]={0,0,0,0};/* Working buffer (int) */ int tmp = 999; /* temp variable (for type code) */ int projcode = FAIL;/* Projection code */ int zonecode = FAIL;/* Zone code */ int spherecode = FAIL;/* Sphere code */ int pixregcode = FAIL;/* Pixel registration code */ int origincode = FAIL;/* Origin code */ hid_t *ntype = (hid_t *)NULL; /* number types */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t dataID = FAIL;/* data field dataset ID */ hid_t dtype = FAIL;/* data field datatype ID */ hsize_t dims[HE5_DTSETRANKMAX];/* Field dimensions */ double upleftpt[2]={0.,0.}; /* Upper left pt coordinates */ double lowrightpt[2]={0.,0.};/* Lower right pt coordinates */ double projparm[16]; /* Projection parameters */ double xVal = FAIL;/* "Exact" x location of interpolated point */ double yVal = FAIL;/* "Exact" y location of interpolated point */ double tNum = 0.; /* Interpolation numerator value 1 */ double uNum = 0.; /* Interpolation numerator value 2 */ double fdbl[4]={0.,0.,0.,0.};/* Working buffer (double) */ short ishort[4]={0,0,0,0};/* Working buffer (short) */ float flt[4]={0.,0.,0.,0.};/* Working buffer (float) */ char *pixVal = NULL; /* Nearest neighbor values */ char *dimlist = NULL; /* Dimension list string */ char *errbuf = NULL; /* Error message buffer */ CHECKPOINTER(fieldname); CHECKPOINTER(lonVal); CHECKPOINTER(latVal); /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDinterpolate", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf,"Checking for grid ID failed.\n"); H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } dimlist = (char *)calloc( HE5_HDFE_DIMBUFSIZE, sizeof(char )); if ( dimlist == NULL ) { sprintf(errbuf,"Cannot allocate memory for dimension list string.\n"); H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Get field information */ /* --------------------- */ ntype = (hid_t *)calloc(1, sizeof(hid_t)); if ( ntype == (hid_t *)NULL ) { sprintf(errbuf,"Cannot allocate memory for data type class ID.\n"); H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); return(FAIL); } /* Initialize dims[] array */ /* ----------------------- */ for (k = 0; k < HE5_DTSETRANKMAX; k++) dims[ k ] = 0; status = HE5_GDfieldinfo(gridID, fieldname, &rank, dims, ntype, dimlist,NULL); if ( status == FAIL ) { sprintf(errbuf,"Cannot get information about \"%s\" data field.\n", fieldname); H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(ntype); return(FAIL); } /* Check for "XDim" & "YDim" in dimension list */ /* ------------------------------------------- */ xdim = HE5_EHstrwithin("XDim", dimlist, ','); if (xdim == FAIL) { sprintf( errbuf, "\"XDim\" not present in dimlist for field: \"%s\".\n", fieldname); H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(ntype); return(FAIL); } ydim = HE5_EHstrwithin("YDim", dimlist, ','); if (ydim == FAIL) { sprintf( errbuf,"\"YDim\" not present in dimlist for field: \"%s\".\n", fieldname); H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(ntype); return(FAIL); } /* If no problems ... */ /* ------------------ */ /* Compute size of data buffer for each interpolated value */ /* ------------------------------------------------------- */ dims[xdim] = 1; dims[ydim] = 1; size = (long)dims[0]; for (k = 1; k < rank; k++) size *= (long)dims[ k ]; numsize = (long)HE5_GDfielddatasize(gridID, fieldname); if ( numsize == 0 ) { sprintf(errbuf,"Cannot get the size of data type.\n"); H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(ntype); return(FAIL); } size *= numsize; nRetn = size / numsize; /* If interpolated values are requested ... */ /* ---------------------------------------- */ if (interpVal != NULL) { /* Get grid info */ /* ------------- */ status = HE5_GDgridinfo(gridID, &xdimsize, &ydimsize,upleftpt, lowrightpt); if ( status == FAIL ) { sprintf(errbuf,"Cannot get information about Grid.\n"); H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(ntype); return(FAIL); } /* Initialize projparm[] array */ /* --------------------------- */ for (k = 0; k < 16; k++) projparm[ k ] = 0.; /* Get projection info */ /* ------------------- */ status = HE5_GDprojinfo(gridID, &projcode, &zonecode,&spherecode, projparm); if ( status == FAIL ) { sprintf(errbuf,"Cannot get projection information.\n"); H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(ntype); return(FAIL); } /* Get explicit upleftpt & lowrightpt if defaults are used */ /* ------------------------------------------------------- */ status = HE5_GDgetdefaults(projcode, zonecode, projparm, spherecode, upleftpt, lowrightpt); if ( status == FAIL ) { sprintf(errbuf,"Cannot get upleftpt and lowrightpt defaults.\n"); H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(ntype); return(FAIL); } /* Get pixel registration and origin info */ /* -------------------------------------- */ status = HE5_GDpixreginfo(gridID, &pixregcode); if ( status == FAIL ) { sprintf(errbuf,"Cannot get pixel registration information.\n"); H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(ntype); return(FAIL); } status = HE5_GDorigininfo(gridID, &origincode); if ( status == FAIL ) { sprintf(errbuf,"Cannot get pixel origin information.\n"); H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(ntype); return(FAIL); } /* Loop through all interpolated points */ /* ------------------------------------ */ for (i = 0; i < nValues; i++) { /* Get row & column of point pixel */ /* ------------------------------- */ status = HE5_GDll2ij(projcode, zonecode, projparm, spherecode,xdimsize, ydimsize, upleftpt, lowrightpt, 1, &lonVal[i], &latVal[i], pixRow, pixCol, &xVal, &yVal); if ( status == FAIL ) { sprintf(errbuf,"Cannot get row and column of point pixel.\n"); H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(pixVal); free(ntype); return(FAIL); } /* Get diff of interp. point from pixel location */ /* --------------------------------------------- */ if (pixregcode == HE5_HDFE_CENTER) { tNum = xVal - (pixCol[0] + 0.5); uNum = yVal - (pixRow[0] + 0.5); } else if (origincode == HE5_HDFE_GD_UL) { tNum = xVal - pixCol[0]; uNum = yVal - pixRow[0]; } else if (origincode == HE5_HDFE_GD_UR) { tNum = xVal - (pixCol[0] + 1); uNum = yVal - pixRow[0]; } else if (origincode == HE5_HDFE_GD_LL) { tNum = xVal - pixCol[0]; uNum = yVal - (pixRow[0] + 1); } else if (origincode == HE5_HDFE_GD_LR) { tNum = xVal - (pixCol[0] + 1); uNum = yVal - (pixRow[0] + 1); } /* Get rows and columns of other nearest neighbor pixels */ /* ----------------------------------------------------- */ pixCol[1] = pixCol[0]; pixRow[3] = pixRow[0]; if (tNum >= 0) { pixCol[2] = pixCol[0] + 1; pixCol[3] = pixCol[0] + 1; } if (tNum < 0) { pixCol[2] = pixCol[0] - 1; pixCol[3] = pixCol[0] - 1; } if (uNum >= 0) { pixRow[2] = pixRow[0] + 1; pixRow[1] = pixRow[0] + 1; } if (uNum < 0) { pixRow[2] = pixRow[0] - 1; pixRow[1] = pixRow[0] - 1; } /* Get values of nearest neighbors */ /* -------------------------------- */ pixVal = (char *)calloc( 4 , size); if(pixVal == NULL) { sprintf(errbuf,"Cannot allocate memory"); H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); free(errbuf); free(dimlist); free(ntype); return(FAIL); } dum = HE5_GDgetpixvalues(gridID,4,pixRow,pixCol,fieldname,pixVal); /* Trap interpolation boundary out of range error */ /* ---------------------------------------------- */ if (dum == FAIL) { sprintf(errbuf, "Interpolation boundary out of grid.\n"); H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(pixVal); free(ntype); return(FAIL); } else { /* * Algorithm taken for Numerical Recipies in C, 2nd * edition, Section 3.6 */ /* Perform bilinear interpolation */ /* ------------------------------ */ tDen = pixCol[3] - pixCol[0]; uDen = pixRow[1] - pixRow[0]; status = HE5_GDgetfieldID( gridID, fieldname, &dataID); if ( status == FAIL ) { sprintf(errbuf,"Cannot get \"%s\" field ID.\n", fieldname); H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(pixVal); free(ntype); return(FAIL); } dtype = H5Dget_type( dataID); if ( status == FAIL ) { sprintf(errbuf,"Cannot get the dataset datatype.\n"); H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(pixVal); free(ntype); return(FAIL); } if ( H5Tequal( dtype, H5T_NATIVE_SHORT) || H5Tequal( dtype, H5T_STD_I16BE) || H5Tequal( dtype, H5T_STD_I16LE) ) tmp = 1; else if ( H5Tequal(dtype, H5T_NATIVE_INT) || H5Tequal(dtype, H5T_STD_I32BE) || H5Tequal(dtype, H5T_STD_I32LE) ) tmp = 2; else if ( H5Tequal(dtype, H5T_NATIVE_FLOAT) || H5Tequal( dtype, H5T_IEEE_F32BE) || H5Tequal( dtype, H5T_IEEE_F32LE) ) tmp = 3; else if ( H5Tequal( dtype, H5T_NATIVE_DOUBLE) || H5Tequal(dtype, H5T_IEEE_F64BE) || H5Tequal(dtype, H5T_IEEE_F64LE) ) tmp = 4; status = H5Tclose(dtype); if ( status == FAIL ) { sprintf(errbuf,"Cannot release the datatype ID.\n"); H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(pixVal); free(ntype); return(FAIL); } switch ( tmp) { case 1: /* Loop through all returned data values */ /* ------------------------------------- */ for (j = 0; j < nRetn; j++) { /* Copy 4 NN values into working array */ /* ----------------------------------- */ for (k = 0; k < 4; k++) { memmove(&ishort[k],pixVal + j * numsize + k * size, sizeof(short)); } /* Compute interpolated value */ /* -------------------------- */ interpVal[i * nRetn + j] = (1 - tNum / tDen) * (1 - uNum / uDen) * ishort[0] + (tNum / tDen) * (1 - uNum / uDen) * ishort[3] + (tNum / tDen) * (uNum / uDen) * ishort[2] + (1 - tNum / tDen) * (uNum / uDen) * ishort[1]; } break; case 2: for (j = 0; j < nRetn; j++) { for (k = 0; k < 4; k++) { memmove(&iINT[k], pixVal + j * numsize + k * size, sizeof(int)); } interpVal[i * nRetn + j] = (1 - tNum / tDen) * (1 - uNum / uDen) * iINT[0] + (tNum / tDen) * (1 - uNum / uDen) * iINT[3] + (tNum / tDen) * (uNum / uDen) * iINT[2] + (1 - tNum / tDen) * (uNum / uDen) * iINT[1]; } break; case 3: for (j = 0; j < nRetn; j++) { for (k = 0; k < 4; k++) { memmove(&flt[k], pixVal + j * numsize + k * size, sizeof(float)); } interpVal[i * nRetn + j] = (1 - tNum / tDen) * (1 - uNum / uDen) * flt[0] + (tNum / tDen) * (1 - uNum / uDen) * flt[3] + (tNum / tDen) * (uNum / uDen) * flt[2] + (1 - tNum / tDen) * (uNum / uDen) * flt[1]; } break; case 4: for (j = 0; j < nRetn; j++) { for (k = 0; k < 4; k++) { memmove(&fdbl[k], pixVal + j * numsize + k * size, sizeof(double)); } interpVal[i * nRetn + j] = (1 - tNum / tDen) * (1 - uNum / uDen) * fdbl[0] + (tNum / tDen) * (1 - uNum / uDen) * fdbl[3] + (tNum / tDen) * (uNum / uDen) * fdbl[2] + (1 - tNum / tDen) * (uNum / uDen) * fdbl[1]; } break; default: { sprintf(errbuf,"Unknown data type.\n"); H5Epush(__FILE__, "HE5_GDinterpolate", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(pixVal); free(ntype); return(FAIL); } } } free(pixVal); pixVal = NULL; } } free(dimlist); free(errbuf); errbuf = NULL; free(ntype); dimlist = NULL; COMPLETION: /* always return size of double buffer */ return ( (long)(nRetn*nValues*sizeof(double)) ); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDwritelocattr | | | | DESCRIPTION: Writes/updates attribute associated with a specified field in | | a grid. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t grid structure ID | | fieldname char* field name | | attrname char* attribute name | | numtype hid_t attribute datatype ID | | count[] hsize_t Number of attribute elements | | datbuf void I/O buffer | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Feb 00 A.Muslimov Original development. | | Mar 00 A.Muslimov Changed the ID of field group from gd_id to data_id.| | 7/12/00 A.Muslimov Unmasked hdf5 data types. | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDwritelocattr(hid_t gridID, const char *fieldname, const char *attrname, hid_t numtype, hsize_t count[], void *datbuf) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t fieldID = FAIL;/* Field-related dataset ID */ long idx = FAIL;/* Grid index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ hid_t ntype; HE5_LOCK; CHECKPOINTER(fieldname); CHECKNAME(attrname); CHECKPOINTER(count); CHECKPOINTER(datbuf); /* if numtype is HE5 numbertype, rather than H5 numbertype, then convert it, otherwise use ntype itself */ ntype = HE5_EHconvdatatype(numtype); if(ntype == FAIL) { ntype = numtype; } /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDwritelocattr", &fid, &gid, &idx); if (status == SUCCEED) { /* Get field ID */ /* ------------ */ fieldID = H5Dopen(HE5_GDXGrid[idx].data_id, fieldname); if(fieldID == FAIL) { sprintf(errbuf,"Cannot open the \"%s\" field dataset ID.\n", fieldname); H5Epush(__FILE__, "HE5_GDwritelocattr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Call EHattr to perform I/O */ /* -------------------------- */ status = HE5_EHattr(fieldID, attrname, ntype, count,"w", datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot write Attribute \"%s\" for the \"%s\" field.\n", attrname, fieldname); H5Epush(__FILE__, "HE5_GDwritelocattr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Dclose(fieldID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"%s\" field dataset ID.\n", fieldname); H5Epush(__FILE__, "HE5_GDwritelocattr", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDreadlocattr | | | | DESCRIPTION: Reads attribute associated with a specified field from a grid.| | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | fieldname char field name | | attrname char attribute name | | | | OUTPUTS: | | datbuf void I/O buffer | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Feb 00 A.Muslimov Original development | | Mar 00 A.Muslimov Changed the ID of field group from gd_id to data_id.| | 7/12/00 A.Muslimov Unmasked hdf5 data types. | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDreadlocattr(hid_t gridID, const char *fieldname, const char *attrname, void *datbuf) { herr_t status = FAIL;/* routine return status variable */ hid_t ntype = FAIL;/* hdf5 type data type ID */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t fieldID = FAIL;/* Field-related dataset ID */ long idx = FAIL;/* Grid index */ hsize_t count[]={0}; /* array with the number of elements */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ HE5_LOCK; CHECKPOINTER(fieldname); CHECKPOINTER(attrname); /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDreadattr", &fid, &gid, &idx); if (status == SUCCEED) { /* Get field ID */ /* ------------ */ fieldID = H5Dopen(HE5_GDXGrid[idx].data_id, fieldname); if(fieldID == FAIL) { sprintf(errbuf,"Cannot open the \"%s\" field dataset ID.\n", fieldname); H5Epush(__FILE__, "HE5_GDreadlocattr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Call EHattr to perform I/O */ /* -------------------------- */ status = HE5_EHattr(fieldID, attrname, ntype, count, "r", datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot read Attribute \"%s\" associated wth the \"%s\" field.\n", attrname,fieldname); H5Epush(__FILE__, "HE5_GDreadlocattr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release dataset ID */ /* ------------------ */ status = H5Dclose(fieldID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"%s\" field dataset ID.\n", fieldname); H5Epush(__FILE__, "HE5_GDreadlocattr", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDlocattrinfo | | | | DESCRIPTION: Retrieves information about local attribute (attribute asso- | | ciated with a specified field) in a grid. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | fieldname char* field name | | attrname char* attribute name | | | | OUTPUTS: | | ntype hid_t attribute data type ID | | count hsize_t Number of attribute elements | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Feb 00 A.Muslimov Original Development | | Mar 00 A.Muslimov Changed the ID of field group from gd_id to data_id.| | 5/10/00 A.Muslimov Changed 'H5T_class_t' type to 'int' data type. | | 7/12/00 A.Muslimov Unmasked hdf5 data types. | | Feb 03 S.Zhao Changed the type of 'ntype' from an H5T_class_t to | | an hid_t. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDlocattrinfo(hid_t gridID, const char *fieldname, const char *attrname, hid_t *ntype, hsize_t *count) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t fieldID = FAIL;/* Field-related dataset ID */ long idx = FAIL;/* Grid index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ CHECKPOINTER(fieldname); CHECKPOINTER(attrname); /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDlocattrinfo", &fid, &gid, &idx); if (status == SUCCEED) { /* Get field ID */ /* ------------ */ fieldID = H5Dopen(HE5_GDXGrid[idx].data_id, fieldname); if(fieldID == FAIL) { sprintf(errbuf,"Cannot open the \"%s\" field dataset ID.\n", fieldname); H5Epush(__FILE__, "HE5_GDlocattrinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Call EHattrinfo */ /* --------------- */ status = HE5_EHattrinfo(fieldID, attrname, ntype, count); if(status == FAIL) { sprintf(errbuf,"Cannot retrieve information about Attribute \"%s\" associated with the \"%s\" field.\n", attrname, fieldname); H5Epush(__FILE__, "HE5_GDlocattrinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Dclose(fieldID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"%s\" field dataset ID.\n", fieldname); H5Epush(__FILE__, "HE5_GDlocattrinfo", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDlocattrinfo2 | | | | DESCRIPTION: Retrieves information about local attribute (attribute asso- | | ciated with a specified field) in a grid. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | fieldname char* field name | | attrname char* attribute name | | | | OUTPUTS: | | ntype hid_t attribute data type ID | | count hsize_t * Number of attribute elements | | size hsize_t * buf size of attribute elements | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Feb 00 A.Muslimov Original Development | | Mar 00 A.Muslimov Changed the ID of field group from gd_id to data_id.| | 5/10/00 A.Muslimov Changed 'H5T_class_t' type to 'int' data type. | | 7/12/00 A.Muslimov Unmasked hdf5 data types. | | Feb 03 S.Zhao Changed the type of 'ntype' from an H5T_class_t to | | an hid_t. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDlocattrinfo2(hid_t gridID, const char *fieldname, const char *attrname, hid_t *ntype, hsize_t *count, hsize_t *size) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t fieldID = FAIL;/* Field-related dataset ID */ long idx = FAIL;/* Grid index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ CHECKPOINTER(fieldname); CHECKPOINTER(attrname); /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDlocattrinfo2", &fid, &gid, &idx); if (status == SUCCEED) { /* Get field ID */ /* ------------ */ fieldID = H5Dopen(HE5_GDXGrid[idx].data_id, fieldname); if(fieldID == FAIL) { sprintf(errbuf,"Cannot open the \"%s\" field dataset ID.\n", fieldname); H5Epush(__FILE__, "HE5_GDlocattrinfo2", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Call EHattrinfo */ /* --------------- */ status = HE5_EHattrinfo2(fieldID, attrname, ntype, count, size); if(status == FAIL) { sprintf(errbuf,"Cannot retrieve information about Attribute \"%s\" associated with the \"%s\" field.\n", attrname, fieldname); H5Epush(__FILE__, "HE5_GDlocattrinfo2", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Dclose(fieldID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"%s\" field dataset ID.\n", fieldname); H5Epush(__FILE__, "HE5_GDlocattrinfo2", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDinqdscaleattrs | | | | DESCRIPTION: Retrieves the number of attributes and string length of | | attribute list associated with a specified dimension scale | | in a grid. | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nattr long number of attributes (-1 if fails) | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | fieldname char dimension scale name | | attrnames char attribute name(s) | | | | OUTPUTS: | | strbufsize long String length of attribute (in bytes) | | | | NOTES: | | | | None | | | | Date Programmer Description | | ====== ============ ================================================= | | June 10 Abe Taaheri Original development. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_GDinqdscaleattrs(hid_t gridID, const char *fieldname, char *attrnames, long *strbufsize) { long nattr = 0; /* Number of attributes (return) */ long idx = FAIL;/* Grid index */ herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ char *dtsname = NULL;/* Buffer for dataset name */ char errbuf[HE5_HDFE_ERRBUFSIZE]; CHECKPOINTER(fieldname); /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDinqdscaleattrs", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf,"Checking for grid ID failed.\n" ); H5Epush(__FILE__, "HE5_GDinqdscaleattrs", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } dtsname = (char *) calloc(HE5_HDFE_NAMBUFSIZE, 1); if( dtsname == NULL) { sprintf(errbuf, "Can not allocate memory.\n"); H5Epush(__FILE__, "HE5_GDinqdscaleattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } strcpy(dtsname,"/HDFEOS/GRIDS/"); strcat(dtsname, HE5_GDXGrid[idx].gdname); strcat(dtsname,"/"); strcat(dtsname,fieldname); nattr = HE5_EHattrcat(fid, dtsname, attrnames, strbufsize); if (dtsname != NULL) free(dtsname); COMPLETION: return(nattr); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDinqlocattrs | | | | DESCRIPTION: Retrieves the number of attributes and string length of | | attribute list associated with a specified field in a grid. | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nattr long number of attributes (-1 if fails) | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | fieldname char field name | | attrnames char attribute name(s) | | | | OUTPUTS: | | strbufsize long String length of attribute (in bytes) | | | | NOTES: | | | | None | | | | Date Programmer Description | | ====== ============ ================================================= | | Feb 00 A.Muslimov Original development. | | Mar 00 A.Muslimov Changed the field group to "Data Fields". | | 7/12/00 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_GDinqlocattrs(hid_t gridID, const char *fieldname, char *attrnames, long *strbufsize) { long nattr = 0; /* Number of attributes (return) */ long idx = FAIL;/* Grid index */ herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ char *dtsname = NULL;/* Buffer for dataset name */ /* char *errbuf = NULL;*//* Buffer for error message */ char errbuf[HE5_HDFE_ERRBUFSIZE]; CHECKPOINTER(fieldname); /* Allocate memory for error message buffer */ /* ---------------------------------------- */ /* errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDinqlocattrs", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } */ /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDinqlocattrs", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf,"Checking for grid ID failed.\n" ); H5Epush(__FILE__, "HE5_GDinqlocattrs", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } dtsname = (char *) calloc(HE5_HDFE_NAMBUFSIZE, 1); if( dtsname == NULL) { sprintf(errbuf, "Can not allocate memory.\n"); H5Epush(__FILE__, "HE5_GDinqlocattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } strcpy(dtsname,"/HDFEOS/GRIDS/"); strcat(dtsname, HE5_GDXGrid[idx].gdname); strcat(dtsname,"/Data Fields/"); strcat(dtsname,fieldname); nattr = HE5_EHattrcat(fid, dtsname, attrnames, strbufsize); if (dtsname != NULL) free(dtsname); COMPLETION: return(nattr); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDwritegrpattr | | | | DESCRIPTION: Writes/updates attribute associated with "Data Fields" group | | in a grid. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | attrname char* attribute name | | numtype hid_t attribute data type ID | | count[] hsize_t Number of attribute elements | | datbuf void I/O buffer | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Mar 00 A.Muslimov Original development. | | 7/12/00 A.Muslimov Unmasked hdf5 data types. | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDwritegrpattr(hid_t gridID, const char *attrname, hid_t numtype, hsize_t count[], void *datbuf) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t dataID = FAIL;/* "Data Fields" group ID */ long idx = FAIL;/* Grid index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ hid_t ntype; HE5_LOCK; CHECKNAME(attrname); CHECKPOINTER(count); CHECKPOINTER(datbuf); /* if numtype is HE5 numbertype, rather than H5 numbertype, then convert it, otherwise use ntype itself */ ntype = HE5_EHconvdatatype(numtype); if(ntype == FAIL) { ntype = numtype; } /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDwritegrpattr", &fid, &gid, &idx); if (status == SUCCEED) { /* Get "Data Fields" group ID */ /* -------------------------- */ dataID = H5Gopen(HE5_GDXGrid[idx].gd_id,"Data Fields"); if(dataID == FAIL) { sprintf(errbuf,"Cannot open the \"Data Fields\" group.\n"); H5Epush(__FILE__, "HE5_GDwritegrpattr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Call EHattr to perform I/O */ /* -------------------------- */ status = HE5_EHattr(dataID, attrname, ntype, count,"w", datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot write Attribute \"%s\" for the \"Data Fields\" group.\n", attrname); H5Epush(__FILE__, "HE5_GDwritegrpattr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release group ID */ /* ---------------- */ status = H5Gclose(dataID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"Data Fields\" group ID.\n"); H5Epush(__FILE__, "HE5_GDwritegrpattr", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDreadgrpattr | | | | DESCRIPTION: Reads attribute associated with "Data Fields" group in a grid.| | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | attrname char attribute name | | | | OUTPUTS: | | datbuf void I/O buffer | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Mar 00 A.Muslimov Original development | | 7/12/00 A.Muslimov Unmasked hdf5 data types. | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDreadgrpattr(hid_t gridID, const char *attrname, void *datbuf) { herr_t status = FAIL;/* routine return status variable */ hid_t ntype = FAIL;/* hdf5 type data type ID */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t dataID = FAIL;/* "Data Fields" group ID */ long idx = FAIL;/* Grid index */ hsize_t count[]={0}; /* array with the number of elements */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKPOINTER(attrname); /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDreadgrpattr", &fid, &gid, &idx); if (status == SUCCEED) { /* Get "Data Fields" group ID */ /* ---------------------------- */ dataID = H5Gopen(HE5_GDXGrid[idx].gd_id, "Data Fields"); if(dataID == FAIL) { sprintf(errbuf,"Cannot open the \"Data Fields\" group.\n"); H5Epush(__FILE__, "HE5_GDreadgrpattr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Call HE5_EHattr to perform I/O */ /* ------------------------------ */ status = HE5_EHattr(dataID, attrname, ntype, count, "r", datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot read Attribute \"%s\" associated wth the \"Data Fields\" group.\n", attrname); H5Epush(__FILE__, "HE5_GDreadgrpattr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release group ID */ /* ---------------- */ status = H5Gclose(dataID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"Data Fields\" group ID.\n"); H5Epush(__FILE__, "HE5_GDreadgrpattr", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDgrpattrinfo | | | | DESCRIPTION: Retrieves information about group attribute (attribute asso- | | ciated with "Data Fields" group) in a grid. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | attrname char* attribute name | | | | OUTPUTS: | | ntype hid_t attribute data type ID | | count hsize_t Number of attribute elements | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Mar 00 A.Muslimov Original Development | | 5/10/00 A.Muslimov Changed 'H5T_class_t' type to 'int' data type. | | 7/12/00 A.Muslimov Unmasked hdf5 data types. | | Feb 03 S.Zhao Changed the type of 'ntype' from an H5T_class_t to | | an hid_t. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDgrpattrinfo(hid_t gridID, const char *attrname, hid_t *ntype, hsize_t *count) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t dataID = FAIL;/* "Data Fields" group ID */ long idx = FAIL;/* Grid index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ CHECKPOINTER(attrname); /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDgrpattrinfo", &fid, &gid, &idx); if (status == SUCCEED) { /* Get "Data Fields" group ID */ /* -------------------------- */ dataID = H5Gopen(HE5_GDXGrid[idx].gd_id, "Data Fields"); if(dataID == FAIL) { sprintf(errbuf,"Cannot open the \"Data Fields\" group.\n"); H5Epush(__FILE__, "HE5_GDgrpattrinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Call HE5_EHattrinfo */ /* ------------------- */ status = HE5_EHattrinfo(dataID, attrname, ntype, count); if(status == FAIL) { sprintf(errbuf,"Cannot retrieve information about Attribute \"%s\" associated with the \"Data Fields\" group.\n", attrname); H5Epush(__FILE__, "HE5_GDgrpattrinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release group ID */ /* ---------------- */ status = H5Gclose(dataID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"Data Fields\" group ID.\n"); H5Epush(__FILE__, "HE5_GDgrpattrinfo", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDgrpattrinfo2 | | | | DESCRIPTION: Retrieves information about group attribute (attribute asso- | | ciated with "Data Fields" group) in a grid. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | attrname char* attribute name | | | | OUTPUTS: | | ntype hid_t attribute data type ID | | count hsize_t * Number of attribute elements | | size hsize_t * buf size of attribute elements | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Mar 00 A.Muslimov Original Development | | 5/10/00 A.Muslimov Changed 'H5T_class_t' type to 'int' data type. | | 7/12/00 A.Muslimov Unmasked hdf5 data types. | | Feb 03 S.Zhao Changed the type of 'ntype' from an H5T_class_t to | | an hid_t. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDgrpattrinfo2(hid_t gridID, const char *attrname, hid_t *ntype, hsize_t *count, hsize_t *size) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t dataID = FAIL;/* "Data Fields" group ID */ long idx = FAIL;/* Grid index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ CHECKPOINTER(attrname); /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDgrpattrinfo2", &fid, &gid, &idx); if (status == SUCCEED) { /* Get "Data Fields" group ID */ /* -------------------------- */ dataID = H5Gopen(HE5_GDXGrid[idx].gd_id, "Data Fields"); if(dataID == FAIL) { sprintf(errbuf,"Cannot open the \"Data Fields\" group.\n"); H5Epush(__FILE__, "HE5_GDgrpattrinfo2", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Call HE5_EHattrinfo */ /* ------------------- */ status = HE5_EHattrinfo2(dataID, attrname, ntype, count, size); if(status == FAIL) { sprintf(errbuf,"Cannot retrieve information about Attribute \"%s\" associated with the \"Data Fields\" group.\n", attrname); H5Epush(__FILE__, "HE5_GDgrpattrinfo2", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release group ID */ /* ---------------- */ status = H5Gclose(dataID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"Data Fields\" group ID.\n"); H5Epush(__FILE__, "HE5_GDgrpattrinfo2", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDinqgrpattrs | | | | DESCRIPTION: Retrieves the number of attributes and string length of | | attribute list associated with "Data Fields" group in a grid.| | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nattr long number of attributes (-1 if fails) | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | attrnames char attribute name(s) | | | | OUTPUTS: | | strbufsize long String length of attribute (in bytes) | | | | NOTES: | | | | None | | | | Date Programmer Description | | ====== ============ ================================================= | | Mar 00 A.Muslimov Original development. | | 7/12/00 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_GDinqgrpattrs(hid_t gridID, char *attrnames, long *strbufsize) { long nattr = 0; /* Number of attributes (return) */ long idx = FAIL;/* Grid index */ herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ char *grpname = NULL;/* Buffer for group name */ char *errbuf = NULL;/* Buffer for error message */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDinqgrpattrs", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDinqgrpattrs", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf,"Checking for grid ID failed.\n" ); H5Epush(__FILE__, "HE5_GDinqgrpattrs", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Allocate memory for a group name buffer */ /* --------------------------------------- */ grpname = (char *) calloc(HE5_HDFE_NAMBUFSIZE, 1); if( grpname == NULL) { sprintf(errbuf, "Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_GDinqgrpattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Construct group pathname string */ /* ------------------------------- */ strcpy(grpname,"/HDFEOS/GRIDS/"); strcat(grpname, HE5_GDXGrid[idx].gdname); strcat(grpname,"/Data Fields"); /* search group for the number of attributes */ /* --------------------------------------------------- */ nattr = HE5_EHattrcat(fid, grpname, attrnames, strbufsize); if (grpname != NULL) free(grpname); free(errbuf); errbuf = NULL; return (nattr); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDsetextdata | | | | DESCRIPTION: Sets external data files. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t grid structure ID | | filelist const char* list of external files | | offset off_t array of offsets (in bytes) from the | | beginning of the file to the location | | in the file where the data starts | | size hsize_t array of sizes (in bytes) reserved in | | the file for the data. | | | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Apr 01 A.Muslimov Original development. | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDsetextdata(hid_t gridID, const char *filelist, off_t offset[], hsize_t size[]) { herr_t status = FAIL; /* return status variable */ int i; /* Loop index */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ long idx = FAIL; /* Grid index */ char *namebuf = (char *)NULL;/* File list buffer */ char *filename = (char *)NULL;/* File name buffer */ char *comma = (char *)NULL;/* Pointer to comma */ char *errbuf = (char *)NULL;/* error message buffer */ HE5_LOCK; CHECKPOINTER(filelist); CHECKPOINTER(offset); CHECKPOINTER(size); /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDsetextdata", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDsetextdata", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for grid ID failed.\n"); H5Epush(__FILE__, "HE5_GDsetextdata", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return( status ); } /* Get current dataset creation property list */ /* ------------------------------------------ */ if( HE5_GDXGrid[idx].plist == FAIL) HE5_GDXGrid[idx].plist = H5Pcreate(H5P_DATASET_CREATE); /* Allocate space for namebuf, copy dimlist into it, & append comma */ /* ---------------------------------------------------------------- */ namebuf = (char *)calloc(strlen(filelist) + 64, sizeof(char)); if(namebuf == NULL) { H5Epush(__FILE__, "HE5_GDsetextdata", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory."); HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__); free(errbuf); return(FAIL); } /* ******************************************************************** * C H E C K T H E C O N T E N T O F filelist S T R I N G * ******************************************************************** */ strcpy(namebuf, filelist); strcat(namebuf, ","); /* Find comma */ /* ---------- */ comma = strchr(namebuf, ','); i = 0; /* Parse the list of file names */ /* ---------------------------- */ while (comma != NULL) { /* Allocate memory for filename buffer */ /* ----------------------------------- */ filename = (char *) calloc(comma - namebuf + 1, sizeof(char)); if (filename == NULL) { sprintf(errbuf, "Cannot allocate memory for filename. \n") ; H5Epush(__FILE__, "HE5_GDsetextdata", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(namebuf); return(FAIL); } /* Copy file list entry to filename */ /* -------------------------------- */ memmove(filename, namebuf, comma - namebuf); filename[comma-namebuf] = 0; /* Set the property list */ /* --------------------- */ status = H5Pset_external(HE5_GDXGrid[idx].plist, filename, offset[i], size[i]); if(status == FAIL) { sprintf(errbuf,"Cannot set external dataset property list.\n"); H5Epush(__FILE__, "HE5_GDsetextdata", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(namebuf); free(filename); return(status); } /* Go to next file entry, find next comma, ... */ /* ============================================ */ memmove(namebuf, comma + 1, strlen(comma + 1) + 1); comma = strchr(namebuf, ','); if (filename != NULL) free(filename); i++; } if (namebuf != NULL) free(namebuf); free(errbuf); COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDgetextdata | | | | DESCRIPTION: Gets external data files information. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nfiles int number of external files SUCCEED, | | (-1) FAIL | | INPUTS: | | gridID hid_t grid structure ID | | fieldname char* External field name | | | | OUTPUTS: | | namelength size_t Length of each name entry | | filelist char* List of file names | | offset off_t array of offsets (in bytes) from the | | beginning of the file to the location | | in the file where the data starts | | size hsize_t ARRAY of sizes (in bytes) reserved in | | the file for the data. | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Apr 01 A.Muslimov Original development. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDgetextdata(hid_t gridID, char *fieldname, size_t namelength, char *filelist, off_t offset[], hsize_t size[]) { int nfiles = FAIL; /* Number of ext. files */ int i; /* Loop index */ int found = 0; /* found flag */ size_t slen = 0; /* String length */ herr_t status = FAIL; /* return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t fieldID = FAIL; /* Data field ID */ hid_t plist = FAIL; /* Property list ID */ off_t off = 0; /* Offset of data segment */ hsize_t sz = 0; /* Size of data segment */ long idx = FAIL; /* Grid index */ char *filename = (char *)NULL;/* File name buffer */ char *errbuf = (char *)NULL;/*error message buffer */ CHECKPOINTER(fieldname); /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDgetextdata", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* ********************************************************** * Check for proper grid ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Grid index * ********************************************************** */ status = HE5_GDchkgdid(gridID, "HE5_GDgetextdata", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for grid ID failed.\n"); H5Epush(__FILE__, "HE5_GDgetextdata", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Loop through all data datasets in grid */ /* -------------------------------------- */ for (i = 0; i < HE5_GDXGrid[ idx ].nDFLD; i++) { /* Get dataset name */ /* ---------------- */ if( strcmp(fieldname, HE5_GDXGrid[ idx ].ddataset[ i ].name) == 0 ) { found = 1; break; } } /* Get dataset ID */ /* -------------- */ if( found == 1) { fieldID = HE5_GDXGrid[ idx ].ddataset[ i ].ID; /* Get the property list ID */ /* ------------------------ */ plist = H5Dget_create_plist(fieldID); if ( plist == FAIL ) { sprintf(errbuf, "Cannot get the property list ID for the \"%s\" data field.\n", fieldname); H5Epush(__FILE__, "HE5_GDgetextdata", __LINE__, H5E_PLIST, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Get the number of external files */ /* -------------------------------- */ nfiles = H5Pget_external_count(plist); if ( nfiles < 0 ) { sprintf(errbuf, "Cannot get the number of external files.\n"); H5Epush(__FILE__, "HE5_GDgetextdata", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Allocate memory for file name */ /* ----------------------------- */ filename = (char *)calloc(HE5_HDFE_NAMBUFSIZE, sizeof(char)); if(filename == NULL) { H5Epush(__FILE__, "HE5_GDgetextdata", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory."); HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__); free(errbuf); return(FAIL); } strcpy(filelist,""); /* Loop through all external files */ /* ------------------------------- */ for (i = 0; i < nfiles; i++) { strcpy(filename,""); /* Get the file name, offset, and size */ /* ----------------------------------- */ status = H5Pget_external(plist, i, namelength, filename, &off, &sz); if( status == FAIL) { sprintf(errbuf,"Cannot get information about external file.\n"); H5Epush(__FILE__, "HE5_GDgetextdata", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(filename); return(FAIL); } offset[i] = off; size[i] = sz; strcat(filelist, filename); /* Append comma */ /* ------------ */ if (nfiles > 1 && i < nfiles - 1) strcat(filelist,","); } slen = strlen(filelist); filelist[slen] = 0; if (filename != NULL) free(filename); /* Release property list ID */ /* ------------------------ */ status = H5Pclose(plist); if (status == FAIL ) { sprintf(errbuf, "Cannot release property list ID.\n"); H5Epush(__FILE__, "HE5_GDgetextdata", __LINE__, H5E_PLIST, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } } else { nfiles = FAIL; sprintf(errbuf, "Data field \"%s\" not found. \n", fieldname); H5Epush(__FILE__, "HE5_GDgetextdata", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } free(errbuf); COMPLETION: return(nfiles); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDfldnameinfo | | | | DESCRIPTION: Retrieves actual name of the field | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nameFlag int None return (1) actual name, (0) alias, | | (-1) FAIL | | INPUTS: | | gridID hid_t Grid structure ID | | fieldname char* name of field | | | | OUTPUTS: | | actualname char* field actual name | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Apr 04 S.Zhao Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ static int HE5_GDfldnameinfo(hid_t gridID, const char *fieldname, char *actualname) { int nameFlag = FAIL;/* Return value of flag */ int length = 0; /* String length */ int fldgroup = FAIL;/* Field group code */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t groupID = FAIL;/* data field group ID */ long idx = FAIL;/* grid index */ H5G_stat_t *statbuf = (H5G_stat_t *)NULL;/* buffer for link info */ herr_t status = FAIL;/* routine return status variable */ char *namebuf = NULL;/* Buffer for an actual field name */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ CHECKPOINTER(fieldname); /* Get HDF-EOS file ID, "HDFEOS" group ID and grid index */ /* ----------------------------------------------------- */ status = HE5_GDchkgdid(gridID, "HE5_GDfldnameinfo", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for grid ID failed.\n"); H5Epush(__FILE__, "HE5_GDfldnameinfo", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } statbuf = (H5G_stat_t *)calloc(1, sizeof(H5G_stat_t )); /* Try to get information about specified field */ /* -------------------------------------------- */ H5E_BEGIN_TRY { groupID = HE5_GDXGrid[idx].data_id; fldgroup = HE5_HDFE_DATAGROUP; status = H5Gget_objinfo(groupID, fieldname, 0, statbuf); } H5E_END_TRY; if (status == FAIL) { nameFlag = FAIL; sprintf(errbuf, "Cannot find \"%s\" field.\n", fieldname); H5Epush(__FILE__, "HE5_GDfldnameinfo", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(statbuf); return(nameFlag); } /* If the field name is an alias */ /* ----------------------------- */ if (statbuf->type == H5G_LINK) nameFlag = FALSE; else nameFlag = TRUE; if (nameFlag == FALSE) { if (actualname != NULL) { status = HE5_GDaliasinfo(gridID, fldgroup, fieldname, &length, NULL); if ( status == FAIL ) { sprintf(errbuf, "Cannot get information about alias \"%s\".\n", fieldname); H5Epush(__FILE__, "HE5_GDfldnameinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } namebuf = (char *)calloc(length, sizeof(char)); if ( namebuf == NULL ) { sprintf(errbuf, "Cannot allocate memory for namebuf.\n"); H5Epush(__FILE__, "HE5_GDfldnameinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Retrieve information about alias */ /* -------------------------------- */ status = HE5_GDaliasinfo(gridID, fldgroup, fieldname, &length, namebuf); if ( status == FAIL ) { sprintf(errbuf, "Cannot get information about alias \"%s\".\n", fieldname); H5Epush(__FILE__, "HE5_GDfldnameinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(namebuf); return(FAIL); } strcpy(actualname,""); strcpy(actualname,namebuf); free(namebuf); } } if (nameFlag == TRUE) { if (actualname != NULL) { strcpy(actualname,""); strcpy(actualname, fieldname); } } free(statbuf); COMPLETION: return(nameFlag); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDsetalias | | | | DESCRIPTION: Defines alias for a specified field name | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | status herr_t Return status | | | | INPUTS: | | gridID hid_t Grid structure ID | | fieldname char Original field name | | | | OUTPUTS: | | aliaslist char List of aliases for the field name | | | | NOTES: | | None | | | | | | Date Programmer Description | | ======= ============ ================================================= | | Apr 04 S.Zhao Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDsetalias(hid_t gridID, char *fieldname, const char *aliaslist) { herr_t status = FAIL; /* return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "GRIDS" group ID */ hid_t groupID = FAIL; /* Field group ID */ long idx = FAIL; /* grid index */ char *buf = NULL; /* Pointer to temporary buffer */ char *comma = NULL; /* Pointer to comma */ char *aliasname = NULL; /* Pointer to the alias name */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKPOINTER(fieldname); CHECKPOINTER(aliaslist); /* Get HDF-EOS file ID, "HDFEOS" group ID and grid index */ /* ----------------------------------------------------- */ status = HE5_GDchkgdid(gridID, "HE5_GDsetalias", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for grid ID failed. \n"); H5Epush(__FILE__, "HE5_GDsetalias", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Find out the field group */ /* ------------------------ */ groupID = HE5_GDXGrid[idx].data_id; if (groupID == FAIL) { sprintf(errbuf, "Cannot find \"%s\" field in grid. \n", fieldname); H5Epush(__FILE__, "HE5_GDsetalias", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Allocate memory for temporary buffer */ /* ------------------------------------ */ buf = (char *)calloc(strlen(aliaslist)+64, sizeof(char)); if (buf == NULL) { sprintf(errbuf, "Cannot allocate memory for \"buf\". \n"); H5Epush(__FILE__, "HE5_GDsetalias", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Make a list like "name1,name2,name3," */ /* ------------------------------------- */ strcpy(buf,aliaslist); strcat(buf,","); /* Find first comma and make pointer pointing to it */ /* ------------------------------------------------ */ comma = strchr(buf, ','); while(comma != NULL) { /* Allocate memory for individual entry */ /* ------------------------------------ */ aliasname = (char *)calloc(comma-buf+1, sizeof(char)); if (aliasname == NULL) { sprintf(errbuf, "Cannot allocate memory for \"aliasname\". \n"); H5Epush(__FILE__, "HE5_GDsetalias", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (buf != NULL) free(buf); return(FAIL); } /* Pick up an individual entry and put it to the "aliasname" */ /* --------------------------------------------------------- */ memmove(aliasname,buf,comma-buf); /* Create a symbolic link for a specified object */ /* --------------------------------------------- */ status = H5Glink(groupID, H5G_LINK_SOFT, fieldname, aliasname); if (status == FAIL) { sprintf(errbuf, "Cannot create an alias \"%s\" for \"%s\" field. \n", aliasname, fieldname); H5Epush(__FILE__, "HE5_GDsetalias", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (aliasname != NULL) free(aliasname); if (buf != NULL) free(buf); return(FAIL); } /* Go to the next name entry */ /* ------------------------- */ memmove(buf,comma+1,strlen(comma+1)+1); comma = strchr(buf, ','); if (aliasname != NULL) free(aliasname); } if (buf != NULL) free(buf); COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDdropalias | | | | DESCRIPTION: Removes the alias for a specified field name | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | status herr_t Return status | | | | INPUTS: | | gridID hid_t Grid structure ID | | aliasname char Alias name to remove | | fldgroup int Field group flag | | | | OUTPUTS: | | | | NOTES: | | None | | | | | | Date Programmer Description | | ======= ============ ================================================= | | Apr 04 S.Zhao Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDdropalias(hid_t gridID, int fldgroup, const char *aliasname) { herr_t status = FAIL; /* return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "GRIDS" group ID */ hid_t groupID = FAIL; /* Field group ID */ long idx = FAIL; /* grid index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKPOINTER(aliasname); /* Get HDF-EOS file ID, "HDFEOS" group ID and grid index */ /* ----------------------------------------------------- */ status = HE5_GDchkgdid(gridID, "HE5_GDdropalias", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for grid ID failed. \n"); H5Epush(__FILE__, "HE5_GDdropalias", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get Group ID */ /* ------------ */ groupID = HE5_GDXGrid[idx].data_id; if (groupID == FAIL) { sprintf(errbuf, "Invalid input group flag. \n"); H5Epush(__FILE__, "HE5_GDdropalias", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Destroy a symbolic link */ /* ----------------------- */ status = H5Gunlink(groupID, aliasname); if (status == FAIL) { sprintf(errbuf, "Cannot remove alias named \"%s\". \n", aliasname); H5Epush(__FILE__, "HE5_GDdropalias", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDaliasinfo | | | | DESCRIPTION: Retrieves information about field aliases | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | status herr_t Return status | | | | INPUTS: | | gridID hid_t Grid structure ID | | aliasname char alias name | | fldgroup int Field group flag | | | | OUTPUTS: | | length int Buffer size | | buffer char Buffer with original field name | | | | NOTES: | | None | | | | | | Date Programmer Description | | ======= ============ ================================================= | | Apr 04 S.Zhao Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDaliasinfo(hid_t gridID, int fldgroup, const char *aliasname, int *length, char *buffer) { herr_t status = FAIL; /* return status variable */ int type = FAIL; /* type-value of an object */ size_t size = 0; /* Size of the name buffer */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDF-EOS" group ID */ hid_t groupID = FAIL; /* Field group ID */ long idx = FAIL; /* grid index */ H5G_stat_t *statbuf = (H5G_stat_t *)NULL; /* pointer to a structure */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ CHECKPOINTER(aliasname); /* Get HDF-EOS file ID, "HDFEOS" group ID and grid index */ /* ----------------------------------------------------- */ status = HE5_GDchkgdid(gridID, "HE5_GDaliasinfo", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for grid ID failed. \n"); H5Epush(__FILE__, "HE5_GDaliasinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the group ID */ /* ---------------- */ if (fldgroup == HE5_HDFE_DATAGROUP) groupID = HE5_GDXGrid[idx].data_id; else { sprintf(errbuf, "Invalid input group flag. \n"); H5Epush(__FILE__, "HE5_GDaliasinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } if (buffer == NULL) { /* Get the string length of a "real" name */ /* -------------------------------------- */ statbuf = (H5G_stat_t *)calloc(1, sizeof(H5G_stat_t)); if (statbuf == NULL) { sprintf(errbuf, "Cannot allocate memory for \"statbuf\". \n"); H5Epush(__FILE__, "HE5_GDaliasinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the Object Info */ /* ------------------- */ status = H5Gget_objinfo(groupID, aliasname, 0, statbuf); if (status == FAIL) { sprintf(errbuf, "Cannot get information about \"%s\" alias. \n", aliasname); H5Epush(__FILE__, "HE5_GDaliasinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* LINK name length with a null terminator */ /* --------------------------------------- */ size = statbuf->linklen; /* Object type (dataset, link, etc) */ /* -------------------------------- */ type = statbuf->type; /* Make sure that the object is a LINK */ /* ----------------------------------- */ if (type != H5G_LINK) { sprintf(errbuf,"The object named \"%s\" is not a symbolic link.\n", aliasname); H5Epush(__FILE__, "HE5_GDaliasinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } *length = (int)size; if ( statbuf != (H5G_stat_t *)NULL ) free(statbuf); } if (buffer != NULL) { size = (size_t)*length; /* Get the "real" name by an "alias" */ /* --------------------------------- */ status = H5Gget_linkval(groupID, aliasname, size, buffer); if (status == FAIL) { sprintf(errbuf,"Cannot get the real name for the alias named \"%s\".\n", aliasname); H5Epush(__FILE__, "HE5_GDaliasinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } COMPLETION: return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDinqfldalias | | | | DESCRIPTION: Retrieves the number of fields & aliases and string length of| | fields & aliases list in "Data Fields" group | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nfldalias long Number of fields & aliases in "Data | | Fields" group. | | | | INPUTS: | | gridID hid_t Grid structure ID | | | | OUTPUTS: | | fldalias char* Fields & aliases names in "Data Fields" | | group (Comma-separated list) | | strbufsize long* Fields & aliases name list string length| | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 04 S.Zhao Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_GDinqfldalias(hid_t gridID, char *fldalias, long *strbufsize) { long nfldalias = FAIL; /* Number of fields & aliases (return) */ long idx = FAIL; /* grid index */ herr_t status = FAIL; /* Return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDF-EOS" group ID */ char *grpname = (char *)NULL; /* Group name string */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ /* Get HDF-EOS file ID, "HDFEOS" group ID and grid index */ /* ----------------------------------------------------- */ status = HE5_GDchkgdid(gridID, "HE5_GDinqfldalias", &fid, &gid, &idx); if(status == SUCCEED ) { grpname = (char *)calloc(HE5_HDFE_NAMBUFSIZE, sizeof(char) ); if( grpname == NULL) { H5Epush(__FILE__, "HE5_GDinqfldalias", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory"); HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__); return(FAIL); } strcpy(grpname,"/HDFEOS/GRIDS/"); strcat(grpname, HE5_GDXGrid[idx].gdname); strcat(grpname,"/Data Fields"); /* search group with grpname for the number of fields & aliases */ /* ------------------------------------------------------------ */ nfldalias = HE5_EHdatasetcat(fid, grpname, fldalias, strbufsize); if ( nfldalias < 0 ) { sprintf(errbuf, "Cannot find the fields & aliases. \n"); H5Epush(__FILE__, "HE5_GDinqfldalias", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); } if (grpname != NULL) free(grpname); } else { sprintf(errbuf, "Checking for grid ID failed. \n"); H5Epush(__FILE__, "HE5_GDinqfldalias", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } return (nfldalias); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDll2mm_cea | | | | DESCRIPTION: | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | projcode int GCTP projection code | | zonecode int UTM zone code | | projparm long Projection parameters | | spherecode int GCTP spheriod code | | xdimsize long xdimsize from GDcreate | | ydimsize long ydimsize from GDcreate | | upleftpt double upper left corner coordinates (DMS) | | lowrightpt double lower right corner coordinates (DMS) | | longitude long longitude array (DMS) | | latitude long latitude array (DMS) | | npnts long number of lon-lat points | | | | OUTPUTS: | | x double X value array | | y double Y value array | | scaleX double X grid size | | scaley double Y grid size | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Dec 04 Adura Adekunjo Added support for EASE grid | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDll2mm_cea(int projcode,int zonecode, int spherecode, double projparm[], long xdimsize, long ydimsize, double upleftpt[], double lowrightpt[], long npnts, double lon[], double lat[], double x[], double y[], double *scaleX, double *scaleY) { herr_t status = SUCCEED; /* routine return status variable */ int (*for_trans[100]) (double, double, double *, double *); int errorcode = 0; /* GCTP error code */ double xMtr0, xMtr1, yMtr0, yMtr1; double lonrad0; /* Longitude in radians of upleft point */ double latrad0; /* Latitude in radians of upleft point */ double lonrad; /* Longitude in radians of point */ double latrad; /* Latitude in radians of point */ char *errbuf; /* Buffer for error message */ /*CHECKPOINTER(upleftpt); CHECKPOINTER(lowrightpt); CHECKPOINTER(longitude); CHECKPOINTER(latitude);*/ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDll2mm_cea", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } if(npnts <= 0) { status = FAIL; sprintf(errbuf,"Improper npnts value\"%li\" must be greater than zero. \n", (long)npnts); H5Epush(__FILE__, "HE5_GDll2mm_cea", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return (status); } if ( projcode == HE5_GCTP_BCEA) { for_init(projcode, zonecode, projparm, spherecode, NULL, NULL, &errorcode, for_trans); /* Convert upleft and lowright X coords from DMS to radians */ /* -------------------------------------------------------- */ lonrad0 = HE5_EHconvAng(upleftpt[0], HE5_HDFE_DMS_RAD); lonrad = HE5_EHconvAng(lowrightpt[0], HE5_HDFE_DMS_RAD); /* Convert upleft and lowright Y coords from DMS to radians */ /* -------------------------------------------------------- */ latrad0 = HE5_EHconvAng(upleftpt[1], HE5_HDFE_DMS_RAD); latrad = HE5_EHconvAng(lowrightpt[1], HE5_HDFE_DMS_RAD); /* Convert from lon/lat to meters(or whatever unit is, i.e unit of r_major and r_minor) using GCTP */ /* ----------------------------------------- */ errorcode = for_trans[projcode] (lonrad0, latrad0, &xMtr0, &yMtr0); x[0] = xMtr0; y[0] = yMtr0; /* Report error if any */ /* ------------------- */ if (errorcode != 0) { status = FAIL; sprintf(errbuf, "GCTP Error: %li\n", (long)errorcode); H5Epush(__FILE__, "HE5_GDll2mm_cea", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return (status); } /* Convert from lon/lat to meters(or whatever unit is, i.e unit of r_major and r_minor) using GCTP */ /* ----------------------------------------- */ errorcode = for_trans[projcode] (lonrad, latrad, &xMtr1, &yMtr1); x[1] = xMtr1; y[1] = yMtr1; /* Report error if any */ /* ------------------- */ if (errorcode != 0) { status = FAIL; sprintf(errbuf, "GCTP Error: %li\n", (long)errorcode); H5Epush(__FILE__, "HE5_GDll2mm_cea", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return (status); } /* Compute x scale factor */ /* ---------------------- */ *scaleX = (xMtr1 - xMtr0) / xdimsize; /* Compute y scale factor */ /* ---------------------- */ *scaleY = (yMtr1 - yMtr0) / ydimsize; } else { status = FAIL; sprintf(errbuf, "Wrong projection code; this function is only for EASE grid \n"); H5Epush(__FILE__, "HE5_GDll2mm_cea", __LINE__, H5E_ARGS, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return (status); } if (errbuf != NULL) free(errbuf); COMPLETION: return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDmm2ll_cea | | | | DESCRIPTION: | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | projcode int GCTP projection code | | zonecode int UTM zone code | | projparm double Projection parameters | | spherecode int GCTP spheriod code | | xdimsize long xdimsize from GDcreate | | ydimsize long ydimsize from GDcreate | | upleftpt double upper left corner coordinates (DMS) | | lowrightpt double lower right corner coordinates (DMS) | | x double X value array | | y double Y value array | | npnts long number of x-y points | | | | OUTPUTS: | | longitude double longitude array (DMS) | | latitude double latitude array (DMS) | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ =============================================== | | Dec 04 Adura Adekunjo Added support for EASE grid | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDmm2ll_cea(int projcode,int zonecode, int spherecode, double projparm[], long xdimsize, long ydimsize, double upleftpt[], double lowrightpt[], long npnts, double x[], double y[], double longitude[], double latitude[]) { herr_t status = FAIL; /* routine return status variable */ int (*inv_trans[100]) (double, double, double*, double*); int errorcode = 0; /* GCTP error code */ int i; char *errbuf; /* Buffer for error message */ CHECKPOINTER(upleftpt); CHECKPOINTER(lowrightpt); CHECKPOINTER(longitude); CHECKPOINTER(latitude); /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDmm2ll_cea", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } if(npnts <= 0) { status = FAIL; sprintf(errbuf,"Improper npnts value\"%li\" must be greater than zero. \n", (long)npnts); H5Epush(__FILE__, "HE5_GDmm2ll_cea", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return (status); } if ( projcode == HE5_GCTP_BCEA) { inv_init(projcode, zonecode, projparm, spherecode, NULL, NULL, &errorcode, inv_trans); /* Convert from meters(or whatever unit is, i.e unit of r_major and r_minor) to lat/lon using GCTP */ /* ----------------------------------------- */ for(i=0; i 0 ) { if (fieldlist != NULL) free(fieldlist); if (fldalias != NULL) free(fldalias); if (buff != NULL) free(buff); if (tmpbuf != NULL) free(tmpbuf); return (nalias); } else { sprintf(errbuf, "Cannot find the aliases.\n"); H5Epush(__FILE__, "HE5_GDgetaliaslist", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if(fieldlist != NULL) free(fieldlist); if(fldalias != NULL) free(fldalias); if (buff != NULL) free(buff); if (tmpbuf != NULL) free(tmpbuf); return(FAIL); } } else { if(nalias > 0 ) { strncpy(aliaslist, tmpbuf, *strbufsize-1); aliaslist[*strbufsize-1] = '\0'; } else { sprintf(errbuf, "Cannot find the aliases.\n"); H5Epush(__FILE__, "HE5_GDgetaliaslist", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if(fieldlist != NULL) free(fieldlist); if(fldalias != NULL) free(fldalias); if (buff != NULL) free(buff); if (tmpbuf != NULL) free(tmpbuf); return(FAIL); } } } else { sprintf(errbuf, "Invalid input field group flag. \n"); H5Epush(__FILE__, "HE5_GDgetaliaslist", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } else { sprintf(errbuf, "Checking for grid ID failed. \n"); H5Epush(__FILE__, "HE5_GDgetaliaslist", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } if (fieldlist != NULL) free(fieldlist); if (fldalias != NULL) free(fldalias); if (buff != NULL) free(buff); if (tmpbuf != NULL) free(tmpbuf); return (nalias); } /* ***************************************************************************** | | | F O R T R A N 7 7 W R A P P E R S | | | ***************************************************************************** */ /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDopenF (FORTRAN wrapper) | | | | DESCRIPTION: Opens or creates HDF file in order to create, read, or write | | a grid. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | FileID int None HDF-EOS file ID | | | | INPUTS: | | filename char* None Filename | | | | OUTPUTS: | | None | | | | NOTES: | | | | HDF5 Library Functions Called: | | | | None | | | | Date Programmer Description | | ====== ============ ================================================= | | 8/28/00 A. Muslimov | | 3/13/02 A. Muslimov Added "Flags" options for core metadata. | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDopenF(char *filename, int Flags) { int FileID = FAIL;/* Return file ID */ hid_t fid = FAIL;/* hdf5 type file ID */ uintn flags = 9999;/* HDF5 file access code */ char *errbuf = NULL;/* Error message buffer */ /* Allocate memory for error buffer */ /* -------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDopenF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory to error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Set up the file access flag */ /* --------------------------- */ if (Flags == HE5F_ACC_RDWR || Flags == HDF5_ACC_RDWR) flags = H5F_ACC_RDWR; else if (Flags == HE5F_ACC_RDONLY || Flags == HDF5_ACC_RDONLY) flags = H5F_ACC_RDONLY; else if (Flags == HE5F_ACC_TRUNC || Flags == HDF5_ACC_CREATE) flags = H5F_ACC_TRUNC; else { sprintf(errbuf, "File access flag is not supported. \n"); H5Epush(__FILE__, "HE5_GDopenF", __LINE__, H5E_ARGS, H5E_UNSUPPORTED, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Call HE5_GDopen to perform file access */ /* -------------------------------------- */ fid = HE5_GDopen(filename,flags); if(fid == FAIL) { sprintf(errbuf, "Error calling HE5_GDopen() from FORTRAN wrapper. \n"); H5Epush(__FILE__, "HE5_GDopenF", __LINE__, H5E_FILE, H5E_CANTOPENFILE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } FileID = (int)fid; free(errbuf); return(FileID); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDcreateF (FORTRAN wrapper) | | | | DESCRIPTION: Creates a grid within the file. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | GridID int None Grid structure ID | | | | INPUTS: | | FileID int None File ID | | gridname char None Grid structure name | | xdimsize long None Number of columns in grid | | ydimsize long None Number of rows in grid | | upleftpt double None Location (m/deg) of upper left corner | | lowrightpt double None Location (m/deg) of lower right corner | | | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | 8/28/00 A. Muslimov | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDcreateF(int FileID, char *gridname, long xdimsize, long ydimsize, double upleftpt[], double lowrightpt[]) { int GridID = FAIL;/* grid ID (return value) */ hid_t gridID = FAIL;/* HDF5 type grid ID */ hid_t fid = FAIL;/* HDF5 type file ID */ char *errbuf = (char *)NULL; /* Buffer for error message */ errbuf = (char *)calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char) ); if (errbuf == NULL) { H5Epush(__FILE__, "HE5_GDcreateF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } fid = (hid_t)FileID; gridID = HE5_GDcreate(fid, gridname, xdimsize, ydimsize, upleftpt, lowrightpt); if (gridID == FAIL) { sprintf(errbuf, "Error calling HE5_GDcreate() from FORTRAN wrapper. \n"); H5Epush(__FILE__, "HE5_GDcreateF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } free(errbuf); GridID = (int)gridID; return(GridID); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDattachF (FORTRAN wrapper) | | | | DESCRIPTION: Attaches to an existing grid within the file. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | GridID int None HDF-EOS type grid ID | | | | INPUTS: | | FileID int None HDF-EOS file id | | gridname char* None grid sructure name | | | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 00 A.Muslimov | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDattachF(int FileID, char *gridname) { int GridID = FAIL; /* Return value of the Grid ID */ hid_t gridID = FAIL; /* HDF5 type Grid ID */ hid_t fid = FAIL; /* HDF5 type file ID */ char *errbuf = (char *)NULL;/* Buffer for error message */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDattachF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory to error buffer."); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } fid = (hid_t)FileID; gridID = HE5_GDattach(fid, gridname); if(gridID == FAIL) { sprintf(errbuf, "Error calling HE5_GDattach() from FORTRAN wrapper. \n"); H5Epush(__FILE__, "HE5_GDattachF", __LINE__,H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } GridID = (int)gridID; return(GridID); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDdetachF (FORTRAN wrapper) | | | | DESCRIPTION: Detaches from grid interface and performs file housekeeping. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | GridID int None HDF-EOS type grid ID | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | HDF5 Library Functions Called: | | H5Dclose | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 00 A.Muslimov | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDdetachF(int GridID) { int ret = FAIL;/* (int) Return status variable */ herr_t status = FAIL;/* routine return status variable */ hid_t gridID = FAIL;/* HDF5 type grid ID */ char *errbuf = (char *)NULL;/*Error message buffer */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDdetachF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } gridID = (hid_t)GridID; status = HE5_GDdetach(gridID); if(status == FAIL) { sprintf(errbuf, "Error calling HE5_GDdetach() from FORTRAN wrapper. \n"); H5Epush(__FILE__, "HE5_GDdetachF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDcloseF (FORTRAN wrapper) | | | | DESCRIPTION: Closes file. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | FileID int HDF-EOS type file ID | | | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 00 A.Muslimov | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDcloseF(int FileID) { int ret = FAIL;/* (int) return status variable */ hid_t fid = FAIL;/* HDF5 type file ID */ herr_t status = FAIL;/* routine return status variable */ char *errbuf = (char *)NULL;/*Error message buffer */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDcloseF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } fid = (hid_t)FileID; /* Call HE5_GDclose to perform file close */ /* -------------------------------------- */ status = HE5_GDclose(fid); if(status == FAIL) { sprintf(errbuf, "Error calling HE5_GDclose() from FORTRAN wrapper. \n"); H5Epush(__FILE__, "HE5_GDcloseF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDdefdimF | | | | DESCRIPTION: Defines numerical value of dimension (FORTRAN wrapper) | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | GrdiID int grid structure ID | | dim. name char dimension name | | dim. size long dimension size | | | | OUTPUTS: | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jun 00 D.Wynne Original Version | | Aug 00 A.Muslimov Updated to reflect data type changes. | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDdefdimF(int GridID, char *dimname, long dim) { int ret = SUCCEED; herr_t status = SUCCEED; hid_t gridID = FAIL; hsize_t tdim = 0; char *errbuf = (char *)NULL; errbuf = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); tdim = (hsize_t)dim; gridID = (hid_t)GridID; status = HE5_GDdefdim(gridID, dimname, tdim); if ( status == FAIL ) { sprintf(errbuf, "Error calling HE5_GDdefdim from FORTRAN wrapper. \n"); H5Epush(__FILE__, "HE5_GDdefdimF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDdefprojF (FORTRAN wrapper) | | | | DESCRIPTION: Defines projection of grid. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | GridID int None HDF-EOS type grid ID | | projcode int GCTP projection code | | zonecode int UTM zone code | | spherecode int GCTP spheriod code | | projparm double Projection parameters | | | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 00 A.Muslimov | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDdefprojF(int GridID, int projcode, int zonecode, int spherecode, double projparm[]) { int ret = FAIL; /* routine return status variable */ herr_t status = FAIL; /* routine return status variable */ hid_t gridID = FAIL; /* HDF5 type grid ID */ char *errbuf = (char *)NULL;/* Buffer for error message */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDdefprojF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } gridID = (hid_t)GridID; status = HE5_GDdefproj(gridID, projcode, zonecode, spherecode, projparm); if(status == FAIL) { sprintf(errbuf, "Error calling HE5_GDdefproj() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_GDdefprojF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDdeforiginF (FORTRAN wrapper) | | | | DESCRIPTION: Defines the origin of the grid data. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | GridID int None Grid ID | | origincode int origin code | | HDFE_GD_UL (0) | | HDFE_GD_UR (1) | | HDFE_GD_LL (2) | | HDFE_GD_LR (3) | | | | OUTPUTS: | | None | | | | NOTES: | | Date Programmer Description | | ====== ============ ================================================= | | Aug 00 A.Muslimov | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDdeforiginF(int GridID, int origincode) { int ret = FAIL;/* routine return status variable */ herr_t status = FAIL;/* routine return status variable */ hid_t gridID = FAIL;/* HDF5 type grid ID */ char *errbuf = (char *)NULL;/* Buffer for error message */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDdeforigin", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } gridID = (hid_t)GridID; status = HE5_GDdeforigin(gridID, origincode); if ( status == FAIL) { sprintf(errbuf, "Error calling HE5_GDdeforigin() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_GDdeforiginF", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDdeffld | | | | | | DESCRIPTION: Defines data field within grid structure (FORTRAN) | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | GridID int Grid structure ID | | fieldname char fieldname | | fortdimlist char Dimension list (comma-separated list) | | FORTRAN dimesion order | | fortmaxdimlist char Max Dimension list (FORTRAN order) | | numtype int field type | | merge int merge code | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jun 00 D.Wynne Modified for HDF5 | | Aug 00 A.Muslimov Updated to reflect data type changes. | | Nov 00 A.Muslimov Updated to reverse order of "fortmaxdimlist"entries.| | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDdeffld(int GridID, char *fieldname, char *fortdimlist, char *fortmaxdimlist, int numtype, int merge) { int ret = SUCCEED;/* routine return status variable */ herr_t status = SUCCEED;/* routine return status variable */ hid_t gridID = FAIL;/* HDF5 type grid ID */ hid_t numbertype = FAIL;/* HDF5 type data type ID */ char *dimlist = (char *)NULL;/* Dimension list (C order) */ char *maxdimlist = (char *)NULL;/* Max. Dim. list (C) */ char *errbuf = (char *)NULL;/* error message buffer */ /* Allocate memory for error message buffers */ /* ----------------------------------------- */ errbuf = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDdeffld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } numbertype = HE5_EHconvdatatype(numtype); if(numbertype == FAIL) { sprintf(errbuf,"Error calling HE5_EHconvdatatype() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_GDdeffld", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } if(strcmp(fortmaxdimlist,"") == 0) fortmaxdimlist = NULL; /* Allocate space for C order dimension list */ /* ----------------------------------------- */ dimlist = (char *)calloc(strlen(fortdimlist) + 1, sizeof(char)); if(dimlist == NULL) { sprintf(errbuf,"Cannot allocate memory for dimlist.\n"); H5Epush(__FILE__, "HE5_GDdeffld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Reverse entries in dimension list (FORTRAN -> C) */ /* ------------------------------------------------ */ status = HE5_EHrevflds(fortdimlist, dimlist); if(status == FAIL) { sprintf(errbuf,"Error calling HE5_EHrevflds() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_GDdeffld", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); return(FAIL); } if (fortmaxdimlist != NULL) { /* Allocate space for C order dimension list */ /* ----------------------------------------- */ maxdimlist = (char *)calloc(strlen(fortmaxdimlist) + 1, sizeof(char)); if(maxdimlist == NULL) { sprintf(errbuf,"Cannot allocate memory for maxdimlist.\n"); H5Epush(__FILE__, "HE5_GDdeffld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); return(FAIL); } /* Reverse entries in maximum dimension list (FORTRAN -> C) */ /* -------------------------------------------------------- */ status = HE5_EHrevflds(fortmaxdimlist, maxdimlist); if(status == FAIL) { sprintf(errbuf,"Error calling HE5_EHrevflds() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_GDdeffld", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(maxdimlist); return(FAIL); } } else { maxdimlist = NULL; } gridID = (hid_t)GridID; /* Call Define Field routine */ /* ------------------------- */ status = HE5_GDdeffield(gridID, fieldname, dimlist, maxdimlist, numbertype, merge); if(status == FAIL) { sprintf(errbuf,"Error calling HE5_GDdeffld() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_GDdeffld", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); if (maxdimlist !=NULL) free(maxdimlist); return(FAIL); } free(dimlist); if (maxdimlist !=NULL) free(maxdimlist); free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDsetfill (FORTRAN wrapper) | | | | DESCRIPTION: Sets fill value for the specified field. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | GridID int grid structure ID | | fieldname char* field name | | fillval void* fill value | | | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 00 A.Muslimov | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDsetfill(int GridID, char *fieldname, int numtype, void *fillval) { int ret = FAIL;/* (int) return status variable */ herr_t status = FAIL;/* routine return status variable */ hid_t gridID = FAIL;/* HDF5 type grid ID */ hid_t ntype = FAIL;/* HDF5 type data type ID */ char *errbuf = (char *)NULL;/* error message buffer */ /* Allocate memory for error message buffers */ /* ----------------------------------------- */ errbuf = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDsetfill", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } ntype = HE5_EHconvdatatype(numtype); if(ntype == FAIL) { sprintf(errbuf,"Error calling HE5_EHconvdatatype() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_GDsetfill", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } gridID = (hid_t)GridID; status = HE5_GDsetfillvalue(gridID, fieldname, ntype, fillval); if(status == FAIL) { sprintf(errbuf,"Error calling HE5_GDsetfillvalue() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_GDsetfill", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDdeftileF | | | | DESCRIPTION: Defines tiling parameters, FORTRAN wrapper for GDdeftile | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | GridID int None HDF-EOS type grid ID | | tilecode int tile code | | tilerank int number of tiling dimensions | | tiledims long tiling dimensions | | | | OUTPUTS: | | None | | | | NOTES: | | None | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jun 00 D.Wynne Original Version | | Aug 00 A.Muslimov Updated to reflect data type changes | | Jan 01 A.Muslimov Added proper FORTRAN to C dimension order conversion| | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDdeftileF(int GridID, int tilecode, int tilerank, long *tiledims) { int ret = FAIL; /* (int) return status */ int i = 0; /* Loop index */ hid_t gridID = FAIL; /* HDF5 type grid ID */ herr_t status = FAIL; /* return status */ hsize_t *tdims = (hsize_t *)NULL;/* size variable */ char *errbuf = (char *)NULL; /* error message buffer */ errbuf = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDdeftileF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } tdims = (hsize_t *)calloc(tilerank, sizeof(hsize_t)); if(tdims == NULL) { sprintf(errbuf,"Cannot allocate memory for tdims.\n"); H5Epush(__FILE__, "HE5_GDdeftileF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Convert from FORTRAN to C dimension order */ /* ----------------------------------------- */ for(i = 0; i < tilerank; i++) tdims[i] = (hsize_t)tiledims[tilerank - 1 - i]; gridID = (hid_t)GridID; status = HE5_GDdeftile(gridID, tilecode, tilerank, tdims); if ( status == FAIL ) { sprintf(errbuf, "Error calling HE5_GDdeftile() from FORTRAN wrapper. \n"); H5Epush(__FILE__, "HE5_GDdeftileF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(tdims); return(FAIL); } free(tdims); free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDdefcompF (FORTRAN wrapper) | | | | DESCRIPTION: Defines compression type and parameters | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | GridID int None HDF-EOS type grid ID | | compcode int compression code | | compparm int compression parameters | | | | OUTPUTS: | | None | | | | NOTES: Before calling this function, storage must be CHUNKED | | Values of compression code | | HDFE_COMP_NONE 0 | | HDFE_COMP_RLE 1 | | HDFE_COMP_NBIT 2 | | HDFE_COMP_SKPHUFF 3 | | HDFE_COMP_DEFLATE 4 | | HDFE_COMP_SZIP_CHIP 5 | | HDFE_COMP_SZIP_K13 6 | | HDFE_COMP_SZIP_EC 7 | | HDFE_COMP_SZIP_NN 8 | | HDFE_COMP_SZIP_K13orEC 9 | | HDFE_COMP_SZIP_K13orNN 10 | | HDFE_COMP_SHUF_DEFLATE 11 | | HDFE_COMP_SHUF_SZIP_CHIP 12 | | HDFE_COMP_SHUF_SZIP_K13 13 | | HDFE_COMP_SHUF_SZIP_EC 14 | | HDFE_COMP_SHUF_SZIP_NN 15 | | HDFE_COMP_SHUF_SZIP_K13orEC 16 | | HDFE_COMP_SHUF_SZIP_K13orNN 17 | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 00 A.Muslimov | | Aug 03 S.Zhao Added Szip compression methods. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDdefcompF(int GridID, int compcode, int compparm[]) { int ret = FAIL;/* (int) return status variable */ herr_t status = FAIL;/* routine return status variable */ hid_t gridID = FAIL;/* HDF5 type grid ID */ char *errbuf = (char *)NULL; /* error message buffer */ errbuf = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDdefcompF", __LINE__, H5E_RESOURCE, H5E_NOSPACE,"Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } gridID = (hid_t)GridID; status = HE5_GDdefcomp(gridID, compcode, compparm); if ( status == FAIL ) { sprintf(errbuf, "Error calling HE5_GDdefcomp() from FORTRAN wrapper. \n"); H5Epush(__FILE__, "HE5_GDdefcompF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDdefpixregF (FORTRAN wrapper) | | | | DESCRIPTION: Defines pixel registration within grid cell. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | GridID int None HDF-EOS type grid ID | | pixregcode int None Pixel registration code | | HDFE_CENTER (0) | | HDFE_CORNER (1) | | | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 00 A.Muslimov | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDdefpixregF(int GridID, int pixregcode) { int ret = FAIL; /* (int) returmn status variable */ herr_t status = FAIL; /* routine return status variable */ hid_t gridID = FAIL; /* HDF5 type grid ID */ char *errbuf = (char *)NULL;/* Buffer for error message */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDdefpixregF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } gridID = (hid_t)GridID; status = HE5_GDdefpixreg(gridID, pixregcode); if ( status == FAIL) { sprintf(errbuf, "Error calling HE5_GDdefpixreg() from FORTRAN wrapper. \n"); H5Epush(__FILE__, "HE5_GDdefpixregF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDwrcharfld | | | | DESCRIPTION: Writes data to a character field (FORTRAN wrapper around | | GDwritefield) | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | GridID int grid structure ID | | fieldname char fieldname | | elemlen int each element length in array of string | | numelem int number of elements in declared buffer | | array | | fortstart long start array | | fortstride long stride array | | fortedge long edge array | | | | | | OUTPUTS: | | data void data buffer for write | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Feb 04 S.Zhao For an array of character string dataset. | | Jun 04 S.Zhao Added one more argument (numelem). | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDwrcharfld(int GridID, char *fieldname, int elemlen, int numelem, long fortstart[], long fortstride[], long fortedge[], void *data) { int ret = FAIL; /* (int) return status variable */ int i = 0; /* Loop index */ int rank = 0; /* Field rank */ hid_t gridID = FAIL; /* HDF5 type grid ID */ hid_t ntype[1] = {FAIL}; /* Field number type */ herr_t status = FAIL; /* return status variable */ hsize_t dims[HE5_DTSETRANKMAX];/* Field dimensions */ hsize_t *stride = (hsize_t *)NULL;/* Stride array (C order) */ hsize_t *edge = (hsize_t *)NULL;/* Edge array (C order) */ hssize_t *start = (hssize_t *)NULL;/* Start array (C order) */ char *errbuf = (char *)NULL; /* error message buffer */ char **strdatabuf = NULL; /* string data buffer */ int nelem = 0; /* number of elements in array of str*/ int strsize = 0; /* each str length in array of str */ char *blankPtr = (char *)NULL; /* pointer to blank character */ char *tmpString = (char *)NULL; /* pointer to temp string */ int attr = 0; /* attribute value */ hsize_t count[1]; /* number of attribute elements */ /* Initialize dims[] array */ /* ----------------------- */ for (i = 0; i < HE5_DTSETRANKMAX; i++) dims[i] = 0; /* Allocate memory for error message buffers */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDwrcharfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } gridID = (hid_t)GridID; /* Get field info */ status = HE5_GDfieldinfo(gridID, fieldname, &rank, dims, ntype, NULL, NULL); if (status == SUCCEED) { start = (hssize_t *)calloc(rank, sizeof(hssize_t)); if(start == NULL) { sprintf(errbuf,"Cannot allocate memory for start.\n"); H5Epush(__FILE__, "HE5_GDwrcharfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } stride = (hsize_t *)calloc(rank, sizeof(hsize_t)); if(stride == NULL) { sprintf(errbuf,"Cannot allocate memory for stride.\n"); H5Epush(__FILE__, "HE5_GDwrcharfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(errbuf); return(FAIL); } edge = (hsize_t *)calloc(rank, sizeof(hsize_t)); if(edge == NULL) { sprintf(errbuf,"Cannot allocate memory for edge.\n"); H5Epush(__FILE__, "HE5_GDwrcharfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(stride); free(errbuf); return(FAIL); } /* Reverse order of dimensions (FORTRAN -> C) */ /* ------------------------------------------ */ for (i = 0; i < rank; i++) { start[i] = (hssize_t)fortstart[rank - 1 - i]; stride[i] = (hsize_t)fortstride[rank - 1 - i]; edge[i] = (hsize_t)fortedge[rank - 1 - i]; } strsize = elemlen; nelem = dims[0]; tmpString = (char *)calloc(1,strsize+1); if(tmpString == NULL) { sprintf(errbuf,"Cannot allocate memory for tmpString.\n"); H5Epush(__FILE__, "HE5_GDwrcharfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(stride); free(edge); free(errbuf); return(FAIL); } strdatabuf = (char **)malloc(nelem*sizeof(char *)); for (i = 0; i C) */ /* ------------------------------------------ */ for (i = 0; i < rank; i++) { start[i] = (hssize_t)fortstart[rank - 1 - i]; stride[i] = (hsize_t)fortstride[rank - 1 - i]; edge[i] = (hsize_t)fortedge[rank - 1 - i]; } myedge = (hsize_t *)calloc(rank, sizeof(hsize_t)); if(myedge == NULL) { sprintf(errbuf,"Cannot allocate memory for edge.\n"); H5Epush(__FILE__, "HE5_GDwrfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(stride); free(edge); free(errbuf); return(FAIL); } /* get maxdims for the field */ status = HE5_GDflddiminfo(gridID, fieldname, &rank, dims, maxdims); /* see if we need first to extend data dimensions for unlimited dimensions */ for (i = 0; i < rank; i++) { if( dims[i] == maxdims[i] ) append = FALSE; else if ( (dims[i] < maxdims[i]) || (maxdims[i] == H5S_UNLIMITED)) { append = TRUE; break; } } unlimdim = i; if(append == FALSE) { for (i = 0; i < rank; i++) { if(edge[i] > dims[i]) myedge[i] = dims[i]; else myedge[i] = edge[i]; } } else { for (i = 0; i < rank; i++) { myedge[i] = edge[i]; } } if((append == TRUE) && (edge[unlimdim] > dims[unlimdim])) { hssize_t newstart[8]; hsize_t newedge[8]; for (i = 0; i < rank; i++) { newstart[i]=start[i]; newedge[i] = edge[i]; } newstart[unlimdim]=edge[unlimdim]-1; newedge[unlimdim] = 1; status = HE5_GDwrrdfield(gridID, fieldname, "w", newstart, stride, newedge,data); if (status == FAIL) { sprintf(errbuf, "Cannot write data to the field \"%s\".",fieldname) ; H5Epush(__FILE__, "HE5_GDwrfld", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(stride); free(edge); free(myedge); free(errbuf); return(FAIL); } else { for (i = 0; i < rank; i++) { dims[i]=edge[i]; } } } status = HE5_GDwrrdfield(gridID, fieldname, "w", start, stride, myedge,data); if (status == FAIL) { sprintf(errbuf, "Cannot write data to the field \"%s\".",fieldname) ; H5Epush(__FILE__, "HE5_GDwrfld", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(stride); free(edge); free(myedge); free(errbuf); return(FAIL); } } else { sprintf(errbuf, "Error calling GDfieldinfo() from FORTRAN wrapper.") ; H5Epush(__FILE__, "HE5_GDwrfld", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); status = FAIL; } if (start != NULL) free(start); if (stride != NULL) free(stride); if (edge != NULL) free(edge); if (errbuf != NULL) free(errbuf); if (myedge != NULL) free(myedge); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDrdfld | | | | DESCRIPTION: Reads data from field (FORTRAN wrapper around GDreadfield) | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | GridID int Grid structure ID | | fieldname char fieldname | | fortstart long start array | | fortstride long stride array | | fortedge long edge array | | buffer void data buffer for read | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Nov 99 Abe Taaheri Modified for HDF5 | | Jun 00 D.Wynne Updated to reflect data type changes | | Aug 00 A.Muslimov Updated to reflect data type changes. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDrdfld(int GridID, char *fieldname, long fortstart[], long fortstride[], long fortedge[], void *buffer) { int ret = FAIL; /* (int) return status variable */ int i = 0; /* Loop index */ int rank = 0; /* Field rank */ hid_t gridID = FAIL; /* HDF5 type grid ID */ hid_t ntype[1] = {FAIL}; /* Field number type */ herr_t status = FAIL; /* return status variable */ hsize_t dims[HE5_DTSETRANKMAX];/* Field dimensions */ hsize_t *stride = (hsize_t *)NULL;/* Stride array (C order) */ hsize_t *edge = (hsize_t *)NULL;/* Edge array (C order) */ hssize_t *start = (hssize_t *)NULL;/* Start array (C order) */ char *errbuf = (char *)NULL; /* error message buffer */ /* Initialize dims[] array */ /* ----------------------- */ for (i = 0; i < HE5_DTSETRANKMAX; i++) dims[i] = 0; /* Allocate memory for error message buffers */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDrdfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } gridID = (hid_t)GridID; /* Get field info */ /* -------------- */ status = HE5_GDfieldinfo(gridID, fieldname, &rank, dims, ntype, NULL,NULL); if (status != FAIL) { start = (hssize_t *)calloc(rank, sizeof(hssize_t)); if(start == NULL) { sprintf(errbuf,"Cannot allocate memory for start.\n"); H5Epush(__FILE__, "HE5_GDrdfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } stride = (hsize_t *)calloc(rank, sizeof(hsize_t)); if(stride == NULL) { sprintf(errbuf,"Cannot allocate memory for stride.\n"); H5Epush(__FILE__, "HE5_GDrdfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(errbuf); return(FAIL); } edge = (hsize_t *)calloc(rank, sizeof(hsize_t)); if(edge == NULL) { sprintf(errbuf,"Cannot allocate memory for edge.\n"); H5Epush(__FILE__, "HE5_GDrdfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(stride); free(errbuf); return(FAIL); } /* Reverse order of dimensions (FORTRAN -> C) */ for (i = 0; i < rank; i++) { start[i] = (hssize_t)fortstart[rank - 1 - i]; stride[i] = (hsize_t)fortstride[rank - 1 - i]; edge[i] = (hsize_t)fortedge[rank - 1 - i]; } status = HE5_GDwrrdfield(gridID, fieldname, "r", start, stride, edge, buffer); if (status == FAIL) { sprintf(errbuf, "Error calling HE5_GDwrrdfield() from FORTRAN wrapper.") ; H5Epush(__FILE__, "HE5_GDrdfld", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(stride); free(edge); free(errbuf); return(FAIL); } } else { sprintf(errbuf, "Error calling HE5_GDfieldinfo() from FORTRAN wrapper.") ; H5Epush(__FILE__, "HE5_GDrdfld", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); status = FAIL; } if (start != NULL) free(start); if (stride != NULL) free(stride); if (edge != NULL) free(edge); if (errbuf != NULL) free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDrdcharfld | | | | DESCRIPTION: Reads data from a character string field (FORTRAN wrapper | | around GDreadfield) | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | GridID int Grid structure ID | | fieldname char fieldname | | elemlen int each element length in array of string | | numelem int number of elements in declared buffer | | array | | fortstart long start array | | fortstride long stride array | | fortedge long edge array | | buffer void data buffer for read | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Apr 04 S.Zhao For an array of character string dataset. | | Jun 04 S.Zhao Added two more arguments (elemlen and numelem). | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDrdcharfld(int GridID, char *fieldname, int elemlen, int numelem, long fortstart[], long fortstride[], long fortedge[], void *buffer) { int ret = FAIL; /* (int) return status variable */ int i = 0; /* Loop index */ int rank = 0; /* Field rank */ hid_t gridID = FAIL; /* HDF5 type grid ID */ hid_t ntype[1] = {FAIL}; /* Field number type */ herr_t status = FAIL; /* return status variable */ hsize_t dims[HE5_DTSETRANKMAX];/* Field dimensions */ hsize_t *stride = (hsize_t *)NULL;/* Stride array (C order) */ hsize_t *edge = (hsize_t *)NULL;/* Edge array (C order) */ hssize_t *start = (hssize_t *)NULL;/* Start array (C order) */ char *errbuf = (char *)NULL; /* error message buffer */ char **strdatabuf = NULL; /* string data buffer */ int stlen = 0; /* whole string array length */ int nelem = 0; /* number of elements in array of str*/ int strsize = 0; /* each str length in array of str */ int attr = 0; /* attribute value */ int j = 0; /* Loop index */ int num_elem_passed_out; int numread; /* Initialize dims[] array */ /* ----------------------- */ for (i = 0; i < HE5_DTSETRANKMAX; i++) dims[i] = 0; /* Allocate memory for error message buffers */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDrdcharfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } gridID = (hid_t)GridID; /* Get field info */ /* -------------- */ status = HE5_GDfieldinfo(gridID, fieldname, &rank, dims, ntype, NULL,NULL); if (status != FAIL) { start = (hssize_t *)calloc(rank, sizeof(hssize_t)); if(start == NULL) { sprintf(errbuf,"Cannot allocate memory for start.\n"); H5Epush(__FILE__, "HE5_GDrdcharfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } stride = (hsize_t *)calloc(rank, sizeof(hsize_t)); if(stride == NULL) { sprintf(errbuf,"Cannot allocate memory for stride.\n"); H5Epush(__FILE__, "HE5_GDrdcharfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(errbuf); return(FAIL); } edge = (hsize_t *)calloc(rank, sizeof(hsize_t)); if(edge == NULL) { sprintf(errbuf,"Cannot allocate memory for edge.\n"); H5Epush(__FILE__, "HE5_GDrdcharfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(stride); free(errbuf); return(FAIL); } /* Reverse order of dimensions (FORTRAN -> C) */ for (i = 0; i < rank; i++) { start[i] = (hssize_t)fortstart[rank - 1 - i]; stride[i] = (hsize_t)fortstride[rank - 1 - i]; edge[i] = (hsize_t)fortedge[rank - 1 - i]; } status = HE5_GDreadlocattr(gridID, fieldname, "StringLengthAttribute", &attr); if (status == FAIL) { sprintf(errbuf, "Cannot read attribute from the field \"%s\".",fieldname) ; H5Epush(__FILE__, "HE5_GDrdcharfld", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(stride); free(edge); free(errbuf); return(FAIL); } if(elemlen < attr ) { sprintf(errbuf, "Element length passed in is not correct. Should be same as in declration"); H5Epush(__FILE__, "HE5_GDrdcharfld", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(stride); free(edge); free(errbuf); return(FAIL); } strsize = attr; stlen = dims[0] * strsize; nelem = stlen / strsize; strdatabuf = (char **)malloc(nelem*sizeof(char *)); for (i = 0; i C) */ /* ------------------------------------------ */ for (i = 0; i < RANK; i++) { count[i] = (hsize_t)fortcount[RANK - 1 - i]; } gridID = (hid_t)GridID; if ((dtype == HE5T_CHARSTRING) || (dtype == H5T_NATIVE_CHAR) || (dtype == H5T_C_S1)) { if (strlen((char *)datbuf) < count[0]) { sprintf(errbuf,"Size of databuf is less than the number of attribute elements.\n"); H5Epush(__FILE__, "HE5_GDwrattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); return(FAIL); } /* Allocate memory for temp buffer */ /* ------------------------------- */ tempbuf = (char * )calloc((count[0]+1), sizeof(char)); if(tempbuf == NULL) { sprintf(errbuf,"Cannot allocate memory for temp buffer.\n"); H5Epush(__FILE__, "HE5_GDwrattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); return(FAIL); } strncpy(tempbuf, (char *)datbuf, count[0]); tempbuf[count[0]] = '\0'; status = HE5_GDwriteattr(gridID, attrname, dtype, count, tempbuf); if(status == FAIL) { sprintf(errbuf,"Cannot write data to the attribute \"%s\".\n", attrname); H5Epush(__FILE__, "HE5_GDwrattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); free(tempbuf); return(FAIL); } free(count); free(errbuf); free(tempbuf); } else { status = HE5_GDwriteattr(gridID, attrname, dtype, count, datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot write data to the attribute \"%s\".\n", attrname); H5Epush(__FILE__, "HE5_GDwrattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); return(FAIL); } free(count); free(errbuf); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDwrgattr | | | | DESCRIPTION: FORTRAN wrapper to write/update group attribute in a grid. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | GridID int grid structure ID | | attrname char* attribute name | | ntype int attribute HDF numbertype | | fortcount[] long Number of attribute elements | | datbuf void I/O buffer | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Oct 99 Abe Taaheri Modified data types | | Jun 00 D.Wynne Updated for native datatypes | | Aug 00 A.Muslimov Updated to reflect recent datatype changes. | | Mar 04 S.Zhao Modified for a character string attribute. | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDwrgattr(int GridID, char *attrname, int ntype, long fortcount[], void *datbuf) { int ret = FAIL; /* (int) return status variable */ int RANK = 1; /* Rank of a dataset */ int i = 0; /* Loop index */ herr_t status = FAIL; /* routine return status variable */ hid_t gridID = FAIL; /* HDF5 type grid ID */ hid_t dtype = FAIL; /* HDF5 type data type ID */ hsize_t *count = (hsize_t *)NULL;/* Count array (C order) */ char *errbuf = (char *)NULL; /* error message buffer */ char *tempbuf = (char *)NULL; /* temp buffer */ /* Allocate memory for error message buffers */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDwrgattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } dtype = HE5_EHconvdatatype(ntype); if(dtype == FAIL) { sprintf(errbuf,"Error calling HE5_EHconvdatatype() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_GDwrgattr", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } count = (hsize_t *)calloc(RANK, sizeof(hsize_t)); if( count == NULL) { sprintf(errbuf,"Cannot allocate memory for count.\n"); H5Epush(__FILE__, "HE5_GDwrgattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Reverse order of dimensions (FORTRAN -> C) */ /* ------------------------------------------ */ for (i = 0; i < RANK; i++) { count[i] = (hsize_t)fortcount[RANK - 1 - i]; } gridID = (hid_t)GridID; if ((dtype == HE5T_CHARSTRING) || (dtype == H5T_NATIVE_CHAR) || (dtype == H5T_C_S1)) { if (strlen((char *)datbuf) < count[0]) { sprintf(errbuf,"Size of databuf is less than the number of group attribute elements.\n"); H5Epush(__FILE__, "HE5_GDwrgattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); return(FAIL); } /* Allocate memory for temp buffer */ /* ------------------------------- */ tempbuf = (char * )calloc((count[0]+1), sizeof(char)); if(tempbuf == NULL) { sprintf(errbuf,"Cannot allocate memory for temp buffer.\n"); H5Epush(__FILE__, "HE5_GDwrgattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); return(FAIL); } strncpy(tempbuf, (char *)datbuf, count[0]); tempbuf[count[0]] = '\0'; status = HE5_GDwritegrpattr(gridID, attrname, dtype, count, tempbuf); if(status == FAIL) { sprintf(errbuf,"Cannot write group attribute value.\n"); H5Epush(__FILE__, "HE5_GDwrgattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); free(tempbuf); return(FAIL); } free(count); free(errbuf); free(tempbuf); } else { status = HE5_GDwritegrpattr(gridID, attrname, dtype, count, datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot write group attribute value.\n"); H5Epush(__FILE__, "HE5_GDwrgattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); return(FAIL); } free(count); free(errbuf); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDwrlattr | | | | DESCRIPTION: FORTRAN wrapper to Write/update local attribute in a grid. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | GridID int grid structure ID | | fieldname char* field with local attribute | | attrname char* local attribute name | | ntype int local attribute HDF numbertype | | fortcount[] long Number of local attribute elements | | datbuf void I/O buffer | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Apr 00 D.Wynne Original Programmer | | Mar 04 S.Zhao Modified for a character string attribute. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDwrlattr(int GridID, char *fieldname, char *attrname, int ntype, long fortcount[], void *datbuf) { int ret = FAIL; /* (int) return status variable */ int RANK = 1; /* Rank of a dataset */ int i = 0; /* Loop index */ herr_t status = FAIL; /* routine return status variable */ hid_t gridID = FAIL; /* HDF5 type grid ID */ hid_t dtype = FAIL; /* HDF5 type data type ID */ hsize_t *count = (hsize_t *)NULL;/* Count array (C order) */ char *errbuf = (char *)NULL; /* error message buffer */ char *tempbuf = (char *)NULL; /* temp buffer */ /* Allocate memory for error message buffers */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDwrlattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } dtype = HE5_EHconvdatatype(ntype); if(dtype == FAIL) { sprintf(errbuf,"Error calling HE5_EHconvdatatype() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_GDwrlattr", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } count = (hsize_t *)calloc(RANK, sizeof(hsize_t)); if( count == NULL) { sprintf(errbuf,"Cannot allocate memory for count.\n"); H5Epush(__FILE__, "HE5_GDwrlattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Reverse order of dimensions (FORTRAN -> C) */ /* ------------------------------------------ */ for (i = 0; i < RANK; i++) { count[i] = (hsize_t)fortcount[RANK - 1 - i]; } gridID = (hid_t)GridID; if ((dtype == HE5T_CHARSTRING) || (dtype == H5T_NATIVE_CHAR) || (dtype == H5T_C_S1)) { if (strlen((char *)datbuf) < count[0]) { sprintf(errbuf,"Size of databuf is less than the number of local attribute elements.\n"); H5Epush(__FILE__, "HE5_GDwrlattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); return(FAIL); } /* Allocate memory for temp buffer */ /* ------------------------------- */ tempbuf = (char * )calloc((count[0]+1), sizeof(char)); if(tempbuf == NULL) { sprintf(errbuf,"Cannot allocate memory for temp buffer.\n"); H5Epush(__FILE__, "HE5_GDwrlattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); return(FAIL); } strncpy(tempbuf, (char *)datbuf, count[0]); tempbuf[count[0]] = '\0'; status = HE5_GDwritelocattr(gridID, fieldname, attrname, dtype, count, tempbuf); if(status == FAIL) { sprintf(errbuf,"Cannot write local attribute value.\n"); H5Epush(__FILE__, "HE5_GDwrlattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); free(tempbuf); return(FAIL); } free(count); free(errbuf); free(tempbuf); } else { status = HE5_GDwritelocattr(gridID, fieldname, attrname, dtype, count, datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot write local attribute value.\n"); H5Epush(__FILE__, "HE5_GDwrlattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); return(FAIL); } free(count); free(errbuf); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDrdattr (FORTRAN wrapper) | | | | DESCRIPTION: Reads attribute from a grid. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | GridID int None HDF-EOS type grid ID | | attrname char attribute name | | | | OUTPUTS: | | datbuf void I/O buffer | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 00 A.Muslimov | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDrdattr(int GridID, char *attrname, void *datbuf) { int ret = FAIL;/* (int) return status variable */ herr_t status = FAIL;/* routine return status variable */ hid_t gridID = FAIL;/* HDF5 type grid ID */ char *errbuf = (char *)NULL;/* error message buffer */ /* Allocate memory for error message buffers */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDrdattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } gridID = (hid_t)GridID; status = HE5_GDreadattr(gridID, attrname, datbuf); if(status == FAIL) { sprintf(errbuf,"Error calling HE5_GDreadattr() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_GDrdattr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDrdgattr (FORTRAN wrapper) | | | | DESCRIPTION: Reads group attribute from a grid. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | GridID int None HDF-EOS type grid ID | | attrname char attribute name | | | | OUTPUTS: | | datbuf void I/O buffer | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 00 A.Muslimov | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDrdgattr(int GridID, char *attrname, void *datbuf) { int ret = FAIL;/* (int) return status variable */ herr_t status = FAIL;/* routine return status variable */ hid_t gridID = FAIL;/* HDF5 type grid ID */ char *errbuf = (char *)NULL;/* error message buffer */ /* Allocate memory for error message buffers */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDrdgattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } gridID = (hid_t)GridID; status = HE5_GDreadgrpattr(gridID, attrname, datbuf); if(status == FAIL) { sprintf(errbuf,"Error calling HE5_GDreadgrpattr() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_GDrdgattr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDrdlattr (FORTRAN wrapper) | | | | DESCRIPTION: Reads local attribute from a grid. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | GridID int None HDF-EOS type grid ID | | fieldname char field name | | attrname char attribute name | | | | OUTPUTS: | | datbuf void I/O buffer | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 00 A.Muslimov | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDrdlattr(int GridID, char *fieldname, char *attrname, void *datbuf) { int ret = FAIL;/* (int) return status variable */ herr_t status = FAIL;/* routine return status variable */ hid_t gridID = FAIL;/* HDF5 type grid ID */ char *errbuf = (char *)NULL;/* error message buffer */ /* Allocate memory for error message buffers */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDrdlattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } gridID = (hid_t)GridID; status = HE5_GDreadlocattr(gridID, fieldname, attrname, datbuf); if(status == FAIL) { sprintf(errbuf,"Error calling HE5_GDreadlocattr() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_GDrdlattr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDinqdimsF | | | | DESCRIPTION: Returns dimension names and values defined in grid structure | | (FORTRAN Wrapper) | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nDim long Number of defined dimensions | | | | INPUTS: | | GridID int grid structure ID | | | | OUTPUTS: | | dimnames char Dimension names (comma-separated) | | dims long Dimension values | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jun 00 D.Wynne Original Version | | Aug 00 A.Muslimov Updated to reflect data type changes. | | | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_GDinqdimsF(int GridID, char *dimnames, long dims[]) { long nDim = FAIL; /* Number of dimensions */ long strbufsize = 0; /* Size of a string */ hid_t gridID = FAIL; /* HDF5 type grid ID */ int i = 0; /* Loop index */ hsize_t *tdims = (hsize_t *)NULL;/* Dimension size array */ char *errbuf = (char *)NULL; /* error message buffer */ /* Allocate memory for error message buffers */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDinqdimsF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } gridID = (hid_t)GridID; nDim = HE5_GDnentries(gridID, 0, &strbufsize); if(nDim == FAIL) { sprintf(errbuf,"Error calling HE5_GDnentries() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_GDinqdimsF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } tdims = (hsize_t *)calloc(nDim, sizeof(hsize_t)); if(tdims == NULL) { sprintf(errbuf,"Cannot allocate memory for tdims.\n"); H5Epush(__FILE__, "HE5_GDinqdimsF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } nDim = HE5_GDinqdims(gridID, dimnames, tdims); if(nDim == FAIL) { sprintf(errbuf,"Error calling HE5_GDinqdims() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_GDinqdimsF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(tdims); return(FAIL); } for(i = 0; i < nDim; i++) dims[i] = (long)tdims[i]; free(tdims); free(errbuf); return(nDim); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDdiminfoF | | | | DESCRIPTION: FORTRAN wrapper for GDdiminfo to Retrieve size of specified | | dimension. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | size long None Size of dimension | | | | INPUTS: | | GridID int None grid structure id | | dimname char* None Dimension name | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 9/21/99 A.Muslimov In the call to EHmetagroup() replaced the argument | | gid by fid. | | Oct 99 Abe Taaheri Added to convert hsize_t to integer | | Jun 00 D.Wynne Modified to update datatype changes | | Aug 00 A.Muslimov Modified to reflect data type changes | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_GDdiminfoF(int GridID, char *dimname) { long size = FAIL; /* dimension size (return) */ hid_t gridID = FAIL; /* HDF5 type grid ID */ hsize_t tsize = 0; char *errbuf = (char *)NULL;/* error message buffer */ /* Allocate memory for error message buffers */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDdiminfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } gridID = (hid_t)GridID; tsize = HE5_GDdiminfo(gridID, dimname); if(tsize == 0) { sprintf(errbuf,"Error calling HE5_GDdiminfo() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_GDdiminfoF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } size = (long)tsize; free(errbuf); return(size); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDfldinfo | | | | DESCRIPTION: FORTRAN wrapper arount GDfieldinfo | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | GridID int grid structure id | | fieldname char name of field | | | | OUTPUTS: | | rank long rank of field (# of dims) | | dims long field dimensions | | ntype int field number type | | fortdimlist char field dimension list (FORTRAN order) | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Nov 99 Abe Taaheri Modified for HDF5 | | Jun 00 D.Wynne Updated to reflect datatypes changes | | Aug 00 A.Muslimov Updated to reflect data type changes | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDfldinfo(int GridID, char *fieldname, int *rank, long dims[], int *ntype, char *fortdimlist, char *fortmaxdimlist) { int ret = SUCCEED;/* (int) return status variable */ int j = 0; /* Loop Index */ hid_t gridID = FAIL; /* HDF5 type grid ID */ hid_t dtype[1] = {FAIL};/* number types */ herr_t status = SUCCEED;/* routine return status variable */ hsize_t swap = 0; /* Temporary variable */ hsize_t tempdims[HE5_DTSETRANKMAX]; /* Dimension list in C order */ char *dimlist = (char *)NULL; char *maxdimlist = (char *)NULL; char *errbuf = (char *)NULL;/* error message buffer */ /* Allocate memory for error message buffers */ /* ----------------------------------------- */ errbuf = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDfldinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Allocate space for C order dimension list */ /* ----------------------------------------- */ dimlist = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char)); if(dimlist == NULL) { sprintf(errbuf,"Cannot allocate memory for dimlist.\n"); H5Epush(__FILE__, "HE5_GDfldinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Allocate space for C order max dimension list */ /* --------------------------------------------- */ maxdimlist = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char)); if(maxdimlist == NULL) { sprintf(errbuf,"Cannot allocate memory for maxdimlist.\n"); H5Epush(__FILE__, "HE5_GDfldinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); return(FAIL); } /* Initialize tempdims[] array */ /* --------------------------- */ for (j = 0; j < HE5_DTSETRANKMAX; j++) tempdims[j] = 0; /* Get field info */ /* -------------- */ gridID = (hid_t)GridID; status = HE5_GDfieldinfo(gridID, fieldname, rank, tempdims, dtype, dimlist, maxdimlist); if(status == FAIL) { sprintf(errbuf,"Error calling HE5_GDfieldinfo() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_GDfldinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(maxdimlist); return(FAIL); } *ntype = (int)dtype[0]; /* If no error then reverse order of dimension sizes */ /* ------------------------------------------------- */ if (status == SUCCEED) { for (j = 0; j < *rank / 2; j++) { swap = tempdims[*rank - 1 - j]; tempdims[*rank - 1 - j] = tempdims[j]; tempdims[j] = swap; } /*change the datatype */ for (j = 0; j < *rank; j++) { dims[j] = (long)tempdims[j]; } /* Reverse order of dimensions entries in dimension list */ /* ----------------------------------------------------- */ if(fortdimlist != (char *)NULL) { status = HE5_EHrevflds(dimlist, fortdimlist); if(status == FAIL) { sprintf(errbuf,"Error calling HE5_EHrevflds() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_GDfldinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } if(fortmaxdimlist != (char *)NULL) { status = HE5_EHrevflds(maxdimlist, fortmaxdimlist); if(status == FAIL) { sprintf(errbuf,"Error calling HE5_EHrevflds() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_GDfldinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } } if (maxdimlist != NULL) free(maxdimlist); if (dimlist != NULL) free(dimlist); if (errbuf != NULL) free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDtileinfoF | | | | DESCRIPTION: FORTRAN wrapper for GDtileinfo | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | GridID int grid structure ID | | fieldname char* name of field | | | | OUTPUTS: | | tilecode int* tile code | | tilerank int* rank of a dataset | | tiledims long the array containing sizes | | of each dimension of a tile | | | | NOTES: | | | | | | Date Programmer Description | | ========= ============ ============================================ | | Dec 03 S.Zhao Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDtileinfoF(int GridID, char *fieldname, int *tilecode, int *tilerank, long tiledims[]) { int ret = FAIL; /* return status */ int j = 0; /* Loop index */ herr_t status = FAIL; /* return status */ hid_t gridID = FAIL; /* HDF5 type grid ID */ hsize_t tempdims[HE5_DTSETRANKMAX]; /* Temporary dimension sizes array */ hsize_t swap = 0; /* Temporary dimension size */ char *errbuf = (char *)NULL; /* error message buffer */ /* Allocate memory for error message buffer */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDtileinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Initialize tempdims[] array */ /* --------------------------- */ for ( j = 0; j < HE5_DTSETRANKMAX; j++) tempdims[ j ] = 0; gridID = (hid_t)GridID; status = HE5_GDtileinfo(gridID, fieldname, tilecode, tilerank, tempdims); if(status == FAIL) { sprintf(errbuf,"Error calling GDtileinfo() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_GDtileinfoF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } for (j = 0; j < *tilerank / 2; j++) { swap = tempdims[*tilerank - 1 - j]; tempdims[*tilerank - 1 - j] = tempdims[j]; tempdims[j] = swap; } for (j = 0; j < *tilerank; j++) tiledims[j] = (long)tempdims[j]; free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDinqdatatypeF | | | | DESCRIPTION: Inquires about data fields in grid (FORTRAN Wrapper) | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | GridID int None HDF-EOS type grid ID | | fieldname char * | | attrname char * | | | | OUTPUTS: | | type int None HDF-EOS data type ID | | TypeClass int | | TypeOrder int | | TypeSize long | | | | NOTES: | | Date Programmer Description | | ====== ============ ================================================= | | Oct 99 D.Wynne Original Programmer | | Dec 99 A.Muslimov Changed the status return data type from hid_t to | | int . | | Feb 00 A.Muslimov Added error checkings. | | Mar 00 A.Muslimov Changed the ID of field group from gd_id to data_id.| | Mar 00 A.Muslimov Updated to include Group/Local attributes. | | 5/10/00 A.Muslimov Changed 'H5T_class_t' type to 'int' data type. | | Aug 00 A.Muslimov Updated to reflect data type changes. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDinqdatatypeF(int GridID, char *fieldname, char *attrname, int fieldgroup, int *type, int *TypeClass, int *TypeOrder, long *TypeSize) { int ret = FAIL; /* (int) return status variable */ herr_t status = FAIL; /* return status variable */ hid_t *typeID = NULL; /* HDF5 type data type ID */ hid_t gridID = FAIL; /* HDF5 type grid ID */ H5T_class_t *classID = (H5T_class_t *)NULL;/* Data type class ID */ H5T_order_t *Order = (H5T_order_t *)NULL;/* Data type byte order */ size_t *tempsize = (size_t *)NULL;/* Temporary variable */ char *errbuf = (char *)NULL; /* error message buffer */ /* Allocate memory for error message buffers */ /* ----------------------------------------- */ errbuf = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDinqdatatypeF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } typeID = (hid_t *)calloc(1, sizeof(hid_t)); if(typeID == NULL) { sprintf(errbuf,"Cannot allocate memory for typeID.\n"); H5Epush(__FILE__, "HE5_GDinqdatatypeF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } classID = (H5T_class_t *)calloc(1, sizeof(H5T_class_t)); if(classID == NULL) { sprintf(errbuf,"Cannot allocate memory for classID.\n"); H5Epush(__FILE__, "HE5_GDinqdatatypeF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(typeID); return(FAIL); } Order = (H5T_order_t *)calloc(1, sizeof(H5T_order_t)); if(Order == NULL) { sprintf(errbuf,"Cannot allocate memory for Order.\n"); H5Epush(__FILE__, "HE5_GDinqdatatypeF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(typeID); free(classID); return(FAIL); } tempsize = (size_t *)calloc(1, sizeof(size_t)); if(tempsize == NULL) { sprintf(errbuf,"Cannot allocate memory for tempsize.\n"); H5Epush(__FILE__, "HE5_GDinqdatatypeF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(typeID); free(classID); free(Order); return(FAIL); } gridID = (hid_t)GridID; status = HE5_GDinqdatatype(gridID, fieldname, attrname, fieldgroup, typeID,classID, Order, tempsize); if(status == FAIL) { sprintf(errbuf,"Error calling HE5_GDinqdatatype() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_GDinqdatatypeF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(typeID); free(classID); free(Order); free(tempsize); return(FAIL); } *type = (int)typeID[0]; *TypeSize = (long)tempsize[0]; *TypeClass = (int)classID[0]; *TypeOrder = (int)Order[0]; free(errbuf); free(typeID); free(classID); free(Order); free(tempsize); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDinqgridF (FORTRAN wrapper) | | | | DESCRIPTION: Returns number and names of grid structures in file | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nGrid long Number of grid structures in file | | | | INPUTS: | | filename char HDF-EOS filename | | | | OUTPUTS: | | gridlist char List of grid names (comma-separated) | | strbufsize long Length of gridlist | | | | NOTES: | | | | | | Date Programmer Description | | ======= ============ ================================================ | | 9/11/00 A.Muslimov | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_GDinqgridF(char *filename, char *gridlist, long *strbufsize) { long nGrid = FAIL; /* Number of grid structures in file */ char *errbuf = (char *)NULL;/* error message buffer */ /* Allocate memory for error message buffers */ /* ----------------------------------------- */ errbuf = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDinqgridF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Call "HE5_GDinqgrid" routine */ /* ------------------------ */ nGrid = HE5_GDinqgrid(filename, gridlist, strbufsize); if(nGrid == FAIL) { sprintf(errbuf,"Error calling HE5_GDinqgrid() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_GDinqgridF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } free(errbuf); return(nGrid); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDgridinfoF (FORTRAN wrapper) | | | | DESCRIPTION: Returns xdim, ydim and location of upper left and lower | | right corners, in meters. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | GridID int None Grid ID | | | | OUTPUTS: | | xdimsize long Number of columns in grid | | ydimsize long Number of rows in grid | | upleftpt double Location (m/deg) of upper left corner | | lowrightpt double Location (m/deg) of lower right corner | | | | NOTES: | | | | Date Programmer Description | | ======= ============ ================================================= | | 9/11/00 A.Muslimov | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDgridinfoF(int GridID, long *xdimsize, long *ydimsize, double upleftpt[], double lowrightpt[]) { int ret = FAIL; /* (int) return status variable */ herr_t status = FAIL; /* routine return status variable */ hid_t gridID = FAIL; /* "HDFEOS" group ID */ char *errbuf = (char *)NULL; /* buffer for error message */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDgridinfoF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } gridID = (hid_t)GridID; status = HE5_GDgridinfo(gridID, xdimsize, ydimsize, upleftpt, lowrightpt); if(status == FAIL) { sprintf( errbuf,"Error calling \"HE5_GDgridinfo()\" from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_GDgridinfoF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------r | BEGIN_PROLOG | | | | FUNCTION: HE5_GDinqflds (FORTRAN wrapper) | | | | DESCRIPTION: Retrieve information about all data fields defined in a grid. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nFld int Number of fields in grid | | | | INPUTS: | | GridID int None Grid ID | | | | OUTPUTS: | | fieldlist char* Field names (comma-separated) | | rank int Array of ranks | | ntype int Array of field data type class IDs | | | | NOTES: | | | | Date Programmer Description | | ======= ============ ================================================= | | 9/11/00 A.Muslimov | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDinqflds(int GridID, char *fieldlist, int rank[], int ntype[]) { int nFld = 0; /* Number of fields (return) */ int i; /* Loop index */ hid_t gridID = FAIL;/* Grid ID */ hid_t *dtype = (hid_t *)NULL;/* number types */ char *errbuf = (char *)NULL; /* error message buffer */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDinqflds", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } gridID = (hid_t)GridID; /* Call "HE5_GDinqfields" routine to get number of fields */ /* -------------------------------------------------- */ nFld = HE5_GDinqfields(gridID, fieldlist, NULL, NULL); if (nFld == FAIL) { sprintf(errbuf, "Error calling \"HE5_GDinqfields()\" from FORTRAN wrapper. \n"); H5Epush(__FILE__, "HE5_GDinqflds", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } if (nFld > 0) { dtype = (hid_t *)calloc(nFld, sizeof(hid_t)); if (dtype == NULL) { sprintf(errbuf, "Cannot allocate memory. \n"); H5Epush(__FILE__, "HE5_GDinqflds", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } nFld = HE5_GDinqfields(gridID, fieldlist, rank, dtype); if (nFld == FAIL) { sprintf(errbuf, "Error calling \"HE5_GDinqfields()\" from FORTRAN wrapper. \n"); H5Epush(__FILE__, "HE5_GDinqflds", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dtype); return(FAIL); } for (i = 0; i < nFld; i++) ntype[ i ] = (int)dtype[i]; free(dtype); } free(errbuf); return(nFld); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDprojinfoF (FORTRAN wrapper) | | | | DESCRIPTION: Returns GCTP projection code, zone code, spheroid code | | and projection parameters. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | GridID int None Grif ID | | | | OUTPUTS: | | projcode int GCTP projection code | | zonecode int UTM zone code | | spherecode int GCTP spheriod code | | projparm double Projection parameters | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | 9/11/00 A.Muslimov | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDprojinfoF(int GridID, int *projcode, int *zonecode, int *spherecode, double projparm[]) { int ret = FAIL; /* routine return status variable */ herr_t status = FAIL; /* routine return status variable */ hid_t gridID = FAIL; /* HDF-EOS file ID */ char *errbuf = (char *)NULL;/* Buffer for error message */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDprojinfoF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } gridID = (hid_t)GridID; status = HE5_GDprojinfo(gridID,projcode,zonecode,spherecode,projparm); if (status == FAIL) { sprintf(errbuf, "Error calling \"HE5_GDprojinfo()\" from FORTRAN wrapper. \n"); H5Epush(__FILE__, "HE5_GDprojinfoF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDdefboxregionF (FORTRAN wrapper) | | | | DESCRIPTION: Defines region for subsetting in a grid. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | RegionID int None Region ID | | | | INPUTS: | | GridID int Grid structure ID | | cornerlon double dec deg Longitude of opposite corners of box | | cornerlat double dec deg Latitude of opposite corners of box | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 9/12/00 A.Muslimov | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDdefboxregionF(int GridID, double cornerlon[], double cornerlat[]) { int RegionID = FAIL;/* Region ID (return value) */ hid_t regionID = FAIL;/* Region ID */ hid_t gridID = FAIL;/* Grid structure ID */ char *errbuf=(char *)NULL;/* Buffer for error message */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDdefboxregionF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } gridID = (hid_t)GridID; regionID = HE5_GDdefboxregion(gridID, cornerlon, cornerlat); if (regionID == FAIL) { sprintf(errbuf, "Error calling \"HE5_GDdefboxregion()\" from FORTRAN wrapper. \n"); H5Epush(__FILE__, "HE5_GDdefboxregionF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } free(errbuf); RegionID = (int)regionID; return(RegionID); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDreginfo | | | | DESCRIPTION: Retrieves size of region in bytes. FORTRAN Wrapper | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | GridID int None HDF-EOS type grid ID | | RegionID int Region ID | | fieldname char* Fieldname | | | | OUTPUTS: | | ntype int field data type class ID | | rank int field rank | | dims long dimensions of field region | | size long size in bytes of field region | | upleftpt double Upper left corner coord for region | | lowrightpt double Lower right corner coord for region | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Nov 99 Abe Taaheri Added for HDF5 | | Jun 00 D.Wynne Modified to reflect datatype changes | | Sep 00 A.Muslimov Updated to reflect data type changes. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDreginfo(int GridID, int RegionID, char *fieldname, int *ntype, int *rank, long dims[], long *size, double upleftpt[], double lowrightpt[]) { int ret = FAIL; /* (int) return status variable */ int j; /* Loop index */ hid_t gridID = FAIL; /* Grid ID */ hid_t regionID = FAIL; /* Region ID */ herr_t status = FAIL; /* routine return status variable */ hid_t *dtype = (hid_t *)NULL;/* number type */ hsize_t swap = 0; /* Temporary swap variable */ hsize_t tempdims[HE5_DTSETRANKMAX];/* Temporary dimensions array */ char *errbuf = (char *)NULL;/* Buffer for error message */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDreginfoF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } gridID = (hid_t)GridID; regionID = (hid_t)RegionID; dtype = (hid_t *)calloc(1, sizeof(hid_t)); if (dtype == (hid_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for dtype.\n"); H5Epush(__FILE__, "HE5_GDreginfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Initialize tempdims[] array */ /* --------------------------- */ for (j = 0; j C) */ /* -------------------------------------------- */ status = HE5_EHrevflds(fortaliaslist, aliaslist); if(status == FAIL) { sprintf(errbuf,"Cannot reverse entries in alias list.\n"); H5Epush(__FILE__, "HE5_GDsetaliasF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(aliaslist); return(FAIL); } /* Call GDsetalias() */ /* ----------------- */ status = HE5_GDsetalias(gridID, fieldname, aliaslist); if ( status == FAIL ) { sprintf(errbuf, "Error calling GDsetalias() from FORTRAN wrapper. \n"); H5Epush(__FILE__, "HE5_GDsetaliasF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(aliaslist); return(FAIL); } free(aliaslist); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDdropaliasF (FORTRAN wrapper) | | | | DESCRIPTION: Removes the alias for a specified field name | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | ret int Return status | | | | INPUTS: | | GridID int Grid structure ID | | aliasname char Alias name to remove | | fldgroup int Field group flag | | | | OUTPUTS: | | | | NOTES: | | None | | | | | | Date Programmer Description | | ======= ============ ================================================= | | Apr 04 S.Zhao Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDdropaliasF(int GridID, int fldgroup, char *aliasname) { int ret = FAIL;/* (int)Return status variable */ herr_t status = FAIL;/* return status variable */ hid_t gridID = FAIL;/* HDF5 type grid ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ gridID = (hid_t)GridID; status = HE5_GDdropalias(gridID, fldgroup, aliasname); if(status == FAIL) { sprintf(errbuf,"Error calling GDdropalias() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_GDdropaliasF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDaliasinfoF (FORTRAN wrapper) | | | | DESCRIPTION: Retrieves information about field aliases | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | ret int Return status | | | | INPUTS: | | GridID int Grid structure ID | | aliasname char alias name | | fldgroup int Field group flag | | | | OUTPUTS: | | length int Buffer size | | buffer char Buffer with original field name | | | | NOTES: | | None | | | | | | Date Programmer Description | | ======= ============ ================================================= | | Apr 04 S.Zhao Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDaliasinfoF(int GridID, int fldgroup, char *aliasname, int *length, char *buffer) { int ret = FAIL;/* (int) return status variable */ herr_t status = FAIL;/* return status variable */ hid_t gridID = FAIL;/* HDF5 type grid ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ gridID = (hid_t)GridID; status = HE5_GDaliasinfo(gridID, fldgroup, aliasname, length, buffer); if(status == FAIL) { sprintf(errbuf,"Error calling GDaliasinfo() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_GDaliasinfoF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDinqfldaliasF (FORTRAN wrapper) | | | | DESCRIPTION: Retrieves the number of fields & aliases and string length of| | fields & aliases list in "Data Fields" group | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nfldalias long Number of fields & aliases in "Data | | Fields" group. | | | | INPUTS: | | GridID int Grid structure ID | | | | OUTPUTS: | | fldalias char* Fields & aliases names in "Data Fields" | | group (Comma-separated list) | | strbufsize long* Fields & aliases name list string length| | | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 04 S.Zhao Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_GDinqfldaliasF(int GridID, char *fldalias, long *strbufsize) { long nfldalias = FAIL; /* Number of fields & aliases (return) */ hid_t gridID = FAIL; /* HDF5 type grid ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ gridID = (hid_t)GridID; nfldalias = HE5_GDinqfldalias(gridID, fldalias, strbufsize); if ( nfldalias < 0 ) { sprintf(errbuf, "Cannot retrieve the fields & aliases. \n"); H5Epush(__FILE__, "HE5_GDinqfldaliasF", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return(nfldalias); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDwrmeta | | | | DESCRIPTION: Defines structural metadata for pre-existing field | | within grid structure (FORTRAN) | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | GridID int grid structure ID | | fieldname char fieldname | | fortdimlist char Dimension list (comma-separated list) | | FORTRAN dimesion order | | ntype int field type | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jun 05 S. Zhao Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDwrmeta(int GridID, char *fieldname, char *fortdimlist, int ntype) { int ret = FAIL; /* (int) return status variable */ herr_t status = FAIL; /* routine return status variable */ hid_t gridID = FAIL; /* HDF5 type grid ID */ hid_t numbertype = FAIL; /* HDF5 type data type ID */ char *dimlist = (char *)NULL; /* Dimension list (C order) */ char *errbuf = (char *)NULL; /* error message buffer */ gridID = (hid_t)GridID; numbertype = HE5_EHconvdatatype(ntype); if(numbertype == FAIL) { H5Epush(__FILE__, "HE5_GDwrmeta", __LINE__, H5E_DATATYPE, H5E_BADVALUE, "Cannot convert datatype for FORTRAN wrapper."); HE5_EHprint("Error: Cannot convert datatype for FORTRAN wrapper, occured", __FILE__, __LINE__); return(FAIL); } /* Allocate memory for error message buffers */ /* ----------------------------------------- */ errbuf = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDwrmeta", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Allocate space for C order dimension list */ /* ----------------------------------------- */ dimlist = (char *) calloc(strlen(fortdimlist) + 1, sizeof(char)); if(dimlist == NULL) { sprintf(errbuf,"Cannot allocate memory for dimlist.\n"); H5Epush(__FILE__, "HE5_GDwrmeta", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Reverse entries in dimension list (FORTRAN -> C) */ /* ------------------------------------------------ */ status = HE5_EHrevflds(fortdimlist, dimlist); if(status == FAIL) { sprintf(errbuf,"Cannot reverse entries in dimension list.\n"); H5Epush(__FILE__, "HE5_GDwrmeta", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); return(FAIL); } /* Call Write Metadata routine */ /* --------------------------- */ status = HE5_GDwritefieldmeta(gridID, fieldname, dimlist, numbertype); if(status == FAIL) { sprintf(errbuf,"Cannot write \"%s\" field metadata.\n", fieldname); H5Epush(__FILE__, "HE5_GDwrmeta", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); return(FAIL); } free(dimlist); free(errbuf); ret = (int)status; return (ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDgetaliaslistF (FORTRAN wrapper) | | | | DESCRIPTION: Retrieves the number of aliases and aliases list in "Data | | Fields" group | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nalias long number of aliases in "Data Fields" | | group | | | | INPUTS: | | GridID int grid structure ID | | fldgroup int field group flag | | | | OUTPUTS: | | aliaslist char* list of aliases in "Data Fields" group | | (comma-separated list) | | strbufsize long* length of aliases list | | | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 05 S.Zhao Original development | | Dec 05 T.Roegner NCR 44092 - Added CYGWIN capability | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_GDgetaliaslistF(int GridID, int fldgroup, char *aliaslist, long *strbufsize) { long nalias = FAIL; /* Number of aliases (return) */ hid_t gridID = FAIL; /* HDF5 type grid ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ gridID = (hid_t)GridID; nalias = HE5_GDgetaliaslist(gridID, fldgroup, aliaslist, strbufsize); if (nalias < 0) { sprintf(errbuf, "Cannot retrieve the aliases. \n"); H5Epush(__FILE__, "HE5_GDgetaliaslistF", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return(nalias); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDsetdimscaleF (FORTRAN wrapper) | | | | DESCRIPTION: Defines a dimension scale for a fields dimension in a GRID | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gdID int GRID structure ID | | fieldname char field name | | dimname char dim name | | dim long Dimemsion value | | numbertype_in int dim scale data type such as DFNT_INT32, | | DFNT_FLOAT64, DFNT_FLOAT32, etc. | | data void data buffer for write | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | May 10 Abe Taaheri Original Programmer | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDsetdimscaleF(int GridID, char *fieldname, char *dimname, long dim, int numbertype_in, void * data) { herr_t status; hid_t gdID; char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ gdID = (hid_t)GridID; status = HE5_GDsetdimscale(gdID, fieldname, dimname, (hsize_t) dim, (hid_t) numbertype_in, data); if (status < 0) { sprintf(errbuf, "Cannot set dimension scale %s for field %s. \n", dimname, fieldname); H5Epush(__FILE__, "HE5_GDsetdimscaleF", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return((int)status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDsetdimscale2F (FORTRAN wrapper forHE5_GDsetdimscale2 ) | | | | DESCRIPTION: Defines a dimension scale for a fields dimension in a GRID | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gdID int GRID structure ID | | fieldname char field name | | dimname char dim name | | dimnscaleame char dim scale name | | dim long Dimemsion value | | numbertype_in int dim scale data type such as DFNT_INT32, | | DFNT_FLOAT64, DFNT_FLOAT32, etc. | | data void data buffer for write | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | March 17 Abe Taaheri Original Programmer | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDsetdimscale2F(int GridID, char *fieldname, char *dimname, char *dimscalename, long dim, int numbertype_in, void * data) { herr_t status; hid_t gdID; char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ gdID = (hid_t)GridID; status = HE5_GDsetdimscale2(gdID, fieldname, dimname, dimscalename, (hsize_t) dim, (hid_t) numbertype_in, data); if (status < 0) { sprintf(errbuf, "Cannot set dimension scale %s for field %s. \n", dimscalename, fieldname); H5Epush(__FILE__, "HE5_GDsetdimscale2F", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return((int)status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDdefdimscaleF (FORTRAN wrapper) | | | | DESCRIPTION: Defines dimension scale for a dimension for all fields in a | | GRID | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gdID int GRID structure ID | | dimname char dim name | | dim long Dimemsion value | | numbertype_in int dim scale data type such as DFNT_INT32, | | DFNT_FLOAT64, DFNT_FLOAT32, etc. | | data void data buffer for write | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jan 14 Abe Taaheri Original Programmer | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDdefdimscaleF(int GridID, char *dimname, long dim, int numbertype_in, void * data) { herr_t status; hid_t gdID; char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ gdID = (hid_t)GridID; status = HE5_GDdefdimscale(gdID, dimname, (hsize_t) dim, (hid_t) numbertype_in, data); if (status < 0) { sprintf(errbuf, "Cannot set dimension scale %s for all grid fields. \n", dimname); H5Epush(__FILE__, "HE5_GDdefdimscaleF", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return((int)status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDdefdimscale2F (FORTRAN wrapper for HE5_GDdefdimscale2) | | | | DESCRIPTION: Defines dimension scale for a dimension for all fields in a | | GRID | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gdID int GRID structure ID | | dimname char dim name | | dimscalename char dim scale name | | dim long Dimemsion value | | numbertype_in int dim scale data type such as DFNT_INT32, | | DFNT_FLOAT64, DFNT_FLOAT32, etc. | | data void data buffer for write | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | March 17 Abe Taaheri Original Programmer | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDdefdimscale2F(int GridID, char *dimname, char *dimscalename, long dim, int numbertype_in, void * data) { herr_t status; hid_t gdID; char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ gdID = (hid_t)GridID; status = HE5_GDdefdimscale2(gdID, dimname, dimscalename, (hsize_t) dim, (hid_t) numbertype_in, data); if (status < 0) { sprintf(errbuf, "Cannot set dimension scale %s for all grid fields. \n", dimscalename); H5Epush(__FILE__, "HE5_GDdefdimscale2F", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return((int)status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDgetdimscaleF (FORTRAN wrapper) | | | | DESCRIPTION: Get dimension scale for a dimension of a field in a GRID | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return databuffsize SUCCEED, (-1) FAIL | | | | INPUTS: | | gdID int GRID structure ID | | fieldname char field name | | dimname char dim name | | | | | | OUTPUTS: | | dimsize long dimension size | | ntype int number type | | databuff void data buffer for read | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | May 10 Abe Taaheri Original Programmer | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_GDgetdimscaleF(int GridID, char *fieldname, char *dimname, long *dimsize, int *ntype, void * databuff) { long databuffsize = FAIL;/* Size of buffer */ hid_t gdID = FAIL; /* HDF5 type grid ID */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Buffer for error message */ hsize_t ds; hid_t numtype; gdID = (hid_t)GridID; databuffsize = HE5_GDgetdimscale(gdID, fieldname, dimname, &ds, &numtype, databuff); *dimsize = (long) ds; *ntype = (int) numtype; if ( databuffsize <= 0 ) { sprintf(errbuf,"Cannot get dimension scale %s for field %s. \n", dimname, fieldname); H5Epush(__FILE__, "HE5_GDgetdimscaleF", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return((long)databuffsize); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDreaddscaleattrF (FORTRAN wrapper) | | | | DESCRIPTION: Reads attribute associated with a dimension scale field | | from a GD. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gdID int None HDF-EOS type GRID ID | | fieldname char field name | | attrname char attribute name | | | | OUTPUTS: | | datbuf void I/O buffer | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jun 10 Abe Taaheri Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDreaddscaleattrF(int GridID, char *fieldname, char *attrname, void *datbuf) { herr_t status = FAIL; /* return status */ hid_t gdID = FAIL; /* HDF5 type grid ID */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Buffer for error message */ gdID = (hid_t)GridID; status = HE5_GDreaddscaleattr(gdID, fieldname, attrname, datbuf); if ( status < 0 ) { sprintf(errbuf,"Cannot read attribute %s for dimension scale %s. \n", attrname, fieldname); H5Epush(__FILE__, "HE5_GDreaddscaleattrF", __LINE__, H5E_IO, H5E_SEEKERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return((int)status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDwritedscaleattrF (FORTRAN wrapper) | | | | DESCRIPTION: Writes/updates attribute associated with a dimension scale | | field in a GD. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gdID int GRID structure ID | | fieldname char* dimension scale SDS name | | attrname char* attribute name | | numtype int attribute datatype ID | | count[] long Number of attribute elements | | datbuf void I/O buffer | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | May 10 Abe Taaheri Original development. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDwritedscaleattrF(int GridID, char *fieldname, char *attrname, int numtype, long count[], void *datbuf) { herr_t status = FAIL; /* return status */ hid_t gdID = FAIL; /* HDF5 type grid ID */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Buffer for error message */ hsize_t fort_count[HE5_FLDNUMBERMAX]; gdID = (hid_t)GridID; fort_count[0] = (hsize_t)count[0]; status = HE5_GDwritedscaleattr(gdID, fieldname, attrname, (hid_t)numtype, fort_count, datbuf); if ( status < 0 ) { sprintf(errbuf,"Cannot write attribute %s for dimension scale %s. \n", attrname, fieldname); H5Epush(__FILE__, "HE5_GDwritedscaleattrF", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return((int)status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDdscaleattrinfoF (FORTRAN wrapper) | | | | DESCRIPTION: Retrieves information about dimension scale attribute | | (attribute associated with a specified dimension scale field) | | in a GD. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gdID int None HDF-EOS type GRID ID | | fieldname char* field name | | attrname char* attribute name | | | | OUTPUTS: | | ntype int attribute data type ID | | fortcount long Number of attribute elements | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | May 10 Abe Taaheri Original Development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDdscaleattrinfoF(int GridID, char *fieldname, char *attrname, int *ntype, long *fortcount) { herr_t status = FAIL; /* return status */ hid_t gdID = FAIL; /* HDF5 type grid ID */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Buffer for error message */ hsize_t *count = (hsize_t *)NULL; /* C-order count array */ hid_t *dtype = (hid_t *)NULL; /* Data type class ID */ gdID = (hid_t)GridID; dtype = (hid_t *)calloc(1, sizeof(hid_t)); if(dtype == (hid_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for \"dtype\".\n"); H5Epush(__FILE__, "HE5_GDdscaleattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } count = (hsize_t *)calloc(1, sizeof(hsize_t)); if(count == NULL) { sprintf(errbuf,"Cannot allocate memory for \"count\".\n"); H5Epush(__FILE__, "HE5_GDdscaleattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(dtype); return(FAIL); } count[0] = 0; status = HE5_GDdscaleattrinfo(gdID, fieldname, attrname, dtype, count); if ( status == FAIL) { sprintf(errbuf, "Cannot retrieve attribute info for the %s dimension scale. \n", fieldname); H5Epush(__FILE__, "HE5_GDdscaleattrinfoF", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(dtype); return(FAIL); } *fortcount = (long)(*count); *ntype = (int)(*dtype); free(count); free(dtype); return((int)status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDdscaleattrinfoF2 (FORTRAN wrapper) | | | | DESCRIPTION: Retrieves information about dimension scale attribute | | (attribute associated with a specified dimension scale field) | | in a GD. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gdID int None HDF-EOS type GRID ID | | fieldname char* field name | | attrname char* attribute name | | | | OUTPUTS: | | ntype int attribute data type ID | | fortcount long Number of attribute elements | | fortsize long buf size of attribute elements | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | May 10 Abe Taaheri Original Development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDdscaleattrinfoF2(int GridID, char *fieldname, char *attrname, int *ntype, long *fortcount, long *fortsize) { herr_t status = FAIL; /* return status */ hid_t gdID = FAIL; /* HDF5 type grid ID */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Buffer for error message */ hsize_t *count = (hsize_t *)NULL; /* C-order count array */ hsize_t *size = (hsize_t *)NULL; /* size of array elements */ hid_t *dtype = (hid_t *)NULL; /* Data type class ID */ gdID = (hid_t)GridID; dtype = (hid_t *)calloc(1, sizeof(hid_t)); if(dtype == (hid_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for \"dtype\".\n"); H5Epush(__FILE__, "HE5_GDdscaleattrinfoF2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } count = (hsize_t *)calloc(1, sizeof(hsize_t)); if(count == NULL) { sprintf(errbuf,"Cannot allocate memory for \"count\".\n"); H5Epush(__FILE__, "HE5_GDdscaleattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(dtype); return(FAIL); } size = (hsize_t *)calloc(1, sizeof(hsize_t)); if(size == NULL) { sprintf(errbuf,"Cannot allocate memory for \"size\".\n"); H5Epush(__FILE__, "HE5_GDdscaleattrinfoF2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(dtype); return(FAIL); } count[0] = 0; status = HE5_GDdscaleattrinfo2(gdID, fieldname, attrname, dtype, count, size); if ( status == FAIL) { sprintf(errbuf, "Cannot retrieve attribute info for the %s dimension scale. \n", fieldname); H5Epush(__FILE__, "HE5_GDdscaleattrinfoF2", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(dtype); return(FAIL); } *fortcount = (long)(*count); *fortsize = (long)(*size); *ntype = (int)(*dtype); free(count); free(size); free(dtype); return((int)status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDinqdscaleattrsF (FORTRAN wrapper) | | | | DESCRIPTION: Retrieves the number of attributes and string length of | | attribute list associated with a specified dimension scale | | in a GD. | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nattr long number of attributes (-1 if fails) | | | | INPUTS: | | gdID int None HDF-EOS type GRID ID | | fieldname char dimension scale name | | attrnames char attribute name(s) | | | | OUTPUTS: | | strbufsize long String length of attribute (in bytes) | | | | NOTES: | | | | None | | | | Date Programmer Description | | ====== ============ ================================================= | | June 10 Abe Taaheri Original development. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_GDinqdscaleattrsF(int GridID, char *fieldname, char *attrnames, long *strbufsize) { long status = FAIL; /* return status */ hid_t gdID = FAIL; /* HDF5 type grid ID */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Buffer for error message */ gdID = (hid_t)GridID; status = HE5_GDinqdscaleattrs(gdID, fieldname, attrnames, strbufsize); if ( status == FAIL ) { sprintf(errbuf, "Cannot find the attribute %s for dimension scale %s. \n",attrnames,fieldname); H5Epush(__FILE__, "HE5_GDinqdscaleattrsF", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDgetEastAndNorthFiles | | | | DESCRIPTION: With user provided STPDATADIR environment variable this | | functions returns the files needed for STP projection. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | None void | | | | INPUTS: | | eastFile char nad27 file provides in gctp | | northFile char nad83 file provides in gctp | | | | OUTPUTS: | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | May 11 Abe Taaheri Added support for State Plane Projection grid | | | | END_PROLOG | -----------------------------------------------------------------------------*/ void HE5_GDgetEastAndNorthFiles(char *eastFile, char *northFile) { char *ptr = NULL; char lastables[256]; /*ptr = (char *)malloc(256*sizeof(char)); */ ptr = (char *)getenv("STPDATADIR"); if(ptr == NULL) { /* first try MRTDATADIR for HEG */ ptr = (char *)getenv("MRTDATADIR"); } #if defined(HDFVIEWPLUGIN) if(ptr == NULL) { ptr = (char *)getenv("PWD"); strcpy(lastables, "STPDATADIR="); strcat(lastables,ptr); strcat(lastables,"/lib/ext/eosdata"); putenv(lastables); ptr = (char *)getenv("STPDATADIR"); } #endif if (ptr == NULL) { eastFile = (char *) NULL; northFile = (char *) NULL; } else { memmove(lastables, ptr, strlen(ptr)); lastables[(int)strlen(ptr)] = '\0'; /*strcpy(lastables, ptr);*/ snprintf( eastFile, sizeof(eastFile), "%s/nad27sp_be", lastables ); /* use big endian binary files */ snprintf( northFile,sizeof(northFile), "%s/nad83sp_be", lastables ); } /* if(ptr != NULL) { free(ptr); ptr = NULL; } */ return; } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDflddiminfo | | | | DESCRIPTION: This functions returns dims and maxdims | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t None HDF-EOS type grid ID | | fieldname char* fieldname | | | | OUTPUTS: | | rank int field rank | | dims hsize_t dimensions of field | | maxdims hsize_t max dimensions of field | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Sep 11 Abe Taaheri Added support for unlimited dimension adjustment | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_GDflddiminfo(hid_t GridID, char *fieldname, int *rank, hsize_t dims[], hsize_t maxdims[]) { herr_t status = FAIL; /* return status */ hid_t gdID = FAIL; /* HDF5 type grid ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Buffer for error message */ hid_t ntype[1] = {FAIL}; /* Field numbertypes */ char *dimlist = (char *)NULL; /* Dimension list in C order */ char *maxdimlist = (char *)NULL; /* max Dimension list in C order */ char *dimbuf = (char *)NULL; /* Dimension buffer */ char *comma = (char *)NULL; /* Pointer to comma */ char *dimcheck = (char *)NULL; /* Dimension check buffer */ hsize_t dimsize = 0; /* Dimension size */ int maxrank = 0; /* max dim rank */ int i = 0; /* Loop index */ int foundAllDim = 1; /* found all dimensions flag */ int first = 1; /* first entry flag */ char utlbuf[HE5_HDFE_UTLBUFSIZE];/* Utility buffer */ long xdim = 0; /* X dim size */ long ydim = 0; /* Y dim size */ gdID = (hid_t)GridID; /* Allocate space for C order dimension list */ /* ----------------------------------------- */ maxdimlist = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char)); dimlist = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char)); if(dimlist == NULL || maxdimlist == NULL) { sprintf(errbuf,"Cannot allocate memory for input list.\n"); H5Epush(__FILE__, "HE5_GDflddiminfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get field info */ /* --------------- */ status = HE5_GDfieldinfo(gdID, fieldname, rank, dims, ntype, dimlist, maxdimlist); if ( status == FAIL ) { sprintf(errbuf, "Error calling HE5_GDfieldinfo. \n") ; H5Epush(__FILE__, "HE5_GDflddiminfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Allocate space for dimbuf, copy maxdimlist into it, & append comma */ /* ------------------------------------------------------------------ */ if(maxdimlist != NULL) { dimbuf = (char *) calloc(strlen(maxdimlist) + 64, sizeof(char)); if(dimbuf == NULL) { H5Epush(__FILE__, "HE5_GDflddiminfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory. \n"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); return(FAIL); } /* Copy "maxdimlist" to "dimbuf", & append comma */ /* --------------------------------------------- */ strcpy(dimbuf, maxdimlist); strcat(dimbuf, ","); /* Find comma */ /* ---------- */ comma = strchr(dimbuf, ','); /* * Loop through entries in dimension list to make sure they are * defined in grid */ while (comma != NULL) { /* Copy dimension list entry to dimcheck */ /* ------------------------------------- */ dimcheck = (char *) calloc(comma - dimbuf + 1, sizeof(char)); if(dimcheck == NULL) { H5Epush(__FILE__, "HE5_GDflddiminfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory. \n"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); free(dimbuf); free(dimlist); free(maxdimlist); return(FAIL); } memmove(dimcheck, dimbuf, comma - dimbuf); /* Get dimension size */ /* ------------------ */ if ((strcmp(dimcheck, "XDim") == 0) || (strcmp(dimcheck, "YDim") == 0)) { status = HE5_GDgridinfo(gdID, &xdim, &ydim, NULL, NULL); if(status == FAIL) { sprintf(errbuf, "Cannot get information about Grid.\n"); H5Epush(__FILE__, "HE5_GDflddiminfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(dimbuf); free(dimlist); free(maxdimlist); return(FAIL); } if(strcmp(dimcheck, "XDim") == 0) { dimsize = (hsize_t)xdim; } else if(strcmp(dimcheck, "YDim") == 0) { dimsize = (hsize_t)ydim; } } else { dimsize = HE5_GDdiminfo(gdID, dimcheck); } if ( (dimsize > 0) || (dimsize == H5S_UNLIMITED) ) { maxdims[maxrank] = dimsize; maxrank++; } else { /* * If dimension list entry not found - set error return * status, append name to utility buffer for error report */ status = FAIL; foundAllDim = 0; if (first == 1) strcpy(utlbuf, dimcheck); else { strcat(utlbuf, ","); strcat(utlbuf, dimcheck); } first = 0; } /* * Go to next dimension entry, find next comma, & free up * dimcheck buffer */ memmove(dimbuf, comma + 1, strlen(comma + 1) + 1); comma = strchr(dimbuf, ','); free(dimcheck); } free(dimbuf); free(dimlist); free(maxdimlist); /* If no dimensions found, report error */ /* ------------------------------------ */ if (foundAllDim == 0) { status = FAIL; sprintf(errbuf, "Dimension(s) \"%s\" not found for \"%s\" field. \n", utlbuf, fieldname); H5Epush(__FILE__, "HE5_GDflddiminfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return (status); } /* If maxrank !=rank then report error */ /* ------------------------------------ */ if ( maxrank != *rank ) { status = FAIL; sprintf(errbuf,"Dimension rank doesn't match Max dimension rank.\n"); H5Epush(__FILE__, "HE5_GDflddiminfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return (status); } } /* "maxlist == NULL" ==> maxdims[]= dims[] */ /* ---------------------------------------- */ else { for(i = 0; i < *rank; i++ ) maxdims[ i ] = dims[ i ]; } return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDsetflddimlabel | | | | DESCRIPTION: Sets label for a dimension in a field in a grid. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | gridID hid_t grid structure ID | | fieldname char field name | | dimname char Dimension name | | dimlabel char Dimemsion label | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | July 18 Abe Taaheri Original Programmer | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDsetflddimlabel(hid_t gridID, char *fieldname, char *dimname, char *dimlabel) { hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t did; /* Field dataset id */ long idx = FAIL; /* Grid index */ char olddimlabel[64]={""}; int olddimlabelexist = 0; unsigned int Dimindex; char tempdimlist[HE5_HDFE_DIMBUFSIZE];/* Dimension list */ int rank = FAIL; /* Rank of dataset */ hsize_t tempdims[HE5_DTSETRANKMAX]; /* Dimension sizes array*/ int i, found; int labelsize; char *errbuf = (char *)NULL; /* buffer for error message*/ herr_t status; hid_t dtype = FAIL; /* data type ID */ HE5_LOCK; CHECKNAME(fieldname); CHECKNAME(dimname); CHECKNAME(dimlabel); /* Allocate memory for error buffer */ /* -------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDsetflddimlabel", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /************************************************************************ * Check for proper grid ID and return HDF-EOS file ID, SDinterface ID, * * and grid root Vgroup ID * ************************************************************************/ status = HE5_GDchkgdid(gridID, " HE5_GDsetflddimlabel", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for grid ID failed.\n"); H5Epush(__FILE__, "HE5_GDsetdimscale", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } labelsize = (int)HE5_GDgetflddimlabel(gridID, fieldname, dimname, olddimlabel); if( labelsize == FAIL ) { sprintf(errbuf, "Getting dimlabel failed.\n"); H5Epush(__FILE__, "HE5_GDsetflddimlabel", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } else { if(strcmp(olddimlabel, "") !=0) { olddimlabelexist = 1; } } if(strcmp(dimlabel, olddimlabel)== 0) { /* no need for setting label. It is alread has vbeen set */ free(errbuf); return(SUCCEED); } /* Loop through all datasets in grid */ /* ------------------------------ */ for (i = 0; i < HE5_GDXGrid[idx].nDFLD; i++) { /* Get dataset name */ if( strcmp(fieldname, HE5_GDXGrid[ idx ].ddataset[ i ].name) == 0 ) { found = 1; did = HE5_GDXGrid[ idx ].ddataset[ i ].ID; break; } } if(found != 1) /* did not find fieldname */ { sprintf(errbuf, "Fieldname \"%s\" does not exist.\n", fieldname); H5Epush(__FILE__, "HE5_GDsetflddimlabel", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* if olddimlabel exist, replace it; Otherwise write the new dimlabel */ /* 1. get dim index .... */ /* for this field see if the dimlist contains dimname */ status = HE5_GDfieldinfo(gridID, fieldname, &rank, tempdims, &dtype, tempdimlist, NULL); if (status != SUCCEED) { sprintf(errbuf, "Field \"%s\" not found.\n", fieldname); H5Epush(__FILE__, "HE5_GDsetflddimlabel", __LINE__, H5E_ARGS, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } Dimindex = FAIL; Dimindex = HE5_EHstrwithin(dimname, tempdimlist, ','); if (Dimindex == FAIL) /* dimension not found */ { sprintf(errbuf, "Dimension dimname \"%s\" not found in Field \"%s\" .\n", dimname, fieldname); H5Epush(__FILE__, "HE5_GDsetflddimlabel", __LINE__, H5E_ARGS, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } status = (int)H5DSset_label(did, Dimindex, dimlabel); if(status <0) { sprintf(errbuf, "Setting label for dimension index %d failed.\n", Dimindex ); H5Epush(__FILE__, "HE5_GDsetflddimlabel", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_GDgetflddimlabel | | | | DESCRIPTION: Gets label for a dimension in a field in a grid. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | or the buffer size for label | | | | INPUTS: | | gridID hid_t grid structure ID | | fieldname char field name | | dimname char Dimension name | | dimlabel char Dimemsion label | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | July 18 Abe Taaheri Original Programmer | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_GDgetflddimlabel(hid_t gridID, char *fieldname, char *dimname, char *dimlabel) { hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t did; /* Field dataset id */ long idx = FAIL; /* Grid index */ char olddimlabel[64]; int olddimlabelexist = 0; unsigned int Dimindex; char tempdimlist[HE5_HDFE_DIMBUFSIZE];/* Dimension list */ int rank = FAIL; /* Rank of dataset */ hsize_t tempdims[HE5_DTSETRANKMAX]; /* Dimension sizes array */ int i, found; int labelsize; char *errbuf = (char *)NULL; /* buffer for error message*/ int status; hid_t dtype = FAIL; /* data type ID */ char tempdimlabel[128]; HE5_LOCK; CHECKNAME(fieldname); CHECKNAME(dimname); /* Allocate memory for error buffer */ /* -------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_GDsetflddimlabel", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /************************************************************************ * Check for proper grid ID and return HDF-EOS file ID, SDinterface ID, * * and grid root Vgroup ID * ************************************************************************/ status = (int)HE5_GDchkgdid(gridID, " HE5_GDgetflddimlabel", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for grid ID failed.\n"); H5Epush(__FILE__, "HE5_GDgetdimscale", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Loop through all datasets in grid */ /* ------------------------------ */ for (i = 0; i < HE5_GDXGrid[idx].nDFLD; i++) { /* Get dataset name */ if( strcmp(fieldname, HE5_GDXGrid[ idx ].ddataset[ i ].name) == 0 ) { found = 1; did = HE5_GDXGrid[ idx ].ddataset[ i ].ID; break; } } if(found != 1) /* did not find fieldname */ { sprintf(errbuf, "Fieldname \"%s\" does not exist.\n", fieldname); H5Epush(__FILE__, "HE5_GDgetflddimlabel", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* if olddimlabel exist, replace it; Otherwise write the new dimlabel */ /* 1. get dim index .... */ /* for this field see if the dimlist contains dimname */ status = (int)HE5_GDfieldinfo(gridID, fieldname, &rank, tempdims, &dtype, tempdimlist, NULL); if (status != SUCCEED) { sprintf(errbuf, "Field \"%s\" not found.\n", fieldname); H5Epush(__FILE__, "HE5_GDgetflddimlabel", __LINE__, H5E_ARGS, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } Dimindex = FAIL; Dimindex = HE5_EHstrwithin(dimname, tempdimlist, ','); if (Dimindex == FAIL) /* dimension not found */ { sprintf(errbuf, "Dimension dimname \"%s\" not found in Field \"%s\" .\n", dimname, fieldname); H5Epush(__FILE__, "HE5_GDgetflddimlabel", __LINE__, H5E_ARGS, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } strcpy(tempdimlabel,""); status = (int)H5DSget_label(did, Dimindex, tempdimlabel, (size_t)MAX_NAME); if(status <0) { sprintf(errbuf, "Getting label for dimension index %d failed.\n", Dimindex ); H5Epush(__FILE__, "HE5_GDgetflddimlabel", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } if(dimlabel == NULL) { int len = 0; len = strlen(tempdimlabel); status = len; } else { strcpy(dimlabel, tempdimlabel); status = SUCCEED; } COMPLETION: HE5_UNLOCK; free(errbuf); return(status); } #ifndef __cplusplus /* HDF types used in FORTRAN bindings */ #define INT32 INT #define INT32V INTV #define PINT32 PINT /* File/Grid access routines */ FCALLSCFUN2(INT, HE5_GDopenF, HE5_GDOPEN, he5_gdopen, STRING, INT) FCALLSCFUN6(INT, HE5_GDcreateF, HE5_GDCREATE, he5_gdcreate, INT, STRING, LONG, LONG, DOUBLEV, DOUBLEV) FCALLSCFUN2(INT, HE5_GDattachF, HE5_GDATTACH, he5_gdattach, INT, STRING) FCALLSCFUN1(INT, HE5_GDdetachF, HE5_GDDETACH, he5_gddetach, INT) FCALLSCFUN1(INT, HE5_GDcloseF, HE5_GDCLOSE, he5_gdclose, INT) /* Definition routines */ FCALLSCFUN3(INT, HE5_GDdefdimF, HE5_GDDEFDIM, he5_gddefdim, INT, STRING, LONG) FCALLSCFUN5(INT, HE5_GDdefprojF, HE5_GDDEFPROJ, he5_gddefproj, INT, INT, INT, INT, DOUBLEV) FCALLSCFUN2(INT, HE5_GDdeforiginF, HE5_GDDEFORIGIN, he5_gddeforigin, INT, INT) FCALLSCFUN6(INT, HE5_GDdeffld, HE5_GDDEFFLD, he5_gddeffld, INT, STRING, STRING, STRING, INT, INT) FCALLSCFUN4(INT, HE5_GDsetfill, HE5_GDSETFILL, he5_gdsetfill, INT, STRING, INT, PVOID) FCALLSCFUN3(INT, HE5_GDdefcompF, HE5_GDDEFCOMP, he5_gddefcomp, INT, INT, INTV) FCALLSCFUN4(INT, HE5_GDdeftileF, HE5_GDDEFTLE, he5_gddeftle, INT, INT, INT, PLONG) FCALLSCFUN5(INT, HE5_GDdefcomtileF, HE5_GDDEFCOMTLE, he5_gddefcomtle, INT, INT, PINT, INT, PLONG) FCALLSCFUN2(INT, HE5_GDdefpixregF, HE5_GDDEFPREG, he5_gddefpreg, INT, INT) FCALLSCFUN3(INT, HE5_GDsetaliasF, HE5_GDSETALIAS, he5_gdsetalias, INT, STRING, STRING) FCALLSCFUN3(INT, HE5_GDdropaliasF, HE5_GDDRPALIAS, he5_gddrpalias, INT, INT, STRING) /* I/O routines */ FCALLSCFUN6(INT, HE5_GDwrfld, HE5_GDWRFLD, he5_gdwrfld, INT, STRING, LONGV, LONGV, LONGV, PVOID) FCALLSCFUN8(INT, HE5_GDwrcharfld, HE5_GDWRCHARFLD, he5_gdwrcharfld, INT, STRING, INT, INT, LONGV, LONGV, LONGV, PVOID) FCALLSCFUN6(INT, HE5_GDrdfld, HE5_GDRDFLD, he5_gdrdfld, INT, STRING, LONGV, LONGV, LONGV, PVOID) FCALLSCFUN8(INT, HE5_GDrdcharfld, HE5_GDRDCHARFLD, he5_gdrdcharfld, INT, STRING, INT, INT, LONGV, LONGV, LONGV, PVOID) FCALLSCFUN3(INT, HE5_GDgetfill, HE5_GDGETFILL, he5_gdgetfill, INT, STRING, PVOID) FCALLSCFUN5(INT, HE5_GDwrattr, HE5_GDWRATTR, he5_gdwrattr, INT, STRING, INT, LONGV, PVOID) FCALLSCFUN5(INT, HE5_GDwrgattr, HE5_GDWRATTR, he5_gdwrgattr, INT, STRING, INT, LONGV, PVOID) FCALLSCFUN6(INT, HE5_GDwrlattr, HE5_GDWRLATTR, he5_gdwrlattr, INT, STRING, STRING, INT, LONGV, PVOID) FCALLSCFUN3(INT, HE5_GDrdattr, HE5_GDRDATTR, he5_gdrdattr, INT, STRING, PVOID) FCALLSCFUN3(INT, HE5_GDrdgattr, HE5_GDRDGATTR, he5_gdrdgattr, INT, STRING, PVOID) FCALLSCFUN4(INT, HE5_GDrdlattr, HE5_GDRDLATTR, he5_gdrdlattr, INT, STRING, STRING, PVOID) FCALLSCFUN4(INT, HE5_GDwrmeta, HE5_GDWRMETA, he5_gdwrmeta, INT, STRING, STRING, INT) /* Inquiry routines */ FCALLSCFUN3(LONG, HE5_GDinqdimsF, HE5_GDINQDIMS, he5_gdinqdims, INT, PSTRING, LONGV) FCALLSCFUN2(LONG, HE5_GDdiminfoF, HE5_GDDIMINFO, he5_gddiminfo, INT, STRING) FCALLSCFUN4(INT, HE5_GDinqflds, HE5_GDINQFLDS, he5_gdinqflds, INT, PSTRING, INTV, INTV) FCALLSCFUN7(INT, HE5_GDfldinfo, HE5_GDFLDINFO, he5_gdfldinfo, INT, STRING, PINT, LONGV, INTV, PSTRING, PSTRING) FCALLSCFUN8(INT, HE5_GDinqdatatypeF, HE5_GDINQDATATYPE, he5_gdinqdatatype, INT, STRING, STRING, INT, PINT, PINT, PINT, PLONG) FCALLSCFUN3(LONG, HE5_GDinqgridF, HE5_GDINQGRID, he5_gdinqgrid, STRING, PSTRING, PLONG) FCALLSCFUN5(INT, HE5_GDgridinfoF, HE5_GDGRIDINFO, he5_gdgridinfo, INT, PLONG, PLONG, DOUBLEV, DOUBLEV) FCALLSCFUN5(INT, HE5_GDprojinfoF, HE5_GDPROJINFO, he5_gdprojinfo, INT, PINT, PINT, PINT, DOUBLEV) FCALLSCFUN9(INT, HE5_GDreginfo, HE5_GDREGINFO, he5_gdreginfo, INT, INT, STRING, PINT, PINT, LONGV, PLONG, DOUBLEV, DOUBLEV) FCALLSCFUN4(INT, HE5_GDatinfo, HE5_GDATINFO, he5_gdattrinfo, INT, STRING, PINT, PLONG) FCALLSCFUN4(INT, HE5_GDgatinfo, HE5_GDGATINFO, he5_gdgatinfo, INT, STRING, PINT, PLONG) FCALLSCFUN5(INT, HE5_GDlatinfo, HE5_GDLATINFO, he5_gdlatinfo, INT, STRING, STRING, PINT, PLONG) FCALLSCFUN5(INT, HE5_GDatinfo2, HE5_GDATINFO2, he5_gdattrinfo2, INT, STRING, PINT, PLONG, PLONG) FCALLSCFUN5(INT, HE5_GDgatinfo2, HE5_GDGATINFO2, he5_gdgatinfo2, INT, STRING, PINT, PLONG, PLONG) FCALLSCFUN6(INT, HE5_GDlatinfo2, HE5_GDLATINFO2, he5_gdlatinfo2, INT, STRING, STRING, PINT, PLONG, PLONG) FCALLSCFUN2(INT, HE5_GDorigininfoF, HE5_GDORGINFO, he5_gdorginfo, INT, PINT) FCALLSCFUN2(INT, HE5_GDpixreginfoF, HE5_GDPREGINFO, he5_gdpreginfo, INT, PINT) FCALLSCFUN4(INT, HE5_GDcompinfoF, HE5_GDCOMPINFO, he5_gdcompinfo, INT, STRING, PINT, INTV) FCALLSCFUN3(LONG, HE5_GDnentriesF, HE5_GDNENTRIES, he5_gdnentries, INT, INT, PLONG) FCALLSCFUN3(LONG, HE5_GDinqattrsF, HE5_GDINQATTRS, he5_gdinqattrs, INT, PSTRING, PLONG) FCALLSCFUN3(LONG, HE5_GDinqgrpattrsF, HE5_GDINQGATTRS, he5_gdinqgattrs, INT, PSTRING, PLONG) FCALLSCFUN4(LONG, HE5_GDinqlocattrsF, HE5_GDINQLATTRS, he5_gdinqlattrs, INT, STRING, PSTRING, PLONG) FCALLSCFUN5(INT, HE5_GDtileinfoF, HE5_GDTILEINFO, he5_gdtileinfo,INT,STRING,PINT,PINT,LONGV) FCALLSCFUN5(INT, HE5_GDaliasinfoF, HE5_GDALIASINFO, he5_gdaliasinfo, INT, INT, STRING, PINT, STRING) FCALLSCFUN3(LONG, HE5_GDinqfldaliasF, HE5_GDINQFLDALIAS, he5_gdinqfldalias,INT,PSTRING,PLONG) FCALLSCFUN4(LONG, HE5_GDgetaliaslistF, HE5_GDGETALIASLIST, he5_gdgetaliaslist,INT,INT,PSTRING,PLONG) /* Subsetting/Retrieving routines */ FCALLSCFUN3(INT, HE5_GDdefboxregionF, HE5_GDDEFBOXREG, he5_gddefboxreg, INT, DOUBLEV, DOUBLEV) FCALLSCFUN4(INT, HE5_GDextractregionF, HE5_GDEXTREG, he5_gdextreg, INT, INT, STRING, PVOID) FCALLSCFUN4(INT, HE5_GDdeftimeperiodF, HE5_GDDEFTMEPER, he5_gddeftmeper, INT, INT, DOUBLE, DOUBLE) FCALLSCFUN4(INT, HE5_GDdefvrtregionF, HE5_GDDEFVRTREG, he5_gddefvrtreg, INT, INT, STRING, DOUBLEV) FCALLSCFUN1(INT, HE5_GDdupregionF, HE5_GDDUPREG, he5_gddupreg, INT) FCALLSCFUN6(INT, HE5_GDgetpixelsF, HE5_GDGETPIX, he5_gdgetpix, INT, LONG, DOUBLEV, DOUBLEV, LONGV, LONGV) FCALLSCFUN6(LONG, HE5_GDgetpixvaluesF, HE5_GDGETPIXVAL, he5_gdgetpixval, INT, LONG, LONGV, LONGV, STRING, PVOID) FCALLSCFUN6(LONG, HE5_GDinterpolateF, HE5_GDINTERPOLATE, he5_gdinterpolate, INT, LONG, DOUBLEV, DOUBLEV, STRING, DOUBLEV) /* EXTERNAL DATA FILE INTERFACE */ FCALLSCFUN4(INT, HE5_GDsetextdataF, HE5_GDSETXDAT, he5_gdsetxdat,INT,STRING,LONGV,LONGV) FCALLSCFUN6(INT, HE5_GDgetextdataF, HE5_GDGETXDAT, he5_gdgetxdat,INT,STRING,LONG,STRING,LONGV,LONGV) /* Utility routine */ FCALLSCFUN15(INT,HE5_GDij2ll, HE5_GDIJ2LL, he5_gdij2ll, INT, INT, DOUBLEV, INT, LONG, LONG, DOUBLEV, DOUBLEV, LONG, LONGV, LONGV, DOUBLEV, DOUBLEV, INT, INT) FCALLSCFUN15(INT,HE5_GDll2ij, HE5_GDLL2IJ, he5_gdll2ij, INT, INT, DOUBLEV, INT, LONG, LONG, DOUBLEV, DOUBLEV, LONG, DOUBLEV, DOUBLEV, LONGV, LONGV, DOUBLEV, DOUBLEV) FCALLSCFUN13(INT, HE5_GDrs2ll, HE5_GDRS2LL, he5_gdrs2ll, INT, DOUBLEV, LONG, LONG, DOUBLEV, DOUBLEV, INT, DOUBLEV, DOUBLEV, DOUBLEV, DOUBLEV, INT, INT) FCALLSCFUN5(INT, HE5_GDdefdimscaleF, HE5_GDDEFDIMSCALE, he5_gddefdimscale,INT,STRING,LONG,INT,PVOID) FCALLSCFUN6(INT, HE5_GDdefdimscale2F, HE5_GDDEFDIMSCALE2, he5_gddefdimscale2,INT,STRING,STRING,LONG,INT,PVOID) FCALLSCFUN6(INT, HE5_GDsetdimscaleF, HE5_GDSETDIMSCALE, he5_gdsetdimscale,INT,STRING,STRING,LONG,INT,PVOID) FCALLSCFUN7(INT, HE5_GDsetdimscale2F, HE5_GDSETDIMSCALE2, he5_gdsetdimscale2,INT,STRING,STRING,STRING,LONG,INT,PVOID) FCALLSCFUN6(LONG, HE5_GDgetdimscaleF, HE5_GDGETDIMSCALE, he5_gdgetdimscale,INT,STRING,STRING,PLONG,PINT,PVOID) FCALLSCFUN4(INT, HE5_GDreaddscaleattrF,HE5_GDREADDSCALEATTR, he5_gdreaddscaleattr,INT,STRING,STRING,PVOID) FCALLSCFUN6(INT, HE5_GDwritedscaleattrF, HE5_GDWRITEDSCALEATTR, he5_gdwritedscaleattr,INT,STRING,STRING,INT,LONGV,PVOID) FCALLSCFUN5(INT, HE5_GDdscaleattrinfoF, HE5_GDDSCALEATTRINFO, he5_gddscaleattrinfo,INT,STRING,STRING,PINT,PLONG) FCALLSCFUN6(INT, HE5_GDdscaleattrinfoF2, HE5_GDDSCALEATTRINFO2, he5_gddscaleattrinfo2,INT,STRING,STRING,PINT,PLONG,PLONG) FCALLSCFUN4(INT, HE5_GDinqdscaleattrsF, HE5_GDINQDSCALATTRS, he5_gdinqdscaleattrs,INT,STRING,STRING,PLONG) FCALLSCFUN4(INT, HE5_GDsetflddimlabel, HE5_GDSETFLDDIMLABEL, he5_gdsetflddimlabel, INT, STRING, STRING, STRING); FCALLSCFUN4(INT, HE5_GDgetflddimlabel, HE5_GDGETFLDDIMLABEL, he5_gdgetflddimlabel, INT, STRING, STRING, STRING); #endif hdf-eos5-2.0/src/HE5common.c000066400000000000000000000004321507520047200155130ustar00rootroot00000000000000 #include "H5public.h" #include "HE5_HdfEosDef.h" #include "HE5_config.h" #include #ifndef HAVE_H5FREE_MEMORY herr_t H5free_memory(void *buf) { free(buf); return 0; } #endif #ifdef _HDFEOS5_THREADSAFE HE5_HDFE_MutexStruct GlobalMutex; #endif hdf-eos5-2.0/src/Makefile.am000066400000000000000000000011371507520047200156140ustar00rootroot00000000000000# HDF-EOS5 src Makefile.am # Boilerplate definitions include $(top_srcdir)/config/include.am ## Note that gctp/include contains several header files with the same names ## as files in $(top_srcdir)/include. This doesn't currently cause problems ## in this directory, but may if Automake changes. AM_CPPFLAGS=-I$(top_srcdir)/include/ # Set LDFLAGS to allow the HDF-EOS library to use extern variables from # HDF5 LDFLAGS=-Wl,-single_module # Build HDF-EOS5 lib_LTLIBRARIES=libhe5_hdfeos.la # Source files for library libhe5_hdfeos_la_SOURCES=EHapi.c GDapi.c PTapi.c SWapi.c TSapi.c ZAapi.c HE5common.c hdf-eos5-2.0/src/Makefile.in000066400000000000000000000505421507520047200156310ustar00rootroot00000000000000# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # HDF-EOS5 src Makefile.am VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(top_srcdir)/config/include.am $(srcdir)/Makefile.in \ $(srcdir)/Makefile.am $(top_srcdir)/config/depcomp subdir = src ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/stdlib.m4 $(top_srcdir)/m4/stdinc.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/HE5_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(libdir)" LTLIBRARIES = $(lib_LTLIBRARIES) libhe5_hdfeos_la_LIBADD = am_libhe5_hdfeos_la_OBJECTS = EHapi.lo GDapi.lo PTapi.lo SWapi.lo \ TSapi.lo ZAapi.lo HE5common.lo libhe5_hdfeos_la_OBJECTS = $(am_libhe5_hdfeos_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libhe5_hdfeos_la_SOURCES) DIST_SOURCES = $(libhe5_hdfeos_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FC = @FC@ FCFLAGS = @FCFLAGS@ FFLAGS = @FFLAGS@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ # Set LDFLAGS to allow the HDF-EOS library to use extern variables from # HDF5 LDFLAGS = -Wl,-single_module LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ ac_ct_FC = @ac_ct_FC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ LIBHDFEOS5 = $(top_builddir)/src/libhe5_hdfeos.la LIBGCTP = $(top_builddir)/gctp/src/libGctp.la # Boilerplate definitions AM_CPPFLAGS = -I$(top_srcdir)/include/ # Build HDF-EOS5 lib_LTLIBRARIES = libhe5_hdfeos.la # Source files for library libhe5_hdfeos_la_SOURCES = EHapi.c GDapi.c PTapi.c SWapi.c TSapi.c ZAapi.c HE5common.c all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/include.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/config/include.am: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libhe5_hdfeos.la: $(libhe5_hdfeos_la_OBJECTS) $(libhe5_hdfeos_la_DEPENDENCIES) $(EXTRA_libhe5_hdfeos_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) -rpath $(libdir) $(libhe5_hdfeos_la_OBJECTS) $(libhe5_hdfeos_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/EHapi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GDapi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/HE5common.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PTapi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SWapi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TSapi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ZAapi.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(libdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-libLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-libLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-libLTLIBRARIES install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-libLTLIBRARIES # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: hdf-eos5-2.0/src/PTapi.c000077500000000000000000021544141507520047200147550ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | | | | Permission to use, 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 and that both that | | copyright notice and this permission notice appear in supporting | | documentation. | ---------------------------------------------------------------------------- */ #include #include #include /*#define HE5_PTIDOFFSET 1342177282*/ /* (2**27)*10+2 */ /*modified HE5_PTIDOFFSET to the same value as HE5_GRIDOFFSET, HE5_SWIDOFFSET, HE5_ZAIDOFFSET, i.e. 671088642, for HDF-EOS5 version 2.11 */ #define HE5_PTIDOFFSET 671088642 /* (2**26)*10 + 2 */ #define HE5_NPOINT 64 #define HE5_NPOINTREGN 256 #define HE5_NRECS 1 struct HE5_pointStructure { int active; /* Flag: if file is active or not */ hid_t fid; /* HDF-EOS file ID */ hid_t pt_id; /* Specified Point group ID */ hid_t data_id; /* "Data" group ID */ hid_t link_id; /* "Linkage" group ID */ HE5_DTSinfo level[HE5_DTSETRANKMAX]; /* Level ID and name */ char ptname[HE5_OBJNAMELENMAX]; /* Point name */ }; struct HE5_pointStructure HE5_PTXPoint[HE5_NPOINT]; typedef struct { HE5_DTSinfo level[HE5_DTSETRANKMAX]; int nlevels; } pack; typedef struct { LONGLONG back; } bckptr; typedef struct { LONGLONG begin; LONGLONG extent; } fwdptr; struct HE5_pointRegion { hid_t fid; hid_t pointID; hsize_t nrec[HE5_DTSETRANKMAX]; hssize_t *recPtr[HE5_DTSETRANKMAX]; }; struct HE5_pointRegion *HE5_PTXRegion[HE5_NPOINTREGN]; /* Point Prototypes (internal routines) */ static herr_t HE5_PTchkptid(hid_t pointID, const char *routname, hid_t *fid, hid_t *gid, long *idx); static herr_t HE5_PTfexist(hid_t dataID, const char *fldname, size_t *size, int *rank, size_t dims[], hid_t *dtype ); herr_t HE5_PTlinkinfo(hid_t, hid_t, int level, char *mode, char *linkfield); static herr_t HE5_PTwrbckptr(hid_t pointID, int level); static herr_t HE5_PTrdbckptr(hid_t pointID, int level, void *buffer) ; static herr_t HE5_PTwrfwdptr(hid_t pointID, int level); static herr_t HE5_PTrdfwdptr(hid_t pointID, int level, void *buffer); static herr_t HE5_PTwritesetup(hid_t pointID, int level, hssize_t *nrec); static hid_t HE5_PTrecnum(hid_t pointID, int level, int minlevel, int maxlevel, hsize_t nrec, hssize_t recs[]); hid_t HE5_PTopenlevel(hid_t loc_id, const char *name, void *opdata); int HE5_PTgetdtypesize(hid_t levelID, int i); herr_t HE5_PTgetlevelname_fromSM(hid_t pointID, int level, char *LevelName); /* FORTRAN wrappers */ /* ================ */ /* File/Point access routine */ int HE5_PTopenF(char *filename, uintn Flags); int HE5_PTcreateF(int FileID, char *pointname); int HE5_PTattachF(int FileID, char *pointname); int HE5_PTdetachF(int pointID); int HE5_PTcloseF(int FileID); /* Definition routines */ int HE5_PTdeflevelF(int pointID, const char *levelname, int rank[], char *fieldlist, long *dim_sizes, int dtype[], int array[]); int HE5_PTdeflinkageF(int pointID, char *parent, char *child, char *linkfield); /* I/O routines */ int HE5_PTreadlevelF(int pointID, int level, char *fieldname, int ntype, void *datbuf); int HE5_PTupdatelevelF(int pointID, int level, char *fieldlist, long nrec, long recs[], int ntype, void *data); int HE5_PTwritelevelF(int pointID, int level, long count[], char *fieldname, int ntype, void *data); int HE5_PTwriteattrF(int pointID, const char *attrname, int ntype, long fortcount[], void *datbuf); int HE5_PTwritegrpattrF(int pointID, const char *attrname, int ntype, long fortcount[], void * datbuf); int HE5_PTwritelocattrF(int pointID, const char *levelname, const char *attrname, int ntype, long count[],void * datbuf); int HE5_PTreadattrF(int pointID, const char *attrname, void *datbuf); int HE5_PTreadgrpattrF(int pointID, const char *attrname, void *datbuf); int HE5_PTreadlocattrF(int pointID, const char *levelname, const char *attrname, void *datbuf); int HE5_PTwrbckptrF(int pointID, int level); int HE5_PTwrfwdptrF(int pointID, int level); /* Inquiry routines */ int HE5_PTnrecsF(int pointID, int level); int HE5_PTnlevelsF(hid_t pointID); int HE5_PTnfieldsF(int pointID, int level, char *fieldlist, long *strbufsize); int HE5_PTlevelindxF(int pointID, const char *levelname); int HE5_PTgetlevelnameF(int pointID, int level, char *levelname, long *strbufsize); int HE5_PTbcklinkinfoF(int pointID, int level, char *linkfield); int HE5_PTfwdlinkinfoF(int pointID, int level, char *linkfield); int HE5_PTlevelinfoF(int pointID, int level, char *levelname, int rank[], char *fieldlist, long *dim_sizes, long *datasize, long offset[], int dtype[]); int HE5_PTinqdatatypeF(int pointID, char *fieldname, char *attrname, int fieldgroup, int *Type, int *Class, int *Order, long *size); int HE5_PTinqpointF(const char *filename, char *pointlist, long *strbufsize); int HE5_PTattrinfoF(int pointID, const char *attrname, int *numbertype, long *fortcount); int HE5_PTgrpattrinfoF(int pointID, const char *attrname, int *numbertype, long *fortcount); int HE5_PTlocattrinfoF(int pointID, const char *levelname, const char *attrname, int *numbertype, long *fortcount); int HE5_PTattrinfoF2(int pointID, const char *attrname, int *numbertype, long *fortcount, long *fortsize); int HE5_PTgrpattrinfoF2(int pointID, const char *attrname, int *numbertype, long *fortcount, long *fortsize); int HE5_PTlocattrinfoF2(int pointID, const char *levelname, const char *attrname, int *numbertype, long *fortcount, long *fortsize); long HE5_PTinqattrsF(int pointID, char *attrnames, long *strbufsize); long HE5_PTinqgrpattrsF(int pointID, char *attrnames, long *strbufsize); long HE5_PTinqlocattrsF(int pointID, const char *levelname, char *attrnames, long *strbufsize); int HE5_PTnumtypeinfoF(int pointID, int level, int numtype[]); /* Fortran Wrapper Utility Routines */ static int HE5_PTfort2c(long dims[], int rank, int datatype, void *inputfortbuf, void *outputfortbuf); static int HE5_PTc2fort(long dims[], int rank, int datatype, void *inputfortbuf, void *outputfortbuf); /* Fortran Wrappers (internal routines) */ static int HE5_PTgetfort_order(long *dims, int dim_index, long *c_index, int rank, long *P, long *coeffs, long *n); static herr_t HE5_PTreadlevel_f(hid_t pointID, int level, char *fieldname, hid_t dtype, void *datbuf); static herr_t HE5_PTwritelevel_f(hid_t pointID, int level, hsize_t count[], char *fieldname, int ntype, hid_t dtype, void *data); static herr_t HE5_PTupdatelevel_f(hid_t pointID, int level, char *fieldlist, hsize_t nrec, hssize_t recs[], int ntype, hid_t dtype, void *data); /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTopen | | | | DESCRIPTION: Opens an HDF file and returns file ID. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | fid hid_t HDF-EOS file ID | | | | INPUTS: | | filename char Point Filename | | flags uintn Access Code | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 7.20.99 A. Muslimov | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | END_PROLOG | -----------------------------------------------------------------------------*/ hid_t HE5_PTopen(const char *filename, uintn flags) { hid_t fid = FAIL;/* HDF-EOS file ID */ /* Call HE5_EHopen to open file */ /* ---------------------------- */ fid = HE5_EHopen(filename,flags, H5P_DEFAULT ); return (fid); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTcreate | | | | DESCRIPTION: Creates a new point structure and returns point ID. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | pointID hid_t Point structure ID | | | | INPUTS: | | fid hid_t HDF-EOS File ID | | pointname char Point structure name | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | =========== ============ ============================================ | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | 12/13/99 A.Muslimov Added proper error handlings after the function| | calls. Replace a call EHattrcat() by | | EHdatasetcat(). | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ hid_t HE5_PTcreate(hid_t fid, const char *pointname) { hid_t pointID = FAIL;/* HDF-EOS point ID (return value) */ herr_t status = FAIL;/* routine return status variable */ int i, j; /* Loop indices */ int npointopen = 0; /* # of point structures open */ int rank = 1; /* rank of a data space */ uintn access = 99; /* Read/Write file access code */ unsigned int zerobuf[HE5_DTSETRANKMAX];/* "Level Written" buffer */ hid_t HDFfid = FAIL;/* HDF file ID */ hid_t gid = FAIL;/* HDFEOS group ID */ hid_t pt_id = FAIL;/* HDF5 object point ID */ hid_t data_id = FAIL;/* Data group ID */ hid_t link_id = FAIL;/* Linkage group ID */ hid_t lvwr_id = FAIL;/* "LevelWritten" ID */ hid_t sid = FAIL;/* Data space ID */ hid_t POINTS_ID = FAIL;/* "POINTS" group ID */ long nPoint = 0; /* Point counter */ hsize_t count = HE5_DTSETRANKMAX; char errbuf[HE5_HDFE_ERRBUFSIZE]; /* error message buffer */ char utlbuf[HE5_HDFE_UTLBUFSIZE]; /* Utility buffer */ char utlbuf2[HE5_HDFE_UTLBUFSIZE];/* Utility buffer 2 */ HE5_LOCK; CHECKNAME(pointname); for (i = 0; i < HE5_DTSETRANKMAX; i++) zerobuf[ i ] = 0; /* Check HDF-EOS file ID */ /* --------------------- */ status = HE5_EHchkfid(fid, pointname, &HDFfid, &gid, &access); if (status == FAIL) { sprintf(errbuf, "Checking file ID failed.\n"); H5Epush(__FILE__, "HE5_PTcreate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Check pointname for length */ /* -------------------------- */ if ( strlen(pointname) > HE5_OBJNAMELENMAX) { sprintf(errbuf, "Pointname \"%s\" must be less than %d characters.\n", pointname, HE5_OBJNAMELENMAX); H5Epush(__FILE__, "HE5_PTcreate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Determine number of points currently opened */ /* ------------------------------------------- */ for (i = 0; i < HE5_NPOINT; i++) npointopen += HE5_PTXPoint[i].active; if(npointopen < HE5_NPOINT) { /* Probe , check if "POINTS" group exist*/ H5E_BEGIN_TRY { POINTS_ID = H5Gopen(gid, "POINTS"); } H5E_END_TRY; /* Group "POINTS" not exist*/ if(POINTS_ID == FAIL) { nPoint = 0; /* create the POINTS group*/ POINTS_ID = H5Gcreate(gid,"POINTS",0); if (POINTS_ID == FAIL) { sprintf(errbuf, "Cannot create \"POINTS\" group.\n"); H5Epush(__FILE__, "HE5_PTcreate", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } /* Group "POINTS" exist */ else { /* Probe , check if pointname group exist*/ H5E_BEGIN_TRY{ pt_id = H5Gopen(POINTS_ID, pointname); } H5E_END_TRY; if( pt_id == FAIL) { /* Get the number of points in "POINTS" group*/ nPoint= HE5_EHdatasetcat(fid, "/HDFEOS/POINTS", NULL,NULL); if (nPoint == FAIL) { sprintf(errbuf,"Cannot retrieve the number of points."); H5Epush(__FILE__, "HE5_PTcreate",__LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); status = H5Gclose(POINTS_ID); return(FAIL); } } else { sprintf(errbuf, "Point \"%s\" already exists.", pointname); H5Epush(__FILE__, "HE5_PTcreate", __LINE__, H5E_BTREE, H5E_EXISTS, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); status = H5Gclose(POINTS_ID); return(FAIL); } } /* pointname not exist, will create it! */ /* Create pointname group under "POINTS"*/ pt_id = H5Gcreate( POINTS_ID, pointname , 0); if (pt_id == FAIL) { sprintf(errbuf, "Cannot create \"%s\" group.\n", pointname); H5Epush(__FILE__, "HE5_PTcreate", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Create LevelWritten attribute */ sid = H5Screate_simple(rank, &count, 0); if (sid == FAIL) { sprintf(errbuf, "Cannot create data space ID.\n"); H5Epush(__FILE__, "HE5_PTcreate", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } lvwr_id = H5Acreate(pt_id, "_LevelWritten", H5T_NATIVE_UINT, sid, H5P_DEFAULT); if (lvwr_id == FAIL) { sprintf(errbuf, "Cannot create \"_LevelWritten\" attribute.\n"); H5Epush(__FILE__, "HE5_PTcreate", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Write "LevelWriten" attribute*/ status = H5Awrite(lvwr_id, H5T_NATIVE_UINT, zerobuf); if (status == FAIL) { sprintf(errbuf, "Cannot wtrite data to the \"_LevelWritten\" attribute.\n"); H5Epush(__FILE__, "HE5_PTcreate", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } status = H5Sclose(sid); if (status == FAIL) { sprintf(errbuf, "Cannot release the data space ID.\n"); H5Epush(__FILE__, "HE5_PTcreate", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } status = H5Aclose(lvwr_id); if (status == FAIL) { sprintf(errbuf, "Cannot release the \"_LevelWritten\" attribute ID.\n"); H5Epush(__FILE__, "HE5_PTcreate", __LINE__, H5E_ATTR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Create Data Records group */ data_id = H5Gcreate( pt_id, "Data", 0); if (data_id == FAIL) { sprintf(errbuf, "Cannot create \"Data\" group.\n"); H5Epush(__FILE__, "HE5_PTcreate", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Create Linkage Records group */ link_id = H5Gcreate( pt_id, "Linkage", 0); if (link_id == FAIL) { sprintf(errbuf, "Cannot create \"Linkage\" group.\n"); H5Epush(__FILE__, "HE5_PTcreate", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Establish Point in Structural MetaData Block */ sprintf(utlbuf, "%s%li%s%s%s","\tGROUP=POINT_", nPoint + 1,"\n\t\tPointName=\"", pointname, "\"\n"); strcat(utlbuf, "\t\tGROUP=Level\n"); strcat(utlbuf, "\t\tEND_GROUP=Level\n"); strcat(utlbuf, "\t\tGROUP=LevelLink\n"); strcat(utlbuf, "\t\tEND_GROUP=LevelLink\n"); sprintf(utlbuf2, "%s%li%s","\tEND_GROUP=POINT_", nPoint + 1, "\n"); strcat(utlbuf, utlbuf2); status = HE5_EHinsertmeta(fid, pointname, "p", 1003L, utlbuf, NULL); if (status == FAIL) { sprintf(errbuf, "Cannot insert metadata for the \"%s\" point.\n", pointname); H5Epush(__FILE__, "HE5_PTcreate", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } status = H5Gclose(POINTS_ID); if (status == FAIL) { sprintf(errbuf, "Cannot release the \"POINTS\" group ID.\n"); H5Epush(__FILE__, "HE5_PTcreate", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Assign pointID # & Load point and PTXPoint table entries */ for (i = 0; i < HE5_NPOINT; i++) { if (HE5_PTXPoint[ i ].active == 0) { pointID = i + HE5_PTIDOFFSET; HE5_PTXPoint[i].active = 1; HE5_PTXPoint[i].fid = fid; HE5_PTXPoint[i].pt_id = pt_id; HE5_PTXPoint[i].link_id = link_id; HE5_PTXPoint[i].data_id = data_id; strcpy(HE5_PTXPoint[ i ].ptname, pointname); for(j = 0; j < HE5_DTSETRANKMAX; j++) { HE5_PTXPoint[ i ].level[j].ID = FAIL; HE5_PTXPoint[ i ].level[j].name = NULL; } break; } } } else { /* Too many files opened */ pointID = FAIL; sprintf(errbuf, "\nNo more than %d points may be open simutaneously", HE5_NPOINT); H5Epush(__FILE__, "HE5_PTcreate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } COMPLETION: HE5_UNLOCK; return (pointID); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTchkptid | | | | DESCRIPTION: Checks for valid pointID and returns file ID, group ID, | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID hid_t point structure ID | | routname char Name of routine calling PTchkptid | | | | OUTPUTS: | | fid hid_t File ID | | gid hid_t group ID | | idx long Point index | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ static herr_t HE5_PTchkptid(hid_t pointID, const char *routname, hid_t *fid, hid_t *gid, long *idx) { herr_t status = SUCCEED;/* routine return status variable */ hid_t HDFfid = FAIL; /* HDF-EOS file ID */ hid_t idOffset = HE5_PTIDOFFSET;/* Point ID offset */ uintn access = 77; /* Read/Write access code */ char message1[] = "Invalid point ID: %d in routine \"%s\". ID must be >= %li and < %li.\n"; char message2[] = "Point ID %d in routine \"%s\" not active.\n"; char errbuf[HE5_HDFE_ERRBUFSIZE];/* error message buffer */ /* Check for valid point ID */ /* ------------------------ */ if (pointID < idOffset || pointID >= (HE5_NPOINT + idOffset) ) { status = FAIL; sprintf(errbuf, message1, pointID, routname, idOffset, (long)(HE5_NPOINT + idOffset) ); H5Epush(__FILE__, "HE5_PTchkptid", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } else { /* Check for active point ID */ /* ------------------------- */ if (HE5_PTXPoint[pointID % idOffset].active == 0) { status = FAIL; sprintf(errbuf, message2, pointID, routname); H5Epush(__FILE__, "HE5_PTchkptid", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } else { /* Get file and Point key */ /* ----------------------- */ *idx = (long)(pointID % idOffset); /* Get HDF-EOS file & "HDFEOS" group IDs */ /* -------------------------------------- */ *fid = HE5_PTXPoint[*idx].fid; status = HE5_EHchkfid(*fid,"", &HDFfid, gid, &access); } } return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTattach | | | | DESCRIPTION: Attaches to an existing point data set. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | pointID hid_t point structure ID | | | | INPUTS: | | fid hid_t HDF-EOS file ID | | pointname char point structure name | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 2/24/00 A.Muslimov Added error checkings and made cleanings. | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | 02/01/06 Abe Taaheri Added getting level names from Structure Metadata | | | | END_PROLOG | -----------------------------------------------------------------------------*/ hid_t HE5_PTattach(hid_t fid, const char *pointname) { hid_t pointID = FAIL; /* Point ID (return value) */ hid_t idOffset = HE5_PTIDOFFSET;/* Point ID offset */ hid_t HDFfid = FAIL; /* HDF file ID */ hid_t gid = FAIL; /* "POINTS" group ID */ hid_t data_id = FAIL; /* "Data" group ID */ hid_t link_id = FAIL; /* "Linkage" group ID */ hid_t pt_id = FAIL; /* Point group ID */ hid_t i,j; /* Loop index */ hid_t emptyslot = FAIL; /* Spare Point index */ int npointopen = 0; /* # of point structures opened */ int nlevels = 0; /* Number of levels in point */ int idx = FAIL;/* Return iteration index */ herr_t status = FAIL;/* routine return status variable */ uintn acs = 77; /* Access code */ pack tmpdata; /* Temporary pack structure */ char *grpname = (char *)NULL;/* group name */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ char LevelName[HE5_HDFE_UTLBUFSIZE]; char tempname[HE5_HDFE_UTLBUFSIZE]; hid_t tempid; HE5_LOCK; CHECKPOINTER(pointname); /* Check HDF-EOS file ID, get back HDF file ID and access code */ /* ----------------------------------------------------------- */ status = HE5_EHchkfid(fid, pointname, &HDFfid, &gid, &acs); if (status == SUCCEED) { /* Determine number of points currently opened */ /* ------------------------------------------- */ for (i = 0; i < HE5_NPOINT; i++) npointopen += HE5_PTXPoint[i].active; if (npointopen < HE5_NPOINT) { grpname = (char *)calloc( (strlen(pointname)+40), sizeof(char)); if( grpname == NULL ) { sprintf(errbuf, "Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_PTattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } strcpy( grpname, "/HDFEOS/POINTS/"); strcat( grpname, pointname); /* Try to open the Point group */ /* =========================== */ H5E_BEGIN_TRY{ pt_id = H5Gopen( HDFfid, grpname ); } H5E_END_TRY; if( pt_id == FAIL ) { sprintf(errbuf, "Point:\"%s\" does not exist within HDF-EOS file.\n",pointname) ; H5Epush(__FILE__, "HE5_PTattach", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } /* Attach to "Data" group */ /* ---------------------- */ data_id = H5Gopen( pt_id, "Data"); if( data_id == FAIL ) { sprintf(errbuf, "Cannot open the \"Data\" group in \"%s\" Point", pointname) ; H5Epush(__FILE__, "HE5_PTattach", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } /* Attach to "Linkage" group */ /* ------------------------- */ link_id = H5Gopen( pt_id, "Linkage"); if( link_id == FAIL ) { sprintf(errbuf, "Cannot open the \"Linkage\" group in \"%s\" Point", pointname) ; H5Epush(__FILE__, "HE5_PTattach", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } /* Setup External Arrays */ /* ---------------------- */ for (i = 0; i < HE5_NPOINT; i++) { /* Find empty entry in array */ /* ------------------------- */ if (HE5_PTXPoint[i].active == 0) { pointID = i + idOffset; HE5_PTXPoint[ i ].active = 1; HE5_PTXPoint[ i ].fid = fid; HE5_PTXPoint[ i ].pt_id = pt_id; HE5_PTXPoint[ i ].data_id = data_id; HE5_PTXPoint[ i ].link_id = link_id; strcpy(HE5_PTXPoint[ i ].ptname, pointname); break; } } emptyslot = i; /* Initialize the members of external arrays */ /* ========================================= */ for( i = 0; i < HE5_DTSETRANKMAX; i++ ) { HE5_PTXPoint[ emptyslot ].level[ i ].ID = FAIL; HE5_PTXPoint[ emptyslot ].level[ i ].name = NULL; tmpdata.level[ i ].name = NULL; tmpdata.level[ i ].ID = FAIL; } tmpdata.nlevels = 0; /* ---------------------------------------------------- */ /* Loop throuhgh the group "/HDFEOS/POINTS/../Data" to */ /* get the number of levels and level name list */ /* ---------------------------------------------------- */ strcat(grpname,"/Data"); idx = H5Giterate(data_id, grpname , NULL, (H5G_iterate_t)HE5_PTopenlevel, &tmpdata); if ( idx == FAIL ) { sprintf(errbuf, "Iteration of \"HE5_EHobj_info()\" operation failed.") ; H5Epush(__FILE__, "HE5_PTattach", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } free( grpname ); nlevels = tmpdata.nlevels; /* sort levels using structure metadata to set from 0 to nlevels */ /* ==================================== */ for(i=0; i < nlevels; i++ ) { status = HE5_PTgetlevelname_fromSM(pointID, i, LevelName); if ( status == FAIL ) { sprintf(errbuf, "Failed to get LevelName for the Level_%d.",i) ; H5Epush(__FILE__, "HE5_PTattach", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Remove double quotes */ /* -------------------- */ memmove(LevelName, LevelName + 1, strlen(LevelName) - 2); LevelName[strlen(LevelName) - 2] = 0; /* replace if needed for sorting */ /* ------------------------------*/ for(j=i; j < nlevels; j++) { if(strcmp(tmpdata.level[j].name,LevelName) == 0) { strcpy(tempname, tmpdata.level[i].name); tempid = tmpdata.level[ i ].ID; /*strcpy(tmpdata.level[i].name, tmpdata.level[j].name);*/ memmove(tmpdata.level[i].name, tmpdata.level[j].name, strlen(tmpdata.level[j].name) + 1); tmpdata.level[ i ].ID = tmpdata.level[ j ].ID; strcpy(tmpdata.level[j].name, tempname); tmpdata.level[ j ].ID = tempid; break; } } } /* Set the data for the PTXPoint array */ /* ==================================== */ for( i = 0; i < nlevels; i++ ) { HE5_PTXPoint[ emptyslot ].level[ i ].name = (char *)calloc( (strlen(tmpdata.level[i].name)+1), sizeof(char)); if ( HE5_PTXPoint[ emptyslot ].level[ i ].name == NULL ) { sprintf(errbuf, "Cannot allocate memory for the name.") ; H5Epush(__FILE__, "HE5_PTattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if ( tmpdata.level[ i ].name != NULL ) free(tmpdata.level[ i ].name); return(FAIL); } strcpy(HE5_PTXPoint[ emptyslot ].level[ i ].name, tmpdata.level[ i ].name); if ( tmpdata.level[ i ].name != NULL ) free(tmpdata.level[ i ].name); HE5_PTXPoint[ emptyslot ].level[ i ].ID = tmpdata.level[ i ].ID; } } else { /* Too many Points opened */ /* --------------------- */ pointID = FAIL; sprintf(errbuf,"No more than %d points may be open simutaneously", HE5_NPOINT); H5Epush(__FILE__, "HE5_PTattach", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } COMPLETION: HE5_UNLOCK; return(pointID); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTdetach | | | | DESCRIPTION: Releases a point data set and frees memory. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID hid_t None point structure ID | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 8/26/99 A. Muslimov Changed the type of fid from int32_t to hid_t. | | Feb,2000 A.Muslimov Fixed bug-prone release of IDs. | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_PTdetach(hid_t pointID) { herr_t status = FAIL;/* routine return status variable */ int j, k; /* Loop indices */ int nlevels = 0; /* Number of levels in point */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* HDFEOS group ID */ long idx = FAIL;/* Point index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* error message buffer */ HE5_LOCK; /* Check for valid point ID */ /* ------------------------ */ status = HE5_PTchkptid(pointID, "HE5_PTdetach", &fid, &gid, &idx); if (status == FAIL ) { sprintf(errbuf, "Checking for point ID failed. \n"); H5Epush(__FILE__, "HE5_PTdetach", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get number of levels */ /* -------------------- */ nlevels = HE5_PTnlevels(pointID); if(nlevels == FAIL) { sprintf(errbuf, "Cannot retrieve the number of levels. \n"); H5Epush(__FILE__, "HE5_PTdetach", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* close Point level datasets */ /* -------------------------- */ for (j = 0; j < nlevels; j++) { if ( HE5_PTXPoint[ idx ].level[ j ].ID > 0 ) { status = H5Dclose(HE5_PTXPoint[ idx ].level[ j ].ID); if(status == FAIL) { sprintf(errbuf, "Cannot release the level dataset ID\n"); H5Epush(__FILE__, "HE5_PTdetach", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } } /* close Point "Data" group */ /* -------------------------- */ if ( HE5_PTXPoint[ idx ].data_id > 0 ) { status = H5Gclose(HE5_PTXPoint[ idx ].data_id); if(status == FAIL) { sprintf(errbuf, "Cannot release the group \"Data\" group ID \n"); H5Epush(__FILE__, "HE5_PTdetach", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } /* close Point "Linkage" group */ /* --------------------------- */ if ( HE5_PTXPoint[idx].link_id > 0 ) { status = H5Gclose(HE5_PTXPoint[ idx ].link_id); if(status == FAIL) { sprintf(errbuf, "Cannot release the group \"Linkage\" group ID\n"); H5Epush(__FILE__, "HE5_PTdetach", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } /* close the Point group */ /* --------------------- */ if ( HE5_PTXPoint[ idx ].pt_id > 0 ) { status = H5Gclose(HE5_PTXPoint[ idx ].pt_id); if(status == FAIL) { sprintf(errbuf, "Cannot release the Point group ID\n"); H5Epush(__FILE__, "HE5_PTdetach", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } /* Clear entries from external arrays */ /* ---------------------------------- */ HE5_PTXPoint[ idx ].active = 0; HE5_PTXPoint[ idx ].fid = FAIL; HE5_PTXPoint[ idx ].data_id = FAIL; HE5_PTXPoint[ idx ].link_id = FAIL; HE5_PTXPoint[ idx ].pt_id = FAIL; for (j = 0; j < nlevels; j++) { HE5_PTXPoint[ idx ].level[ j ].ID = FAIL; if ( HE5_PTXPoint[ idx ].level[ j ].name != NULL ) free(HE5_PTXPoint[ idx ].level[ j ].name); } /* Free Region Pointers */ /* -------------------- */ for (k = 0; k < HE5_NPOINTREGN; k++) { if (HE5_PTXRegion[ k ] != NULL && HE5_PTXRegion[ k ]->pointID == pointID) { for (j = 0; j < HE5_DTSETRANKMAX; j++) { if (HE5_PTXRegion[ k ]->recPtr[ j ] != NULL) { free(HE5_PTXRegion[ k ]->recPtr[ j ]); } } free(HE5_PTXRegion[ k ]); HE5_PTXRegion[ k ] = NULL; } } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTclose | | | | DESCRIPTION: Closes HDF-EOS file | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | fid hid_t None File ID | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 7/20/99 A.Muslimov | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_PTclose(hid_t fid) { herr_t status = FAIL;/* routine return status variable */ /* Call HE5_EHclose to perform file close */ /* -------------------------------------- */ status = HE5_EHclose(fid); return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTnrecs | | | | DESCRIPTION: Returns the number of records in a level. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nrec hsize_t Number of records in level | | | | INPUTS: | | pointID hid_t point structure ID | | level int level number (0 - based) | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 12/13/99 A.Muslimov Added proper error handlings after the function| | calls. | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ hsize_t HE5_PTnrecs(hid_t pointID, int level) { hsize_t nrec = 1; /* Number of records in level (return value) */ herr_t status = FAIL;/* routine return status variable */ int i; /* loop index */ int nlevels = 0; /* Number of levels in point */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "POINTS" group ID */ hid_t space = FAIL; /* data space ID */ hid_t ID = FAIL; /* Level dataset ID */ long idx = FAIL; /* Point Index */ unsigned int zerobuf[HE5_DTSETRANKMAX]; char errbuf[HE5_HDFE_ERRBUFSIZE]; /* error message buffer */ for (i = 0; i < HE5_DTSETRANKMAX; i++) zerobuf[ i ] = 0; /* Check for valid point ID */ /* ------------------------ */ status = HE5_PTchkptid(pointID, "HE5_PTnrecs", &fid, &gid, &idx); if (status == FAIL ) { sprintf(errbuf, "Checking for point ID failed. \n"); H5Epush(__FILE__, "HE5_PTnrecs", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(0); } /* Get number of levels */ /* -------------------- */ nlevels = HE5_PTnlevels(pointID); if (nlevels == 0) { sprintf(errbuf, "No Levels Defined for point ID: %d\n", pointID); H5Epush(__FILE__, "HE5_PTnrecs", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(0); } else if (nlevels <= level) { /* Report error if level # to large */ /* -------------------------------- */ sprintf(errbuf, "Only %d levels Defined for point ID: %d\n", nlevels, pointID); H5Epush(__FILE__, "HE5_PTnrecs", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(0); } /* Get level dataset ID and number of records */ /* ------------------------------------------ */ ID = HE5_PTXPoint[idx].level[level].ID; space = H5Dget_space(ID); if (space == FAIL) { sprintf(errbuf, "Cannot get the data space ID.\n"); H5Epush(__FILE__, "HE5_PTnrecs", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(0); } nrec = H5Sget_simple_extent_npoints(space); if (nrec == 0) { sprintf(errbuf, "Cannot get the number of records.\n"); H5Epush(__FILE__, "HE5_PTnrecs", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(0); } status = H5Sclose(space); if (status == FAIL) { sprintf(errbuf, "Cannot release the data space ID.\n"); H5Epush(__FILE__, "HE5_PTnrecs", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(0); } /* If nrec = 1 check whether actual data has been written */ /* ------------------------------------------------------ */ if (nrec == 1) { /* read "_LevelWritten" Attribute */ /* ------------------------------- */ status = HE5_PTreadattr(pointID,"_LevelWritten", zerobuf); if (status == FAIL) { sprintf(errbuf, "Cannot read the \"_LevelWritten\" attribute.\n"); H5Epush(__FILE__, "HE5_PTnrecs", __LINE__, H5E_ATTR, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(0); } /* If level not yet written then reset nrec to 0 */ /* --------------------------------------------- */ if ( zerobuf[level] == 0) nrec = 0; } return(nrec); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTnlevels | | | | DESCRIPTION: Returns the number of levels in a point data set. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nlevels int Number of levels in point structure | | | | INPUTS: | | pointID hid_t point structure ID | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTnlevels(hid_t pointID) { int nlevels = FAIL; /* Number of levels in point (return value) */ herr_t status = SUCCEED;/* routine return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "POINTS" group ID */ long idx = FAIL; /* Point index */ char *grpname = (char *)NULL;/* Group name string buffer */ /* Check for valid point ID */ /* ------------------------ */ status = HE5_PTchkptid(pointID, "HE5_PTnlevels", &fid, &gid, &idx); if(status == SUCCEED ) { grpname = (char *) calloc( (strlen(HE5_PTXPoint[idx].ptname)+40),sizeof(char)); if( grpname == NULL) { H5Epush(__FILE__, "HE5_PTnlevels", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Can not allocate memory"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); return(FAIL); } /* Build the "grpname" string */ /* --------------------------- */ strcpy(grpname,"/HDFEOS/POINTS/"); strcat(grpname, HE5_PTXPoint[idx].ptname); strcat(grpname,"/Data"); /* Get number of levels (Number of entries) in Data group */ /* ------------------------------------------------------ */ nlevels = (int)HE5_EHdatasetcat(HE5_PTXPoint[idx].fid, grpname, NULL, NULL); free(grpname); } return(nlevels); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTfexist | | | | DESCRIPTION: Verify if field exist in a compound datatype and return | | the member data information | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | | | INPUTS: | | dataID hid_t Level dataset ID | | fldname char Field name | | | | OUTPUTS: | | size size_t Field data size (bytes) | | rank int Field rank | | dims[] size_t Array of field dimension sizes | | dtype hid_t Field data type ID | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | Oct 00 A.Muslimov Changed the interface. | | Mar 01 A.Muslimov Updated to reflect introduction of ARRAY class. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ static int HE5_PTfexist(hid_t dataID, const char *fldname, size_t *size, int *rank, size_t dims[], hid_t *dtype ) { int exist = FAIL; /* return flag value */ int i, j; /* loop indices */ herr_t status = FAIL; /* Return status variable */ hid_t typeID = FAIL; /* data type ID */ hsize_t dim_size[HE5_DTSETRANKMAX];/* array of dime. sizes */ HE5_CmpDTSinfo *info; /* Compound dataset info structure */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* error message buffer */ CHECKPOINTER(fldname); /* Allocate memory for info structure */ /* ---------------------------------- */ info = (HE5_CmpDTSinfo *)calloc(1, sizeof(HE5_CmpDTSinfo)); if (info == (HE5_CmpDTSinfo *)NULL) { sprintf(errbuf, "Cannot allocate memory for info structure.\n"); H5Epush(__FILE__, "HE5_PTfexist", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get level dataset type ID */ /* -------------------------- */ typeID = H5Dget_type(dataID); if (typeID == FAIL) { sprintf(errbuf, "Cannot get data type.\n"); H5Epush(__FILE__, "HE5_PTfexist", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(info); return(FAIL); } /* Initialize dim_size[] array */ /* --------------------------- */ for (i = 0; i < HE5_DTSETRANKMAX; i++) dim_size[i] = 0; /* Reset the flag */ /* -------------- */ exist = 0; /* get the number of members in compound datatype */ /* ---------------------------------------------- */ info->nfields = H5Tget_nmembers( typeID ); for( i = 0; i < info->nfields; i++ ) { /* Get member name */ /* --------------- */ info->fieldname[i] = H5Tget_member_name(typeID, i); if (info->fieldname[i] == NULL) { sprintf(errbuf, "Cannot get the field name.\n"); H5Epush(__FILE__, "HE5_PTfexist", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (info != NULL) free(info); return(FAIL); } /* Loop through all fields */ /* ----------------------- */ if( strncmp(info->fieldname[i], fldname, strlen(fldname)) == 0 ) { exist = 1; /* Get field disk data type */ /* ------------------------ */ info->dtype[i] = H5Tget_member_type(typeID, i); if (info->dtype[i] == FAIL) { sprintf(errbuf, "Cannot get the field data type.\n"); H5Epush(__FILE__, "HE5_PTfexist", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (info->fieldname[i] != NULL) H5free_memory(info->fieldname[i]); if (info != NULL) free(info); return(FAIL); } /* Get field data type */ /* ------------------- */ if (dtype != NULL) *dtype = info->dtype[i]; /* Get field data size */ /* ------------------- */ if (size != NULL) { /* Get the field disk data size (in bytes) */ /* --------------------------------------- */ *size = H5Tget_size(info->dtype[i]); if (*size == 0) { sprintf(errbuf, "Cannot get the field size.\n"); H5Epush(__FILE__, "HE5_PTfexist", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (info->fieldname[i] != NULL) H5free_memory(info->fieldname[i]); if (info != NULL) free(info); return(FAIL); } } /* Get the field rank and dimension sizes */ /* -------------------------------------- */ if (rank != NULL && dims != NULL) { /* Get field data class */ /* -------------------- */ info->dclass[i] = H5Tget_class(info->dtype[i]); if (info->dclass[i] == H5T_NO_CLASS) { sprintf(errbuf, "Cannot get the field class.\n"); H5Epush(__FILE__, "HE5_PTfexist", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (info->fieldname[i] != NULL) H5free_memory(info->fieldname[i]); if (info != NULL) free(info); return(FAIL); } /* Get the rank and "array" flag */ /* ----------------------------- */ if (info->dclass[i] == H5T_ARRAY) { /* Get the field rank */ /* ------------------ */ *rank = H5Tget_array_ndims(info->dtype[i]); if (*rank == FAIL) { sprintf(errbuf, "Cannot get the field rank.\n"); H5Epush(__FILE__, "HE5_PTfexist", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (info->fieldname[i] != NULL) H5free_memory(info->fieldname[i]); if (info != NULL) free(info); return(FAIL); } /* Get the field dimension sizes */ /* ----------------------------- */ status = H5Tget_array_dims(info->dtype[i],dim_size, NULL); if (status == FAIL) { sprintf(errbuf, "Cannot get the field dimension sizes.\n"); H5Epush(__FILE__, "HE5_PTfexist", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (info->fieldname[i] != NULL) H5free_memory(info->fieldname[i]); if (info != NULL) free(info); return(FAIL); } for (j = 0; j < *rank; j++) dims[j] = dim_size[j]; } else /* scalar */ { *rank = 1; dims[0] = 1; } } /* Release field type ID */ /* --------------------- */ status = H5Tclose(info->dtype[i]); if (status == FAIL) { sprintf(errbuf, "Cannot release data type ID.\n"); H5Epush(__FILE__, "HE5_PTfexist", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (info->fieldname[i] != NULL) H5free_memory(info->fieldname[i]); if (info != NULL) free(info); return(FAIL); } } /* Release pointers to the name buffers */ /* ------------------------------------ */ if (info->fieldname[i] != NULL) H5free_memory(info->fieldname[i]); } if (info != NULL) free(info); /* Release ID */ /* ---------- */ status = H5Tclose(typeID); if (status == FAIL) { sprintf(errbuf, "Cannot release data type ID.\n"); H5Epush(__FILE__, "HE5_PTfexist", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } COMPLETION: return(exist); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTnfields | | | | DESCRIPTION: Returns number of fields defined in a level. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nflds int Number of fields in a level | | | | INPUTS: | | pointID hid_t point structure ID | | level int level number (0 - based) | | | | OUTPUTS: | | strbufsize long String length of fieldlist | | fieldlist char Coma separated list of fields | | NOTES: | | | | | | Date Programmer Description | | ======== ============ ================================================= | | 12/16/99 A.Muslimov Added appropriate error handlings after the | | function calls. | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTnfields(hid_t pointID, int level, char *fieldlist, long *strbufsize) { int nflds = FAIL;/* Number of fields in a list (return) */ int nlevels = 0; /* Number of levels in point */ int i; /* Loop index */ herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* POINTS group ID */ hid_t levelID = FAIL;/* Level dataset ID */ hid_t tid = FAIL;/* Data type ID */ long idx = FAIL;/* Point index */ size_t strsize = 0; /* String length */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* error message buffer */ char *fldname = (char *)NULL; /* pointer to field name */ char *fldlist = (char *)NULL; /* pointer to field list */ /* Check for valid point ID */ /* ------------------------ */ status = HE5_PTchkptid(pointID, "HE5_PTnfields", &fid, &gid, &idx); if (status == FAIL ) { sprintf(errbuf, "Checking for point ID failed. \n"); H5Epush(__FILE__, "HE5_PTnfields", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get number of levels */ /* -------------------- */ nlevels = HE5_PTnlevels(pointID); if (nlevels == 0) { status = FAIL; sprintf(errbuf, "No Levels Defined for point ID: %d\n", pointID); H5Epush(__FILE__, "HE5_PTnfields", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } else if (nlevels <= level) { /* Report error if level # too large */ /* --------------------------------- */ status = FAIL; sprintf(errbuf, "Only %d levels Defined for point ID: %d\n", nlevels, pointID); H5Epush(__FILE__, "HE5_PTnfields", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get level dataset ID */ /* --------------------- */ levelID = HE5_PTXPoint[idx].level[level].ID; /* Get Compound dataset datatype ID */ /* -------------------------------- */ tid = H5Dget_type(levelID); if (tid == FAIL) { sprintf(errbuf, "Cannot get the compound data type ID. \n"); H5Epush(__FILE__, "HE5_PTnfields", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get number of fields( or number of members of compound type) */ /* ------------------------------------------------------------ */ nflds = H5Tget_nmembers(tid); if (nflds == FAIL) { sprintf(errbuf, "Cannot get the number of fields in compound data type. \n"); H5Epush(__FILE__, "HE5_PTnfields", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Allocate memory */ /* --------------- */ /* fldname = (char *)calloc(HE5_HDFE_NAMBUFSIZE, sizeof(char)); if( fldname == NULL) { H5Epush(__FILE__, "HE5_PTnfields", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory."); HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__); return(FAIL); } */ /* Get field list, field list size */ /* ------------------------------- */ for( i = 0; i < nflds; i++ ) { fldname = H5Tget_member_name(tid, i); if (fldname == NULL ) { sprintf(errbuf, "Cannot get the compound data field name. \n"); H5Epush(__FILE__, "HE5_PTnfields", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } strsize = strsize + strlen(fldname) + 1 ; if( i == 0 ) { fldlist = (char *) calloc( strsize, sizeof(char)); if( fldlist == NULL) { H5Epush(__FILE__, "HE5_PTnfields", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); nflds = FAIL; H5free_memory(fldname); break; } strcpy(fldlist,fldname); } else { fldlist= (char *)realloc(fldlist, sizeof(char)* strsize); if( fldlist==NULL) { H5Epush(__FILE__, "HE5_PTnfields", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); H5free_memory(fldname); nflds = FAIL; break; } strcat(fldlist,","); strcat(fldlist,fldname); } H5free_memory(fldname); } /* Release data type ID */ /* -------------------- */ status = H5Tclose(tid); if (status == FAIL ) { sprintf(errbuf, "Cannot release the compound data type ID. \n"); H5Epush(__FILE__, "HE5_PTnfields", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(fldlist); return(status); } /* Return fieldlist string size */ /* ---------------------------- */ if ( strbufsize != NULL ) { *strbufsize = (long)strlen(fldlist); } /* Also return a coma separated list of fields */ /* ------------------------------------------- */ if(fieldlist != NULL) strcpy(fieldlist, fldlist); free(fldlist); return(nflds); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTgetlevelname | | | | DESCRIPTION: Returns level name | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | | | INPUTS: | | pointID hid_t point structure ID | | level int level number (0 - based) | | | | | | OUTPUTS: | | levelname char Level name | | strbufsize long String length of fieldlist | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_PTgetlevelname(hid_t pointID, int level, char *levelname, long *strbufsize) { herr_t status = FAIL;/* routine return status variable */ int nlevels = 0; /* Number of levels in point */ hid_t fid = FAIL;/* HDF-EOS file id */ hid_t gid = FAIL;/* "POINTS" group ID */ long idx = FAIL;/* Point index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ /* Check for valid point ID */ /* ------------------------ */ status = HE5_PTchkptid(pointID, "HE5_PTgetlevelname", &fid, &gid, &idx); if (status == SUCCEED) { /* Get number of levels */ /* -------------------- */ nlevels = HE5_PTnlevels(pointID); if (nlevels == 0) { status = FAIL; sprintf(errbuf, "No Levels Defined for point ID: %d\n", pointID); H5Epush(__FILE__, "HE5_PTgetlevelname", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } else if (nlevels <= level) { /* Report error if level # to large */ /* -------------------------------- */ status = FAIL; sprintf(errbuf, "Only %d levels Defined for point ID: %d\n", nlevels, pointID); H5Epush(__FILE__, "HE5_PTgetlevelname", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } if (status == SUCCEED) { /* Get level name */ /* -------------- */ *strbufsize = (long)strlen(HE5_PTXPoint[ idx ].level[ level ].name); /* Return levelname if requested */ /* ----------------------------- */ if (levelname != NULL) strcpy(levelname,HE5_PTXPoint[ idx ].level[ level ].name) ; } } return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTopenlevel | | | | DESCRIPTION: Returns level ID and name | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | | | INPUTS: | | | | OUTPUTS: | | | | NOTES: | | | | | | Date Programmer Description | | ======= ========== ============== | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ hid_t HE5_PTopenlevel(hid_t loc_id, const char *name, void *opdata) { int i = 0; pack *ptr; ptr = (pack *)opdata; if( name != NULL ) { i = ptr->nlevels; if( ptr->level[i].name == NULL && ptr->level[i].ID == FAIL ) { ptr->level[i].name = (char *)calloc((strlen(name) + 1), sizeof(char)); strcpy( ptr->level[i].name, name ); ptr->level[i].ID = H5Dopen( loc_id, name ); } ptr->nlevels ++ ; } return 0; } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTdeflevel | | | | DESCRIPTION: Defines a level within the point data set. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID hid_t point structure ID | | levelname char name of level | | levelinfo HE5_CmpDTSinfo Pointer to the structure containing | | information about level dataset | | | | OUTPUTS: | | None | | | | NOTES: Metadata block needs to be developed | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Oct 00 A.Muslimov Revised and recoded. | | Mar 00 A.Muslimov Modified to reflect changes in HDF5 library: | | H5Tinsert_array should be replaced by two calls | | H5Tarray_create() and H5Tinsert(). | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | May 05 S.Zhao Added HE5_EHdtype2numtype() and HE5_EHhid2hsize() | | functions calls. | | Feb 06 Abe Taaheri Added support for H5T_STRING | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_PTdeflevel(hid_t pointID, const char *levelname, HE5_CmpDTSinfo *levelinfo) { herr_t status = FAIL;/* routine return status variable */ int i, j; /* Loop indices */ int nlevels = FAIL;/* Number of levels in point */ int rank = 1; /* Dataset rank */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* HDFEOS group ID */ hid_t dtsID = FAIL;/* Dataset ID */ hid_t space = FAIL;/* dataspace ID */ hid_t tid = FAIL;/* compound datatype ID */ hid_t fwdtid = FAIL;/* compound datatype ID */ hid_t bcktid = FAIL;/* compound datatype ID */ hid_t plist = FAIL;/* property list ID */ hid_t tempid = FAIL;/* temporary ID */ hid_t xfrlist = FAIL;/* Xfer property list ID */ hid_t arr_id = FAIL;/* Array datatype ID */ long idx = FAIL;/* Point index */ hsize_t dim = 1;/* Dimension size */ hsize_t dims[HE5_DTSETRANKMAX];/* Array of dimension sizes */ hsize_t chunkdim[1] = {HE5_NRECS};/* Record chunk size */ hsize_t maxdim = H5S_UNLIMITED;/* Max. dimension size */ hsize_t dum = 0;/* dummy variable */ hsize_t metadata[2]={0,0};/* Metadata input array */ hid_t ntype = FAIL; /* number type ID */ fwdptr ForwardData;/* Structure for forward pointer dataset */ char utlbuf[HE5_HDFE_UTLBUFSIZE];/* Utility buffer */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ int order; HE5_LOCK; CHECKNAME(levelname); CHECKPOINTER(levelinfo); /* Check for valid point ID */ /* ------------------------ */ status = HE5_PTchkptid(pointID, "HE5_PTdeflevel", &fid, &gid, &idx); if (status == FAIL ) { sprintf(errbuf, "Checking for point ID failed. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Check levelname for length */ /* -------------------------- */ if ( strlen(levelname) > HE5_OBJNAMELENMAX) { sprintf(errbuf, "Levelname \"%s\" more than %d characters.\n", levelname, HE5_OBJNAMELENMAX); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Initialize Forward Pointer buffer */ /* --------------------------------- */ ForwardData.begin = FAIL; ForwardData.extent = FAIL; /* Get number of levels in points */ /* ------------------------------ */ nlevels = HE5_PTnlevels(pointID); if(nlevels == FAIL) { sprintf(errbuf, "Cannot retrieve the number of levels\n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Create dataspace with rank=1, dim=1(1 record), unlimited */ /* -------------------------------------------------------- */ space = H5Screate_simple(rank, &dim, &maxdim); if (space == FAIL) { sprintf(errbuf, "Cannot create the data space. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Create and modify dataset property, enable chunking */ /* --------------------------------------------------- */ plist = H5Pcreate(H5P_DATASET_CREATE); if (plist == FAIL) { sprintf(errbuf, "Cannot create a property list ID. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Enable chunking */ /* --------------- */ status = H5Pset_chunk(plist, rank, chunkdim); if (status == FAIL ) { sprintf(errbuf, "Cannot set chunking. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Create the memory compound data type */ /* ------------------------------------ */ tid = H5Tcreate(H5T_COMPOUND, levelinfo->datasize); if (tid == FAIL) { sprintf(errbuf, "Cannot create the data type ID. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Add members to the compound data type */ /* ------------------------------------- */ for (i = 0; i < levelinfo->nfields; i++) { /* Check if the field is an array */ /* ------------------------------ */ if (levelinfo->array[i] == TRUE) { for (j = 0; j < levelinfo->rank[i]; j++) dims[j] = (hsize_t)levelinfo->dims[i][j]; /* Create array datatypes */ /* ---------------------- */ arr_id = H5Tarray_create(levelinfo->dtype[i], levelinfo->rank[i], (const hsize_t *)dims, NULL); if (arr_id == FAIL) { sprintf(errbuf, "Cannot create \"array\" datatype. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Add array field */ /* --------------- */ status = H5Tinsert(tid,levelinfo->fieldname[i], levelinfo->offset[i], arr_id); if (status == FAIL) { sprintf(errbuf, "Cannot insert \"array\" element. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Release the data type ID */ /* ------------------------ */ status = H5Tclose(arr_id); if (status == FAIL ) { sprintf(errbuf, "Cannot release data type ID. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { /* Add atomic field */ /* ---------------- */ status = H5Tinsert(tid,levelinfo->fieldname[i], levelinfo->offset[i],levelinfo->dtype[i]); if (status == FAIL) { sprintf(errbuf, "Cannot insert \"array\" element. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } } /* Create (appendable) dataset for the level */ /* ----------------------------------------- */ dtsID = H5Dcreate(HE5_PTXPoint[idx].data_id, levelname, tid, space, plist); if (dtsID == FAIL) { sprintf(errbuf, "Cannot create the dataset. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Extend the dataset */ /* ------------------ */ status = H5Dextend(dtsID, &dim); if (status == FAIL ) { sprintf(errbuf, "Cannot extend the dataset. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release the data type ID */ /* ------------------------ */ status = H5Tclose(tid); if (status == FAIL ) { sprintf(errbuf, "Cannot release data type ID. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release the data space ID */ /* ------------------------- */ status = H5Sclose(space); if (status == FAIL ) { sprintf(errbuf, "Cannot release data space ID. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release the property list ID */ /* ---------------------------- */ status = H5Pclose(plist); if (status == FAIL ) { sprintf(errbuf, "Cannot release a property list ID. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_PLIST, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Store dataset ID and name in external array */ /* ------------------------------------------- */ HE5_PTXPoint[idx].level[nlevels].ID = dtsID; HE5_PTXPoint[idx].level[nlevels].name = (char *)calloc((strlen(levelname)+1), sizeof(char)); strcpy(HE5_PTXPoint[idx].level[nlevels].name, levelname); /* If previous levels exist ... */ /* ---------------------------- */ if (nlevels > 0) { /* Create dataspace with rank=1, dim=1(1 record), unlimited */ space = H5Screate_simple(rank, &dim, &maxdim); if (space == FAIL) { sprintf(errbuf, "Cannot create the data space. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Create property list */ /* -------------------- */ plist = H5Pcreate(H5P_DATASET_CREATE); if (plist == FAIL) { sprintf(errbuf, "Cannot create a property list ID. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Enable chunking */ /* --------------- */ status = H5Pset_chunk(plist,rank, chunkdim); if (status == FAIL ) { sprintf(errbuf, "Cannot set chunking. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Create compound data type */ /* ------------------------- */ bcktid = H5Tcreate(H5T_COMPOUND, sizeof(bckptr)); if (bcktid == FAIL) { sprintf(errbuf, "Cannot create a compound datatype. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Add back pointer data member */ /* ---------------------------- */ status = H5Tinsert(bcktid,"BCKPOINTER", HOFFSET(bckptr, back), H5T_NATIVE_LLONG); if (status == FAIL ) { sprintf(errbuf, "Cannot add a new member named \"BCKPOINTER\"to a compound datatype. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Set name of BCKPOINTER dataset */ /* ------------------------------ */ sprintf(utlbuf, "%s%d%s%d", "BCKPOINTER:", nlevels, "->", nlevels - 1); /* Create (appendable) compound dataset */ /* ------------------------------------ */ tempid = H5Dcreate(HE5_PTXPoint[idx].link_id, utlbuf, bcktid, space, plist); if (tempid == FAIL) { sprintf(errbuf, "Cannot create the dataset. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Extend the dataset */ /* ------------------ */ status = H5Dextend(tempid, &dim); if (status == FAIL ) { sprintf(errbuf, "Cannot extend the dataset. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return status; } /* Release the data type ID */ /* ------------------------ */ status = H5Tclose(bcktid); if (status == FAIL) { sprintf(errbuf, "Cannot release the data type ID. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return status; } /* Release the data space ID */ /* ------------------------- */ status = H5Sclose(space); if (status == FAIL ) { sprintf(errbuf, "Cannot release the data space ID. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return status; } /* Release the dataset ID */ /* ---------------------- */ status = H5Dclose(tempid); if (status == FAIL ) { sprintf(errbuf, "Cannot release the dataset ID. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return status; } /* Setup Forward Pointer dataset */ /* ----------------------------- */ /* Set name of FWDPOINTER dataset */ /* ------------------------------ */ sprintf(utlbuf, "%s%d%s%d", "FWDPOINTER:", nlevels - 1,"->", nlevels); /* Create dataspace with rank=1, dim=1(1 record), unlimited */ /* -------------------------------------------------------- */ space = H5Screate_simple(rank, &dim, &maxdim); if (space == FAIL) { sprintf(errbuf, "Cannot create the data space ID. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Create the memory data type */ /* --------------------------- */ fwdtid = H5Tcreate(H5T_COMPOUND, sizeof(fwdptr)); if (fwdtid == FAIL) { sprintf(errbuf, "Cannot create a compound datatype. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Insert "BEGIN" data member to the dataset */ /* ----------------------------------------- */ status = H5Tinsert(fwdtid,"BEGIN", HOFFSET(fwdptr, begin), H5T_NATIVE_LLONG); if (status == FAIL) { sprintf(errbuf, "Cannot add a new member named \"BEGIN\"to a compound datatype. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Insert "EXTENT" data member to the dataset */ /* ------------------------------------------ */ status = H5Tinsert(fwdtid,"EXTENT", HOFFSET(fwdptr, extent), H5T_NATIVE_LLONG); if (status == FAIL ) { sprintf(errbuf, "Cannot add a new member named \"EXTENT\"to a compound datatype. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Create (appendable) dataset */ /* --------------------------- */ tempid = H5Dcreate(HE5_PTXPoint[idx].link_id, utlbuf, fwdtid, space, plist); if (tempid == FAIL) { sprintf(errbuf, "Cannot create the dataset. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Extend the dataset */ /* ------------------ */ status = H5Dextend(tempid, &dim); if (status == FAIL ) { sprintf(errbuf, "Cannot extend the dataset. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return status; } /* Create X-fer property list */ /* -------------------------- */ xfrlist = H5Pcreate(H5P_DATASET_XFER); if (xfrlist == FAIL) { sprintf(errbuf, "Cannot create x-fer property list ID. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Set type conversion and background buffer */ /* ----------------------------------------- */ status = H5Pset_buffer(xfrlist,sizeof(fwdptr), NULL, NULL); if (status == FAIL) { sprintf(errbuf, "Cannot set the buffer. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Write out buffer (with -1 fill value) to establish dataset */ /* --------------------------------------------------------- */ status = H5Dwrite(tempid, fwdtid, H5S_ALL, H5S_ALL, xfrlist, &ForwardData); if (status == FAIL) { sprintf(errbuf, "Cannot write data to the dataset. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return status; } /* Release the data type ID */ /* ------------------------ */ status = H5Tclose(fwdtid); if (status == FAIL) { sprintf(errbuf, "Cannot release the data type ID. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return status; } /* Release the data space ID */ /* ------------------------- */ status = H5Sclose(space); if (status == FAIL) { sprintf(errbuf, "Cannot release the data space ID. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return status; } /* Release the property list ID */ /* ---------------------------- */ status = H5Pclose(plist); if (status == FAIL ) { sprintf(errbuf, "Cannot release the property list ID. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_PLIST, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return status; } /* Release the x-ferproperty list ID */ /* --------------------------------- */ status = H5Pclose(xfrlist); if (status == FAIL ) { sprintf(errbuf, "Cannot release the property list ID. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_PLIST, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return status; } /* Release the dataset ID */ /* ---------------------- */ status = H5Dclose(tempid); if (status == FAIL) { sprintf(errbuf, "Cannot release the dataset ID. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return status; } } /* ************************************************************** * M E T A D A T A S E C T I O N * ************************************************************** */ /* Insert Point Level metadata */ /* --------------------------- */ status = HE5_EHinsertmeta(fid , HE5_PTXPoint[idx].ptname, "p", 10L, (char *)levelname, &dum); if (status == FAIL) { sprintf(errbuf, "Cannot insert Point Level metadata \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return status; } for (i = 0; i < levelinfo->nfields; i++) { /* Concatenate fieldname with level name */ /* ------------------------------------- */ memmove(utlbuf, levelinfo->fieldname[i], strlen(levelinfo->fieldname[i])); utlbuf[strlen(levelinfo->fieldname[i])] = 0; strcat(utlbuf, ":"); strcat(utlbuf, levelname); /* Load ntype and field order into metadata input array */ /* ---------------------------------------------------- */ levelinfo->dclass[i] = H5Tget_class(levelinfo->dtype[i]); /* If datatype class is H5T_STRING, then the field is string type */ if (levelinfo->dclass[i] == H5T_STRING) { ntype = HE5T_CHARSTRING; } else { ntype = HE5_EHdtype2numtype(levelinfo->dtype[ i ]); } if (ntype == FAIL) { sprintf(errbuf, "Cannot get the number type ID. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } else if (ntype == 0) { metadata[0] = 0; } else { metadata[0] = HE5_EHhid2hsize(ntype); if (metadata[0] == 0) { sprintf(errbuf, "Cannot convert \"hid_t\" to \"hsize_t\" data type. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } if (levelinfo->array[i] == TRUE) { order = levelinfo->rank[i]; metadata[1] = order; } else { metadata[1] = 1; } /* Set field order (change order = 0 to order = 1) for scalars*/ /* ---------------------------------------------------------- */ if (metadata[1] == 0) { metadata[1] = 1; } /* Insert point field metadata */ /* --------------------------- */ status = HE5_EHinsertmeta(fid, HE5_PTXPoint[idx].ptname, "p", 11L, utlbuf, metadata); if (status == FAIL) { sprintf(errbuf, "Cannot insert Point Field metadata \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return status; } } COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTdeflinkage | | | | DESCRIPTION: Defines link field between two (adjacent) levels. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID hid_t point structure ID | | parent char parent level name | | child char child level name | | linkfield char linkage field name | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ========= ============ ============================================== | | 12/13/99 A.Muslimov Added proper error handlings after the function | | calls. In the call EHinsertmeta() replaced gid | | by fid. | | 1/06/00 A.Muslimov Changed datatype of "dum" from int32_t to hsize_t| | to make a call to EHinsertmeta() successfull. | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | Oct 00 A.Muslimov Modified to reflect changes in HE5_PTfexist(). | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_PTdeflinkage(hid_t pointID, char *parent, char *child, char *linkfield) { herr_t status = FAIL;/* routine return status variable */ int i; /* Loop index */ int nlevels = FAIL;/* Number of levels in point */ int foundParent = FAIL;/* Found parent level flag */ int foundChild = FAIL;/* Found child level flag */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* POINTS group ID */ hid_t dtsid = FAIL;/* Dataset ID */ long idx = FAIL;/* Point index */ hsize_t dum = 0;/* dammy variable */ char utlbuf[HE5_HDFE_UTLBUFSIZE];/* Utility buffer */ char *mess = "Linkage Field \"%s\" not found in Parent Level: \"%s\".\n"; char errbuf[HE5_HDFE_ERRBUFSIZE];/* error message buffer */ HE5_LOCK; CHECKPOINTER(parent); CHECKPOINTER(child); CHECKPOINTER(linkfield); /* Check for valid point ID */ /* ------------------------ */ status = HE5_PTchkptid(pointID, "HE5_PTdeflinkage", &fid, &gid, &idx); if (status == FAIL ) { sprintf(errbuf, "Checking for point ID failed. \n"); H5Epush(__FILE__, "HE5_PTdeflinkage", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get number of levels in point */ /* ----------------------------- */ nlevels = HE5_PTnlevels(pointID); if(nlevels == FAIL) { sprintf(errbuf, "Cannot retrieve the number of levels\n"); H5Epush(__FILE__, "HE5_PTdeflinkage", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* For all levels ... */ /* ------------------ */ for (i = 0; i < nlevels; i++) { /* Get level data ID and name */ /* -------------------------- */ dtsid = HE5_PTXPoint[idx].level[i].ID; strcpy(utlbuf, HE5_PTXPoint[idx].level[i].name); /* If equal to parent level name ... */ /* --------------------------------- */ if (strcmp(utlbuf, parent) == 0) { /* Set found parent flag */ /* --------------------- */ foundParent = i; /* Check if linkfield exists in parent level */ if (HE5_PTfexist(dtsid,linkfield,NULL,NULL,NULL,NULL) == 1 ) { break; } else { /* ... else report error */ /* --------------------- */ status = FAIL; sprintf(errbuf, mess, linkfield, parent); H5Epush(__FILE__, "HE5_PTdeflinkage", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); break; } } } /* For all levels ... */ /* ------------------ */ for (i = 0; i < nlevels; i++) { /* Get level ID and name */ /* -------------------------- */ dtsid = HE5_PTXPoint[idx].level[i].ID; strcpy(utlbuf, HE5_PTXPoint[idx].level[i].name); /* If equal to child level name ... */ /* -------------------------------- */ if (strcmp(utlbuf, child) == 0) { /* Set found child flag */ /* -------------------- */ foundChild = i; /* Check if linkfield exists in patent level */ if (HE5_PTfexist(dtsid,linkfield,NULL,NULL,NULL,NULL) == 1 ) { break; } else { /* ... else report error */ /* --------------------- */ status = FAIL; sprintf(errbuf, mess, linkfield, parent); H5Epush(__FILE__, "HE5_PTdeflinkage", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); break; } } } /* Report parent level not found if relevant */ /* ----------------------------------------- */ if (foundParent == FAIL) { status = FAIL; sprintf(errbuf, "Parent Level: \"%s\" not found.\n", parent); H5Epush(__FILE__, "HE5_PTdeflinkage", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf ); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Report child level not found if relevant */ /* ---------------------------------------- */ if (foundChild == FAIL) { status = FAIL; sprintf(errbuf, "Child Level: \"%s\" not found.\n", child); H5Epush(__FILE__, "HE5_PTdeflinkage", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf ); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Check that parent and child levels are adjacent */ /* ----------------------------------------------- */ if (foundParent != FAIL && foundChild != FAIL && foundChild - foundParent != 1) { status = FAIL; sprintf(errbuf, "Parent/Child Levels not adjacent \"%s/%s\".\n", parent, child); H5Epush(__FILE__, "HE5_PTdeflinkage", __LINE__, H5E_BTREE, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Insert linkage info in structural metadata */ /* ------------------------------------------ */ sprintf(utlbuf, "%s%s%s%s%s", parent, "/", child, ":", linkfield); status = HE5_EHinsertmeta(fid, HE5_PTXPoint[idx].ptname, "p", 12L, utlbuf, &dum); if(status == FAIL) { sprintf(errbuf, "Cannot insert metadata for the \"%s\" point\n", HE5_PTXPoint[idx].ptname); H5Epush(__FILE__, "HE5_PTdeflinkage", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTwritesetup | | | | DESCRIPTION: | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID hid_t HDFEOS point ID | | level int level number (0 - based) | | | | OUTPUTS: | | nrec hssize_t Number of current records | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | 8/26/99 A.Muslimov Added a new variable count to pass as a 4th argument| | to PTwriteattr(). | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | Oct 00 A.Muslimov Modified to reflect chages in other interfaces. | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | END_PROLOG | -----------------------------------------------------------------------------*/ static herr_t HE5_PTwritesetup(hid_t pointID, int level, hssize_t *nrec) { herr_t status = FAIL;/* routine return status variable */ int i; /* loop index */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* POINTS group ID */ long idx = FAIL;/* Point index */ unsigned int zerobuf[HE5_DTSETRANKMAX]; hsize_t count[HE5_DTSETRANKMAX];/* # of attribute elements */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* error messge buffer */ HE5_LOCK; for (i = 0; i < HE5_DTSETRANKMAX; i++) { zerobuf[ i ] = 0; count[ i ] = 0; } /* Check for valid point ID */ /* ------------------------ */ status = HE5_PTchkptid(pointID, "HE5_PTwritesetup", &fid, &gid, &idx); if (status == FAIL) { sprintf(errbuf, "Checking for point ID failed. \n"); H5Epush(__FILE__, "HE5_PTwritesetup", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get current number of records */ /* ----------------------------- */ *nrec = (hssize_t)HE5_PTnrecs(pointID, level); if (*nrec == 0) { /* Read "_LevelWritten" Attribute */ /* ------------------------------- */ status = HE5_PTreadattr(pointID,"_LevelWritten", zerobuf); if (status == FAIL) { sprintf(errbuf, "Cannot read the attribute \"_LevelWritten\". \n"); H5Epush(__FILE__, "HE5_PTwritesetup", __LINE__, H5E_ATTR, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* If level not yet written then write it */ /* -------------------------------------- */ if ( zerobuf[level] == 0) { zerobuf[ level ] = 1; count[ level ] = 1; /* Write "1" to "_LevelWritten" record for this level */ /* -------------------------------------------------- */ status = HE5_PTwriteattr(pointID, "_LevelWritten", H5T_NATIVE_UINT, count, zerobuf); if (status == FAIL) { sprintf(errbuf, "Cannot write record to the attribute \"_LevelWritten\". \n"); H5Epush(__FILE__, "HE5_PTwritesetup", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTwritelevel | | | | DESCRIPTION: Writes full records to a level. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID hid_t point structure ID | | level int level number (0 - based) | | count[] hsize_t Number of records to write | | size size_t Data size (bytes) to write | | data void data buffer | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ========== ============ ============================================= | | 12/13/99 A.Muslimov Added proper error handlings after the function | | calls. | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | Oct 00 A.Muslimov Changed the interface to make it consistent with| | writing data to compound dataset. | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | 02/01/06 Abe Taaheri use the same pointID for both HE5_PTwrbckptr & | | HE5_PTwrfwdptr calls | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_PTwritelevel(hid_t pointID, int level, hsize_t count[], size_t *size, void *data) { herr_t status = FAIL;/* routine return status variable */ int nlevels = FAIL;/* Number of levels in point */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* POINTS group ID */ hid_t dataID = FAIL;/* dataset ID */ hid_t typeID = FAIL;/* data type ID */ hid_t xfer_list = FAIL;/* Property list ID */ long idx = FAIL;/* Point index */ hssize_t nrec = FAIL;/* Current number of records */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ hid_t savePointID; size_t datasize = 0; /* datatype size for data in level records */ HE5_CmpDTSinfo inStruct; herr_t readstatus; unsigned char *newdatabuff = NULL; /* buffer for old + new records in level */ unsigned char *val = NULL; /* buffer for reading old records in level */ hsize_t tcount[1]; HE5_LOCK; CHECKPOINTER(count); CHECKPOINTER(size); CHECKPOINTER(data); tcount[0] = count[0]; /* Check for valid point ID */ /* ------------------------ */ status = HE5_PTchkptid(pointID, "HE5_PTwritelevel", &fid, &gid, &idx); if (status == FAIL ) { sprintf(errbuf, "Checking for file ID failed. \n"); H5Epush(__FILE__, "HE5_PTwritelevel", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get the current number of records */ /* --------------------------------- */ status = HE5_PTwritesetup(pointID, level, &nrec); if(status == FAIL) { sprintf(errbuf, "Cannot retrieve the current number of records\n"); H5Epush(__FILE__, "HE5_PTwritelevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get number of levels */ /* -------------------- */ nlevels = HE5_PTnlevels(pointID); if(nlevels == FAIL) { sprintf(errbuf, "Cannot retrieve the number of levels\n"); H5Epush(__FILE__, "HE5_PTwritelevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Report error if no levels (dataset) defined */ /* ------------------------------------------- */ if (nlevels == 0) { status = FAIL; sprintf(errbuf, "No Levels Defined for point ID: %d\n", pointID); H5Epush(__FILE__, "HE5_PTwritelevel", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } else if (nlevels < level) { /* Report error if level # to large */ /* -------------------------------- */ status = FAIL; sprintf(errbuf, "Only %d levels Defined for point ID: %d\n", nlevels, pointID); H5Epush(__FILE__, "HE5_PTwritelevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* If level already has records, append to it */ if(nrec > 0) { /* read nrec records and append data to it */ readstatus = HE5_PTreadlevel(pointID, level, &inStruct, &datasize, NULL); if (readstatus == FAIL ) { sprintf(errbuf, "Checking for datasize of records in level failed. \n"); H5Epush(__FILE__, "HE5_PTwritelevel", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(readstatus); } readstatus = HE5_PTlevelinfo(pointID, level, &inStruct); if (readstatus == FAIL ) { sprintf(errbuf, "Checking for info on level failed. \n"); H5Epush(__FILE__, "HE5_PTwritelevel", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(readstatus); } val = (unsigned char *)calloc(nrec, datasize); if(val == NULL) { sprintf(errbuf, "Cannot allocate memory for the buffer for reading existing records.\n"); H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } readstatus = HE5_PTreadlevel(pointID, level, &inStruct, &datasize, (void *)val); if (readstatus == FAIL ) { sprintf(errbuf, "Reading existing records in level failed. \n"); H5Epush(__FILE__, "HE5_PTwritelevel", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(readstatus); } /* allocate memory for the buffer to hold all existing and new records */ newdatabuff = (unsigned char*)calloc((nrec+tcount[0]), datasize); /* copy existing records to newdatabuff */ memcpy(newdatabuff, val, nrec * datasize); if( val != NULL) { free(val); val = NULL; } /* add new records to newdatabuff */ memcpy(newdatabuff+(nrec * datasize), data, tcount[0]*datasize); tcount[0] = tcount[0]+nrec; } /* Get the level dataset ID */ /* ------------------------- */ dataID = HE5_PTXPoint[idx].level[level].ID; /* Extend the dataset size */ /* ----------------------- */ status = H5Dextend(dataID, tcount); if (status == FAIL) { sprintf(errbuf, "Cannot extend the dataset. \n"); H5Epush(__FILE__, "HE5_PTwritelevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the datatype ID */ /* ------------------- */ H5Eset_auto(NULL, NULL); typeID = H5Dget_type(dataID); if (typeID == FAIL) { sprintf(errbuf, "Cannot get data type ID. \n"); H5Epush(__FILE__, "HE5_PTwritelevel", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Create the property list */ /* ------------------------ */ xfer_list = H5Pcreate(H5P_DATASET_XFER); if (xfer_list == FAIL) { sprintf(errbuf, "Cannot create the property list ID. \n"); H5Epush(__FILE__, "HE5_PTwritelevel", __LINE__, H5E_PLIST, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Set type conversion and background buffer */ /* ----------------------------------------- */ status = H5Pset_buffer(xfer_list, *size, NULL, NULL); if (status == FAIL) { sprintf(errbuf, "Cannot set type conversion and background buffer. \n"); H5Epush(__FILE__, "HE5_PTwritelevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Write data to the dataset */ /* ------------------------- */ if(nrec > 0) { status = H5Dwrite(dataID, typeID, H5S_ALL, H5S_ALL, xfer_list, (void *)newdatabuff); if (status == FAIL) { sprintf(errbuf, "Cannot write data to the dataset. \n"); H5Epush(__FILE__, "HE5_PTwritelevel", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } if(newdatabuff != NULL) { free(newdatabuff); newdatabuff = NULL; } } else { status = H5Dwrite(dataID, typeID, H5S_ALL, H5S_ALL, xfer_list, (void *)data); if (status == FAIL) { sprintf(errbuf, "Cannot write data to the dataset. \n"); H5Epush(__FILE__, "HE5_PTwritelevel", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } /* Release data type ID */ /* -------------------- */ status = H5Tclose(typeID); if (status == FAIL) { sprintf(errbuf, "Cannot release the data type ID. \n"); H5Epush(__FILE__, "HE5_PTwritelevel", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release property list ID */ /* ------------------------ */ status = H5Pclose(xfer_list); if (status == FAIL) { sprintf(errbuf, "Cannot release the property list ID. \n"); H5Epush(__FILE__, "HE5_PTwritelevel", __LINE__, H5E_PLIST, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } if (level > 0) { savePointID = pointID; /* Write BackPointers */ /* ------------------ */ status = HE5_PTwrbckptr(pointID, level); if (status == FAIL) { sprintf(errbuf, "Cannot write back pointer records. \n"); H5Epush(__FILE__, "HE5_PTwritelevel", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Write FwdPointers */ /* ----------------- */ status = HE5_PTwrfwdptr(savePointID, level - 1); if (status == FAIL) { sprintf(errbuf, "Cannot write forward pointer records. \n"); H5Epush(__FILE__, "HE5_PTwritelevel", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTwriteattr | | | | DESCRIPTION: | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID hid_t point structure ID | | attrname char attribute name | | numtype hid_t attribute HDF numbertype | | count hsize_t Number of attribute elements | | wrcode char Read/Write Code "w/r" | | datbuf void I/O buffer | | | | OUTPUTS: | | datbuf | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_PTwriteattr(hid_t pointID, const char *attrname, hid_t numtype, hsize_t count[],void * datbuf) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* HDFEOS group ID */ long idx = FAIL;/* Point index */ hid_t ntype; HE5_LOCK; CHECKNAME(attrname); CHECKPOINTER(count); CHECKPOINTER(datbuf); /* if numtype is HE5 numbertype, rather than H5 numbertype, then convert it, otherwise use numtype itself */ ntype = HE5_EHconvdatatype(numtype); if(ntype == FAIL) { ntype = numtype; } /* Check Point ID */ /* -------------- */ status = HE5_PTchkptid(pointID, "HE5_PTwriteattr", &fid, &gid, &idx); if (status == SUCCEED) { /* Perform Attribute I/O */ /* --------------------- */ status = HE5_EHattr(HE5_PTXPoint[idx].pt_id, attrname, ntype, count,"w", datbuf); } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTreadattr | | | | DESCRIPTION: Reads attribute from a point. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID hid_t point structure ID | | attrname char attribute name | | | | OUTPUTS: | | datbuf void I/O buffer | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_PTreadattr(hid_t pointID, const char *attrname, void *datbuf) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t tid = FAIL;/* Data type ID */ hid_t gid = FAIL;/* POINTS group ID */ hsize_t count[] = {0}; /* Number of elements */ long idx = FAIL;/* Point index */ HE5_LOCK; CHECKPOINTER(attrname); /* Check Point ID */ /* -------------- */ status = HE5_PTchkptid(pointID, "HE5_PTreadattr", &fid, &gid, &idx); if (status == SUCCEED) { /* Get attribute group ID and call EHattr to perform I/O */ /* ------------------------------------------------------ */ status = HE5_EHattr(HE5_PTXPoint[idx].pt_id, attrname, tid, count, "r", datbuf); } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTlevelinfo | | | | DESCRIPTION: Returns information about a given level. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID hid_t point structure ID | | level int level number (0 - based) | | | | | | OUTPUTS: | | info HE5_CmpDTSinfo Structure containing information about | | specified level. | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | Oct 00 A.Muslimov Changed the interface. | | Aug 04 S.Zhao Added the number type for a field in a point level. | | Feb 06 Abe Taaheri Added support for STRING fields and size of || structure | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_PTlevelinfo(hid_t pointID, int level, HE5_CmpDTSinfo *info) { herr_t status = SUCCEED; /* routine return status variable */ int nlevels = 0; /* Number of levels in point */ int i, j; /* Loop indices */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t levelID = FAIL; /* data ID */ hid_t gid = FAIL; /* "POINTS" group ID */ hid_t typeID = FAIL; /* Data type ID */ hid_t btypeID = FAIL; /* Base Data type ID */ hid_t mdt[HE5_FLDNUMBERMAX] = {FAIL}; /* Member data type ID */ hsize_t dims[HE5_DTSETRANKMAX];/* Array of dimension sizes */ long idx = FAIL; /* Point index */ size_t *size = (size_t *)NULL;/* data size (bytes) */ size_t *order = (size_t *)NULL;/* data byte order */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Check for valid point ID */ /* ------------------------ */ status = HE5_PTchkptid(pointID, "HE5_PTlevelinfo", &fid, &gid, &idx); if (status == FAIL) { sprintf(errbuf, "Checking for Point ID failed. \n"); H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Initialize the members of a structure */ /* ------------------------------------- */ info->nfields = FAIL; info->datasize = 0; for (i = 0; i < HE5_FLDNUMBERMAX; i++) { info->rank[i] = FAIL; info->array[i] = FALSE; info->offset[i] = FAIL; info->dtype[i] = FAIL; info->numtype[i] = FAIL; info->dclass[i] = H5T_NO_CLASS; for (j = 0; j < HE5_DTSETRANKMAX; j++) info->dims[i][j] = 0; } /* Initialize dims[] array */ /* ----------------------- */ for (i = 0; i < HE5_DTSETRANKMAX; i++) dims[ i ] = 0; /* Get number of levels */ /* -------------------- */ nlevels = HE5_PTnlevels(pointID); if (nlevels == 0) { sprintf(errbuf, "No Levels Defined for point ID: %d\n", pointID); H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } else if (nlevels < level) { /* Report error if level # to large */ /* -------------------------------- */ sprintf(errbuf, "Only %d levels Defined for point ID: %d\n", nlevels, pointID); H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get data ID of point level */ /* -------------------------- */ levelID = HE5_PTXPoint[idx].level[level].ID; /* Get compound datatype id */ /* ------------------------ */ typeID = H5Dget_type(levelID); if (typeID == FAIL) { sprintf(errbuf, "Cannot get the datatype ID for a level.\n"); H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get number of fields */ /* -------------------- */ info->nfields = H5Tget_nmembers(typeID); if (info->nfields == FAIL) { sprintf(errbuf, "Cannot get the number of fields for a level.\n"); H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Allocate memory for "size" variable */ /* ----------------------------------- */ size = (size_t *)calloc(info->nfields, sizeof(size_t)); if (size == (size_t *)NULL) { sprintf(errbuf, "Cannot allocate memory for the size variable.\n"); H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Allocate memory for "order" variable */ /* ----------------------------------- */ order = (size_t *)calloc(info->nfields, sizeof(size_t)); if (order == (size_t *)NULL) { sprintf(errbuf, "Cannot allocate memory for the order variable.\n"); H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(size); return(FAIL); } /* Loop through all data members */ /* ----------------------------- */ for( i = 0; i < info->nfields; i++) { size[i] = 0; /* Get member name */ /* --------------- */ info->fieldname[i] = H5Tget_member_name(typeID, i); if (info->fieldname[i] == NULL) { sprintf(errbuf, "Cannot get the field name.\n"); H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (size != NULL) free(size); if (order != NULL) free(order); return(FAIL); } /* Get member type */ /*---------------- */ mdt[i] = H5Tget_member_type(typeID, i); if (mdt[i] == FAIL) { sprintf(errbuf, "Cannot get the field type.\n"); H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (size != NULL) free(size); if (order != NULL) free(order); return(FAIL); } /* Get field data class */ /* -------------------- */ info->dclass[i] = H5Tget_class(mdt[i]); if (info->dclass[i] == H5T_NO_CLASS) { sprintf(errbuf, "Cannot get the field class.\n"); H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (size != NULL) free(size); if (order != NULL) free(order); return(FAIL); } /* Get the rank and "array" flag */ /* ----------------------------- */ if (info->dclass[i] == H5T_ARRAY) { /* Get the field rank */ /* ------------------ */ info->rank[i] = H5Tget_array_ndims(mdt[i]); if (info->rank[i] == FAIL) { sprintf(errbuf, "Cannot get the field rank.\n"); H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (size != NULL) free(size); if (order != NULL) free(order); return(FAIL); } /* The field is an array */ /* --------------------- */ info->array[i] = TRUE; /* Get the field dimension sizes */ /* ----------------------------- */ status = H5Tget_array_dims(mdt[i], dims, NULL); if (status == FAIL) { sprintf(errbuf, "Cannot get the field dimension sizes.\n"); H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (size != NULL) free(size); if (order != NULL) free(order); return(FAIL); } /* Set the field dimension sizes */ /* ----------------------------- */ for (j = 0; j < info->rank[i]; j++) info->dims[i][j] = dims[j]; /* Get the field base data type ID */ /* ------------------------------- */ btypeID = H5Tget_super(mdt[i]); if (btypeID == FAIL) { sprintf(errbuf, "Cannot get the field base data type ID.\n"); H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (size != NULL) free(size); if (order != NULL) free(order); return(FAIL); } /* Set the field data type */ /* ----------------------- */ info->dtype[i] = btypeID; /* Set the field number type */ /* ------------------------- */ info->numtype[i] = HE5_EHdtype2numtype(info->dtype[i]); if (info->numtype[i] == FAIL) { sprintf(errbuf, "Cannot get the number type ID.\n"); H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (size != NULL) free(size); if (order != NULL) free(order); return(FAIL); } /* Get the field data size */ /* ----------------------- */ size[i] = H5Tget_size(btypeID); if (size[i] == 0) { sprintf(errbuf, "Cannot get the field data size.\n"); H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (size != NULL) free(size); if (order != NULL) free(order); return(FAIL); } /* Release the data type ID */ /* ------------------------ */ status = H5Tclose(btypeID); if (status == FAIL) { sprintf(errbuf, "Cannot release the field data type ID.\n"); H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (size != NULL) free(size); if (order != NULL) free(order); return(FAIL); } } else { /* Set the scalar field parameters */ /* ------------------------------- */ info->rank[i] = 1; info->array[i] = FALSE; info->dims[i][0] = 1; info->dtype[i] = mdt[i]; if (info->dclass[i] == H5T_STRING) { info->numtype[i] = HE5T_CHARSTRING; } else { info->numtype[i] = HE5_EHdtype2numtype(info->dtype[i]); } if (info->numtype[i] == FAIL) { sprintf(errbuf, "Cannot get the number type ID.\n"); H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (size != NULL) free(size); if (order != NULL) free(order); return(FAIL); } /* Get the scalar field data size */ /* ------------------------------ */ size[i] = H5Tget_size(mdt[i]); if (size[i] == 0) { sprintf(errbuf, "Cannot release the field data size.\n"); H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (size != NULL) free(size); if (order != NULL) free(order); return(FAIL); } } /* Calculate the field order */ /* ------------------------- */ order[i] = 1; for (j = 0; j < info->rank[i]; j++) order[i] *= info->dims[i][j]; /* Calculate the data size in memory */ /* --------------------------------- */ /* Note: info->datasize += size[i]*order[i]; calculates structure size exactly, but it causes problem with PTreadlevel, where padded size of structure may be needed. For example the following structure for Sensor level typedef struct { char name[32]; float lat; float lon; float alt; unsigned short int id; } Sensor; has exact size of 46 bytes, but padded size is 48, which is needed for " datasize = (hsize_t)(dtsinfo.datasize);" in the PTreadlevel routine. So instead of info->datasize += size[i]*order[i] we will use H5Tget_size(typeID) which gets padded size of level structue */ /*info->datasize += size[i]*order[i];*/ info->datasize = H5Tget_size(typeID); } /* Calculate field unalligned offsets */ /* ---------------------------------- */ info->offset[0] = 0; for (i = 1; i < info->nfields; i++) info->offset[i] = info->offset[i-1]+(off_t)(size[i-1]*order[i-1]); if (size != NULL) free(size); if (order != NULL) free(order); /* Release the field data type ID */ /* ------------------------------ */ for( i = 0; i < info->nfields; i++) { status = H5Tclose(mdt[i]); if (status == FAIL) { sprintf(errbuf, "Cannot release the field data type ID.\n"); H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (size != NULL) free(size); if (order != NULL) free(order); return(FAIL); } } /* Release the datatype ID */ /* ----------------------- */ status = H5Tclose(typeID); if (status == FAIL) { sprintf(errbuf, "Cannot release the datatype ID.\n"); H5Epush(__FILE__, "HE5_PTlevelinfo", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTreadlevel | | | | DESCRIPTION: Reads data from the specified fields and records of a level. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID hid_t point structure ID | | level int level number (0 - based) | | inStruct HE5_CmpDTSinfo Input data structure containing infor- | | mation about compound dataset to read. | | size size_t Memory size (bytes) of data structure to| | read data into. | | | | OUTPUTS: | | datbuf Data buffer | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Apr 00 A.Muslimov Changed type of 'slen' from long to size_t. | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | Oct 00 A.Muslimov Changed the interface. | | Mar 00 A.Muslimov Modified to reflect changes in HDF5 library: | | H5Tinsert_array should be replaced by two calls | | H5Tarray_create() and H5Tinsert(). | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | Feb 06 Abe Taaheri Modified for getting datasize only, | | Correction for setting datasize in xfer_list, | | Support for STRING fields, | | and using correct datatypes | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_PTreadlevel(hid_t pointID, int level, HE5_CmpDTSinfo *inStruct, size_t *size, void *datbuf) { herr_t status = FAIL;/* routine return status variable */ int nlevels = 0; /* Number of levels in point */ int i, j; /* Loop indices */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* POINTS group ID */ hid_t dataID = FAIL;/* dataset ID */ hid_t xfer_list = FAIL;/* Property list ID */ hid_t typeID = FAIL;/* compound datatype ID */ hid_t arr_id = FAIL;/* Array datatype ID */ hsize_t dims[HE5_DTSETRANKMAX];/* Array of dimension sizes */ hsize_t datasize = 0;/* Size (bytes) of a dataset to read */ long idx = FAIL;/* Point index */ HE5_CmpDTSinfo dtsinfo;/* Structure to read information about level */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ hid_t cdatatype = FAIL; /* return data type ID */ int dtypesize = FAIL; hid_t mytypeID = FAIL; /* compound datatype ID */ hid_t mdt = FAIL; /* Member data type ID */ int jjj = 0; int jj = 0; int result = 99; HE5_LOCK; CHECKPOINTER(inStruct); CHECKPOINTER(size); /* Check for valid point ID */ /* ------------------------ */ status = HE5_PTchkptid(pointID, "HE5_PTreadlevel", &fid, &gid, &idx); if (status == FAIL) { sprintf(errbuf, "Checking for the point ID failed.\n"); H5Epush(__FILE__, "HE5_PTreadlevel", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Initialize dims[] array */ /* ----------------------- */ for (i = 0; i < HE5_DTSETRANKMAX; i++) dims[ i ] = 0; /* Get number of levels in point */ /* ----------------------------- */ nlevels = HE5_PTnlevels(pointID); if (nlevels == 0) { status = FAIL; sprintf(errbuf, "No Levels Defined for point ID: %d\n", pointID); H5Epush(__FILE__, "HE5_PTreadlevel", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } else if (nlevels < level) { /* Report error if level # to large */ /* -------------------------------- */ status = FAIL; sprintf(errbuf, "Only %d levels Defined for point ID: %d\n", nlevels, pointID); H5Epush(__FILE__, "HE5_PTreadlevel", __LINE__, H5E_FILE, H5E_SEEKERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get level dataset ID */ /* ------------------ */ dataID = HE5_PTXPoint[idx].level[level].ID; /* Create property list */ /* -------------------- */ xfer_list = H5Pcreate(H5P_DATASET_XFER); if (xfer_list == FAIL) { sprintf(errbuf, "Cannot create the property list. \n"); H5Epush(__FILE__, "HE5_PTreadlevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Call HE5_PTlevelinfo() */ /* ---------------------- */ status = HE5_PTlevelinfo(pointID, level, &dtsinfo); if (status == FAIL) { sprintf(errbuf, "Cannot get the level information. \n"); H5Epush(__FILE__, "HE5_PTreadlevel", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the dataset size */ /* -------------------- */ datasize = (hsize_t)(dtsinfo.datasize); /* If user only wants to get the size of datbuf so that he/she can allocate enough memory for datbuf, user will pass datbuf as NULL. In this case return here with the required size. */ if(datbuf == NULL) { *size = datasize; return(SUCCEED); } /* Set the buffer */ /* -------------- */ status = H5Pset_buffer(xfer_list, dtsinfo.datasize, NULL, NULL); if (status == FAIL) { sprintf(errbuf, "Cannot set the read buffer. \n"); H5Epush(__FILE__, "HE5_PTreadlevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Create Compound datatype */ /* ------------------------ */ typeID = H5Tcreate(H5T_COMPOUND, *size); if (typeID == FAIL) { status = FAIL; sprintf(errbuf, "Cannot create the compound data type.\n"); H5Epush(__FILE__, "HE5_PTreadlevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Add members of a compound datatype to read */ /* ------------------------------------------ */ for ( i = 0; i < inStruct->nfields; i++) { for( jj = 0; jj fieldname[i],dtsinfo.fieldname[jj]); if( result == 0 ) { jjj = jj; result = 99; } } jj = jjj; inStruct->numtype[i]=dtsinfo.numtype[jj]; /* Check if the member is an array */ /* ------------------------------- */ if ( inStruct->array[i] == TRUE) { for (j = 0; j < inStruct->rank[i]; j++) dims[j] = (hsize_t)(inStruct->dims[i][j]); /* Create array datatype */ /* --------------------- */ /*arr_id = H5Tarray_create(inStruct->dtype[i], inStruct->rank[i], (const hsize_t *)dims, NULL);*/ cdatatype = HE5_EHconvdatatype(inStruct->numtype[i]); /* if numtype is HE5 numbertype, rather than H5 numbertype, then convert it, otherwise use numtype itself */ if(cdatatype == FAIL) { cdatatype = inStruct->numtype[i]; } arr_id = H5Tarray_create(cdatatype, inStruct->rank[i], (const hsize_t *)dims, NULL); if (arr_id == FAIL) { sprintf(errbuf, "Cannot create \"array\" datatype. \n"); H5Epush(__FILE__, "HE5_PTreadlevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Add array field */ /* --------------- */ status = H5Tinsert(typeID, inStruct->fieldname[i], inStruct->offset[i], arr_id); if (status == FAIL) { sprintf(errbuf, "Cannot insert \"array\" element. \n"); H5Epush(__FILE__, "HE5_PTreadlevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Release the data type ID */ /* ------------------------ */ status = H5Tclose(arr_id); if (status == FAIL ) { sprintf(errbuf, "Cannot release data type ID. \n"); H5Epush(__FILE__, "HE5_PTreadlevel", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { /* Add atomic field */ /* ---------------- */ if(inStruct->dclass[i] == H5T_STRING) { /* Get compound datatype id */ /* ------------------------ */ mytypeID = H5Dget_type(dataID); mdt = H5Tget_member_type(mytypeID, i); dtypesize = H5Tget_size(mdt); status = H5Tclose(mdt); if (status == FAIL) { sprintf(errbuf, "Cannot release the field data type ID.\n"); H5Epush(__FILE__, "HE5_PTreadlevel", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } arr_id = H5Tcopy(H5T_C_S1); H5Tset_size(arr_id,dtypesize); H5Tset_strpad(arr_id, H5T_STR_NULLPAD); status = H5Tinsert(typeID, inStruct->fieldname[i], inStruct->offset[i],arr_id); if (status == FAIL) { sprintf(errbuf, "Cannot insert atomic data element. \n"); H5Epush(__FILE__, "HE5_PTreadlevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } status = H5Tclose(arr_id); if (status == FAIL ) { sprintf(errbuf, "Cannot release data type ID. \n"); H5Epush(__FILE__, "HE5_PTreadlevel", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { cdatatype = HE5_EHconvdatatype(inStruct->numtype[i]); /* if numtype is HE5 numbertype, rather than H5 numbertype, then convert it, otherwise use numtype itself */ if(cdatatype == FAIL) { cdatatype = inStruct->numtype[i]; } if(inStruct->nfields == 1) { status = H5Tinsert(typeID, inStruct->fieldname[i], 0,cdatatype ); } else { status = H5Tinsert(typeID, inStruct->fieldname[i], inStruct->offset[i],cdatatype ); } if (status == FAIL) { sprintf(errbuf, "Cannot insert atomic data element.\n"); H5Epush(__FILE__, "HE5_PTreadlevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } } } /* Release pointers to the name buffers */ /* ------------------------------------ */ for (i = 0; i < dtsinfo.nfields; i++) { if (dtsinfo.fieldname[i] != NULL) H5free_memory(dtsinfo.fieldname[i]); } /* Read out the level fields */ /* ------------------------- */ status = H5Dread(dataID, typeID, H5S_ALL, H5S_ALL, xfer_list, datbuf); if (status == FAIL) { sprintf(errbuf, "Cannot read the level dataset. \n"); H5Epush(__FILE__, "HE5_PTreadlevel", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Release the property list ID */ /* ---------------------------- */ status = H5Pclose(xfer_list); if (status == FAIL) { sprintf(errbuf, "Cannot release the property list ID. \n"); H5Epush(__FILE__, "HE5_PTreadlevel", __LINE__, H5E_PLIST, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Release the datatype ID */ /* ----------------------- */ status = H5Tclose(typeID); if (status == FAIL) { sprintf(errbuf, "Cannot release the data type ID.\n"); H5Epush(__FILE__, "HE5_PTreadlevel", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTinqdatatype | | | | DESCRIPTION: Inquires about datasets in Point | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID hid_t | | fieldname char * | | attrname char * | | fieldgroup int | | | | OUTPUTS: | | dtype hid_t | | classID H5T_class_t | | Order H5T_order_t | | size size_t | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Oct 99 D.Wynne Original Programmer | | Dec 99 A.Muslimov Modified for Point interface. | | May 00 A.Muslimov Changed 'H5T_class_t' type to 'int' data type. | | Jun 00 A.Muslimov Updated to include Group/Local Attributes options. | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | Oct 00 A.Muslimov Added missing H5Tclose() calls and error handlings. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_PTinqdatatype(hid_t pointID, const char *fieldname, const char *attrname, int fieldgroup, hid_t *dtype, H5T_class_t *classID, H5T_order_t *Order, size_t *size) { herr_t status = FAIL; /* return status variable */ hid_t datasetid = FAIL; /* dataset ID */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "POINTS" group ID */ hid_t attr = FAIL; /* attribute ID */ hid_t fldgroup = FAIL; /* "field group" flag */ long idx = FAIL; /* Point index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ /* Check for valid point id */ /* ======================== */ status = HE5_PTchkptid(pointID, "HE5_PTinqdatatype", &fid, &gid, &idx); if(status == SUCCEED) { if(fieldgroup == HE5_HDFE_DATAGROUP) fldgroup = HE5_PTXPoint[idx].data_id; else if(fieldgroup == HE5_HDFE_ATTRGROUP) fldgroup = HE5_PTXPoint[idx].pt_id; else if(fieldgroup == HE5_HDFE_GRPATTRGROUP) fldgroup = HE5_PTXPoint[idx].data_id; else if(fieldgroup == HE5_HDFE_LOCATTRGROUP) fldgroup = HE5_PTXPoint[idx].data_id; else { sprintf(errbuf, "Group \"%d\" unknown.\n", fieldgroup); H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_FUNC, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Call HDF 5 routines */ /* =================== */ if(fieldgroup == HE5_HDFE_DATAGROUP) { datasetid = H5Dopen(fldgroup, fieldname); if(datasetid == FAIL) { sprintf(errbuf, "Cannot open the dataset \"%s\".\n", fieldname); H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } *dtype = H5Dget_type(datasetid); if(*dtype == FAIL) { sprintf(errbuf, "Cannot get the datatype ID for \"%s\".\n", fieldname); H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } *classID = H5Tget_class(*dtype); if(*classID == H5T_NO_CLASS) { sprintf(errbuf, "Cannot get the data type class ID for \"%s\".\n", fieldname); H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } if (*classID != H5T_COMPOUND) { *Order = H5Tget_order(*dtype); if(*Order == H5T_ORDER_ERROR) { sprintf(errbuf, "Cannot get the datatype byte order for \"%s\".\n", fieldname); H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } if (*classID == H5T_STRING) { *size = 1; } else { *size = H5Tget_size(*dtype); if(*size == 0) { sprintf(errbuf, "Cannot get the datatype size for \"%s\".\n", fieldname); H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } status = H5Tclose(*dtype); if(status == FAIL) { sprintf(errbuf, "Cannot release the datatype ID.\n"); H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } status = H5Dclose(datasetid); if(status == FAIL) { sprintf(errbuf, "Cannot release the dataset ID.\n"); H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } else if(fieldgroup == HE5_HDFE_ATTRGROUP || fieldgroup == HE5_HDFE_GRPATTRGROUP) { attr = H5Aopen_name(fldgroup, attrname); if(attr == FAIL) { sprintf(errbuf, "Cannot open the attribute \"%s\".\n", attrname); H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } *dtype = H5Aget_type(attr); if(*dtype == FAIL) { sprintf(errbuf, "Cannot get the datatype ID for \"%s\".\n", attrname); H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } *classID = H5Tget_class(*dtype); if(*classID == H5T_NO_CLASS) { sprintf(errbuf, "Cannot get the data type class ID for \"%s\".\n", attrname); H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } if (*classID != H5T_COMPOUND) { *Order = H5Tget_order(*dtype); if(*Order == H5T_ORDER_ERROR) { sprintf(errbuf, "Cannot get the datatype byte order for \"%s\".\n", attrname); H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } if (*classID == H5T_STRING) { *size = 1; } else { *size = H5Tget_size(*dtype); if(*size == 0) { sprintf(errbuf, "Cannot get the datatype size for \"%s\".\n", attrname); H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } status = H5Tclose(*dtype); if(status == FAIL) { sprintf(errbuf, "Cannot release the datatype ID.\n"); H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } status = H5Aclose(attr); if(status == FAIL) { sprintf(errbuf, "Cannot release the attribute dataset ID.\n"); H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } else if(fieldgroup == HE5_HDFE_LOCATTRGROUP) { datasetid = H5Dopen(fldgroup, fieldname); if(datasetid == FAIL) { sprintf(errbuf, "Cannot open the dataset \"%s\".\n", fieldname); H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } attr = H5Aopen_name(datasetid, attrname); if(attr == FAIL) { sprintf(errbuf, "Cannot open the attribute \"%s\".\n", attrname); H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } *dtype = H5Aget_type(attr); if(*dtype == FAIL) { sprintf(errbuf, "Cannot get the datatype ID for \"%s\".\n", attrname); H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } *classID = H5Tget_class(*dtype); if(*classID == H5T_NO_CLASS) { sprintf(errbuf, "Cannot get the data type class ID for \"%s\".\n", attrname); H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } if (*classID != H5T_COMPOUND) { *Order = H5Tget_order(*dtype); if(*Order == H5T_ORDER_ERROR) { sprintf(errbuf, "Cannot get the datatype byte order for \"%s\".\n", attrname); H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } if (*classID == H5T_STRING) { *size = 1; } else { *size = H5Tget_size(*dtype); if(*size == 0) { sprintf(errbuf, "Cannot get the datatype size for \"%s\".\n", attrname); H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } status = H5Tclose(*dtype); if(status == FAIL) { sprintf(errbuf, "Cannot release the datatype ID.\n"); H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } status = H5Aclose(attr); if(status == FAIL) { sprintf(errbuf, "Cannot release the attribute dataset ID.\n"); H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } status = H5Dclose(datasetid); if(status == FAIL) { sprintf(errbuf, "Cannot release the dataset ID.\n"); H5Epush(__FILE__, "HE5_PTinqdatatype", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } } return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTinqpoint | | | | DESCRIPTION: Returns number and names of point structures in file | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nPoint int Number of point structures in file | | | | INPUTS: | | filename char HDF-EOS filename | | | | OUTPUTS: | | pointlist char List of point names (comma-separated) | | strbufsize long Length of pointlist | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTinqpoint(const char *filename, char *pointlist, long *strbufsize) { int nPoint = FAIL;/* Number of point structures in file */ herr_t status = FAIL;/* status variable */ CHECKPOINTER(filename); /* Call EHinquire */ /* -------------- */ nPoint = (int)HE5_EHinquire(filename, "/HDFEOS/POINTS", pointlist, strbufsize); COMPLETION: return (nPoint); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTattrinfo | | | | DESCRIPTION: | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID hid_t point structure ID | | attrname char attribute name | | | | OUTPUTS: | | ntype hid_t attribute data type ID | | count hsize_t Number of attribute elements | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ======= ============ ================================================= | | 5/11/00 A.Muslimov Changed 'H5T_class_t' type to 'int' data type. | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | Feb 03 S.Zhao Changed the type of 'ntype' from an H5T_class_t to | | an hid_t. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_PTattrinfo(hid_t pointID, const char *attrname, hid_t *ntype, hsize_t *count) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* POINTS group ID */ long idx = FAIL;/* Point index */ CHECKPOINTER(attrname); /* Check for valid point ID */ /* ------------------------ */ status = HE5_PTchkptid(pointID, "HE5_PTattrinfo", &fid, &gid, &idx); if (status == SUCCEED) { /* Get attribute group ID and call EHattrinfo */ status = HE5_EHattrinfo( HE5_PTXPoint[idx].pt_id, attrname, ntype, count); } COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTattrinfo2 | | | | DESCRIPTION: | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID hid_t point structure ID | | attrname char attribute name | | | | OUTPUTS: | | ntype hid_t attribute data type ID | | count hsize_t Number of attribute elements | | size hsize_t buf size of attribute elements | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ======= ============ ================================================= | | 5/11/00 A.Muslimov Changed 'H5T_class_t' type to 'int' data type. | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | Feb 03 S.Zhao Changed the type of 'ntype' from an H5T_class_t to | | an hid_t. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_PTattrinfo2(hid_t pointID, const char *attrname, hid_t *ntype, hsize_t *count, hsize_t *size) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* POINTS group ID */ long idx = FAIL;/* Point index */ CHECKPOINTER(attrname); /* Check for valid point ID */ /* ------------------------ */ status = HE5_PTchkptid(pointID, "HE5_PTattrinfo2", &fid, &gid, &idx); if (status == SUCCEED) { /* Get attribute group ID and call EHattrinfo */ status = HE5_EHattrinfo2( HE5_PTXPoint[idx].pt_id, attrname, ntype, count, size); } COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTinqattrs | | | | DESCRIPTION: | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nattr long Number of attributes in point struct | | | | INPUTS: | | point ID hid_t point structure ID | | | | OUTPUTS: | | attrnames char Attribute names in point struct | | (Comma-separated list) | | strbufsize long Attributes name list string length | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_PTinqattrs(hid_t pointID, char *attrnames, long *strbufsize) { long nattr = FAIL;/* Number of attributes (return) */ long idx = FAIL;/* Point index */ herr_t status = FAIL;/* routine return status variable */ hid_t gid = FAIL;/* "POINTS" group ID */ hid_t fid = FAIL;/* HDF-EOS file ID */ char *grpname = NULL;/* Group name string buffer */ status = HE5_PTchkptid(pointID, "HE5_PTinqattrs", &fid, &gid, &idx); if(status == SUCCEED ) { grpname = (char *) calloc( (strlen(HE5_PTXPoint[idx].ptname)+40), sizeof(char)); if( grpname == NULL) { H5Epush(__FILE__, "HE5_PTinqattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); return(FAIL); } strcpy(grpname,"/HDFEOS/POINTS/"); strcat(grpname, HE5_PTXPoint[idx].ptname); /* search group with grpname for the number of attrs */ nattr = HE5_EHattrcat(fid, grpname, attrnames, strbufsize); free(grpname); } return (nattr); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTwritegrpattr | | | | DESCRIPTION: Writes/updates attribute associated with the "Data" group | | in a point. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID hid_t point structure ID | | attrname char attribute name | | numtype hid_t attribute data type ID | | count hsize_t Number of attribute elements | | wrcode char Read/Write Code "w/r" | | datbuf void I/O buffer | | | | OUTPUTS: | | datbuf | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Feb 00 A.Muslimov | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_PTwritegrpattr(hid_t pointID, const char *attrname, hid_t numtype, hsize_t count[],void *datbuf) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* HDFEOS group ID */ hid_t DataGrpID = FAIL;/* "Data" group ID */ long idx = FAIL;/* Point index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ hid_t ntype; HE5_LOCK; CHECKNAME(attrname); CHECKPOINTER(count); CHECKPOINTER(datbuf); /* if numtype is HE5 numbertype, rather than H5 numbertype, then convert it, otherwise use numtype itself */ ntype = HE5_EHconvdatatype(numtype); if(ntype == FAIL) { ntype = numtype; } /* Check Point ID */ /* -------------- */ status = HE5_PTchkptid(pointID, "HE5_PTwritegrpattr", &fid, &gid, &idx); if (status == SUCCEED) { DataGrpID = H5Gopen(HE5_PTXPoint[idx].pt_id, "Data"); if(DataGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"Data\" group ID.\n"); H5Epush(__FILE__, "HE5_PTwritegrpattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Perform Attribute I/O */ /* --------------------- */ status = HE5_EHattr(DataGrpID, attrname, ntype, count,"w", datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot write Attribute \"%s\"to the \"Data\" group.\n", attrname); H5Epush(__FILE__, "HE5_PTwritegrpattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Gclose(DataGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"Data\" group ID.\n"); H5Epush(__FILE__, "HE5_PTwritegrpattr", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTreadgrpattr | | | | DESCRIPTION: Reads attribute associated with the "Data" group from a point.| | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID hid_t point structure ID | | attrname char attribute name | | | | OUTPUTS: | | datbuf void I/O buffer | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Feb 00 A.Muslimov | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_PTreadgrpattr(hid_t pointID, const char *attrname, void *datbuf) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t ntype = FAIL;/* Data type ID */ hid_t gid = FAIL;/* POINTS group ID */ hid_t DataGrpID = FAIL;/* "Data" group ID */ hsize_t count[] = {0}; /* Number of attribute elements */ long idx = FAIL;/* Point index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKPOINTER(attrname); /* Check Point ID */ /* -------------- */ status = HE5_PTchkptid(pointID, "HE5_PTreadgrpattr", &fid, &gid, &idx); if (status == SUCCEED) { /* Get "Data" group ID */ /* -------------------- */ DataGrpID = H5Gopen(HE5_PTXPoint[idx].pt_id, "Data"); if(DataGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"Data\" group ID.\n"); H5Epush(__FILE__, "HE5_PTreadgrpattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Call EHattr to perform I/O */ /* --------------------------- */ status = HE5_EHattr(DataGrpID, attrname, ntype, count, "r", datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot read Attribute \"%s\" from the \"Data\" group.\n", attrname); H5Epush(__FILE__, "HE5_PTreadgrpattr", __LINE__, H5E_ATTR, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Gclose(DataGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"Data\" group ID.\n"); H5Epush(__FILE__, "HE5_PTreadgrpattr", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTgrpattrinfo | | | | DESCRIPTION: Retrieves information about attributes in "Data" group. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID hid_t point structure ID | | attrname char attribute name | | | | OUTPUTS: | | ntype hid_t attribute data type ID | | count hsize_t Number of attribute elements | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Feb 00 A.Muslimov | | May 00 A.Muslimov Changed 'H5T_class_t' type to 'int' data type. | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | Feb 03 S.Zhao Changed the type of 'ntype' from an H5T_class_t to | | an hid_t. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_PTgrpattrinfo(hid_t pointID, const char *attrname, hid_t *ntype, hsize_t *count) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* HDFEOS group ID */ hid_t DataGrpID = FAIL;/* "Data" group ID */ long idx = FAIL;/* Point index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ CHECKPOINTER(attrname); /* Check for valid point ID */ /* ------------------------ */ status = HE5_PTchkptid(pointID, "HE5_PTgrpattrinfo", &fid, &gid, &idx); if (status == SUCCEED) { /* Get "Data" group ID */ /* --------------------- */ DataGrpID = H5Gopen(HE5_PTXPoint[idx].pt_id, "Data"); if(DataGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"Data\" group ID.\n"); H5Epush(__FILE__, "HE5_PTgrpattrinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Call HE5_EHattrinfo */ /* ------------------- */ status = HE5_EHattrinfo(DataGrpID, attrname, ntype, count); if(status == FAIL) { sprintf(errbuf,"Cannot retrieve information about Attribute \"%s\" in the \"Data\" group.\n", attrname); H5Epush(__FILE__, "HE5_PTgrpattrinfo", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Gclose(DataGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"Data\" group ID.\n"); H5Epush(__FILE__, "HE5_PTgrpattrinfo", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTgrpattrinfo2 | | | | DESCRIPTION: Retrieves information about attributes in "Data" group. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID hid_t point structure ID | | attrname char attribute name | | | | OUTPUTS: | | ntype hid_t attribute data type ID | | count hsize_t Number of attribute elements | | size hsize_t buf size of attribute elements | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Feb 00 A.Muslimov | | May 00 A.Muslimov Changed 'H5T_class_t' type to 'int' data type. | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | Feb 03 S.Zhao Changed the type of 'ntype' from an H5T_class_t to | | an hid_t. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_PTgrpattrinfo2(hid_t pointID, const char *attrname, hid_t *ntype, hsize_t *count, hsize_t *size) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* HDFEOS group ID */ hid_t DataGrpID = FAIL;/* "Data" group ID */ long idx = FAIL;/* Point index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ CHECKPOINTER(attrname); /* Check for valid point ID */ /* ------------------------ */ status = HE5_PTchkptid(pointID, "HE5_PTgrpattrinfo2", &fid, &gid, &idx); if (status == SUCCEED) { /* Get "Data" group ID */ /* --------------------- */ DataGrpID = H5Gopen(HE5_PTXPoint[idx].pt_id, "Data"); if(DataGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"Data\" group ID.\n"); H5Epush(__FILE__, "HE5_PTgrpattrinfo2", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Call HE5_EHattrinfo */ /* ------------------- */ status = HE5_EHattrinfo2(DataGrpID, attrname, ntype, count, size); if(status == FAIL) { sprintf(errbuf,"Cannot retrieve information about Attribute \"%s\" in the \"Data\" group.\n", attrname); H5Epush(__FILE__, "HE5_PTgrpattrinfo2", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Gclose(DataGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"Data\" group ID.\n"); H5Epush(__FILE__, "HE5_PTgrpattrinfo2", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTinqgrpattrs | | | | DESCRIPTION: Retrieves the number of attributes and string length of | | attribute list in "Data" group | | | | | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nattr long Number of attributes in point struct | | | | INPUTS: | | point ID hid_t point structure ID | | | | OUTPUTS: | | attrnames char Attribute names in point struct | | (Comma-separated list) | | strbufsize long Attributes name list string length | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Feb 00 A.Muslimov | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_PTinqgrpattrs(hid_t pointID, char *attrnames, long *strbufsize) { long nattr = FAIL;/* Number of attributes (return) */ long idx = FAIL;/* Point index */ herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* HDFEOS group ID */ char *grpname = NULL;/* Buffer for a group name */ status = HE5_PTchkptid(pointID, "HE5_PTinqgrpattrs", &fid, &gid, &idx); if(status == SUCCEED ) { grpname = (char *) calloc(HE5_HDFE_NAMBUFSIZE, sizeof(char)); if( grpname == NULL) { H5Epush(__FILE__, "HE5_PTinqgrpattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); return(FAIL); } strcpy(grpname,"/HDFEOS/POINTS/"); strcat(grpname, HE5_PTXPoint[idx].ptname); strcat(grpname,"/Data"); /* search group with grpname for the number of attrs */ /* ------------------------------------------------- */ nattr = HE5_EHattrcat(fid, grpname, attrnames, strbufsize); free(grpname); } return (nattr); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTwritelocattr | | | | DESCRIPTION: Writes/updates attribute associated with the a specified | | level in a point. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID hid_t point structure ID | | levelname char level name | | attrname char attribute name | | numtype hid_t attribute data type ID | | count hsize_t Number of attribute elements | | wrcode char Read/Write Code "w/r" | | datbuf void I/O buffer | | | | OUTPUTS: | | datbuf | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Feb 00 A.Muslimov | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_PTwritelocattr(hid_t pointID, const char *levelname, const char *attrname, hid_t numtype, hsize_t count[],void *datbuf) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* HDFEOS group ID */ hid_t DataGrpID = FAIL;/* "Data" group ID */ hid_t levelID = FAIL;/* Level-related dataset ID */ long idx = FAIL;/* Point index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ hid_t ntype; HE5_LOCK; CHECKPOINTER(levelname); CHECKNAME(attrname); CHECKPOINTER(count); CHECKPOINTER(datbuf); /* if numtype is HE5 numbertype, rather than H5 numbertype, then convert it, otherwise use ntype itself */ ntype = HE5_EHconvdatatype(numtype); if(ntype == FAIL) { ntype = numtype; } /* Check Point ID */ /* -------------- */ status = HE5_PTchkptid(pointID, "HE5_PTwritelocattr", &fid, &gid, &idx); if (status == SUCCEED) { DataGrpID = H5Gopen(HE5_PTXPoint[idx].pt_id, "Data"); if(DataGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"Data\" group ID.\n"); H5Epush(__FILE__, "HE5_PTwritelocattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get level ID */ /* ------------- */ levelID = H5Dopen(DataGrpID, levelname); if(levelID == FAIL) { sprintf(errbuf,"Cannot open the \"%s\" level dataset ID.\n", levelname); H5Epush(__FILE__, "HE5_PTwritelocattr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Perform Attribute I/O */ /* --------------------- */ status = HE5_EHattr(levelID, attrname, ntype, count,"w", datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot write Attribute \"%s\"to the \"%s\" level.\n", attrname,levelname); H5Epush(__FILE__, "HE5_PTwritelocattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Dclose(levelID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"%s\" level dataset ID.\n", levelname); H5Epush(__FILE__, "HE5_PTwritelocattr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Gclose(DataGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"Data\" group ID.\n"); H5Epush(__FILE__, "HE5_PTwritelocattr", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTreadlocattr | | | | DESCRIPTION: Reads attribute associated with a specified level in a point. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID hid_t point structure ID | | levelname char level name | | attrname char attribute name | | | | OUTPUTS: | | datbuf void I/O buffer | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Feb 00 A.Muslimov | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_PTreadlocattr(hid_t pointID, const char *levelname, const char *attrname, void *datbuf) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t ntype = FAIL;/* Data type ID */ hid_t gid = FAIL;/* POINTS group ID */ hid_t DataGrpID = FAIL;/* "Data" group ID */ hid_t levelID = FAIL;/* Level-related dataset ID */ hsize_t count[] = {0}; /* Number of attribute elements */ long idx = FAIL;/* Point index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKPOINTER(levelname); CHECKPOINTER(attrname); /* Check Point ID */ /* -------------- */ status = HE5_PTchkptid(pointID, "HE5_PTreadlocattr", &fid, &gid, &idx); if (status == SUCCEED) { /* Get "Data" group ID */ /* -------------------- */ DataGrpID = H5Gopen(HE5_PTXPoint[idx].pt_id, "Data"); if(DataGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"Data\" group ID.\n"); H5Epush(__FILE__, "HE5_PTreadlocattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get level ID */ /* ------------- */ levelID = H5Dopen(DataGrpID, levelname); if(levelID == FAIL) { sprintf(errbuf,"Cannot open the \"%s\" level dataset ID.\n", levelname); H5Epush(__FILE__, "HE5_PTreadlocattr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Call EHattr to perform I/O */ /* --------------------------- */ status = HE5_EHattr(levelID, attrname, ntype, count, "r", datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot read Attribute \"%s\" from the \"%s\" level.\n", attrname, levelname); H5Epush(__FILE__, "HE5_PTreadlocattr", __LINE__, H5E_ATTR, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Dclose(levelID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"%s\" level dataset ID.\n", levelname); H5Epush(__FILE__, "HE5_PTreadlocattr", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Gclose(DataGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"Data\" group ID.\n"); H5Epush(__FILE__, "HE5_PTreadlocattr", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTlocattrinfo | | | | DESCRIPTION: Retrieves information about attributes in associated with a | | specified level in a point. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID hid_t point structure ID | | levelname char level name | | attrname char attribute name | | | | OUTPUTS: | | ntype hid_t attribute data type ID | | count hsize_t Number of attribute elements | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Feb 00 A.Muslimov | | May 00 A.Muslimov Changed 'H5T_class_t' type to 'int' data type. | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | Feb 03 S.Zhao Changed the type of 'ntype' from an H5T_class_t to | | an hid_t. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_PTlocattrinfo(hid_t pointID, const char *levelname, const char *attrname, hid_t *ntype, hsize_t *count) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* HDFEOS group ID */ hid_t DataGrpID = FAIL;/* "Data" group ID */ hid_t levelID = FAIL;/* Level-related dataset ID */ long idx = FAIL;/* Point index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ CHECKPOINTER(levelname); CHECKPOINTER(attrname); /* Check for valid point ID */ /* ------------------------ */ status = HE5_PTchkptid(pointID, "HE5_PTlocattrinfo", &fid, &gid, &idx); if (status == SUCCEED) { /* Get "Data" group ID */ /* --------------------- */ DataGrpID = H5Gopen(HE5_PTXPoint[idx].pt_id, "Data"); if(DataGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"Data\" group ID.\n"); H5Epush(__FILE__, "HE5_PTlocattrinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get level ID */ /* ------------- */ levelID = H5Dopen(DataGrpID, levelname); if(levelID == FAIL) { sprintf(errbuf,"Cannot open the \"%s\" level dataset ID.\n", levelname); H5Epush(__FILE__, "HE5_PTlocattrinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Call EHattrinfo */ /* --------------- */ status = HE5_EHattrinfo(levelID, attrname, ntype, count); if(status == FAIL) { sprintf(errbuf,"Cannot retrieve information about Attribute \"%s\" in the \"%s\" level.\n", attrname,levelname); H5Epush(__FILE__, "HE5_PTlocattrinfo", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Dclose(levelID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"%s\" level dataset ID.\n", levelname); H5Epush(__FILE__, "HE5_PTlocattrinfo", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Gclose(DataGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"Data\" group ID.\n"); H5Epush(__FILE__, "HE5_PTlocattrinfo", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTlocattrinfo2 | | | | DESCRIPTION: Retrieves information about attributes in associated with a | | specified level in a point. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID hid_t point structure ID | | levelname char level name | | attrname char attribute name | | | | OUTPUTS: | | ntype hid_t attribute data type ID | | count hsize_t Number of attribute elements | | size hsize_t buf size of attribute elements | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Feb 00 A.Muslimov | | May 00 A.Muslimov Changed 'H5T_class_t' type to 'int' data type. | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | Feb 03 S.Zhao Changed the type of 'ntype' from an H5T_class_t to | | an hid_t. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_PTlocattrinfo2(hid_t pointID, const char *levelname, const char *attrname, hid_t *ntype, hsize_t *count, hsize_t *size) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* HDFEOS group ID */ hid_t DataGrpID = FAIL;/* "Data" group ID */ hid_t levelID = FAIL;/* Level-related dataset ID */ long idx = FAIL;/* Point index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ CHECKPOINTER(levelname); CHECKPOINTER(attrname); /* Check for valid point ID */ /* ------------------------ */ status = HE5_PTchkptid(pointID, "HE5_PTlocattrinfo2", &fid, &gid, &idx); if (status == SUCCEED) { /* Get "Data" group ID */ /* --------------------- */ DataGrpID = H5Gopen(HE5_PTXPoint[idx].pt_id, "Data"); if(DataGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"Data\" group ID.\n"); H5Epush(__FILE__, "HE5_PTlocattrinfo2", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get level ID */ /* ------------- */ levelID = H5Dopen(DataGrpID, levelname); if(levelID == FAIL) { sprintf(errbuf,"Cannot open the \"%s\" level dataset ID.\n", levelname); H5Epush(__FILE__, "HE5_PTlocattrinfo2", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Call EHattrinfo */ /* --------------- */ status = HE5_EHattrinfo2(levelID, attrname, ntype, count, size); if(status == FAIL) { sprintf(errbuf,"Cannot retrieve information about Attribute \"%s\" in the \"%s\" level.\n", attrname,levelname); H5Epush(__FILE__, "HE5_PTlocattrinfo2", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Dclose(levelID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"%s\" level dataset ID.\n", levelname); H5Epush(__FILE__, "HE5_PTlocattrinfo2", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Gclose(DataGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"Data\" group ID.\n"); H5Epush(__FILE__, "HE5_PTlocattrinfo2", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTinqlocattrs | | | | DESCRIPTION: Retrieves the number of attributes and string length of | | attribute list from a specified level in a point. | | | | | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nattr long Number of attributes in a level | | | | INPUTS: | | point ID hid_t point structure ID | | levelname char level name | | | | OUTPUTS: | | attrnames char Attribute names in a level | | (Comma-separated list) | | strbufsize long Attributes name list string length | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Feb 00 A.Muslimov | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_PTinqlocattrs(hid_t pointID, const char *levelname, char *attrnames, long *strbufsize) { long nattr = FAIL;/* Number of attributes (return) */ long idx = FAIL;/* Point index */ herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* HDFEOS group ID */ char *dtsname = NULL;/* Buffer for a dataset name */ CHECKPOINTER(levelname); status = HE5_PTchkptid(pointID, "HE5_PTinqlocattrs", &fid, &gid, &idx); if(status == SUCCEED ) { dtsname = (char *) calloc(HE5_HDFE_NAMBUFSIZE, sizeof(char)); if( dtsname == NULL) { H5Epush(__FILE__, "HE5_PTinqlocattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); return(FAIL); } strcpy(dtsname,"/HDFEOS/POINTS/"); strcat(dtsname, HE5_PTXPoint[idx].ptname); strcat(dtsname,"/Data/"); strcat(dtsname,levelname); /* search group with grpname for the number of attrs */ /* ------------------------------------------------- */ nattr = HE5_EHattrcat(fid, dtsname, attrnames, strbufsize); free(dtsname); } COMPLETION: return (nattr); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTlinkinfo | | | | DESCRIPTION: Returns ("bck/fwd") linkage info | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID hid_t point structure ID | | level int level number (0 - based) | | mode char mode ("+/-") | | linkfield char linkage field | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 8/26/99 A.Muslimov Changed the return type from intn to int . | | 12/13/99 A.Muslimov Added proper error handlings after the function | | calls. Added a call to PTchkptid(), and replaced | | the parameter "gid" by "fid" in the call to | | EHmetagroup(). | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_PTlinkinfo(hid_t pointID, hid_t gid, int level, char *mode, char *linkfield) { herr_t status = FAIL; /* Return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t pID = FAIL; /* Point ID - offset */ hid_t idOffset = HE5_PTIDOFFSET; /* Point ID offset */ long idx = FAIL; /* Point index */ char *metabuf = NULL; /* Pointer to SM */ char *metaptrs[2]={NULL,NULL}; /* Ptrs to begin/end of SM */ char name1[HE5_HDFE_NAMBUFSIZE]; /* Name string 1 */ char name2[HE5_HDFE_NAMBUFSIZE]; /* Name string 2 */ char utlbuf[HE5_HDFE_UTLBUFSIZE];/* Utility buffer */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error messg buffer */ /* Check for valid point ID */ /* ------------------------ */ status = HE5_PTchkptid(pointID, "HE5_PTfwdlinkinfo", &fid, &gid, &idx); if (status == FAIL ) { sprintf(errbuf, "Checking for point ID failed. \n"); H5Epush(__FILE__, "HE5_PTfwdlinkinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Compute "reduced" point ID */ /* -------------------------- */ pID = pointID % idOffset; /* Get level link structural metadata */ /* ---------------------------------- */ metabuf = (char *)HE5_EHmetagroup(fid, HE5_PTXPoint[pID].ptname, "p","LevelLink", metaptrs); if (metabuf == NULL ) { status = FAIL; sprintf(errbuf, "Cannot get pointer to metadata buffer for the \"%s\" point. \n", HE5_PTXPoint[pID].ptname); H5Epush(__FILE__, "HE5_PTfwdlinkinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } if (strcmp(mode, "-") == 0) { /* If back link get names of previous & current levels */ /* --------------------------------------------------- */ strcpy(name1, HE5_PTXPoint[pID].level[level - 1].name); strcpy(name2, HE5_PTXPoint[pID].level[level].name); } else { /* If fwd link get names of current & following levels */ /* --------------------------------------------------- */ strcpy(name1, HE5_PTXPoint[pID].level[level].name); strcpy(name2, HE5_PTXPoint[pID].level[level+1].name); } /* Search for parent name entry */ /* ---------------------------- */ sprintf(utlbuf, "%s%s", "\t\t\t\tParent=\"", name1); metaptrs[0] = strstr(metaptrs[0], utlbuf); /* If name found within linkage metadata ... */ /* ----------------------------------------- */ if (metaptrs[0] < metaptrs[1] || metaptrs[0] == NULL) { /* Get Linkage Field */ /* ----------------- */ status = HE5_EHgetmetavalue(metaptrs, "LinkField", linkfield); if (status == FAIL ) { sprintf(errbuf, "Cannot get \"LinkField\" metavalue for the \"%s\" point. \n", HE5_PTXPoint[pID].ptname); H5Epush(__FILE__, "HE5_PTfwdlinkinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(metabuf); return(status); } /* Remove double quotes */ /* -------------------- */ memmove(linkfield, linkfield + 1, strlen(linkfield) - 2); linkfield[strlen(linkfield) - 2] = 0; } else { /* If not found return error status */ /* -------------------------------- */ status = FAIL; } free(metabuf); return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTbcklinkinfo | | | | DESCRIPTION: Returns link field to previous level. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID hid_t point structure ID | | level int level number (0 - based) | | linkfield char linkage field | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_PTbcklinkinfo(hid_t pointID, int level, char *linkfield) { herr_t status = SUCCEED;/* routine return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "POINTS" group ID */ long idx = FAIL; /* Point index */ char *mess = "No Back Linkage Defined between levels: %d and %d.\n"; char errbuf[HE5_HDFE_ERRBUFSIZE];/* error message buffer */ /* Check for valid point ID */ /* ------------------------ */ status = HE5_PTchkptid(pointID, "HE5_PTfwdlinkinfo", &fid, &gid, &idx); if (status == SUCCEED) { /* Check that level is within bounds for backlink info */ if (level > 0 && level < HE5_PTnlevels(pointID)) { status = HE5_PTlinkinfo(pointID, gid, level, "-", linkfield); if (status == FAIL) { sprintf( errbuf, mess, level, level - 1); H5Epush(__FILE__, "HE5_PTbcklinkinfo", __LINE__, H5E_IO, H5E_SEEKERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } else { status = FAIL; sprintf( errbuf, mess, level, level - 1); H5Epush(__FILE__, "HE5_PTbcklinkinfo", __LINE__, H5E_IO, H5E_SEEKERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTfwdlinkinfo | | | | DESCRIPTION: Returns link field to following level. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID hid_t point structure ID | | level int level number (0 - based) | | linkfield char linkage field | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_PTfwdlinkinfo(hid_t pointID, int level, char *linkfield) { herr_t status = SUCCEED;/* routine return status variable */ hid_t fid = FAIL; /* HDF-EOS file id */ hid_t gid = FAIL; /* "POINTS" group ID */ long idx = FAIL; /* Point index */ char *mess = "No Forward Linkage Defined between levels: %d and %d.\n"; char errbuf[HE5_HDFE_ERRBUFSIZE];/* error message buffer */ /* Check for valid point ID */ /* ------------------------ */ status = HE5_PTchkptid(pointID, "HE5_PTfwdlinkinfo", &fid, &gid, &idx); if (status == SUCCEED) { /* Check that level is within bounds for fwdlink info */ if (level >= 0 && level < HE5_PTnlevels(pointID) - 1) { status = HE5_PTlinkinfo(pointID, gid, level, "+", linkfield); if (status == FAIL) { sprintf( errbuf, mess, level, level + 1); H5Epush(__FILE__, "HE5_PTfwdlinkinfo", __LINE__, H5E_IO, H5E_SEEKERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } else { status = FAIL; sprintf( errbuf, mess, level, level + 1); H5Epush(__FILE__, "HE5_PTfwdlinkinfo", __LINE__, H5E_IO, H5E_SEEKERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTlevelindx | | | | DESCRIPTION: Returns index number for a named level. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | n int Level number (0 - based) | | | | INPUTS: | | pointID hid_t point structure ID | | levelname char point level name | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTlevelindx(hid_t pointID, const char *levelname) { int level = FAIL;/* Level corresponding to levelname (RETURN) */ int nlevels = FAIL;/* Number of levels in point */ herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "POINTS" group ID */ long idx = FAIL;/* Point index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ CHECKPOINTER(levelname); /* Check for valid point ID */ /* ------------------------ */ status = HE5_PTchkptid(pointID, "HE5_PTlevelindx", &fid, &gid, &idx); if (status == SUCCEED) { /* Get number of levels */ /* -------------------- */ nlevels = HE5_PTnlevels(pointID); if(nlevels == FAIL) { sprintf(errbuf, "Cannot get the number of levels in point.\n"); H5Epush(__FILE__, "HE5_PTlevelindx", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } else if(nlevels == 0) { sprintf(errbuf, "There are no levels in point.\n"); H5Epush(__FILE__, "HE5_PTlevelindx", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } else { /* Loop through all levels in point */ /* -------------------------------- */ for (level = 0; level < nlevels; level++) { /* If it matches input levelname then exit loop */ /* -------------------------------------------- */ if (strcmp(HE5_PTXPoint[ idx ].level[ level ].name, levelname) == 0) break; } } } /* Levelname not found so set error status */ /* --------------------------------------- */ if (level == nlevels) level = FAIL; COMPLETION: return(level); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTwrbckptr | | | | DESCRIPTION: Writes back pointer records | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID hid_t point structure ID | | level int level index (0 - based) | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Nov 00 A.Muslimov Changed the interface. | | Mar 00 A.Muslimov Modified to reflect changes in HDF5 library: | | H5Tinsert_array should be replaced by two calls | | H5Tarray_create() and H5Tinsert(). | | Sep 04 S.Zhao Changed "long long" to "LONGLONG" for Windows. | | Feb 06 Abe Taaheri Support for STRING fields, | | | | END_PROLOG | ----------------------------------------------------------------------------*/ static herr_t HE5_PTwrbckptr(hid_t pointID, int level) { herr_t status = FAIL;/* routine return status variable */ int TypeFlag = FAIL;/* Data type Flag */ int k; /* Loop index */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "POINTS" group ID */ hid_t link_id = FAIL;/* "Linkage" group ID */ hid_t bckid = FAIL;/* "BACKPOINTER" dataset ID */ hid_t typeID = FAIL;/* Data type ID */ hid_t tid = FAIL;/* Data type ID */ hid_t fldtype = FAIL;/* Field data type ID */ hid_t xfer_list= FAIL;/* Property list ID */ hid_t dataID_curr = FAIL;/* current level dataset ID */ hid_t dataID_prev = FAIL;/* previous level dataset ID */ hid_t arr_id = FAIL;/* Array datatype ID */ size_t datasize = 0; /* Input data size parameter */ long idx = FAIL;/* Point index */ LONGLONG j; /* Loop indices */ hsize_t count[1] = {0}; /* Number of elements to write */ hsize_t nrecPrev = 0; /* Number of records in previous level */ hsize_t nrecCurr = 0; /* Number of records in current level */ hsize_t dims[HE5_DTSETRANKMAX];/* Data member dimension */ char utlbuf[HE5_HDFE_UTLBUFSIZE];/* Utility buffer */ char *mess = "No Linkage Defined between levels: %d and %d.\n"; char errbuf[HE5_HDFE_ERRBUFSIZE];/* buffer for error message */ bckptr *bck = (bckptr *)NULL;/* struct to write bckpointer data to */ HE5_CmpDTSinfo currLevel; /* structure for current level information */ /* Data buffers */ /* ------------------------- */ int *intFldCurr; int *intFldPrev; float *fltFldCurr; float *fltFldPrev; double *dblFldCurr; double *dblFldPrev; long *lngFldCurr; long *lngFldPrev; char *chrFldCurr; char *chrFldPrev; int string_size; hid_t cdatatype = FAIL; hid_t fldnumtype; /* Check for valid point ID */ /* ------------------------ */ status = HE5_PTchkptid(pointID, "HE5_PTwrbckptr", &fid, &gid, &idx); if (status == FAIL) { sprintf(errbuf, "Checking for point ID failed. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Check the level number */ /* ---------------------- */ if (level <= 0) { sprintf(errbuf, "Passed wrong level number. Level should be > 0. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get Back-Linkage Field (copy into utlbuf) */ /* ----------------------------------------- */ status = HE5_PTbcklinkinfo(pointID, level, utlbuf); if (status == FAIL) { sprintf(errbuf, mess, level, level - 1); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get number of fields in Current level */ /* ------------------------------------- */ status = HE5_PTlevelinfo(pointID, level, &currLevel); if (status == FAIL) { sprintf(errbuf, "Cannot get information about current level. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Initialize dims[] array */ /* ----------------------- */ for (k = 0; k < HE5_DTSETRANKMAX; k++) dims[ k ] = 0; /* Get current level dataset ID */ /* ---------------------------- */ dataID_curr = HE5_PTXPoint[idx].level[level].ID; /* Get the field data type and number of elements (for char ) */ /* ---------------------------------------------------------- */ for (k = 0; k < currLevel.nfields; k++) { if (memcmp(currLevel.fieldname[k], utlbuf, strlen(utlbuf)) == 0) { fldtype = currLevel.dtype[k]; fldnumtype = currLevel.numtype[k]; dims[0] = (hsize_t)(currLevel.dims[k][0]); if(currLevel.dclass[k] == H5T_STRING) { TypeFlag = 5; string_size = HE5_PTgetdtypesize(dataID_curr, k); if (string_size == FAIL) { sprintf(errbuf,"Cannot get member datatype size.\n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } else { cdatatype = HE5_EHconvdatatype(currLevel.numtype[k]); /* if numtype is HE5 numbertype, rather than H5 numbertype, then convert it, otherwise use numtype itself */ if(cdatatype == FAIL) { cdatatype = currLevel.numtype[k]; } if(H5Tequal(cdatatype, H5T_NATIVE_INT)) TypeFlag = 1; else if(H5Tequal(cdatatype, H5T_NATIVE_LONG)) TypeFlag = 2; else if(H5Tequal(cdatatype, H5T_NATIVE_FLOAT)) TypeFlag = 3; else if(H5Tequal(cdatatype, H5T_NATIVE_DOUBLE)) TypeFlag = 4; else if(H5Tequal(cdatatype, H5T_NATIVE_CHAR)) TypeFlag = 0; } } /* Deallocate memory */ /* ----------------- */ if (currLevel.fieldname[k] != NULL) H5free_memory(currLevel.fieldname[k]); } /* Get number of records in current level */ /* -------------------------------------- */ nrecCurr = HE5_PTnrecs(pointID,level); if (nrecCurr == 0) { sprintf(errbuf, "No records in current level. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get number of records in previous level */ /* --------------------------------------- */ nrecPrev = HE5_PTnrecs(pointID,level-1); if (nrecPrev == 0) { sprintf(errbuf, "No records in previous level. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Allocate memory for bckpointer dataset */ /* -------------------------------------- */ bck = (bckptr *)calloc(nrecCurr, sizeof(bckptr)); if (bck == NULL) { sprintf(errbuf, "Cannot allocate memory. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get previous level dataset ID */ /* ----------------------------- */ dataID_prev = HE5_PTXPoint[idx].level[level-1].ID; /* Get ID of Linkage group */ /* ------------------------ */ link_id = HE5_PTXPoint[idx].link_id; /* Get data buffer containing link field records in current level */ /* -------------------------------------------------------------- */ switch (TypeFlag) { case 5: /* string type field */ { datasize = (size_t)(dims[0] * sizeof(char)); chrFldCurr = (char *)calloc(nrecCurr, string_size); if (chrFldCurr == NULL) { sprintf(errbuf, "Cannot allocate memory. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(bck); return(FAIL); } chrFldPrev = (char *)calloc(nrecPrev, string_size); if (chrFldPrev == NULL) { sprintf(errbuf, "Cannot allocate memory. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(chrFldCurr); free(bck); return(FAIL); } /* Create Compound datatype */ /* ------------------------ */ tid = H5Tcreate(H5T_COMPOUND, string_size); if (tid == FAIL) { sprintf(errbuf, "Cannot create Compound datatype. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(chrFldCurr); free(chrFldPrev); free(bck); return(FAIL); } /* Create array datatype */ /* --------------------- */ arr_id = H5Tcopy(H5T_C_S1); if (arr_id == FAIL) { sprintf(errbuf, "Cannot create array data type. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(bck); free(chrFldCurr); free(chrFldPrev); return(FAIL); } H5Tset_size(arr_id,string_size); H5Tset_strpad(arr_id, H5T_STR_NULLPAD); /* Add array field */ /* --------------- */ status = H5Tinsert(tid, utlbuf, 0, arr_id); if (status == FAIL) { sprintf(errbuf, "Cannot add array data field. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(bck); free(chrFldCurr); free(chrFldPrev); return(FAIL); } /* Read the link field data from Current level */ /* ------------------------------------------- */ status = H5Dread(dataID_curr, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, chrFldCurr); if (status == FAIL) { sprintf(errbuf, "Cannot read link field from current level. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(bck); free(chrFldCurr); free(chrFldPrev); return(FAIL); } /* Read the link field data from Previous level */ /* -------------------------------------------- */ status = H5Dread(dataID_prev, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, chrFldPrev); if (status == FAIL) { sprintf(errbuf, "Cannot read link field from previous level. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(bck); free(chrFldCurr); free(chrFldPrev); return(FAIL); } /* Release datatype ID */ /* -------------------- */ status = H5Tclose(arr_id); if (status == FAIL) { sprintf(errbuf, "Cannot release the array datatype ID. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(bck); free(chrFldCurr); free(chrFldPrev); return(FAIL); } /* Loop through input records */ /* -------------------------- */ for (k = 0; k < nrecCurr; k++){ for (j = 0; j < nrecPrev; j++){ if (strcmp((chrFldCurr + (k*string_size)), (chrFldPrev + (j*string_size))) == 0) { bck[k].back = j; break; } } } free(chrFldCurr); free(chrFldPrev); } break; case 0: { datasize = (size_t)(dims[0] * sizeof(char)); chrFldCurr = (char *)calloc(nrecCurr, datasize); if (chrFldCurr == NULL) { sprintf(errbuf, "Cannot allocate memory. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(bck); return(FAIL); } chrFldPrev = (char *)calloc(nrecPrev, datasize); if (chrFldPrev == NULL) { sprintf(errbuf, "Cannot allocate memory. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(chrFldCurr); free(bck); return(FAIL); } /* Create Compound datatype */ /* ------------------------ */ tid = H5Tcreate(H5T_COMPOUND, datasize); if (tid == FAIL) { sprintf(errbuf, "Cannot create Compound datatype. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(chrFldCurr); free(chrFldPrev); free(bck); return(FAIL); } /* Create array datatype */ /* --------------------- */ /*arr_id = H5Tarray_create(HE5_EHdtype2mtype(fldtype), 1, dims, NULL);*/ cdatatype = HE5_EHconvdatatype(fldnumtype); /* if fldnumtype is HE5 numbertype, rather than H5 numbertype, then convert it, otherwise use fldnumtype itself */ if(cdatatype == FAIL) { cdatatype = fldnumtype; } arr_id = H5Tarray_create(cdatatype, 1, dims, NULL); if (arr_id == FAIL) { sprintf(errbuf, "Cannot create array data type. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(bck); free(chrFldCurr); free(chrFldPrev); return(FAIL); } /* Add array field */ /* --------------- */ status = H5Tinsert(tid, utlbuf, 0, arr_id); if (status == FAIL) { sprintf(errbuf, "Cannot add array data field. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(bck); free(chrFldCurr); free(chrFldPrev); return(FAIL); } /* Read the link field data from Current level */ /* ------------------------------------------- */ status = H5Dread(dataID_curr, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, chrFldCurr); if (status == FAIL) { sprintf(errbuf, "Cannot read link field from current level. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(bck); free(chrFldCurr); free(chrFldPrev); return(FAIL); } /* Read the link field data from Previous level */ /* -------------------------------------------- */ status = H5Dread(dataID_prev, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, chrFldPrev); if (status == FAIL) { sprintf(errbuf, "Cannot read link field from previous level. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(bck); free(chrFldCurr); free(chrFldPrev); return(FAIL); } /* Release datatype ID */ /* -------------------- */ status = H5Tclose(arr_id); if (status == FAIL) { sprintf(errbuf, "Cannot release the array datatype ID. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(bck); free(chrFldCurr); free(chrFldPrev); return(FAIL); } /* Loop through input records */ /* -------------------------- */ for (k = 0; k < nrecCurr; k++){ for (j = 0; j < nrecPrev; j++){ if (memcmp(chrFldCurr+k*datasize, chrFldPrev+j*datasize, dims[0]) == 0) { bck[k].back = j; break; } } } free(chrFldCurr); free(chrFldPrev); } break; case 1: { intFldCurr = (int *)calloc(nrecCurr, sizeof(int)); intFldPrev = (int *)calloc(nrecPrev, sizeof(int)); /* Create Compound datatype */ /* ------------------------ */ tid = H5Tcreate(H5T_COMPOUND, sizeof(int)); if (tid == FAIL) { sprintf(errbuf, "Cannot create Compound datatype. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(intFldCurr); free(intFldPrev); free(bck); return(FAIL); } /* Insert data member */ /* ------------------ */ status = H5Tinsert(tid, utlbuf, 0, HE5_EHdtype2mtype(fldtype)); if (status == FAIL) { sprintf(errbuf, "Cannot insert data member. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(bck); free(intFldCurr); free(intFldPrev); return(FAIL); } /* Read the link field data from Current level */ /* ------------------------------------------- */ status = H5Dread(dataID_curr, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, intFldCurr); if (status == FAIL) { sprintf(errbuf, "Cannot read link field from current level. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(bck); free(intFldCurr); free(intFldPrev); return(FAIL); } /* Read the link field data from Previous level */ /* -------------------------------------------- */ status = H5Dread(dataID_prev, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, intFldPrev); if (status == FAIL) { sprintf(errbuf, "Cannot read link field from previous level. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(bck); free(intFldCurr); free(intFldPrev); return(FAIL); } /* Loop through input records */ /* -------------------------- */ for (k = 0; k < nrecCurr; k++){ for (j = 0; j < nrecPrev; j++){ if (intFldCurr[k] == intFldPrev[j]) { bck[k].back = j; break; } } } free(intFldCurr); free(intFldPrev); } break; case 2: { lngFldCurr = (long *)calloc(nrecCurr, sizeof(long)); lngFldPrev = (long *)calloc(nrecPrev, sizeof(long)); /* Create Compound datatype */ /* ------------------------ */ tid = H5Tcreate(H5T_COMPOUND, sizeof(long)); if (tid == FAIL) { sprintf(errbuf, "Cannot create Compound datatype. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(lngFldCurr); free(lngFldPrev); free(bck); return(FAIL); } /* Insert data member */ /* ------------------ */ status = H5Tinsert(tid, utlbuf, 0, HE5_EHdtype2mtype(fldtype)); if (status == FAIL) { sprintf(errbuf, "Cannot insert data member. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(bck); free(lngFldCurr); free(lngFldPrev); return(FAIL); } /* Read the link field data from Current level */ /* ------------------------------------------- */ status = H5Dread(dataID_curr, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, lngFldCurr); if (status == FAIL) { sprintf(errbuf, "Cannot read link field from current level. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(bck); free(lngFldCurr); free(lngFldPrev); return(FAIL); } /* Read the link field data from Previous level */ /* -------------------------------------------- */ status = H5Dread(dataID_prev, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, lngFldPrev); if (status == FAIL) { sprintf(errbuf, "Cannot read link field from previous level. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(bck); free(lngFldCurr); free(lngFldPrev); return(FAIL); } /* Loop through input records */ /* -------------------------- */ for (k = 0; k < nrecCurr; k++){ for (j = 0; j < nrecPrev; j++){ if (lngFldCurr[k] == lngFldPrev[j]) { bck[k].back = j; break; } } } free(lngFldCurr); free(lngFldPrev); } break; case 3: { fltFldCurr = (float *)calloc(nrecCurr, sizeof(float)); fltFldPrev = (float *)calloc(nrecPrev, sizeof(float)); /* Create Compound datatype */ /* ------------------------ */ tid = H5Tcreate(H5T_COMPOUND, sizeof(float)); if (tid == FAIL) { sprintf(errbuf, "Cannot create Compound datatype. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(fltFldCurr); free(fltFldPrev); free(bck); return(FAIL); } /* Insert data member */ /* ------------------ */ status = H5Tinsert(tid, utlbuf, 0, HE5_EHdtype2mtype(fldtype)); if (status == FAIL) { sprintf(errbuf, "Cannot insert data member. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(bck); free(fltFldCurr); free(fltFldPrev); return(FAIL); } /* Read the link field data from Current level */ /* ------------------------------------------- */ status = H5Dread(dataID_curr, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, fltFldCurr); if (status == FAIL) { sprintf(errbuf, "Cannot read link field from current level. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(bck); free(fltFldCurr); free(fltFldPrev); return(FAIL); } /* Read the link field data from Previous level */ /* -------------------------------------------- */ status = H5Dread(dataID_prev, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, fltFldPrev); if (status == FAIL) { sprintf(errbuf, "Cannot read link field from previous level. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(bck); free(fltFldCurr); free(fltFldPrev); return(FAIL); } /* Loop through input records */ /* -------------------------- */ for (k = 0; k < nrecCurr; k++){ for (j = 0; j < nrecPrev; j++){ if (fltFldCurr[k] == fltFldPrev[j]) { bck[k].back = j; break; } } } free(fltFldCurr); free(fltFldPrev); } break; case 4: { dblFldCurr = (double *)calloc(nrecCurr, sizeof(double)); dblFldPrev = (double *)calloc(nrecPrev, sizeof(double)); /* Create Compound datatype */ /* ------------------------ */ tid = H5Tcreate(H5T_COMPOUND, sizeof(double)); if (tid == FAIL) { sprintf(errbuf, "Cannot create Compound datatype. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(dblFldCurr); free(dblFldPrev); free(bck); return(FAIL); } /* Insert data member */ /* ------------------ */ status = H5Tinsert(tid, utlbuf, 0, HE5_EHdtype2mtype(fldtype)); if (status == FAIL) { sprintf(errbuf, "Cannot insert data member. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(bck); free(dblFldCurr); free(dblFldPrev); return(FAIL); } /* Read the link field data from Current level */ /* ------------------------------------------- */ status = H5Dread(dataID_curr, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dblFldCurr); if (status == FAIL) { sprintf(errbuf, "Cannot read link field from current level. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(bck); free(dblFldCurr); free(dblFldPrev); return(FAIL); } /* Read the link field data from Previous level */ /* -------------------------------------------- */ status = H5Dread(dataID_prev, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dblFldPrev); if (status == FAIL) { sprintf(errbuf, "Cannot read link field from previous level. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(bck); free(dblFldCurr); free(dblFldPrev); return(FAIL); } /* Loop through input records */ /* -------------------------- */ for (k = 0; k < nrecCurr; k++){ for (j = 0; j < nrecPrev; j++){ if (dblFldCurr[k] == dblFldPrev[j]) { bck[k].back = j; break; } } } free(dblFldCurr); free(dblFldPrev); } break; default: { sprintf(errbuf, "Link record datatype is not supported. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(bck); return(FAIL); } } /* Release datatype ID */ /* -------------------- */ status = H5Tclose(tid); if (status == FAIL) { sprintf(errbuf, "Cannot release the datatype ID. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(bck); return(FAIL); } /* Get ID of BCKPOINTER data */ /* -------------------------- */ sprintf(utlbuf, "%s%d%s%d", "BCKPOINTER:", level, "->", level - 1); /* Open "BCKPOINTER" dataset */ /* ------------------------- */ bckid = H5Dopen(link_id, utlbuf); if (bckid == FAIL) { sprintf(errbuf, "Cannot open the \"BCKPOINTER\" dataset. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(bck); return(FAIL); } datasize = (size_t)sizeof(bckptr); count[0] = (hsize_t)nrecCurr; /* Extend BCKPOINTER dataset */ /* -------------------------- */ status = H5Dextend(bckid, count); if (status == FAIL) { sprintf(errbuf, "Cannot extend the \"BCKPOINTER\" dataset. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(bck); return(FAIL); } /* Get datatype ID of BCKPOINTER data */ /* ----------------------------------- */ typeID = H5Dget_type(bckid); if (typeID == FAIL) { sprintf(errbuf, "Cannot get the datatype of \"BCKPOINTER\" dataset. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(bck); return(FAIL); } /* Create the property list */ /* -------------------------- */ xfer_list = H5Pcreate(H5P_DATASET_XFER); if (xfer_list == FAIL) { sprintf(errbuf, "Cannot create the property list. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_PLIST, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(bck); return(FAIL); } /* Set buffer */ /* ----------- */ status = H5Pset_buffer(xfer_list, datasize, NULL, NULL); if (status == FAIL) { sprintf(errbuf, "Cannot set the buffer. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(bck); return(FAIL); } /* Write back pointer values to "BCKPOINTER" dataset */ /* ------------------------------------------------- */ status = H5Dwrite(bckid, typeID, H5S_ALL,H5S_ALL, xfer_list, bck); if (status == FAIL) { sprintf(errbuf, "Cannot write data to the \"BCKPOINTER\" dataset. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(bck); return(FAIL); } /* Release dataset ID */ /* ------------------- */ status = H5Dclose(bckid); if (status == FAIL) { sprintf(errbuf, "Cannot release the dataset ID. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(bck); return(FAIL); } /* Release datatype ID */ /* -------------------- */ status = H5Tclose(typeID); if (status == FAIL) { sprintf(errbuf, "Cannot release the datatype ID. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(bck); return(FAIL); } /* Release property list ID */ /* ------------------------- */ status = H5Pclose(xfer_list); if (status == FAIL) { sprintf(errbuf, "Cannot release the property list ID. \n"); H5Epush(__FILE__, "HE5_PTwrbckptr", __LINE__, H5E_PLIST, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(bck); return(FAIL); } free(bck); return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTrdbckptr | | | | DESCRIPTION: Reads back pointers | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID hid_t point structure ID | | level int level index (0 - based) | | | | OUTPUTS: | | buffer void Data buffer | | | | NOTES: | | | | | | Date Programmer Description | | ======== ============ ================================================= | | 12/20/99 A. Muslimov Added proper error handlings after the function | | calls. Made some minor (mostly cosmetic) changes. | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | Nov 00 A.Muslimov Changed the interface. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ static herr_t HE5_PTrdbckptr(hid_t pointID, int level, void *buffer) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* POINTS group ID */ hid_t bckid = FAIL;/* "BACKPOINTER" dataset ID */ hid_t typeID = FAIL;/* Data type ID */ hid_t link_id = FAIL;/* "Linkage" group ID */ long idx = FAIL;/* Point index */ char utlbuf[HE5_HDFE_UTLBUFSIZE];/* Utility buffer */ char *mess = "No Linkage Defined between levels: %d and %d.\n"; char errbuf[HE5_HDFE_ERRBUFSIZE];/* error message buffer */ /* Check for valid point ID */ /* ------------------------ */ status = HE5_PTchkptid(pointID, "HE5_PTrdbckptr", &fid, &gid, &idx); if (status == FAIL ) { sprintf(errbuf, "Checking for point ID failed. \n"); H5Epush(__FILE__, "HE5_PTrdbckptr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Check the level number */ /* ---------------------- */ if (level <= 0) { sprintf(errbuf, "Passed wrong level number. Level should be > 0. \n"); H5Epush(__FILE__, "HE5_PTrdbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get Back-Linkage Field */ /* ---------------------- */ status = HE5_PTbcklinkinfo(pointID, level, utlbuf); if (status == FAIL) { sprintf(errbuf, mess, level, level - 1); H5Epush(__FILE__, "HE5_PTrdbckptr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get ID of "Linkage" group */ /* ------------------------ */ link_id = HE5_PTXPoint[idx].link_id; /* Get ID of BCKPOINTER data */ /* -------------------------- */ sprintf(utlbuf, "%s%d%s%d","BCKPOINTER:", level, "->", level - 1); /* READ THE "BCKPOINTER" DATASET */ /* ----------------------------- */ /* Open the "BCKPOINTER" dataset */ /* ----------------------------- */ bckid = H5Dopen(link_id, utlbuf); if (bckid == FAIL) { sprintf(errbuf,"Cannot open the \"BCKPOINTER\" dataset. \n"); H5Epush(__FILE__, "HE5_PTrdbckptr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Create Compound datatype */ /* ------------------------ */ typeID = H5Tcreate(H5T_COMPOUND, sizeof(bckptr)); if (typeID == FAIL) { sprintf(errbuf,"Cannot create the Compound datatype. \n"); H5Epush(__FILE__, "HE5_PTrdbckptr", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Insert data member */ /* ------------------ */ status = H5Tinsert(typeID,"BCKPOINTER",HOFFSET(bckptr, back),H5T_NATIVE_LLONG); if (status == FAIL) { sprintf(errbuf,"Cannot insert data member to \"BCKPOINTER\" dataset. \n"); H5Epush(__FILE__, "HE5_PTrdbckptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Read the data from the dataset */ /* ------------------------------ */ status = H5Dread(bckid, typeID, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer); if (status == FAIL) { sprintf(errbuf,"Cannot read data from the \"BCKPOINTER\" dataset. \n"); H5Epush(__FILE__, "HE5_PTrdbckptr", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* release dataset ID */ /* ------------------ */ status = H5Dclose(bckid); if (status == FAIL) { sprintf(errbuf,"Cannot release the dataset ID. \n"); H5Epush(__FILE__, "HE5_PTrdbckptr", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* release datatype ID */ /* ------------------- */ status = H5Tclose(typeID); if (status == FAIL) { sprintf(errbuf,"Cannot release the datatype ID. \n"); H5Epush(__FILE__, "HE5_PTrdbckptr", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTwrfwdptr | | | | DESCRIPTION: Write forward pointer records | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID hid_t point structure ID | | level int level index (0 - based) | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 12/20/99 A. Muslimov Added proper error handlings after the function | | calls. Corrected memory management stuff. Made | | some minor (mostly cosmetic) changes. | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | Nov 00 A.Muslimov Changed the interface. | | Sept 04 S.Zhao Changed "long long" to "LONGLONG" for Windows. | | Feb 06 Abe Taaheri Support for STRING fields and setting pointers to -1| | values when the records in child level is not | | monotonic | | | | END_PROLOG | -----------------------------------------------------------------------------*/ static herr_t HE5_PTwrfwdptr(hid_t pointID, int level) { herr_t status = FAIL; /* routine return status variable */ int FORWARD = TRUE; /* Forward pointer flag */ int nlevels = 0; /* Number of levels in point */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* POINTS group ID */ hid_t fwdID = FAIL; /* "FORWARD" pointer data set ID */ hid_t typeID = FAIL; /* Data type ID */ hid_t link_id = FAIL; /* "Linkage" group ID */ long idx = FAIL; /* Point index */ LONGLONG max = 0; /* Maximun back pointer value */ LONGLONG i, j, k; /* Loop indices */ LONGLONG start = 0; /* Loop index */ LONGLONG nrec = 0; /* # of records in FWDPOINTER dataset */ /* hsize_t nrec = 0;*/ /* # of records in FWDPOINTER dataset */ hsize_t count = 0; /* Size of the fwdpointer dataset */ bckptr *bck = (bckptr *)NULL;/* Struct for bckpointer dataset */ fwdptr *fwd = (fwdptr *)NULL;/* Struct for fwdpointer dataset */ char utlbuf[HE5_HDFE_UTLBUFSIZE];/* Utility buffer */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* error message buffer */ /* Check for valid point ID */ /* ------------------------ */ status = HE5_PTchkptid(pointID, "HE5_PTwrfwdptr", &fid, &gid, &idx); if (status == FAIL ) { sprintf(errbuf, "Checking for point ID failed. \n"); H5Epush(__FILE__, "HE5_PTwrfwdptr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get number of levels in point */ /* ----------------------------- */ nlevels = HE5_PTnlevels(pointID); /* Get number of records in following level */ /* ---------------------------------------- */ nrec = (level < nlevels - 1) ? (LONGLONG)HE5_PTnrecs(pointID, level + 1) : 0; /* If records exist in current and following level... */ /* -------------------------------------------------- */ if ((int)HE5_PTnrecs(pointID, level) > 0 && (int)nrec > 0) { /* Allocate memory */ /* --------------- */ bck = (bckptr *)calloc((int)nrec, sizeof(bckptr)); if (bck == (bckptr *)NULL) { sprintf(errbuf, "Cannot allocate memory. \n"); H5Epush(__FILE__, "HE5_PTwrfwdptr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } status = HE5_PTrdbckptr(pointID, level + 1, bck); if (status == FAIL ) { sprintf(errbuf, "Cannot read the back pointer. \n"); H5Epush(__FILE__, "HE5_PTwrfwdptr", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(bck); return(FAIL); } /* Find Max BackPointer value */ /* -------------------------- */ max = bck[0].back; for (i = 1; i < nrec; i++) { if (bck[i].back > max) { max = bck[i].back; } } /* Allocate memory for fwdpointer struct */ /* ------------------------------------- */ fwd = (fwdptr *)calloc((int)max + 1, sizeof(fwdptr)); if(fwd == (fwdptr *)NULL) { sprintf(errbuf, "Cannot allocate memory. \n"); H5Epush(__FILE__, "HE5_PTwrfwdptr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(bck); return(FAIL); } /* Get ID of "Linkage" group */ /* ------------------------- */ link_id = HE5_PTXPoint[idx].link_id; /* Get ID of FWDPOINTER dataset */ /* ---------------------------- */ sprintf(utlbuf, "%s%d%s%d", "FWDPOINTER:", level, "->", level+1); /* Open FWDPOINTER dataset */ /* ----------------------- */ fwdID = H5Dopen(link_id, utlbuf); if (fwdID == FAIL) { sprintf(errbuf, "Cannot open the dataset. \n"); H5Epush(__FILE__, "HE5_PTwrfwdptr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(fwd); free(bck); return(FAIL); } count = (hsize_t)max + 1; /* Extend the dataset size */ /* ----------------------- */ status = H5Dextend(fwdID, &count); if (status == FAIL) { sprintf(errbuf, "Cannot extend the dataset.\n"); H5Epush(__FILE__, "HE5_PTwrfwdptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(fwd); free(bck); return(FAIL); } /* Get dataset FWDPOINT:?->? datatype */ /* ---------------------------------- */ typeID = H5Dget_type(fwdID); if (typeID == FAIL) { sprintf(errbuf, "Cannot get the data type ID. \n"); H5Epush(__FILE__, "HE5_PTwrfwdptr", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(fwd); free(bck); return(FAIL); } /* Set the values for the forward pointers */ /* --------------------------------------- */ /* Fill Fwd Ptr buffers with -1 */ /* ---------------------------- */ for ( k = 0; k <= max; k++) { fwd[k].begin = (LONGLONG)FAIL; fwd[k].extent = (LONGLONG)FAIL; } /* Set forward pointer flag to 1 (TRUE) */ /* ----------------------------- */ FORWARD = TRUE; /* Loop through all records */ /* ------------------------ */ for (j = 0; j < nrec; j++) { /* If fwd extent entry not yet written for rec[j] ... */ /* ----------------------------------------------- */ if (fwd[bck[j].back].extent == (LONGLONG)FAIL) { /* Set fwd begin to (possible) beginning of sequence */ /* -------------------------------------------- */ fwd[bck[j].back].begin = (LONGLONG)j; /* Set fwd extent to initial value of sequence */ /* ------------------------------------- */ fwd[bck[j].back].extent = (LONGLONG)j; } else { /* If numbers in sequence ... */ /* -------------------------- */ if ((LONGLONG)j - fwd[bck[j].back].extent == 1) { /* Set Buf1 to current value of sequence */ /* ------------------------------------- */ fwd[bck[j].back].extent = (LONGLONG)j; } else { /* Back pointers in following level not monotonic */ /* ---------------------------------*/ /* Set begin begin and extent for first record in Forward pointer to Fail */ /* -------------------------------------- */ fwd[0].begin = (LONGLONG)FAIL; fwd[0].extent = (LONGLONG)FAIL; /* also set to fail other elemets */ fwd[bck[j].back].begin = (LONGLONG)FAIL; fwd[bck[j].back].extent = (LONGLONG)FAIL; /* Set forward pointer flag to 0 */ /* ----------------------------- */ FORWARD = FALSE; break; } } } /* Although setting to (-1,-1) of first forward pointer record for non-monotonic backward pointers is good enough for knowing this fact, let's put -1 in rest of the records for making output in hdf file less confusing */ if((fwd[0].begin == (LONGLONG)FAIL) && (fwd[0].extent == (LONGLONG)FAIL)) { for ( k = 1; k <= max; k++) { fwd[k].begin = (LONGLONG)FAIL; fwd[k].extent = (LONGLONG)FAIL; } } /* Back pointers in following level are monotonic */ /* ---------------------------------------------- */ if (FORWARD == TRUE) { for (k = 0; k <= max; k++) { fwd[k].begin = fwd[k].begin; fwd[k].extent = fwd[k].extent - fwd[k].begin + 1; } } /* Write data to the "FWDPOINTER" */ /* ------------------------------ */ status = H5Dwrite(fwdID, typeID, H5S_ALL, H5S_ALL, H5P_DEFAULT, fwd); if (status == FAIL ) { sprintf(errbuf, "Cannot write data to the dataset. \n"); H5Epush(__FILE__, "HE5_PTwrfwdptr", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (fwd != NULL) free(fwd); if (bck != NULL) free(bck); return(FAIL); } if (bck != NULL) free(bck); if (fwd != NULL) free(fwd); /* Release the dataset ID */ /* ---------------------- */ status = H5Dclose(fwdID); if (status == FAIL ) { sprintf(errbuf, "Cannot release the dataset ID. \n"); H5Epush(__FILE__, "HE5_PTwrfwdptr", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Release the datatype ID */ /* ----------------------- */ status = H5Tclose(typeID); if (status == FAIL ) { sprintf(errbuf, "Cannot release the data type ID. \n"); H5Epush(__FILE__, "HE5_PTwrfwdptr", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTrdfwdptr | | | | DESCRIPTION: Read forward pointer records | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID hid_t point structure ID | | level int level index (0 - based) | | | | | | OUTPUTS: | | buffer void Data buffer | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ======== ============ ================================================= | | 12/20/99 A. Muslimov Added proper error handlings after the function | | calls. Made some minor (mostly cosmetic) changes. | | 7.18.99 A.Muslimov Unmasked hdf5 data types. | | Nov 00 A.Muslimov Changed the interface. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ static herr_t HE5_PTrdfwdptr(hid_t pointID, int level, void *buffer) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* POINTS group ID */ hid_t link_id = FAIL;/* Linkage group ID */ hid_t fwdID = FAIL;/* FWDPOINTER dataset ID */ hid_t typeID = FAIL;/* FWDPOINTER dataset datatype ID */ long idx = FAIL;/* Point index */ char utlbuf[HE5_HDFE_UTLBUFSIZE];/* Utility buffer */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* error message buffer */ fwdptr fwd; /* Tmp FWDPOINTER struct dataset */ /* Check for valid point ID */ /* ------------------------ */ status = HE5_PTchkptid(pointID, "HE5_PTrdfwdptr", &fid, &gid, &idx); if (status == FAIL ) { sprintf(errbuf, "Checking for point ID failed. \n"); H5Epush(__FILE__, "HE5_PTrdfwdptr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get ID of Linkage group */ /* ------------------------ */ link_id = HE5_PTXPoint[idx].link_id; /* Get name string of FWDPOINTER dataset */ /* ------------------------------------- */ sprintf(utlbuf, "%s%d%s%d", "FWDPOINTER:", level, "->", level + 1); /* Open the "FWDPOINTER" dataset */ /* ----------------------------- */ fwdID = H5Dopen(link_id, utlbuf); if (fwdID == FAIL) { sprintf(errbuf, "Cannot open the dataset \"%s\". \n", utlbuf); H5Epush(__FILE__, "HE5_PTrdfwdptr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the (Compound) dataset type ID */ /* ---------------------------------- */ typeID = H5Dget_type(fwdID); if (typeID == FAIL) { sprintf(errbuf, "Cannot get the data type ID. \n"); H5Epush(__FILE__, "HE5_PTrdfwdptr", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Create (Compound) datatype */ /* -------------------------- */ typeID = H5Tcreate(H5T_COMPOUND, sizeof(fwdptr)); if (typeID == FAIL) { sprintf(errbuf, "Cannot create compound datatype. \n"); H5Epush(__FILE__, "HE5_PTrdfwdptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Insert "BEGIN" data member */ /* -------------------------- */ status = H5Tinsert(typeID, "BEGIN", HOFFSET(fwdptr, begin), H5T_NATIVE_LLONG); if (status == FAIL) { sprintf(errbuf, "Cannot insert \"BEGIN\" data member. \n"); H5Epush(__FILE__, "HE5_PTrdfwdptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Insert "EXTENT" data member */ /* --------------------------- */ status = H5Tinsert(typeID, "EXTENT", HOFFSET(fwdptr, extent), H5T_NATIVE_LLONG); if (status == FAIL) { sprintf(errbuf, "Cannot insert \"EXTENT\" data member. \n"); H5Epush(__FILE__, "HE5_PTrdfwdptr", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Read BEGIN & EXTENT fields in first record */ /* ------------------------------------------ */ status = H5Dread(fwdID, typeID, H5S_ALL, H5S_ALL, H5P_DEFAULT, &fwd); if (status == FAIL) { sprintf(errbuf, "Cannot read \"FWDPOINTER\" dataset. \n"); H5Epush(__FILE__, "HE5_PTrdfwdptr", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Check if first record is not a garbage */ /* -------------------------------------- */ if (fwd.begin == FAIL || fwd.extent == FAIL) { /* Release the dataset ID */ /* ---------------------- */ status = H5Dclose(fwdID); if (status == FAIL) { sprintf(errbuf, "Cannot release dataset ID. \n"); H5Epush(__FILE__, "HE5_PTrdfwdptr", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } /* Release the data type ID */ /* ------------------------ */ status = H5Tclose(typeID); if (status == FAIL) { sprintf(errbuf, "Cannot release datatype ID. \n"); H5Epush(__FILE__, "HE5_PTrdfwdptr", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return(FAIL); } /* Read BEGIN & EXTENT fields for all records */ /* ------------------------------------------ */ status = H5Dread(fwdID, typeID, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer); if (status == FAIL) { sprintf(errbuf, "Cannot read \"FWDPOINTER\" dataset. \n"); H5Epush(__FILE__, "HE5_PTrdfwdptr", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Release the dataset ID */ /* ---------------------- */ status = H5Dclose(fwdID); if (status == FAIL) { sprintf(errbuf, "Cannot release dataset ID. \n"); H5Epush(__FILE__, "HE5_PTrdfwdptr", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Release the data type ID */ /* ------------------------ */ status = H5Tclose(typeID); if (status == FAIL) { sprintf(errbuf, "Cannot release datatype ID. \n"); H5Epush(__FILE__, "HE5_PTrdfwdptr", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTupdatelevel | | | | DESCRIPTION: Updates the specified fields and records of a level. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID hid_t point structure ID | | level int level number (0 - based) | | fieldlist char fieldlist to read (comma-separated) | | nrec hsize_t Number of records to read | | recs hssize_t array of record numbers to read | | data void data buffer | | | | OUTPUTS: | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Nov 00 A.Muslimov Changed the interface. | | Mar 01 A.Muslimov Updated to reflect changes in the HDF5 library. | | 09/13/01 A.Muslimov Added mutex "lock"/"unlock" calls. | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_PTupdatelevel(hid_t pointID, int level, char *fieldlist, hsize_t nrec, hssize_t recs[], void *data) { herr_t status = FAIL;/* routine return status variable */ int nlevels = 0; /* Number of levels in point */ int rank = 1; /* Rank of compound dataset */ int j; /* Loop index */ long idx = FAIL;/* Point index */ long nfields = 0; /* Number of fields in fieldlist */ long i; /* Loop inde x */ long dum = FAIL;/* Dummy variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "POINTS" group ID */ hid_t dataID = FAIL;/* Dataset ID */ hid_t dspace = FAIL;/* Disk data space ID */ hid_t mspace = FAIL;/* Memory data space ID */ hid_t typeID = FAIL;/* Data type ID */ hsize_t nallrec = 0; /* Number of records in Point */ hsize_t dims[1] = {0}; /* member dimensions in dataset */ hsize_t *coord = NULL;/* Coordinates of elemnts to update */ size_t datasize = 0; /* Data size (bytes) of each record */ size_t slen[HE5_HDFE_DIMBUFSIZE]; /* String length array */ char utlbuf[HE5_HDFE_UTLBUFSIZE];/* Utility buffer */ char *pntr[HE5_HDFE_DIMBUFSIZE]; /* String pointer array */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_CmpDTSinfo info; /* Structure with the dataset information */ HE5_LOCK; CHECKPOINTER(data); /* Check for valid point ID */ /* ------------------------ */ status = HE5_PTchkptid(pointID, "HE5_PTupdatelevel", &fid, &gid, &idx); if (status == FAIL) { sprintf(errbuf, "Checking for point ID failed. \n"); H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get number of levels */ /* -------------------- */ nlevels = HE5_PTnlevels(pointID); if (nlevels == 0) { status = FAIL; sprintf(errbuf, "No Levels Defined for point.\n"); H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } else if (nlevels < level) { status = FAIL; sprintf(errbuf, "Only %d levels defined for the point. \n", nlevels); H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get dataset ID */ /* -------------- */ dataID = HE5_PTXPoint[idx].level[level].ID; /* Initialize slen[] array */ /* ----------------------- */ for (j = 0; j < HE5_HDFE_DIMBUFSIZE; j++) slen[ j ] = 0; /* Parse field list */ /* ---------------- */ nfields = HE5_EHparsestr(fieldlist, ',', pntr, slen); /* Check that all fields in list exist in level */ /* -------------------------------------------- */ for (i = 0; i < nfields; i++) { memmove(utlbuf, pntr[i], slen[i]); utlbuf[slen[i]] = 0; if (HE5_PTfexist(dataID, utlbuf, NULL, NULL, NULL, NULL) != 1) { status = FAIL; sprintf(errbuf, "Field: \"%s\" does not exist.\n", utlbuf); H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf ); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } /* Check input records to update */ /* ----------------------------- */ if( nrec == 0 || recs == NULL ) { /* Get neumber of records in level */ /* ------------------------------- */ nallrec = HE5_PTnrecs(pointID, level); if (nallrec == 0) { sprintf(errbuf, "Cannot retrieve number of records in Point. \n"); H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Call HE5_PTlevelinfo() */ /* ---------------------- */ status = HE5_PTlevelinfo(pointID, level, &info); if (status == FAIL) { sprintf(errbuf, "Cannot get the level information. \n"); H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the dataset size */ /* -------------------- */ datasize = info.datasize; /* Release pointers to the name buffers */ /* ------------------------------------ */ for (j = 0; j < info.nfields; j++) { if (info.fieldname[j] != NULL) H5free_memory(info.fieldname[j]); } /* Update all records in level */ /* --------------------------- */ status = HE5_PTwritelevel(pointID, level, &nallrec, &datasize, data); if (status == FAIL) { sprintf(errbuf, "Cannot write updated data to the level. \n"); H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } else if( nrec > 0 && recs != NULL ) { /* Get dataset space and datatype */ /* ------------------------------ */ dspace = H5Dget_space(dataID); if (dspace == FAIL) { sprintf(errbuf, "Cannot get the data space ID.\n"); H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get data type ID */ /* ---------------- */ typeID = H5Dget_type(dataID); if (typeID == FAIL) { sprintf(errbuf, "Cannot get the data type ID.\n"); H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } dims[0] = nrec; /* Create the memory data space */ /* ---------------------------- */ mspace = H5Screate_simple(rank, dims, NULL); if (mspace == FAIL) { sprintf(errbuf, "Cannot create the data space.\n"); H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Allocate memory */ /* --------------- */ coord = (hsize_t *)calloc(nrec, sizeof(hsize_t)); if (coord == NULL) { sprintf(errbuf, "Cannot allocate memory. \n"); H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Loop through all records to update */ /* ---------------------------------- */ for (i = 0; i < nrec; i++) coord[i] = (hsize_t)recs[i]; /* Select elements to update */ /* ------------------------- */ status = H5Sselect_elements(dspace, H5S_SELECT_SET, nrec, (const hsize_t *)coord); if (status == FAIL) { sprintf(errbuf, "Cannot select elements.\n"); H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(coord); return(FAIL); } /* Update selected records */ /* ----------------------- */ status = H5Dwrite(dataID, typeID, mspace, dspace, H5P_DEFAULT, data); if (status == FAIL) { sprintf(errbuf, "Cannot write data to the dataset.\n"); H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(coord); return(FAIL); } /* Release memory */ /* -------------- */ free(coord); /* Release data space ID */ /* --------------------- */ status = H5Sclose(mspace); if (status == FAIL) { sprintf(errbuf, "Cannot release the data space ID.\n"); H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Release data type ID */ /* --------------------- */ status = H5Tclose(typeID); if (status == FAIL) { sprintf(errbuf, "Cannot release the data type ID.\n"); H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Release data space ID */ /* --------------------- */ status = H5Sclose(dspace); if (status == FAIL) { sprintf(errbuf, "Cannot release the data space ID.\n"); H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } /* Update Pointers to Previous Level */ /* -------------------------------- */ if (level > 0) { /* Store back linkage field in utlbuf */ /* ---------------------------------- */ status = HE5_PTbcklinkinfo(pointID, level, utlbuf); if (status == FAIL) { sprintf(errbuf, "Cannot get backward linkage information.\n"); H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Check whether back linkage field is in fieldlist */ /* ------------------------------------------------ */ dum = HE5_EHstrwithin(utlbuf, fieldlist, ','); if (dum != FAIL) { /* Back pointers to previous level */ /* ------------------------------- */ status = HE5_PTwrbckptr(pointID, level); if (status == FAIL) { sprintf(errbuf, "Cannot write backward pointer.\n"); H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Forward pointers from previous level */ /* ------------------------------------ */ status = HE5_PTwrfwdptr(pointID, level - 1); if (status == FAIL) { sprintf(errbuf, "Cannot write forward pointer.\n"); H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } } /* Update Pointers to Next Level */ /* ---------------------------- */ if (level < HE5_PTnlevels(pointID) - 1 && dum != FAIL) { /* Store forward linkage field in utlbuf */ /* ------------------------------------- */ status = HE5_PTfwdlinkinfo(pointID, level, utlbuf); if (status == FAIL) { sprintf(errbuf, "Cannot get forward linkage information.\n"); H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Check whether forward linkage field is in fieldlist */ /* --------------------------------------------------- */ dum = HE5_EHstrwithin(utlbuf, fieldlist, ','); if (dum != FAIL) { /* Back pointers from next level */ /* ----------------------------- */ status = HE5_PTwrbckptr(pointID, level + 1); if (status == FAIL) { sprintf(errbuf, "Cannot write backward pointer.\n"); H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Forward pointers to next level */ /* ------------------------------ */ status = HE5_PTwrfwdptr(pointID, level); if (status == FAIL) { sprintf(errbuf, "Cannot write forward pointer.\n"); H5Epush(__FILE__, "HE5_PTupdatelevel", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } } COMPLETION: HE5_UNLOCK; return(status); } /* ***************************************************************************** | | | F O R T R A N 7 7 W R A P P E R S | | | ***************************************************************************** */ /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTopenF (FORTRAN wrapper) | | | | DESCRIPTION: Opens or creates HDF file in order to create, read, or write | | a grid. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | FileID int None HDF-EOS file ID | | | | INPUTS: | | | | filename char* None Filename | | Flags uintn Access Code | | | | OUTPUTS: | | None | | | | NOTES: | | | | HDF5 Library Functions Called: | | | | None | | | | Date Programmer Description | | ====== ============ ================================================= | | 12/01/01 C.Praderas Initial coding | | 3/12/02 A.Muslimov Added more "Flags" options for core metadata. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTopenF(char *filename, uintn Flags) { hid_t fid = FAIL;/* hdf5 type file ID */ int FileID = FAIL;/* Return file ID */ uintn flags = 9999;/* HDF5 file access code */ char *errbuf = NULL;/* Error message buffer */ /* Allocate memory for error buffer */ /* -------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_PTopenF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory to error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Set up the file access flag */ /* --------------------------- */ if (Flags == HE5F_ACC_RDWR || Flags == HDF5_ACC_RDWR) flags = H5F_ACC_RDWR; else if (Flags == HE5F_ACC_RDONLY || Flags == HDF5_ACC_RDONLY) flags = H5F_ACC_RDONLY; else if (Flags == HE5F_ACC_TRUNC || Flags == HDF5_ACC_CREATE) flags = H5F_ACC_TRUNC; else { sprintf(errbuf, "File access flag is not supported. \n"); H5Epush(__FILE__, "HE5_PTopenF", __LINE__, H5E_ARGS, H5E_UNSUPPORTED, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Call HE5_PTopen to perform file access */ /* -------------------------------------- */ fid = HE5_PTopen(filename,flags); if(fid == FAIL) { sprintf(errbuf, "Error calling HE5_PTopen() from FORTRAN wrapper. \n"); H5Epush(__FILE__, "HE5_PTopenF", __LINE__, H5E_FILE, H5E_CANTOPENFILE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } FileID = (int)fid; free(errbuf); return(FileID); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTcreateF (FORTRAN wrapper) | | | | DESCRIPTION: Creates a new point structure and returns point ID. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | pointID int Point structure ID | | | | INPUTS: | | FileID int None HDF-EOS file id | | pointname char Point structure name | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTcreateF(int FileID, char *pointname) { int PointID = FAIL;/* point ID (return value) */ hid_t pointID = FAIL;/* HDF5 type point ID */ hid_t fid = FAIL;/* HDF5 type file ID */ char *errbuf = (char *)NULL; /* Buffer for error message */ errbuf = (char *)calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char) ); if (errbuf == NULL) { H5Epush(__FILE__, "HE5_PTcreateF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } fid = (hid_t)FileID; pointID = HE5_PTcreate(fid, pointname); if (pointID == FAIL) { sprintf(errbuf, "Error calling HE5_PTcreate() from FORTRAN wrapper. \n"); H5Epush(__FILE__, "HE5_PTcreateF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } free(errbuf); PointID = (int)pointID; return(PointID); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTattachF (FORTRAN wrapper) | | | | DESCRIPTION: Attaches to an existing grid within the file. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | pointID int point structure ID | | | | INPUTS: | | FileID int HDF-EOS file ID | | pointname char point structure name | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTattachF(int FileID, char *pointname) { int PointID = FAIL; /* Return value of the Point ID */ hid_t pointID = FAIL; /* HDF5 type Point ID */ hid_t fid = FAIL; /* HDF5 type file ID */ char *errbuf = (char *)NULL;/* Buffer for error message */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_PTattachF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory to error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } fid = (hid_t)FileID; pointID = HE5_PTattach(fid, pointname); if(pointID == FAIL) { sprintf(errbuf, "Error calling HE5_PTattach() from FORTRAN wrapper. \n"); H5Epush(__FILE__, "HE5_PTattachF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } free(errbuf); PointID = (int)pointID; return(PointID); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTdetachF (FORTRAN wrapper) | | | | DESCRIPTION: Detaches from grid interface and performs file housekeeping. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | PointID int None point structure ID | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTdetachF(int PointID) { int ret = FAIL;/* (int) Return status variable */ herr_t status = FAIL;/* routine return status variable */ hid_t pointID = FAIL;/* HDF5 type point ID */ char *errbuf = (char *)NULL;/*Error message buffer */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_PTdetachF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } pointID = (hid_t)PointID; status = HE5_PTdetach(pointID); if(status == FAIL) { sprintf(errbuf, "Error calling HE5_PTdetach() from FORTRAN wrapper. \n"); H5Epush(__FILE__, "HE5_PTdetachF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTcloseF (FORTRAN wrapper) | | | | DESCRIPTION: Closes file. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | | | FileID int HDF-EOS type file ID | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTcloseF(int FileID) { int ret = FAIL;/* (int) return status variable */ hid_t fid = FAIL;/* HDF5 type file ID */ herr_t status = FAIL;/* routine return status variable */ char *errbuf = (char *)NULL;/*Error message buffer */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_PTcloseF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } fid = (hid_t)FileID; /* Call HE5_PTclose to perform file close */ /* -------------------------------------- */ status = HE5_PTclose(fid); if(status == FAIL) { sprintf(errbuf, "Error calling HE5_PTclose() from FORTRAN wrapper. \n"); H5Epush(__FILE__, "HE5_PTcloseF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } free(errbuf); ret = (int)status; return(ret); } /* Definition routines */ /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTdeflevelF (FORTRAN wrapper) | | | | DESCRIPTION: Defines a level within the point data set. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID int point structure ID | | levelname char name of level | | rank int Rank of Fields | | fieldlist char Fieldlist to read (comma-separated) | | dim_sizes void Sizes of field dimensions | | datasize long Datasize of compound structure | | offset long Offsets of each of the fields | | dtype int Datatypes of each of the fields | | array int array flag identifier | | | | | | | | | | OUTPUTS: | | None | | | | NOTES: Metadata block needs to be developed | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTdeflevelF(int pointID, const char *levelname, int rank[], char *fieldlist, long *dim_sizes, int dtype[], int array[]) { herr_t status = FAIL;/* routine return status variable */ int ret = FAIL;/* (int) Return status variable */ int i, j, k = 0; hid_t PointID = FAIL; HE5_CmpDTSinfo dtsinfo; long nfields = FAIL; long max_rank = 0; long nelements_field = 0; long *datatype_size = (long *)NULL; long *datasize_field = (long *)NULL; long *offset = (long *)NULL; long datasize = 0; size_t slen[HE5_HDFE_DIMBUFSIZE]; char *errbuf = (char *)NULL; /* Error message buffer */ char utlbuf[HE5_HDFE_UTLBUFSIZE];/* Utility buffer */ char *pntr[HE5_HDFE_DIMBUFSIZE]; /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_PTdeflevelF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Parse field list */ /* ---------------- */ nfields = HE5_EHparsestr(fieldlist, ',', pntr, slen); /* Set up level data structure */ /* --------------------------- */ dtsinfo.nfields = (int)nfields; /* Calculate maximum rank of all the fields */ /* ---------------------------------------- */ for( i = 0; i < nfields; i++ ) { if( rank[i] > max_rank ) max_rank = rank[i]; } /* Load dimension array (2-d fortran dimension array is in fortran order) */ /* ----------------------------------------------------------------------- */ for( i = 0; i < max_rank; i++ ) { for( j = 0; j < nfields; j++ ) { k = i * (int)nfields + j; dtsinfo.dims[j][i] = (size_t)dim_sizes[k]; } } /* Store fieldname in level data structure */ /* --------------------------------------- */ for (i = 0; i < nfields; i++) { dtsinfo.fieldname[i] = (char *)calloc(HE5_HDFE_NAMBUFSIZE,sizeof(char)); memmove(utlbuf, pntr[i], slen[i]); utlbuf[slen[i]] = '\0'; memmove(dtsinfo.fieldname[i], utlbuf, slen[i]+1); } datatype_size = (long *)calloc(nfields,sizeof(long)); datasize_field = (long *)calloc(nfields,sizeof(long)); offset = (long *)calloc(nfields,sizeof(long)); for( i = 0; i < nfields; i++) { switch( dtype[i] ) { case HE5T_NATIVE_INT: { datatype_size[i] = sizeof(int); } break; case HE5T_NATIVE_FLOAT: { datatype_size[i] = sizeof(float); } break; case HE5T_NATIVE_DOUBLE: { datatype_size[i] = sizeof(double); } break; case HE5T_NATIVE_CHAR: { datatype_size[i] = sizeof(char); } break; case HE5T_NATIVE_LONG: { datatype_size[i] = sizeof(long); } break; default: break; } nelements_field = 0; for( j = 0; j < rank[i]; j++ ) { nelements_field = nelements_field + (long)dtsinfo.dims[i][j]; } datasize_field[i] = nelements_field*datatype_size[i]; } offset[0] = 0; datasize = datasize_field[0]; for( i = 1; i < nfields; i++) { offset[i] = offset[i-1] + datasize_field[i-1]; datasize = datasize + datasize_field[i]; } for( i = 0; i < nfields; i++ ) { dtsinfo.array[i] = array[i]; dtsinfo.rank[i] = rank[i]; dtsinfo.offset[i] = (off_t)offset[i]; dtsinfo.dtype[i] = HE5_EHconvdatatype(dtype[i]); /* if dtype[i] is HE5 numbertype, rather than H5 numbertype, then convert it, otherwise use dtype[i] itself */ if(dtsinfo.dtype[i] == FAIL) { dtsinfo.dtype[i] = dtype[i]; } } dtsinfo.datasize = (size_t)datasize; PointID = (hid_t)pointID; /* Call HE5_PTdeflevel() */ /* --------------------- */ status = HE5_PTdeflevel(PointID, levelname, &dtsinfo); if (status == FAIL ) { sprintf(errbuf, "Call to HE5_PTdeflevel() failed. \n"); H5Epush(__FILE__, "HE5_PTdeflevel", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } /* Free up space */ /* ------------- */ for (i = 0; i < nfields; i++ ) H5free_memory(dtsinfo.fieldname[i]); free(errbuf); free(datatype_size); free(datasize_field); free(offset); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTdeflinkageF (FORTRAN wrapper) | | | | DESCRIPTION: Defines link field between two (adjacent) levels. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID int point structure ID | | parent char parent level name | | child char child level name | | linkfield char linkage field name | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ========= ============ ============================================== | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTdeflinkageF(int pointID, char *parent, char *child, char *linkfield) { int ret = FAIL;/* (int) Return status variable */ herr_t status = FAIL;/* routine return status variable */ hid_t PointID = FAIL;/* hdf5 type file ID */ char *errbuf = NULL;/* Error message buffer */ /* Allocate memory for error buffer */ /* -------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_PTdeflinkageF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory to error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } PointID = (hid_t)pointID; /* Call HE5_PTdeflinkage */ /* -------------------------------------- */ status = HE5_PTdeflinkage(PointID, parent, child, linkfield); if(status == FAIL) { sprintf(errbuf, "Error calling HE5_PTdeflinkageF() from FORTRAN wrapper. \n"); H5Epush(__FILE__, "HE5_PTdeflinkageF", __LINE__, H5E_FILE, H5E_CANTOPENFILE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } ret = (int)status; free(errbuf); return(ret); } /* I/O routines */ /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTreadlevelF (FORTRAN wrapper) | | | | DESCRIPTION: Reads data from the specified fields and records of a level. | | Reads only one field at a time | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID int point structure ID | | level int level number (0 - based) | | fieldname char Name of field | | ntype int HDF numbertype of field datatype | | size int Memory size (bytes) of field being | | read. | | | | OUTPUTS: | | datbuf void Data buffer | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTreadlevelF(int pointID, int level, char *fieldname, int ntype, void *datbuf) { int ret = FAIL;/* (int) return status variable */ herr_t status = FAIL;/* routine return status variable */ hid_t ptID = FAIL; hid_t dtype = FAIL;/* HDF5 type data type ID */ char *errbuf = (char *)NULL;/*Error message buffer */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_PTcloseF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } dtype = HE5_EHconvdatatype(ntype); /* if ntype is HE5 numbertype, rather than H5 numbertype, then convert it, otherwise use ntype itself */ if(dtype == FAIL) { dtype = ntype; } ptID = (hid_t)pointID; /* Call HE5_PTreadlevel_f to read data */ /* ----------------------------------- */ status = HE5_PTreadlevel_f(ptID, level, fieldname, dtype, datbuf); if (status == FAIL) { sprintf(errbuf, "Reading data failed.\n"); H5Epush(__FILE__, "HE5_PTreadlevel_f", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTreadlevel_f | | | | DESCRIPTION: Reads data from the specified fields and records of a level. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID hid_t point structure ID | | level int level number (0 - based) | | fieldname char Name of field | | ntype int HDF numbertype of field datatype | | dtype hid_t datatype ID of field | | | | OUTPUTS: | | datbuf Data buffer | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ static herr_t HE5_PTreadlevel_f(hid_t pointID, int level, char *fieldname, hid_t dtype, void *datbuf) { herr_t status = FAIL;/* routine return status variable */ int nlevels = 0; /* Number of levels in point */ int i, j; /* Loop index */ int ii = 0; int nflds = FAIL; int result = 99; int field_size = 0; int rank = 0; size_t datatype_size = 0; hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* POINTS group ID */ hid_t dataID = FAIL;/* dataset ID */ hid_t xfer_list = FAIL;/* Property list ID */ hid_t typeID = FAIL;/* compound datatype ID */ hid_t arr_id = FAIL;/* Array datatype ID */ hid_t mtype = FAIL;/* Memory data type ID */ hsize_t dims[HE5_DTSETRANKMAX];/* Array of dimension sizes */ hsize_t datasize = 0;/* Size (bytes) of a dataset to read */ long idx = FAIL;/* Point index */ HE5_CmpDTSinfo dtsinfo;/* Structure to read information about level*/ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ /* Check for valid point ID */ /* ------------------------ */ status = HE5_PTchkptid(pointID, "HE5_PTreadlevel_f", &fid, &gid, &idx); if (status == FAIL) { sprintf(errbuf, "Checking for the point ID failed.\n"); H5Epush(__FILE__, "HE5_PTreadlevel_f", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Initialize dims[] array */ /* ----------------------- */ for (i = 0; i < HE5_DTSETRANKMAX; i++) dims[ i ] = 0; /* Get number of levels in point */ /* ----------------------------- */ nlevels = HE5_PTnlevels(pointID); if (nlevels == 0) { status = FAIL; sprintf(errbuf, "No Levels Defined for point ID: %d\n", pointID); H5Epush(__FILE__, "HE5_PTreadlevel_f", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } else if (nlevels < level) { /* Report error if level # to large */ /* -------------------------------- */ status = FAIL; sprintf(errbuf, "Only %d levels Defined for point ID: %d\n", nlevels, pointID); H5Epush(__FILE__, "HE5_PTreadlevel_f", __LINE__, H5E_FILE, H5E_SEEKERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get level dataset ID */ /* ------------------ */ dataID = HE5_PTXPoint[idx].level[level].ID; /* Create property list */ /* -------------------- */ xfer_list = H5Pcreate(H5P_DATASET_XFER); if (xfer_list == FAIL) { sprintf(errbuf, "Cannot create the property list. \n"); H5Epush(__FILE__, "HE5_PTreadlevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Call HE5_PTlevelinfo() */ /* ---------------------- */ status = HE5_PTlevelinfo(pointID, level, &dtsinfo); if (status == FAIL) { sprintf(errbuf, "Cannot get the level information. \n"); H5Epush(__FILE__, "HE5_PTreadlevel_f", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the dataset size */ /* -------------------- */ datasize = (hsize_t)(dtsinfo.datasize); /* Set the buffer */ /* -------------- */ status = H5Pset_buffer(xfer_list, datasize, NULL, NULL); if (status == FAIL) { sprintf(errbuf, "Cannot set the read buffer. \n"); H5Epush(__FILE__, "HE5_PTreadlevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } nflds = dtsinfo.nfields; /* Check that field does exist */ /* --------------------------- */ if (HE5_PTfexist(dataID, fieldname, NULL, NULL, NULL, NULL) != 1) { status = FAIL; sprintf(errbuf, "Field: \"%s\" does not exist.\n", fieldname); H5Epush(__FILE__, "HE5_PTreadlevel_f", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf ); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Find index of fieldname in the compound datatype */ /* ------------------------------------------------ */ for( i = 0; i < nflds; i++ ) { result = strcmp(fieldname,dtsinfo.fieldname[i]); if( result == 0 ) { ii = i; result = 99; } } i = ii; /* Calculate the data size of the field */ /* ------------------------------------ */ rank = dtsinfo.rank[i]; field_size = 1; for( j=0; j < rank; j++ ) field_size = (int)(field_size*dtsinfo.dims[i][j]); mtype = HE5_EHdtype2mtype(dtype); datatype_size = H5Tget_size(mtype); field_size = field_size*((int)datatype_size); /* Create Compound datatype */ /* ------------------------ */ typeID = H5Tcreate(H5T_COMPOUND, field_size); /* field_size is size of the entire field */ if (typeID == FAIL) { status = FAIL; sprintf(errbuf, "Cannot create the compound data type.\n"); H5Epush(__FILE__, "HE5_PTreadlevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Add members of a compound datatype to read */ /* ------------------------------------------ */ /* Check if the member is an array */ /* ------------------------------- */ if ( dtsinfo.array[i] == TRUE) { for (j = 0; j < dtsinfo.rank[i]; j++) dims[j] = (hsize_t)(dtsinfo.dims[i][j]); /* Create array datatype */ /* --------------------- */ arr_id = H5Tarray_create(dtype, dtsinfo.rank[i], (const hsize_t *)dims, NULL); if (arr_id == FAIL) { sprintf(errbuf, "Cannot create \"array\" datatype. \n"); H5Epush(__FILE__, "HE5_PTreadlevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Add array field */ /* --------------- */ status = H5Tinsert(typeID, dtsinfo.fieldname[i], 0, arr_id); if (status == FAIL) { sprintf(errbuf, "Cannot insert \"array\" element. \n"); H5Epush(__FILE__, "HE5_PTreadlevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release the data type ID */ /* ------------------------ */ status = H5Tclose(arr_id); if (status == FAIL ) { sprintf(errbuf, "Cannot release data type ID. \n"); H5Epush(__FILE__, "HE5_PTreadlevel_f", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { status = H5Tinsert(typeID, dtsinfo.fieldname[i], 0,dtype); /* Add atomic field */ /* ---------------- */ if (status == FAIL) { sprintf(errbuf, "Cannot insert \"array\" element. \n"); H5Epush(__FILE__, "HE5_PTreadlevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } /* Release pointers to the name buffers */ /* ------------------------------------ */ for (i = 0; i < dtsinfo.nfields; i++) { if (dtsinfo.fieldname[i] != NULL) H5free_memory(dtsinfo.fieldname[i]); } /* Read out the level fields */ /* ------------------------- */ status = H5Dread(dataID, typeID, H5S_ALL, H5S_ALL, xfer_list, datbuf); if (status == FAIL) { sprintf(errbuf, "Cannot read the level dataset. \n"); H5Epush(__FILE__, "HE5_PTreadlevel_f", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release the property list ID */ /* ---------------------------- */ status = H5Pclose(xfer_list); if (status == FAIL) { sprintf(errbuf, "Cannot release the property list ID. \n"); H5Epush(__FILE__, "HE5_PTreadlevel_f", __LINE__, H5E_PLIST, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release the datatype ID */ /* ----------------------- */ status = H5Tclose(typeID); if (status == FAIL) { sprintf(errbuf, "Cannot release the data type ID.\n"); H5Epush(__FILE__, "HE5_PTreadlevel_f", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTwritelevelF (FORTRAN wrapper) | | | | DESCRIPTION: Writes full records to a level. | | Writes only one field at a time. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID int point structure ID | | level int level number (0 - based) | | fieldname char Name of field | | count[] long Number of records to write | | ntype int HDF numbertype of field datatype | | data void data buffer | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ========== ============ ============================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTwritelevelF(int pointID, int level, long count[], char *fieldname, int ntype, void *data) { herr_t status = FAIL;/* routine return status variable */ int ret = FAIL;/* (int) return status variable */ hid_t ptID = FAIL; hid_t dtype = FAIL;/* HDF5 type data type ID */ hsize_t count_t1[1] = {0}; char *errbuf = (char *)NULL;/*Error message buffer */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_PTcloseF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } dtype = HE5_EHconvdatatype(ntype); /* if ntype is HE5 numbertype, rather than H5 numbertype, then convert it, otherwise use ntype itself */ if(dtype == FAIL) { dtype = ntype; } ptID = (hid_t)pointID; count_t1[0] = (hsize_t)count[0]; /* WRITE data */ /* ---------- */ status = HE5_PTwritelevel_f(ptID, level, count_t1, fieldname, ntype, dtype, data); if (status == FAIL) { sprintf(errbuf, "Cannot write updated data to the level. \n"); H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTwritelevel_f | | | | DESCRIPTION: Writes full records to a level. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID hid_t point structure ID | | level int level number (0 - based) | | count[] hsize_t Number of records to write | | fieldname char Name of field | | ntype int HDF numbertype of field datatype | | dtype hid_t datatype ID of field | | data void data buffer | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ========== ============ ============================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ static herr_t HE5_PTwritelevel_f(hid_t pointID, int level, hsize_t count[], char *fieldname, int ntype, hid_t dtype, void *data) { herr_t status = FAIL;/* routine return status variable */ int nlevels = FAIL;/* Number of levels in point */ int i,j; /* Loop index */ int ii = 0; int nflds = 0; int result = 99; int datatype_size = 0; int field_size = 0; int rank = 0; int err_xfer = FALSE; hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* POINTS group ID */ hid_t dataID = FAIL;/* dataset ID */ hid_t typeID = FAIL;/* data type ID */ hid_t xfer_list = FAIL;/* Property list ID */ hid_t arr_id = FAIL;/* Array datatype ID */ long idx = FAIL;/* Point index */ size_t orig_size = 0; hssize_t nrec = FAIL;/* Current number of records */ hsize_t dims[HE5_DTSETRANKMAX];/* Array of dimension sizes */ hsize_t orig_size_t = 0; char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_CmpDTSinfo infolevel; /* Level information data structure */ /* Check for valid point ID */ /* ------------------------ */ status = HE5_PTchkptid(pointID, "HE5_PTwritelevel_f", &fid, &gid, &idx); if (status == FAIL ) { sprintf(errbuf, "Checking for file ID failed. \n"); H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get the current number of records */ /* --------------------------------- */ status = HE5_PTwritesetup(pointID, level, &nrec); if(status == FAIL) { sprintf(errbuf, "Cannot retrieve the current number of records\n"); H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get number of levels */ /* -------------------- */ nlevels = HE5_PTnlevels(pointID); if(nlevels == FAIL) { sprintf(errbuf, "Cannot retrieve the number of levels\n"); H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Report error if no levels (dataset) defined */ /* ------------------------------------------- */ if (nlevels == 0) { status = FAIL; sprintf(errbuf, "No Levels Defined for point ID: %d\n", pointID); H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } else if (nlevels < level) { /* Report error if level # to large */ /* -------------------------------- */ status = FAIL; sprintf(errbuf, "Only %d levels Defined for point ID: %d\n", nlevels, pointID); H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get the level dataset ID */ /* ------------------------- */ dataID = HE5_PTXPoint[idx].level[level].ID; /* Extend the dataset size */ /* ----------------------- */ status = H5Dextend(dataID, count); if (status == FAIL) { sprintf(errbuf, "Cannot extend the dataset. \n"); H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the datatype ID */ /* ------------------- */ typeID = H5Dget_type(dataID); /* need to get the size of the orig compound datatype */ orig_size = H5Tget_size(typeID); status = H5Tclose(typeID); if (status == FAIL ) { sprintf(errbuf, "Cannot release data type ID. \n"); H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = HE5_PTlevelinfo(pointID, level, &infolevel); if (status == FAIL) { sprintf(errbuf, "Cannot get the level information. \n"); H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Check that field does exist */ /* --------------------------- */ if (HE5_PTfexist(dataID, fieldname, NULL, NULL, NULL, NULL) != 1) { status = FAIL; sprintf(errbuf, "Field: \"%s\" does not exist.\n", fieldname); H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf ); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Find index of fieldname in the compound datatype */ /* ------------------------------------------------ */ nflds = infolevel.nfields; for( i = 0; i < nflds; i++ ) { result = strcmp(fieldname,infolevel.fieldname[i]); if( result == 0 ) { ii = i; result = 99; } } i = ii; /* Calculate the data size of the field */ /* ------------------------------------ */ rank = infolevel.rank[i]; field_size = 1; for( j=0; j < rank; j++ ) field_size = (int)(field_size*infolevel.dims[i][j]); switch( ntype ) { case HE5T_NATIVE_INT: { datatype_size = sizeof(int); } break; case HE5T_NATIVE_FLOAT: { datatype_size = sizeof(float); } break; case HE5T_NATIVE_DOUBLE: { datatype_size = sizeof(double); } break; case HE5T_NATIVE_CHAR: { datatype_size = sizeof(char); } break; case HE5T_NATIVE_LONG: { datatype_size = sizeof(long); } break; default: break; } field_size = field_size*datatype_size; /* Create Compound datatype */ /* ------------------------ */ typeID = H5Tcreate(H5T_COMPOUND, field_size); /* field_size is size of the entire field */ if (typeID == FAIL) { sprintf(errbuf, "Cannot get data type ID. \n"); H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Add members to the compound data type */ /* ------------------------------------- */ /* Check if the field is an array */ /* ------------------------------ */ if (infolevel.array[i] == TRUE) { for (j = 0; j < infolevel.rank[i]; j++) dims[j] = (hsize_t)infolevel.dims[i][j]; /* Create array datatypes */ /* ---------------------- */ arr_id = H5Tarray_create(dtype, infolevel.rank[i], (const hsize_t *)dims, NULL); if (arr_id == FAIL) { sprintf(errbuf, "Cannot create \"array\" datatype. \n"); H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Add array field */ /* --------------- */ status = H5Tinsert(typeID,infolevel.fieldname[i], 0, arr_id); if (status == FAIL) { sprintf(errbuf, "Cannot insert \"array\" element. \n"); H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release the data type ID */ /* ------------------------ */ status = H5Tclose(arr_id); if (status == FAIL ) { sprintf(errbuf, "Cannot release data type ID. \n"); H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { /* Add atomic field */ /* ---------------- */ status = H5Tinsert(typeID,infolevel.fieldname[i], 0,dtype); if (status == FAIL) { sprintf(errbuf, "Cannot insert \"array\" element. \n"); H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } /* Release pointers to the name buffers */ /* ------------------------------------ */ for (j = 0; j < infolevel.nfields; j++) { if (infolevel.fieldname[j] != NULL) H5free_memory(infolevel.fieldname[j]); } /* Create the property list */ /* ------------------------ */ xfer_list = H5Pcreate(H5P_DATASET_XFER); if (xfer_list == FAIL) { sprintf(errbuf, "Cannot create the property list ID. \n"); H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_PLIST, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Set type conversion and background buffer */ /* ----------------------------------------- */ orig_size_t = (hsize_t)orig_size; status = H5Pset_buffer(xfer_list, orig_size_t, NULL, NULL); if (status == FAIL) { sprintf(errbuf, "Cannot set type conversion and background buffer. \n"); H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Preserve partially initialized fields to the compound datatypes */ /* --------------------------------------------------------------- */ err_xfer = H5Pget_preserve(xfer_list); if (err_xfer == FAIL) { sprintf(errbuf, "Cannot get X-fer property list ID. \n"); H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } err_xfer = H5Pset_preserve(xfer_list, 1); if (err_xfer == FAIL) { sprintf(errbuf, "Cannot set X-fer property list ID. \n"); H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } err_xfer = H5Pget_preserve(xfer_list); if (err_xfer == FAIL) { sprintf(errbuf, "Cannot get X-fer property list ID. \n"); H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Write data to the dataset */ /* ------------------------- */ status = H5Dwrite(dataID, typeID, H5S_ALL, H5S_ALL, xfer_list, data); if (status == FAIL) { sprintf(errbuf, "Cannot write data to the dataset. \n"); H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release data type ID */ /* -------------------- */ status = H5Tclose(typeID); if (status == FAIL) { sprintf(errbuf, "Cannot release the data type ID. \n"); H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release property list ID */ /* ------------------------ */ status = H5Pclose(xfer_list); if (status == FAIL) { sprintf(errbuf, "Cannot release the property list ID. \n"); H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_PLIST, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTwrbckptrF (FORTRAN wrapper) | | | | DESCRIPTION: Writes back pointer records | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID int point structure ID | | level int level index (0 - based) | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTwrbckptrF(int pointID, int level) { int ret = FAIL;/* (int) Return status variable */ herr_t status = FAIL;/* routine return status variable */ hid_t PointID = FAIL;/* HDF5 type point ID */ char *errbuf = (char *)NULL;/*Error message buffer */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_PTwrbckptrF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } PointID = (hid_t)pointID; status = HE5_PTwrbckptr(PointID, level); if (status == FAIL) { sprintf(errbuf, "Cannot write back pointer records. \n"); H5Epush(__FILE__, "HE5_PTwrbckptrF", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTwrfwdptrF (FORTRAN wrapper) | | | | DESCRIPTION: Write foward pointer records | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID int point structure ID | | level int level index (0 - based) | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTwrfwdptrF(int pointID, int level) { int ret = FAIL;/* (int) Return status variable */ herr_t status = FAIL;/* routine return status variable */ hid_t PointID = FAIL;/* HDF5 type point ID */ char *errbuf = (char *)NULL;/*Error message buffer */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_PTwrfwdptrF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } PointID = (hid_t)pointID; status = HE5_PTwrfwdptr(PointID, level - 1); if (status == FAIL) { sprintf(errbuf, "Cannot write back pointer records. \n"); H5Epush(__FILE__, "HE5_PTwrfwdptrF", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTupdatelevelF (FORTRAN wrapper) | | | | DESCRIPTION: Updates the specified field and records of a level. | | Only updates one field at a time. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID int point structure ID | | level int level number (0 - based) | | fieldlist char fieldlist (of one field) | | nrec long number of records to update | | recs[] long array of record numbers to update | | ntype int HDF numbertype of field datatype | | data void data buffer | | | | OUTPUTS: | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTupdatelevelF(int pointID, int level, char *fieldlist, long nrec, long recs[], int ntype, void *data) { herr_t status = FAIL; hid_t PointID = FAIL; hid_t dtype = FAIL; /* HDF5 type data type ID */ hsize_t nrec_t = 0; hssize_t *recs_t; int i; int ret = FAIL; char *errbuf = (char *)NULL;/*Error message buffer */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_PTcloseF", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(ret); } dtype = HE5_EHconvdatatype(ntype); /* if ntype is HE5 numbertype, rather than H5 numbertype, then convert it, otherwise use ntype itself */ if(dtype == FAIL) { dtype = ntype; } PointID = (hid_t)pointID; nrec_t = (hsize_t)nrec; recs_t = (hssize_t *)calloc(nrec, sizeof(hssize_t)); for( i = 0; i < nrec; i++ ) recs_t[i] = (hssize_t)recs[i]; /* Call HE5_PTupdatelevel_f() */ /* -------------------------- */ status = HE5_PTupdatelevel_f(PointID, level, fieldlist, nrec_t, recs_t, ntype, dtype, data); if (status == FAIL) { sprintf(errbuf, "Trouble calling HE5_PTupdatelevel_f(). \n"); H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (recs_t != NULL) free(recs_t); } free(errbuf); if (recs_t != NULL) free(recs_t); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTupdatelevel_f | | | | DESCRIPTION: Updates the specified field and records of a level. | | Only updates one field at a time. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID hid_t point structure ID | | level int level number (0 - based) | | fieldlist char fieldlist (of one field) | | nrec hsize_t Number of records to update | | recs[] hssize_t array of record numbers to update | | ntype int HDF numbertype of field datatype | | dtype hid_t datatype ID of field | | data void data buffer | | | | OUTPUTS: | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ static herr_t HE5_PTupdatelevel_f(hid_t pointID, int level, char *fieldlist, hsize_t nrec, hssize_t recs[], int ntype, hid_t dtype, void *data) { herr_t status = FAIL;/* routine return status variable */ int j; /* Loop index */ int nlevels = 0; /* Number of levels in point */ int rank = 1; /* Rank of compound dataset */ int ii = 0; int nflds = 0; int result = 99; int datatype_size = 0; int field_size = 0; int field_rank = 0; int err_xfer = FALSE; long i; /* Loop index */ long idx = FAIL;/* Point index */ long nfields = 0; /* Number of fields in fieldlist */ long dum = FAIL;/* Dummy variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "POINTS" group ID */ hid_t dataID = FAIL;/* Dataset ID */ hid_t dspace = FAIL;/* Disk data space ID */ hid_t mspace = FAIL;/* Memory data space ID */ hid_t typeID = FAIL;/* Data type ID */ hid_t arr_id = FAIL;/* Array datatype ID */ hid_t xfer_list = FAIL;/* Property list ID */ hsize_t nallrec = 0; /* Number of records in Point */ hsize_t dims_1[1] = {0}; /* member dimensions in dataset */ hsize_t *coord = NULL;/* Coordinates of elemnts to update */ hsize_t dims[HE5_DTSETRANKMAX];/* Array of dimension sizes */ hsize_t orig_size_t = 0; size_t orig_size = 0; size_t slen[HE5_HDFE_DIMBUFSIZE]; /* String length array */ char *fieldname = (char *)NULL; /* Field name buffer */ char utlbuf[HE5_HDFE_UTLBUFSIZE];/* Utility buffer */ char *pntr[HE5_HDFE_DIMBUFSIZE]; /* String pointer array */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_CmpDTSinfo info; /* Structure with the dataset information */ HE5_CmpDTSinfo infolevel; /* Level information data structure */ /* Check for valid point ID */ /* ------------------------ */ status = HE5_PTchkptid(pointID, "HE5_PTupdatelevel_f", &fid, &gid, &idx); if (status == FAIL) { sprintf(errbuf, "Checking for point ID failed. \n"); H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get number of levels */ /* -------------------- */ nlevels = HE5_PTnlevels(pointID); if (nlevels == 0) { status = FAIL; sprintf(errbuf, "No Levels Defined for point.\n"); H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } else if (nlevels < level) { status = FAIL; sprintf(errbuf, "Only %d levels defined for the point. \n", nlevels); H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get dataset ID */ /* -------------- */ dataID = HE5_PTXPoint[idx].level[level].ID; /* Initialize slen[] array */ /* ----------------------- */ for (j = 0; j < HE5_HDFE_DIMBUFSIZE; j++) slen[ j ] = 0; /* Parse field list */ /* ---------------- */ nfields = HE5_EHparsestr(fieldlist, ',', pntr, slen); if( nfields != 1 ) { status = FAIL; sprintf(errbuf, "Should be only one field specified in fieldlist...nfields is not equal to 1 \n"); H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } else { fieldname = (char *)calloc(HE5_HDFE_NAMBUFSIZE,sizeof(char)); memmove(utlbuf, pntr[0], slen[0]); utlbuf[slen[0]] = '\0'; memmove(fieldname, utlbuf, slen[0]+1); } /* Check that all fields in list exist in level */ /* -------------------------------------------- */ for (i = 0; i < nfields; i++) { memmove(utlbuf, pntr[i], slen[i]); utlbuf[slen[i]] = 0; if (HE5_PTfexist(dataID, utlbuf, NULL, NULL, NULL, NULL) != 1) { status = FAIL; sprintf(errbuf, "Field: \"%s\" does not exist.\n", utlbuf); H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf ); HE5_EHprint(errbuf, __FILE__, __LINE__); if (fieldname != NULL) H5free_memory(fieldname); return(status); } } /* Check input records to update */ /* ----------------------------- */ if( nrec == 0 || recs == NULL ) { /* Get neumber of records in level */ /* ------------------------------- */ nallrec = HE5_PTnrecs(pointID, level); if (nallrec == 0) { sprintf(errbuf, "Cannot retrieve number of records in Point. \n"); H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (fieldname != NULL) H5free_memory(fieldname); return(FAIL); } /* Call HE5_PTlevelinfo() */ /* ---------------------- */ status = HE5_PTlevelinfo(pointID, level, &info); if (status == FAIL) { sprintf(errbuf, "Cannot get the level information. \n"); H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (fieldname != NULL) H5free_memory(fieldname); return(FAIL); } /* Release pointers to the name buffers */ /* ------------------------------------ */ for (j = 0; j < info.nfields; j++) { if (info.fieldname[j] != NULL) H5free_memory(info.fieldname[j]); } /* Update all records in level */ /* --------------------------- */ /* USE "writelevel_f" routine which works on ONE FIELD at a time */ /* ------------------------------------------------------------- */ status = HE5_PTwritelevel_f(pointID, level, &nallrec, fieldname, ntype, dtype, data); if (status == FAIL) { sprintf(errbuf, "Cannot write updated data to the level. \n"); H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (fieldname != NULL) H5free_memory(fieldname); return(FAIL); } if (fieldname != NULL) H5free_memory(fieldname); } else if( nrec > 0 && recs != NULL ) { /* Get dataset space and datatype */ /* ------------------------------ */ dspace = H5Dget_space(dataID); if (dspace == FAIL) { sprintf(errbuf, "Cannot get the data space ID.\n"); H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (fieldname != NULL) H5free_memory(fieldname); return(FAIL); } /* Get data type ID */ /* ---------------- */ typeID = H5Dget_type(dataID); if (typeID == FAIL) { sprintf(errbuf, "Cannot get the data type ID.\n"); H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (fieldname != NULL) H5free_memory(fieldname); return(FAIL); } /* Get the size of the original compound datatype */ /* ---------------------------------------------- */ orig_size = H5Tget_size(typeID); status = H5Tclose(typeID); if (status == FAIL) { sprintf(errbuf, "Cannot release the data type ID.\n"); H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (fieldname != NULL) H5free_memory(fieldname); return(FAIL); } status = HE5_PTlevelinfo(pointID, level, &infolevel); if (status == FAIL) { sprintf(errbuf, "Cannot get the level information. \n"); H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (fieldname != NULL) H5free_memory(fieldname); return(FAIL); } /* Check that field does exist */ /* --------------------------- */ if (HE5_PTfexist(dataID, fieldname, NULL, NULL, NULL, NULL) != 1) { status = FAIL; sprintf(errbuf, "Field: \"%s\" does not exist.\n", fieldname); H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf ); HE5_EHprint(errbuf, __FILE__, __LINE__); if (fieldname != NULL) H5free_memory(fieldname); return(status); } /* Find index of fieldname in the compound datatype */ /* ------------------------------------------------ */ nflds = infolevel.nfields; for( i = 0; i < nflds; i++ ) { result = strcmp(fieldname,infolevel.fieldname[i]); if( result == 0 ) { ii = (int)i; result = 99; } } i = ii; /* Calculate the data size of the field */ /* ------------------------------------ */ field_rank = infolevel.rank[i]; field_size = 1; for( j=0; j < field_rank; j++ ) field_size = (int)(field_size*infolevel.dims[i][j]); switch( ntype ) { case HE5T_NATIVE_INT: { datatype_size = sizeof(int); } break; case HE5T_NATIVE_FLOAT: { datatype_size = sizeof(float); } break; case HE5T_NATIVE_DOUBLE: { datatype_size = sizeof(double); } break; case HE5T_NATIVE_CHAR: { datatype_size = sizeof(char); } break; case HE5T_NATIVE_LONG: { datatype_size = sizeof(long); } break; default: break; } field_size = field_size*datatype_size; /* Create Compound datatype */ /* ------------------------ */ typeID = H5Tcreate(H5T_COMPOUND, field_size); /* field_size is size of the entire field */ if (typeID == FAIL) { sprintf(errbuf, "Cannot get data type ID. \n"); H5Epush(__FILE__, "HE5_PTwritelevel_f", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Free previously allocated space */ /* ------------------------------- */ if (fieldname != NULL) H5free_memory(fieldname); /* Add members to the compound data type */ /* ------------------------------------- */ /* Check if the field is an array */ /* ------------------------------ */ if (infolevel.array[i] == TRUE) { for (j = 0; j < infolevel.rank[i]; j++) dims[j] = (hsize_t)infolevel.dims[i][j]; /* Create array datatypes */ /* ---------------------- */ arr_id = H5Tarray_create(dtype, infolevel.rank[i], (const hsize_t *)dims, NULL); if (arr_id == FAIL) { sprintf(errbuf, "Cannot create \"array\" datatype. \n"); H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Add array field */ /* --------------- */ status = H5Tinsert(typeID,infolevel.fieldname[i], 0, arr_id); if (status == FAIL) { sprintf(errbuf, "Cannot insert \"array\" element. \n"); H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Release the data type ID */ /* ------------------------ */ status = H5Tclose(arr_id); if (status == FAIL ) { sprintf(errbuf, "Cannot release data type ID. \n"); H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { /* Add atomic field */ /* ---------------- */ status = H5Tinsert(typeID,infolevel.fieldname[i], 0,dtype); if (status == FAIL) { sprintf(errbuf, "Cannot insert \"array\" element. \n"); H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } /* Release pointers to the name buffers */ /* ------------------------------------ */ for (j = 0; j < infolevel.nfields; j++) { if (infolevel.fieldname[j] != NULL) H5free_memory(infolevel.fieldname[j]); } /* Preserve partially initialized fields of the compound datatypes */ /* --------------------------------------------------------------- */ /* Create the property list */ /* ------------------------ */ xfer_list = H5Pcreate(H5P_DATASET_XFER); if (xfer_list == FAIL) { sprintf(errbuf, "Cannot create the property list ID. \n"); H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_PLIST, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Set type conversion and background buffer */ /* ----------------------------------------- */ orig_size_t = (hsize_t)orig_size; status = H5Pset_buffer(xfer_list, orig_size_t, NULL, NULL); if (status == FAIL) { sprintf(errbuf, "Cannot set type conversion and background buffer. \n"); H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } err_xfer = H5Pget_preserve(xfer_list); if (err_xfer == FAIL) { sprintf(errbuf, "Cannot get X-fer property list ID. \n"); H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } err_xfer = H5Pset_preserve(xfer_list, 1); if (err_xfer == FAIL) { sprintf(errbuf, "Cannot set X-fer property list ID. \n"); H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } err_xfer = H5Pget_preserve(xfer_list); if (err_xfer == FAIL) { sprintf(errbuf, "Cannot get X-fer property list ID. \n"); H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } dims_1[0] = nrec; /* Create the memory data space */ /* ---------------------------- */ mspace = H5Screate_simple(rank, dims_1, NULL); if (mspace == FAIL) { sprintf(errbuf, "Cannot create the data space.\n"); H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Allocate memory */ /* --------------- */ coord = (hsize_t *)calloc(nrec, sizeof(hsize_t)); if (coord == NULL) { sprintf(errbuf, "Cannot allocate memory. \n"); H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Loop through all records to update */ /* ---------------------------------- */ for (i = 0; i < nrec; i++) coord[i] = (hsize_t)recs[i]; /* Select elements to update */ /* ------------------------- */ status = H5Sselect_elements(dspace, H5S_SELECT_SET, nrec, (const hsize_t *)coord); if (status == FAIL) { sprintf(errbuf, "Cannot select elements.\n"); H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(coord); return(FAIL); } /* Update selected records */ /* ----------------------- */ status = H5Dwrite(dataID, typeID, mspace, dspace, xfer_list, data); if (status == FAIL) { sprintf(errbuf, "Cannot write data to the dataset.\n"); H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(coord); return(FAIL); } /* Release memory */ /* -------------- */ free(coord); /* Release data space ID */ /* --------------------- */ status = H5Sclose(mspace); if (status == FAIL) { sprintf(errbuf, "Cannot release the data space ID.\n"); H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Release data type ID */ /* --------------------- */ status = H5Tclose(typeID); if (status == FAIL) { sprintf(errbuf, "Cannot release the data type ID.\n"); H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Release data space ID */ /* --------------------- */ status = H5Sclose(dspace); if (status == FAIL) { sprintf(errbuf, "Cannot release the data space ID.\n"); H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } /* Update Pointers to Previous Level */ /* -------------------------------- */ if (level > 0) { /* Store back linkage field in utlbuf */ /* ---------------------------------- */ status = HE5_PTbcklinkinfo(pointID, level, utlbuf); if (status == FAIL) { sprintf(errbuf, "Cannot get backward linkage information.\n"); H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Check whether back linkage field is in fieldlist */ /* ------------------------------------------------ */ dum = HE5_EHstrwithin(utlbuf, fieldlist, ','); if (dum != FAIL) { /* Back pointers to previous level */ /* ------------------------------- */ status = HE5_PTwrbckptr(pointID, level); if (status == FAIL) { sprintf(errbuf, "Cannot write backward pointer.\n"); H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Forward pointers from previous level */ /* ------------------------------------ */ status = HE5_PTwrfwdptr(pointID, level - 1); if (status == FAIL) { sprintf(errbuf, "Cannot write forward pointer.\n"); H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } } /* Update Pointers to Next Level */ /* ---------------------------- */ if (level < HE5_PTnlevels(pointID) - 1 && dum != FAIL) { /* Store forward linkage field in utlbuf */ /* ------------------------------------- */ status = HE5_PTfwdlinkinfo(pointID, level, utlbuf); if (status == FAIL) { sprintf(errbuf, "Cannot get forward linkage information.\n"); H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Check whether forward linkage field is in fieldlist */ /* --------------------------------------------------- */ dum = HE5_EHstrwithin(utlbuf, fieldlist, ','); if (dum != FAIL) { /* Back pointers from next level */ /* ----------------------------- */ status = HE5_PTwrbckptr(pointID, level + 1); if (status == FAIL) { sprintf(errbuf, "Cannot write backward pointer.\n"); H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Forward pointers to next level */ /* ------------------------------ */ status = HE5_PTwrfwdptr(pointID, level); if (status == FAIL) { sprintf(errbuf, "Cannot write forward pointer.\n"); H5Epush(__FILE__, "HE5_PTupdatelevel_f", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } } return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTwriteattrF (FORTRAN wrapper) | | | | DESCRIPTION: | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID int point structure ID | | attrname char attribute name | | ntype int attribute HDF numbertype | | fortcount long Number of attribute elements | | datbuf void I/O buffer | | | | OUTPUTS: | | datbuf void I/O buffer | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTwriteattrF(int pointID, const char *attrname, int ntype, long fortcount[], void *datbuf) { int ret = FAIL;/* int return status variable */ int rank = 1; /* Note: It is assumed that fortcout has just */ /* one element to agree with EHattr function */ int i; /* Loop index */ hid_t PointID = FAIL;/* HDF-EOS Swath ID */ hid_t numbertype = FAIL;/* HDF5 data type ID */ herr_t status = FAIL;/* routine return status variable */ hsize_t *count = (hsize_t *)NULL; /* Pointer to count array (C order)*/ char *errbuf = (char *)NULL; /* error message buffer */ char *tempbuf = (char *)NULL; /* temp buffer */ numbertype = HE5_EHconvdatatype(ntype); if(numbertype == FAIL) { H5Epush(__FILE__, "HE5_PTwriteattrF", __LINE__, H5E_DATATYPE, H5E_BADVALUE, "Error calling HE5_EHconvdatatype() from FORTRAN wrapper."); HE5_EHprint("Error: Error calling HE5_EHconvdatatype() from FORTRAN wrapper, occured", __FILE__, __LINE__); return(FAIL); } /* Allocate memory for error message buffers */ errbuf = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_PTwriteattrF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Allocate memory for "count" array */ count = (hsize_t *)calloc(rank, sizeof(hsize_t)); if( count == NULL) { sprintf(errbuf,"Cannot allocate memory for count.\n"); H5Epush(__FILE__, "HE5_PTwriteattrF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Reverse order of dimensions (FORTRAN -> C) */ /* ------------------------------------------ */ for (i = 0; i < rank; i++) count[i] = (hsize_t)fortcount[rank - 1 - i]; PointID = (hid_t)pointID; if ((numbertype == HE5T_CHARSTRING) || (numbertype == H5T_NATIVE_CHAR) || (numbertype == H5T_C_S1)) { if (strlen((char *)datbuf) < count[0]) { sprintf(errbuf,"Size of databuf is less than the number of attribute elements.\n"); H5Epush(__FILE__, "HE5_PTwriteattrF", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); return(FAIL); } /* Allocate memory for temp buffer */ /* ------------------------------- */ tempbuf = (char * )calloc((count[0]+1), sizeof(char)); if(tempbuf == NULL) { sprintf(errbuf,"Cannot allocate memory for temp buffer.\n"); H5Epush(__FILE__, "HE5_PTwriteattrF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); return(FAIL); } strncpy(tempbuf, (char *)datbuf, count[0]); tempbuf[count[0]] = '\0'; /* Call PTwriteattr() */ /* ------------------ */ status = HE5_PTwriteattr(PointID, attrname, numbertype, count, tempbuf); if( status == FAIL) { sprintf(errbuf,"Cannot write data to the attribute \"%s\".\n", attrname); H5Epush(__FILE__, "HE5_PTwriteattrF", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); free(tempbuf); return(FAIL); } free(count); free(errbuf); free(tempbuf); } else { /* Call PTwriteattr() */ /* ------------------ */ status = HE5_PTwriteattr(PointID, attrname, numbertype, count, datbuf); if( status == FAIL) { sprintf(errbuf,"Cannot write data to the attribute \"%s\".\n", attrname); H5Epush(__FILE__, "HE5_PTwriteattrF", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); return(FAIL); } free(count); free(errbuf); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTwritegrpattrF (FORTRAN wrapper) | | | | DESCRIPTION: Writes/updates attribute associated with the "Data" group | | in a point. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID int point structure ID | | attrname char attribute name | | ntype int attribute HDF numbertype | | fortcount long Number of attribute elements | | datbuf void I/O buffer | | | | OUTPUTS: | | datbuf void I/O buffer | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTwritegrpattrF(int pointID, const char *attrname, int ntype, long fortcount[], void * datbuf) { int ret = FAIL; /* (int) return status variable */ int rank = 1; /* Rank variable */ int i; /* Loop index */ herr_t status = FAIL; /* routine return status variable */ hid_t PointID = FAIL; /* HDF5 type Swath ID */ hid_t numbertype = FAIL; /* HDF5 data type ID */ hsize_t *count = (hsize_t *)NULL;/* Pointer to count array (C order) */ char *errbuf = (char *)NULL; /* error message buffer */ char *tempbuf = (char *)NULL; /* temp buffer */ /* Allocate memory for error message buffers */ /* ----------------------------------------- */ errbuf = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_PTwritegrpattrF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Get HDF5 data type ID */ /* --------------------- */ numbertype = HE5_EHconvdatatype(ntype); if(numbertype == FAIL) { sprintf(errbuf,"Cannot convert to HDF5 type data type ID.\n"); H5Epush(__FILE__, "HE5_PTwritegrpattrF", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } count = (hsize_t *)calloc(rank, sizeof(hsize_t)); if( count == NULL) { sprintf(errbuf,"Cannot allocate memory for count.\n"); H5Epush(__FILE__, "HE5_PTwritegrpattrF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Reverse order of dimensions (FORTRAN -> C) */ /* ------------------------------------------ */ for (i = 0; i < rank; i++) count[i] = (hsize_t)fortcount[rank - 1 - i]; PointID = (hid_t)pointID; if ((numbertype == HE5T_CHARSTRING) || (numbertype == H5T_NATIVE_CHAR) || (numbertype == H5T_C_S1)) { if (strlen((char *)datbuf) < count[0]) { sprintf(errbuf,"Size of databuf is less than the number of group attribute elements.\n"); H5Epush(__FILE__, "HE5_PTwritegrpattrF", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); return(FAIL); } /* Allocate memory for temp buffer */ /* ------------------------------- */ tempbuf = (char * )calloc((count[0]+1), sizeof(char)); if(tempbuf == NULL) { sprintf(errbuf,"Cannot allocate memory for temp buffer.\n"); H5Epush(__FILE__, "HE5_PTwritegrpattrF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); return(FAIL); } strncpy(tempbuf, (char *)datbuf, count[0]); tempbuf[count[0]] = '\0'; status = HE5_PTwritegrpattr(PointID, attrname, numbertype, count, tempbuf); if(status == FAIL) { sprintf(errbuf,"Cannot write group attribute value.\n"); H5Epush(__FILE__, "HE5_PTwritegrpattrF", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); free(tempbuf); return(FAIL); } free(count); free(errbuf); free(tempbuf); } else { status = HE5_PTwritegrpattr(PointID, attrname, numbertype, count, datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot write group attribute value.\n"); H5Epush(__FILE__, "HE5_PTwritegrpattrF", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); return(FAIL); } free(count); free(errbuf); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTwritelocattrF (FORTRAN wrapper) | | | | DESCRIPTION: Writes/updates attribute associated with the a specified | | level in a point. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID int point structure ID | | levelname char level name | | attrname char attribute name | | ntype int attribute HDF numbertype | | fortcount long Number of attribute elements | | datbuf void I/O buffer | | | | OUTPUTS: | | datbuf void I/O buffer | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTwritelocattrF(int pointID, const char *levelname, const char *attrname, int ntype, long fortcount[],void * datbuf) { int ret = FAIL; /* routine return status variable */ int rank = 1; /* Note: It is assumed that fortcout has just */ /* one element to agree with EHattr function */ int i = 0; herr_t status = FAIL; /* routine return status variable */ hsize_t *count = (hsize_t *)NULL;/* Pointer to count array (C order) */ hid_t PointID = FAIL; /* Swath HDF5 type ID */ hid_t numbertype = FAIL; /* HDF5 dta type ID */ char *errbuf = (char *)NULL; /* error message buffer */ char *tempbuf = (char *)NULL; /* temp buffer */ /* Get HDF5 type data type ID */ /* -------------------------- */ numbertype = HE5_EHconvdatatype(ntype); if(numbertype == FAIL) { sprintf(errbuf,"Cannot convert to HDF5 data type ID.\n"); H5Epush(__FILE__, "HE5_PTwritelocattrF", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Allocate memory for error message buffers */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_PTwritelocattrF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } count = (hsize_t *)calloc(rank, sizeof(hsize_t)); if( count == NULL) { sprintf(errbuf,"Cannot allocate memory for count.\n"); H5Epush(__FILE__, "HE5_PTwritelocattrF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Reverse order of dimensions (FORTRAN -> C) */ /* ------------------------------------------ */ for (i = 0; i < rank; i++) count[i] = (hsize_t)fortcount[rank - 1 - i]; PointID = (hid_t)pointID; if ((numbertype == HE5T_CHARSTRING) || (numbertype == H5T_NATIVE_CHAR) || (numbertype == H5T_C_S1)) { if (strlen((char *)datbuf) < count[0]) { sprintf(errbuf,"Size of databuf is less than the number of local attribute elements.\n"); H5Epush(__FILE__, "HE5_PTwritelocattrF", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); return(FAIL); } /* Allocate memory for temp buffer */ /* ------------------------------- */ tempbuf = (char * )calloc((count[0]+1), sizeof(char)); if(tempbuf == NULL) { sprintf(errbuf,"Cannot allocate memory for temp buffer.\n"); H5Epush(__FILE__, "HE5_PTwritelocattrF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); return(FAIL); } strncpy(tempbuf, (char *)datbuf, count[0]); tempbuf[count[0]] = '\0'; /* Write local attribute buffer */ /* ---------------------------- */ status = HE5_PTwritelocattr(PointID, levelname, attrname, numbertype, count, tempbuf); if(status == FAIL) { sprintf(errbuf,"Cannot write local attribute value.\n"); H5Epush(__FILE__, "HE5_PTwritelocattrF", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); free(tempbuf); return(FAIL); } free(count); free(errbuf); free(tempbuf); } else { /* Write local attribute buffer */ /* ---------------------------- */ status = HE5_PTwritelocattr(PointID, levelname, attrname, numbertype, count, datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot write local attribute value.\n"); H5Epush(__FILE__, "HE5_PTwritelocattrF", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); return(FAIL); } free(count); free(errbuf); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTreadattrF (FORTRAN wrapper) | | | | DESCRIPTION: Reads attribute from a point. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID int point structure ID | | attrname char attribute name | | | | OUTPUTS: | | datbuf void I/O buffer | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTreadattrF(int pointID, const char *attrname, void *datbuf) { int ret = FAIL;/* routine return status variable */ herr_t status = FAIL;/* routine return status variable */ hid_t PointID = FAIL;/* HDF-EOS point ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ PointID = (hid_t)pointID; /* Read the attribute buffer */ /* ------------------------- */ status = HE5_PTreadattr(PointID, attrname, datbuf); if ( status == FAIL ) { sprintf(errbuf, "Cannot read the attribute value. \n"); H5Epush(__FILE__, "HE5_PTreadattr", __LINE__, H5E_ATTR, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTreadgrpattrF (FORTRAN wrapper) | | | | DESCRIPTION: Reads attribute associated with the "Data" group from a point.| | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID int point structure ID | | attrname char attribute name | | | | OUTPUTS: | | datbuf void I/O buffer | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTreadgrpattrF(int pointID, const char *attrname, void *datbuf) { int ret = FAIL; /* (int) return status */ herr_t status = FAIL; /* return status variable */ hid_t PointID = FAIL; /* HDF5 type Point ID */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ PointID = (hid_t)pointID; status = HE5_PTreadgrpattr(PointID,attrname,datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot read Group Attribute \"%s\".\n", attrname); H5Epush(__FILE__, "HE5_PTreadgrpattr", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTreadlocattrF (FORTRAN wrapper) | | | | DESCRIPTION: Reads attribute associated with a specified level in a point. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID int point structure ID | | levelname char level name | | attrname char attribute name | | | | OUTPUTS: | | datbuf void I/O buffer | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTreadlocattrF(int pointID, const char *levelname, const char *attrname, void *datbuf) { int ret = FAIL;/* return status variable */ herr_t status = FAIL;/* return status variable */ hid_t PointID = FAIL;/* HDF5 type Point ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ PointID = (hid_t)pointID; status = HE5_PTreadlocattr( PointID, levelname, attrname, datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot read Attribute \"%s\" associated wth the \"%s\" level.\n", attrname,levelname); H5Epush(__FILE__, "HE5_PTreadlocattr", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTc2fort | | | | DESCRIPTION: Translates a buffer in Fortran order into a buffer in | | 'C' order. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | dims[] long Dimensions of Fortran array | | rank int Rank of Fortran array | | datatype int Datatype of Fortran array | | inputfortbuf void input data buffer (Fortran array) | | | | OUTPUTS: | | outputfortbuf void output data buffer (Fortran array) | | | | NOTES: | | | | | | Date Programmer Description | | ========== ============ ============================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ static int HE5_PTc2fort(long dims[], int rank, int datatype, void *inputfortbuf, void *outputfortbuf) { herr_t status = FAIL;/* routine return status variable */ int ret = FAIL;/* (int) return status variable */ int i = 0; int dim_index = 0; long *c_index = (long *)NULL; long *coeffs = (long *)NULL; long *n1 = (long *)NULL; long *fort_order_buf = (long *)NULL; long num_elements1 = 0; long num_elements2 = 0; int *databuf1_int = (int *)NULL; int *databuf2_int = (int *)NULL; float *databuf1_float = (float *)NULL; float *databuf2_float = (float *)NULL; double *databuf1_double = (double *)NULL; double *databuf2_double = (double *)NULL; char *databuf1_char = (char *)NULL; char *databuf2_char = (char *)NULL; long *databuf1_long = (long *)NULL; long *databuf2_long = (long *)NULL; char *errbuf = (char *)NULL;/*Error message buffer */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_PTc2fort", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Calculate the number of elements in the array */ /* --------------------------------------------- */ num_elements1 = 1; for( i=0; i < rank; i++ ) num_elements1 = dims[i]*num_elements1; /* Set up arguments for call to HE5_PTgetfort_order() */ /* -------------------------------------------------- */ /* Initialize c_index array */ /* ------------------------ */ c_index = (long *) calloc(rank, sizeof(long)); for( i=0; i< rank; i++ ) c_index[i] = 0; /* Initialize coeffs array */ /* ----------------------- */ coeffs = (long *) calloc(rank, sizeof(long)); for( i=0; i< rank; i++ ) coeffs[i] = 0; coeffs[0] = 1; /* Initialize n1 variable */ /* ---------------------- */ n1 = (long *) calloc(1,sizeof(long)); *n1 = 0; dim_index = 1; /* Initialize fort_order_buf */ /* ------------------------- */ fort_order_buf = (long *) calloc(num_elements1,sizeof(long)); status = HE5_PTgetfort_order(dims, dim_index, c_index, rank, fort_order_buf, coeffs, n1); if (status == FAIL) { sprintf(errbuf, "Call to HE5_PTgetfort_order() failed.\n"); H5Epush(__FILE__, "HE5_PTc2fort", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(fort_order_buf); return(status); } num_elements2 = *n1; /* Check num_elements2 against num_elements1 */ /* ----------------------------------------- */ if( num_elements1 != num_elements2 ) { sprintf(errbuf, "Error with number of elements processed by HE5_PTgetfort_order or HE5_ptc2fort.\n"); H5Epush(__FILE__, "HE5_PTc2fort", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(fort_order_buf); return(FAIL); } switch( datatype ) { case HE5T_NATIVE_INT: { databuf1_int = (int *) calloc(num_elements1,sizeof(int)); memmove(databuf1_int,inputfortbuf,num_elements1*sizeof(int)); databuf2_int = (int *) calloc(num_elements1,sizeof(int)); /* Create the Fortran ordered buffer from the hash list */ /* and the C buffer */ /* ---------------------------------------------------- */ for( i = 0; i < num_elements1; i++ ) { databuf2_int[fort_order_buf[i]] = databuf1_int[i]; } memmove(outputfortbuf,databuf2_int,num_elements1*sizeof(int)); free(databuf1_int); free(databuf2_int); } break; case HE5T_NATIVE_FLOAT: { databuf1_float = (float *) calloc(num_elements1,sizeof(float)); memmove(databuf1_float,inputfortbuf,num_elements1*sizeof(float)); databuf2_float = (float *) calloc(num_elements1,sizeof(float)); /* Create the Fortran ordered buffer from the hash list */ /* and the C buffer */ /* ---------------------------------------------------- */ for( i = 0; i < num_elements1; i++ ) { databuf2_float[fort_order_buf[i]] = databuf1_float[i]; } memmove(outputfortbuf,databuf2_float,num_elements1*sizeof(float)); free(databuf1_float); free(databuf2_float); } break; case HE5T_NATIVE_DOUBLE: { databuf1_double = (double *) calloc(num_elements1,sizeof(double)); memmove(databuf1_double,inputfortbuf,num_elements1*sizeof(double)); databuf2_double = (double *) calloc(num_elements1,sizeof(double)); /* Create the Fortran ordered buffer from the hash list */ /* and the C buffer */ /* ---------------------------------------------------- */ for( i = 0; i < num_elements1; i++ ) { databuf2_double[fort_order_buf[i]] = databuf1_double[i]; } memmove(outputfortbuf,databuf2_double,num_elements1*sizeof(double)); free(databuf1_double); free(databuf2_double); } break; case HE5T_NATIVE_CHAR: { databuf1_char = (char *) calloc(num_elements1,sizeof(char)); memmove(databuf1_char,inputfortbuf,num_elements1*sizeof(char)); databuf2_char = (char *) calloc(num_elements1,sizeof(char)); /* Create the Fortran ordered buffer from the hash list */ /* and the C buffer */ /* ---------------------------------------------------- */ for( i = 0; i < num_elements1; i++ ) { databuf2_char[fort_order_buf[i]] = databuf1_char[i]; } memmove(outputfortbuf,databuf2_char,num_elements1*sizeof(char)); free(databuf1_char); free(databuf2_char); } break; case HE5T_NATIVE_LONG: { databuf1_long = (long *) calloc(num_elements1,sizeof(long)); memmove(databuf1_long,inputfortbuf,num_elements1*sizeof(long)); databuf2_long = (long *) calloc(num_elements1,sizeof(long)); /* Create the Fortran ordered buffer from the hash list */ /* and the C buffer */ /* ---------------------------------------------------- */ for( i = 0; i < num_elements1; i++ ) { databuf2_long[fort_order_buf[i]] = databuf1_long[i]; } memmove(outputfortbuf,databuf2_long,num_elements1*sizeof(long)); free(databuf1_long); free(databuf2_long); } break; default: { sprintf(errbuf, "Bad datatype value in call to HE5_PTc2fort. \n"); H5Epush(__FILE__, "HE5_PTc2fort", __LINE__, H5E_ARGS, H5E_BADVALUE,errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); status = FAIL; } break; } /* Free up space */ /* ------------- */ free(c_index); free(coeffs); free(n1); free(fort_order_buf); free(errbuf); status = 0; ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTfort2c | | | | DESCRIPTION: Translates a buffer in Fortran order into a buffer in | | 'C' order. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | dims[] long Dimensions of Fortran array | | rank int Rank of Fortran array | | datatype int Datatype of Fortran array | | inputfortbuf void input data buffer (Fortran array) | | | | OUTPUTS: | | outputfortbuf void output data buffer (Fortran array) | | | | NOTES: | | | | | | Date Programmer Description | | ========== ============ ============================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ static int HE5_PTfort2c(long dims[], int rank, int datatype, void *inputfortbuf, void *outputfortbuf) { herr_t status = FAIL;/* routine return status variable */ int ret = FAIL;/* (int) return status variable */ int i = 0; int dim_index = 0; long *c_index = (long *)NULL; long *coeffs = (long *)NULL; long *n1 = (long *)NULL; long *fort_order_buf = (long *)NULL; long num_elements1 = 0; long num_elements2 = 0; int *databuf1_int = (int *)NULL; int *databuf2_int = (int *)NULL; float *databuf1_float = (float *)NULL; float *databuf2_float = (float *)NULL; double *databuf1_double = (double *)NULL; double *databuf2_double = (double *)NULL; char *databuf1_char = (char *)NULL; char *databuf2_char = (char *)NULL; long *databuf1_long = (long *)NULL; long *databuf2_long = (long *)NULL; char *errbuf = (char *)NULL;/*Error message buffer */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_PTfort2c", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Calculate the number of elements in the array */ /* --------------------------------------------- */ num_elements1 = 1; for( i=0; i < rank; i++ ) { num_elements1 = dims[i]*num_elements1; } /* Set up arguments for call to HE5_PTgetfort_order() */ /* -------------------------------------------------- */ /* Initialize c_index array */ /* ------------------------ */ c_index = (long *) calloc(rank, sizeof(long)); for( i=0; i< rank; i++ ) c_index[i] = 0; /* Initialize coeffs array */ /* ----------------------- */ coeffs = (long *) calloc(rank, sizeof(long)); for( i=0; i< rank; i++ ) coeffs[i] = 0; coeffs[0] = 1; /* Initialize n1 variable */ /* ---------------------- */ n1 = (long *) calloc(1,sizeof(long)); *n1 = 0; dim_index = 1; /* Initialize fort_order_buf */ /* ------------------------- */ fort_order_buf = (long *) calloc(num_elements1,sizeof(long)); status = HE5_PTgetfort_order(dims, dim_index, c_index, rank, fort_order_buf, coeffs, n1); if (status == FAIL) { sprintf(errbuf, "Call to HE5_PTgetfort_order() failed.\n"); H5Epush(__FILE__, "HE5_PTfort2c", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(fort_order_buf); return(status); } num_elements2 = *n1; /* Check num_elements2 against num_elements1 */ /* ----------------------------------------- */ if( num_elements1 != num_elements2 ) { sprintf(errbuf, "Error with number of elements processed by HE5_PTgetfort_order or HE5_ptfort2c.\n"); H5Epush(__FILE__, "HE5_PTfort2c", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(fort_order_buf); return(FAIL); } switch( datatype ) { case HE5T_NATIVE_INT: { databuf1_int = (int *) calloc(num_elements1,sizeof(int)); memmove(databuf1_int,inputfortbuf,num_elements1*sizeof(int)); databuf2_int = (int *) calloc(num_elements1,sizeof(int)); /* Create the c ordered buffer from the hash list */ /* ---------------------------------------------- */ for( i = 0; i < num_elements1; i++ ) { databuf2_int[i] = databuf1_int[fort_order_buf[i]]; } memmove(outputfortbuf,databuf2_int,num_elements1*sizeof(int)); free(databuf1_int); free(databuf2_int); } break; case HE5T_NATIVE_FLOAT: { databuf1_float = (float *) calloc(num_elements1,sizeof(float)); memmove(databuf1_float,inputfortbuf,num_elements1*sizeof(float)); databuf2_float = (float *) calloc(num_elements1,sizeof(float)); /* Create the c ordered buffer from the hash list */ /* ---------------------------------------------- */ for( i = 0; i < num_elements1; i++ ) { databuf2_float[i] = databuf1_float[fort_order_buf[i]]; } memmove(outputfortbuf,databuf2_float,num_elements1*sizeof(float)); free(databuf1_float); free(databuf2_float); } break; case HE5T_NATIVE_DOUBLE: { databuf1_double = (double *) calloc(num_elements1,sizeof(double)); memmove(databuf1_double,inputfortbuf,num_elements1*sizeof(double)); databuf2_double = (double *) calloc(num_elements1,sizeof(double)); /* Create the c ordered buffer from the hash list */ /* ---------------------------------------------- */ for( i = 0; i < num_elements1; i++ ) { databuf2_double[i] = databuf1_double[fort_order_buf[i]]; } memmove(outputfortbuf,databuf2_double,num_elements1*sizeof(double)); free(databuf1_double); free(databuf2_double); } break; case HE5T_NATIVE_CHAR: { databuf1_char = (char *) calloc(num_elements1,sizeof(char)); memmove(databuf1_char,inputfortbuf,num_elements1*sizeof(char)); databuf2_char = (char *) calloc(num_elements1,sizeof(char)); /* Create the c ordered buffer from the hash list */ /* ---------------------------------------------- */ for( i = 0; i < num_elements1; i++ ) { databuf2_char[i] = databuf1_char[fort_order_buf[i]]; } memmove(outputfortbuf,databuf2_char,num_elements1*sizeof(char)); free(databuf1_char); free(databuf2_char); } break; case HE5T_NATIVE_LONG: { databuf1_long = (long *) calloc(num_elements1,sizeof(long)); memmove(databuf1_long,inputfortbuf,num_elements1*sizeof(long)); databuf2_long = (long *) calloc(num_elements1,sizeof(long)); /* Create the c ordered buffer from the hash list */ /* ---------------------------------------------- */ for( i = 0; i < num_elements1; i++ ) { databuf2_long[i] = databuf1_long[fort_order_buf[i]]; } memmove(outputfortbuf,databuf2_long,num_elements1*sizeof(long)); free(databuf1_long); free(databuf2_long); } break; default: { sprintf(errbuf, "Bad datatype value in call to HE5_PTfort2c. \n"); H5Epush(__FILE__, "HE5_PTfort2c", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); status = FAIL; } break; } /* Free up space */ /* ------------- */ free(c_index); free(coeffs); free(n1); free(fort_order_buf); free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTgetfort_order | | | | DESCRIPTION: Translates a buffer in Fortran order into a buffer in | | 'C' order. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | dims long Dimensions of Fortran array | | dim_index int Current dimension in recursive iteration| | c_index Changing coeffiencients in equation to | | calculate fortran order | | rank int Rank of Fortran array | | coeffs long Constant coefficients in equation to | | calculate fortran order | | | | n long number of elements processed which | | will equal num_elemnts in array | | | | OUTPUTS: | | P long buffer containing Fortran ordering | | | | NOTES: This program is called recursively, once for each of the | | dimensions in the fortran array. Values in c_index and coeffs | | are calculated during each of the recursive calls. Values in | | P are calculated in the last recursive call. | | | | | | | | Date Programmer Description | | ========== ============ ============================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ static int HE5_PTgetfort_order(long *dims, int dim_index, long *c_index, int rank, long *P, long *coeffs, long *n) { herr_t status = FAIL;/* routine return status variable */ int ret = FAIL;/* (int) return status variable */ int i = 0; int j = 0; int k = 0; int l = 0; int dim_index_tt = 0; long K1 = 0; long P1 = 0; char *errbuf = (char *)NULL;/*Error message buffer */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_PTgetfort_order", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } K1 = 1; for( i = 0; i < dim_index; i++ ) { K1 = dims[i]*K1; } if( dim_index < rank ) { coeffs[dim_index] = K1; dim_index_tt = dim_index; dim_index = dim_index + 1; for( k = 0; k < dims[dim_index_tt-1]; k++ ) { c_index[dim_index_tt-1] = k; status = HE5_PTgetfort_order( dims, dim_index, c_index, rank, P, coeffs, n); if (status == FAIL) { sprintf(errbuf, "Call to HE5_PTgetfort_order() failed.\n"); H5Epush(__FILE__, "HE5_PTgetfort_order", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } } } else { for( l = 0; l < dims[dim_index-1]; l++ ) { P1 = 0; c_index[dim_index-1] = l; for( j = 0; j < rank ; j++ ) { P1 = (coeffs[j])*(c_index[j]) + P1; } P[*n] = P1; *n = *n+1; } } free(errbuf); status = 0; ret = (int)status; return(ret); } /* Inquiry routines */ /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTnrecsF (FORTRAN wrapper) | | | | DESCRIPTION: Returns the number of records in a level. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nallrec int Number of records in level | | | | INPUTS: | | pointID int point structure ID | | level int level number (0 - based) | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTnrecsF(int pointID, int level) { hid_t PointID = FAIL;/* HDF5 type point ID */ hsize_t nallrec = 0; /* Number of records in Point */ char *errbuf = (char *)NULL;/*Error message buffer */ PointID = (hid_t)pointID; /* Allocate memory for error buffer */ /* -------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_PTnrecsF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory to error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } nallrec = HE5_PTnrecs(PointID, level); if(nallrec == 0) { sprintf(errbuf, "No records in current level. \n"); H5Epush(__FILE__, "HE5_PTnrecsF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } free(errbuf); return((int)nallrec); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTnlevelsF (FORTRAN wrapper) | | | | DESCRIPTION: Returns the number of levels in a point data set. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nlevels int Number of levels in point structure | | | | INPUTS: | | pointID int point structure ID | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTnlevelsF(hid_t pointID) { hid_t PointID = FAIL;/* HDF5 type point ID */ int nlevels = 0; /* Number of levels in point */ char *errbuf = (char *)NULL;/*Error message buffer */ PointID = (hid_t)pointID; /* Allocate memory for error buffer */ /* -------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_PTnlevelsF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory to error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Get number of levels */ /* -------------------- */ nlevels = HE5_PTnlevels(PointID); if(nlevels == FAIL) { sprintf(errbuf, "Cannot retrieve the number of levels. \n"); H5Epush(__FILE__, "HE5_PTnlevelsF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } free(errbuf); return((int)nlevels); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTnfieldsF (FORTRAN wrapper) | | | | DESCRIPTION: Returns number of fields defined in a level. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nfields int Number of fields in a level | | | | INPUTS: | | pointID int point structure ID | | level int level number (0 - based) | | | | OUTPUTS: | | strbufsize long String length of fieldlist | | fieldlist char Coma separated list of fields | | NOTES: | | | | | | Date Programmer Description | | ======== ============ ================================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTnfieldsF(int pointID, int level, char *fieldlist, long *strbufsize) { hid_t PointID = FAIL;/* HDF5 type point ID */ int nfields = 0; /* Number of fields in the level of the point*/ char *errbuf = (char *)NULL;/*Error message buffer */ PointID = (hid_t)pointID; /* Allocate memory for error buffer */ /* -------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_PTnfieldsF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory to error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Get number of fields and fieldlist */ /* ---------------------------------- */ nfields = HE5_PTnfields(PointID, level, fieldlist, strbufsize); if(nfields == 0) { sprintf(errbuf, "Cannot retrieve the number of fields. \n"); H5Epush(__FILE__, "HE5_PTnfieldsF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } free(errbuf); return((int)nfields); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTlevelindxF (FORTRAN wrapper) | | | | DESCRIPTION: Returns index number for a named level. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | n int Level number (0 - based) | | | | INPUTS: | | pointID in point structure ID | | levelname char point level name | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTlevelindxF(int pointID, const char *levelname) { hid_t PointID = FAIL;/* HDF5 type point ID */ int index = FAIL; char *errbuf = (char *)NULL;/*Error message buffer */ PointID = (hid_t)pointID; /* Allocate memory for error buffer */ /* -------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_PTlevelindxF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory to error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } PointID = (hid_t)pointID; /* Get index of named Level */ /* ---------------------------------- */ index = HE5_PTlevelindx(PointID, levelname); if(index == FAIL) { sprintf(errbuf, "Cannot retrieve the Level Index. \n"); H5Epush(__FILE__, "HE5_PTlevelindxF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } free(errbuf); return(index); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTgetlevelnameF (FORTRAN wrapper) | | | | DESCRIPTION: Returns level name | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | | | INPUTS: | | pointID int point structure ID | | level int level number (0 - based) | | | | | | OUTPUTS: | | levelname char Level name | | strbufsize long String length of fieldlist | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTgetlevelnameF(int pointID, int level, char *levelname, long *strbufsize) { int ret = FAIL; herr_t status = FAIL;/* routine return status variable */ hid_t PointID = FAIL; char *errbuf = (char *)NULL;/*Error message buffer */ /* Allocate memory for error buffer */ /* -------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_PTgetlevelnameF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory to error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(ret); } PointID = (hid_t)pointID; /* Get index of named Level */ /* ---------------------------------- */ status = HE5_PTgetlevelname( PointID, level, levelname, strbufsize); if(status == FAIL) { sprintf(errbuf, "Cannot retrieve the Level Name. \n"); H5Epush(__FILE__, "HE5_PTgetlevelnameF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTbcklinkinfoF (FORTRAN wrapper) | | | | DESCRIPTION: Returns link field to previous level. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID int point structure ID | | level int level number (0 - based) | | linkfield char linkage field | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTbcklinkinfoF(int pointID, int level, char *linkfield) { int ret = FAIL; herr_t status = FAIL;/* routine return status variable */ hid_t PointID = FAIL;/* HDF5 type point ID */ char *errbuf = (char *)NULL;/*Error message buffer */ /* Allocate memory for error buffer */ /* -------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_PTbcklinkinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory to error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(ret); } PointID = (hid_t)pointID; status = HE5_PTbcklinkinfo( PointID, level, linkfield); if(status == FAIL) { sprintf(errbuf, "Error in Fortran Wrapper HE5_PTbcklinkinfoF(). \n"); H5Epush(__FILE__, "HE5_PTbcklinkinfoF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTfwdlinkinfoF (FORTRAN wrapper) | | | | DESCRIPTION: Returns link field to following level. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID int point structure ID | | level int level number (0 - based) | | linkfield char linkage field | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTfwdlinkinfoF(int pointID, int level, char *linkfield) { int ret = FAIL; herr_t status = FAIL;/* routine return status variable */ hid_t PointID = FAIL;/* HDF5 type point ID */ char *errbuf = (char *)NULL;/*Error message buffer */ /* Allocate memory for error buffer */ /* -------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_PTfwdlinkinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory to error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(ret); } PointID = (hid_t)pointID; status = HE5_PTfwdlinkinfo( PointID, level, linkfield); if(status == FAIL) { sprintf(errbuf, "Error in Fortran Wrapper HE5_PTfwdlinkinfoF(). \n"); H5Epush(__FILE__, "HE5_PTfwdlinkinfoF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTlevelinfoF (FORTRAN wrapper) | | | | DESCRIPTION: Returns information about a given level. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID int point structure ID | | level int level number (0 - based) | | | | | | OUTPUTS: | | levelname char Name of Level | | rank int Rank of Fields | | fieldlist char Fieldlist to read (comma-separated) | | dim_sizes Sizes of field dimensions | | datasize long Datasize of compound structure | | offset long Offsets of each of the fields | | dtype int Datatypes of each of the fields | | | | | | | | | | | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTlevelinfoF(int pointID, int level, char *levelname, int rank[], char *fieldlist, long *dim_sizes, long *datasize, long offset[], int dtype[]) { herr_t status = FAIL;/* routine return status variable */ hid_t PointID = FAIL; HE5_CmpDTSinfo dtsinfo; int ret = FAIL;/* (int) Return status variable */ int i, j, k = 0; long nfields = FAIL; long max_rank = 0; long strbufsize = 0; char errbuf[HE5_HDFE_ERRBUFSIZE]; /* error message buffer */ PointID = (hid_t)pointID; /* Call HE5_PTlevelinfo to get information structure */ /* ------------------------------------------------- */ status = HE5_PTlevelinfo(PointID, level, &dtsinfo); if (status == FAIL) { sprintf(errbuf, "Call to HE5_PTlevelinfo failed.\n"); H5Epush(__FILE__, "HE5_PTlevelinfoF", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } nfields = (long)dtsinfo.nfields; *datasize = (long)dtsinfo.datasize; /* Release pointers to the name buffers */ /* ------------------------------------ */ for (j = 0; j < dtsinfo.nfields; j++) { if (dtsinfo.fieldname[j] != NULL) H5free_memory(dtsinfo.fieldname[j]); } /* Get the levelname */ /* ----------------- */ status = HE5_PTgetlevelname(PointID, level, levelname, &strbufsize); if (status == FAIL) { sprintf(errbuf, "Call to HE5_PTgetlevelname failed.\n"); H5Epush(__FILE__, "HE5_PTlevelinfoF", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } for( i = 0; i < nfields; i++ ) { rank[i] = dtsinfo.rank[i]; offset[i] = (long)dtsinfo.offset[i]; dtype[i] = (int)dtsinfo.dtype[i]; } /* Get fieldlist (output from HE5_PTnfields) */ /* ----------------------------------------- */ HE5_PTnfields(pointID, level, fieldlist, &strbufsize); /* Do work to store dimensions in level data structure */ /* --------------------------------------------------- */ /* Calculate maximum rank */ /* ---------------------- */ for( i = 0; i < nfields; i++ ) { if( rank[i] > max_rank ) max_rank = (long)rank[i]; } /* Load dimension arrays (2-d fortran dimension array is in fortran order) */ /* ----------------------------------------------------------------------- */ for( i = 0; i < max_rank; i++ ) { for( j = 0; j < nfields; j++ ) { k = j * (int)max_rank + i; dim_sizes[k] = (long)dtsinfo.dims[j][i] ; } } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTinqdatatype (FORTRAN wrapper) | | | | DESCRIPTION: Inquires about datasets in Point | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID int point structure ID | | fieldname char * Name of field | | attrname char * Name of attribute | | fieldgroup int Field group flag | | | | OUTPUTS: | | dtype int Datatype flag | | class int Class ID | | Order int | | size long | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTinqdatatypeF(int pointID, char *fieldname, char *attrname, int fieldgroup, int *Type, int *Class, int *Order, long *size) { int ret = FAIL; /* (int) status variable */ herr_t status = FAIL; /* return status variable */ size_t *tsize = (size_t *)NULL; /* data size variable */ hid_t *typeID = (hid_t *)NULL; /* HDF5 Data type ID */ hid_t PointID = FAIL; /* HDF5 type Point ID */ H5T_class_t *classID = (H5T_class_t *)NULL;/* Data type class ID */ H5T_order_t *order = (H5T_order_t *)NULL;/* Byte order of datatype */ char *errbuf = (char *)NULL; /* error message buffer */ /* Change Fortran character '0' to NULL */ /* (still works with '0' */ /* ------------------------------------ */ if( *fieldname == '0' ) { *fieldname = (char)(intptr_t)NULL; } if( *attrname == '0' ) { *attrname = (char)(intptr_t)NULL; } /* Allocate memory for error message buffers */ /* ----------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_PTinqdatatypeF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } typeID = (hid_t *)calloc(1, sizeof(hid_t)); if(typeID == NULL) { sprintf(errbuf,"Cannot allocate memory for typeID.\n"); H5Epush(__FILE__, "HE5_PTinqdatatypeF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } tsize = (size_t *)calloc(1, sizeof(size_t)); if(tsize == NULL) { sprintf(errbuf,"Cannot allocate memory for tsize.\n"); H5Epush(__FILE__, "HE5_PTinqdatatypeF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(typeID); return(FAIL); } classID = (H5T_class_t *)calloc(1, sizeof(H5T_class_t)); if(classID == (H5T_class_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for classID.\n"); H5Epush(__FILE__, "HE5_PTinqdatatypeF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(typeID); free(tsize); return(FAIL); } order = (H5T_order_t *)calloc(1, sizeof(H5T_order_t)); if(order == (H5T_order_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for order.\n"); H5Epush(__FILE__, "HE5_PTinqdatatypeF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(typeID); free(tsize); free(classID); return(FAIL); } PointID = (hid_t)pointID; /* Get data type information */ /* ------------------------- */ status = HE5_PTinqdatatype(PointID, fieldname, attrname, fieldgroup, typeID, classID, order, tsize); if(status == FAIL) { sprintf(errbuf,"Cannot get information about data type.\n"); H5Epush(__FILE__, "HE5_PTinqdatatypeF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } *Type = (int)(*typeID); *Class = (int)(*classID); *Order = (int)(*order); *size = (long)(*tsize); free(errbuf); free(typeID); free(classID); free(order); free(tsize); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTinqpointF (FORTRAN wrapper) | | | | DESCRIPTION: Returns number and names of point structures in file | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nPoint int Number of point structures in file | | | | INPUTS: | | filename char HDF-EOS filename | | | | OUTPUTS: | | pointlist char List of point names (comma-separated) | | strbufsize long Length of pointlist | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTinqpointF(const char *filename, char *pointlist, long *strbufsize) { int npoint = FAIL; long nPoint = FAIL;/* Number of point structures in file (return) */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ nPoint = HE5_PTinqpoint( filename, pointlist, strbufsize); if ( nPoint < 0 ) { sprintf(errbuf, "Cannot retrieve the list of Point names. \n"); H5Epush(__FILE__, "HE5_PTinqpointF", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } npoint = (int)nPoint; return(npoint); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTattrinfoF (FORTRAN wrapper) | | | | DESCRIPTION: | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID int point structure ID | | attrname char attribute name | | | | OUTPUTS: | | ntype int Data type of attribute | | fortcount long Number of attribute elements | | | | | | | | NOTES: | | | | | | Date Programmer Description | | ======= ============ ================================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTattrinfoF(int pointID, const char *attrname, int *numbertype, long *fortcount) { int ret = FAIL; /* (int) return status variable */ herr_t status = FAIL; /* return status variable */ hid_t *ntype = (hid_t *)NULL; /* Data type class ID */ hid_t PointID = FAIL; /* HDF5 type Point ID */ hsize_t *count = (hsize_t *)NULL; /* Pointer to count (C order) */ char *errbuf = (char *)NULL; /* error message buffer */ /* Allocate memory for error message buffers */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_PTattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } count = (hsize_t *) calloc(1, sizeof(hsize_t)); if( count == NULL) { sprintf(errbuf,"Cannot allocate memory for count.\n"); H5Epush(__FILE__, "HE5_PTattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } ntype = (hid_t *) calloc(1, sizeof(hid_t)); if(ntype == (hid_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for ntype.\n"); H5Epush(__FILE__, "HE5_PTattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); return(FAIL); } PointID = (hid_t)pointID; status = HE5_PTattrinfo(PointID, attrname, ntype, count); if(status == FAIL) { sprintf(errbuf,"Cannot get information about attribute \"%s\".\n", attrname); H5Epush(__FILE__, "HE5_PTattrinfoF", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } *fortcount = (long)(*count); *numbertype = (int)(*ntype); free(errbuf); free(count); free(ntype); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTattrinfoF2 (FORTRAN wrapper) | | | | DESCRIPTION: | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID int point structure ID | | attrname char attribute name | | | | OUTPUTS: | | ntype int Data type of attribute | | fortcount long Number of attribute elements | | fortsize long buf size of attribute elements | | | | | | | | NOTES: | | | | | | Date Programmer Description | | ======= ============ ================================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTattrinfoF2(int pointID, const char *attrname, int *numbertype, long *fortcount, long *fortsize) { int ret = FAIL; /* (int) return status variable */ herr_t status = FAIL; /* return status variable */ hid_t *ntype = (hid_t *)NULL; /* Data type class ID */ hid_t PointID = FAIL; /* HDF5 type Point ID */ hsize_t *count = (hsize_t *)NULL; /* Pointer to count of array elements */ hsize_t *size = (hsize_t *)NULL; /* Pointer to size of array elements */ char *errbuf = (char *)NULL; /* error message buffer */ /* Allocate memory for error message buffers */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_PTattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } count = (hsize_t *) calloc(1, sizeof(hsize_t)); if( count == NULL) { sprintf(errbuf,"Cannot allocate memory for count.\n"); H5Epush(__FILE__, "HE5_PTattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } size = (hsize_t *) calloc(1, sizeof(hsize_t)); if( size == NULL) { sprintf(errbuf,"Cannot allocate memory for size.\n"); H5Epush(__FILE__, "HE5_PTattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } ntype = (hid_t *) calloc(1, sizeof(hid_t)); if(ntype == (hid_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for ntype.\n"); H5Epush(__FILE__, "HE5_PTattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); return(FAIL); } PointID = (hid_t)pointID; status = HE5_PTattrinfo2(PointID, attrname, ntype, count, size); if(status == FAIL) { sprintf(errbuf,"Cannot get information about attribute \"%s\".\n", attrname); H5Epush(__FILE__, "HE5_PTattrinfoF", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } *fortcount = (long)(*count); *fortsize = (long)(*size); *numbertype = (int)(*ntype); free(errbuf); free(count); free(size); free(ntype); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTgrpattrinfoF (FORTRAN wrapper) | | | | DESCRIPTION: Retrieves information about attributes in "Data" group. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID int point structure ID | | attrname char attribute name | | | | OUTPUTS: | | ntype int Data type of attribute | | fortcount long Number of attribute elements | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTgrpattrinfoF(int pointID, const char *attrname, int *numbertype, long *fortcount) { int ret = FAIL; /* (int) return status variable */ herr_t status = FAIL; /* routine return status variable */ hid_t *ntype = (hid_t *)NULL; /* Data type class ID */ hid_t PointID = FAIL; /* HDF5 type Point ID */ hsize_t *count = (hsize_t *)NULL;/* Pointer to count (C order) */ char *errbuf = (char *)NULL; /* error message buffer */ /* Allocate memory for error message buffers */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_PTgrpattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } count = (hsize_t *)calloc(1, sizeof(hsize_t)); if( count == NULL) { sprintf(errbuf,"Cannot allocate memory for count.\n"); H5Epush(__FILE__, "HE5_PTgrpattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } ntype = (hid_t *)calloc(1, sizeof(hid_t)); if( ntype == (hid_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for ntype.\n"); H5Epush(__FILE__, "HE5_PTgrpattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); return(FAIL); } PointID = (hid_t)pointID; status = HE5_PTgrpattrinfo(PointID, attrname, ntype, count); if(status == FAIL) { sprintf(errbuf,"Cannot get information about group attribute.\n"); H5Epush(__FILE__, "HE5_PTgrpattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } *fortcount = (long)(*count); *numbertype = (int)(*ntype); free(errbuf); free(count); free(ntype); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTgrpattrinfoF2 (FORTRAN wrapper) | | | | DESCRIPTION: Retrieves information about attributes in "Data" group. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID int point structure ID | | attrname char attribute name | | | | OUTPUTS: | | ntype int Data type of attribute | | fortcount long Number of attribute elements | | fortsize long buf size of attribute elements | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTgrpattrinfoF2(int pointID, const char *attrname, int *numbertype, long *fortcount, long *fortsize) { int ret = FAIL; /* (int) return status variable */ herr_t status = FAIL; /* routine return status variable */ hid_t *ntype = (hid_t *)NULL; /* Data type class ID */ hid_t PointID = FAIL; /* HDF5 type Point ID */ hsize_t *count = (hsize_t *)NULL; /* Pointer to count of array elements */ hsize_t *size = (hsize_t *)NULL; /* Pointer to size of array elements */ char *errbuf = (char *)NULL; /* error message buffer */ /* Allocate memory for error message buffers */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_PTgrpattrinfoF2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } count = (hsize_t *)calloc(1, sizeof(hsize_t)); if( count == NULL) { sprintf(errbuf,"Cannot allocate memory for count.\n"); H5Epush(__FILE__, "HE5_PTgrpattrinfoF2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } size = (hsize_t *)calloc(1, sizeof(hsize_t)); if( size == NULL) { sprintf(errbuf,"Cannot allocate memory for size.\n"); H5Epush(__FILE__, "HE5_PTgrpattrinfoF2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } ntype = (hid_t *)calloc(1, sizeof(hid_t)); if( ntype == (hid_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for ntype.\n"); H5Epush(__FILE__, "HE5_PTgrpattrinfoF2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); return(FAIL); } PointID = (hid_t)pointID; status = HE5_PTgrpattrinfo2(PointID, attrname, ntype, count, size); if(status == FAIL) { sprintf(errbuf,"Cannot get information about group attribute.\n"); H5Epush(__FILE__, "HE5_PTgrpattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } *fortcount = (long)(*count); *fortsize = (long)(*size); *numbertype = (int)(*ntype); free(errbuf); free(count); free(size); free(ntype); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTlocattrinfoF (FORTRAN wrapper) | | | | DESCRIPTION: Retrieves information about attributes in associated with a | | specified level in a point. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID int point structure ID | | levelname char level name | | attrname char attribute name | | | | OUTPUTS: | | ntype int Data type of attribute | | count long Number of attribute elements | | | | | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTlocattrinfoF(int pointID, const char *levelname, const char *attrname, int *numbertype, long *fortcount) { int ret = FAIL; /* (int) return status variable */ herr_t status = FAIL; /* routine return status variable */ hid_t *ntype = (hid_t *)NULL; /* Data type class ID */ hid_t PointID = FAIL; /* HDF5 type Point ID */ hsize_t *count = (hsize_t *)NULL;/* Pointer to count (C order) */ char *errbuf = (char *)NULL; /* error message buffer */ /* Allocate memory for error message buffers */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_PTlocattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } count = (hsize_t *)calloc(1, sizeof(hsize_t)); if( count == NULL) { sprintf(errbuf,"Cannot allocate memory for count.\n"); H5Epush(__FILE__, "HE5_PTlocattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } ntype = (hid_t *)calloc(1, sizeof(hid_t)); if( ntype == (hid_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for ntype.\n"); H5Epush(__FILE__, "HE5_PTlocattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); return(FAIL); } PointID = (hid_t)pointID; status = HE5_PTlocattrinfo(PointID, levelname, attrname, ntype, count); if(status == FAIL) { sprintf(errbuf,"Cannot get information about local attribute.\n"); H5Epush(__FILE__, "HE5_PTlocattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } *fortcount = (long)(*count); *numbertype = (int)(*ntype); free(errbuf); free(count); free(ntype); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTlocattrinfoF2 (FORTRAN wrapper) | | | | DESCRIPTION: Retrieves information about attributes in associated with a | | specified level in a point. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID int point structure ID | | levelname char level name | | attrname char attribute name | | | | OUTPUTS: | | ntype int Data type of attribute | | fortcount long Number of attribute elements | | fortsize long buf size of attribute elements | | | | | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTlocattrinfoF2(int pointID, const char *levelname, const char *attrname, int *numbertype, long *fortcount, long *fortsize) { int ret = FAIL; /* (int) return status variable */ herr_t status = FAIL; /* routine return status variable */ hid_t *ntype = (hid_t *)NULL; /* Data type class ID */ hid_t PointID = FAIL; /* HDF5 type Point ID */ hsize_t *count = (hsize_t *)NULL; /* Pointer to count of array elements */ hsize_t *size = (hsize_t *)NULL; /* Pointer to size of array elements */ char *errbuf = (char *)NULL; /* error message buffer */ /* Allocate memory for error message buffers */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_PTlocattrinfoF2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } count = (hsize_t *)calloc(1, sizeof(hsize_t)); if( count == NULL) { sprintf(errbuf,"Cannot allocate memory for count.\n"); H5Epush(__FILE__, "HE5_PTlocattrinfoF2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } size = (hsize_t *)calloc(1, sizeof(hsize_t)); if( size == NULL) { sprintf(errbuf,"Cannot allocate memory for size.\n"); H5Epush(__FILE__, "HE5_PTlocattrinfoF2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } ntype = (hid_t *)calloc(1, sizeof(hid_t)); if( ntype == (hid_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for ntype.\n"); H5Epush(__FILE__, "HE5_PTlocattrinfoF2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); return(FAIL); } PointID = (hid_t)pointID; status = HE5_PTlocattrinfo2(PointID, levelname, attrname, ntype, count, size); if(status == FAIL) { sprintf(errbuf,"Cannot get information about local attribute.\n"); H5Epush(__FILE__, "HE5_PTlocattrinfoF2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } *fortcount = (long)(*count); *fortsize = (long)(*size); *numbertype = (int)(*ntype); free(errbuf); free(count); free(size); free(ntype); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTinqattrsF (FORTRAN wrapper) | | | | DESCRIPTION: | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nattr long Number of attributes in point struct | | | | INPUTS: | | point ID int point structure ID | | | | OUTPUTS: | | attrnames char Attribute names in point struct | | (Comma-separated list) | | strbufsize long Attributes name list string length | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_PTinqattrsF(int pointID, char *attrnames, long *strbufsize) { long nattr = FAIL;/* Number of attributes (return) */ hid_t PointID = FAIL;/* HDF5 type Point ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ char *attrnames_t = (char *)NULL; char buffer[1] = {'0'}; char buffer1[1] = {'1'}; int result = 1; PointID = (hid_t)pointID; /* Change Fortran character '0' to NULL if needed */ /* ---------------------------------------------- */ buffer1[0] = attrnames[0]; result = memcmp(buffer1,buffer,sizeof(buffer)); if( memcmp(buffer1,buffer,sizeof(buffer)) == 0 ) { result = 0; } if( result == 0 ) nattr = HE5_PTinqattrs(PointID, attrnames_t, strbufsize); if( result != 0 ) nattr = HE5_PTinqattrs(PointID, attrnames, strbufsize); if ( nattr < 0 ) { sprintf(errbuf, "Cannot retrieve the attributes. \n"); H5Epush(__FILE__, "HE5_PTinqattrsF", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return(nattr); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTinqgrpattrsF (FORTRAN wrapper) | | | | DESCRIPTION: Retrieves the number of attributes and string length of | | attribute list in "Data" group | | | | | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nattr long Number of attributes in point struct | | | | INPUTS: | | point ID int point structure ID | | | | OUTPUTS: | | attrnames char Attribute names in point struct | | (Comma-separated list) | | strbufsize long Attributes name list string length | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_PTinqgrpattrsF(int pointID, char *attrnames, long *strbufsize) { long nattr = FAIL; /* Number of attributes (return) */ hid_t PointID = FAIL; /* HDF5 type swath ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ char *attrnames_t = (char *)NULL; char buffer[1] = {'0'}; char buffer1[1] = {'1'}; int result = 1; PointID = (hid_t)pointID; /* Change Fortran character '0' to NULL if needed */ /* ---------------------------------------------- */ buffer1[0] = attrnames[0]; result = memcmp(buffer1,buffer,sizeof(buffer)); if( memcmp(buffer1,buffer,sizeof(buffer)) == 0 ) { result = 0; } if( result == 0 ) nattr = HE5_PTinqgrpattrs(PointID, attrnames_t, strbufsize); if( result != 0 ) nattr = HE5_PTinqgrpattrs(PointID, attrnames, strbufsize); if ( nattr < 0 ) { sprintf(errbuf, "Cannot retrieve the attributes. \n"); H5Epush(__FILE__, "HE5_PTinqgrpattrsF", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return(nattr); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTinqlocattrsF (FORTRAN wrapper) | | | | DESCRIPTION: Retrieves the number of attributes and string length of | | attribute list from a specified level in a point. | | | | | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nattr long Number of attributes in a level | | | | INPUTS: | | point ID int point structure ID | | levelname char level name | | | | OUTPUTS: | | attrnames char Attribute names in a level | | (Comma-separated list) | | strbufsize long Attributes name list string length | | | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 12/01/01 C.Praderas Initial coding | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_PTinqlocattrsF(int pointID, const char *levelname, char *attrnames, long *strbufsize) { long nattr = FAIL; /* Number of attributes */ hid_t PointID = FAIL; /* HDF5 type swath ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ char *attrnames_t = (char *)NULL; char buffer[1] = {'0'}; char buffer1[1] = {'1'}; int result = 1; PointID = (hid_t)pointID; /* Change Fortran character '0' to NULL if needed */ /* ---------------------------------------------- */ buffer1[0] = attrnames[0]; result = memcmp(buffer1,buffer,sizeof(buffer)); if( memcmp(buffer1,buffer,sizeof(buffer)) == 0 ) { result = 0; } if( result == 0 ) nattr = HE5_PTinqlocattrs(PointID, levelname, attrnames_t, strbufsize); if( result != 0 ) nattr = HE5_PTinqlocattrs(PointID, levelname, attrnames, strbufsize); if ( nattr < 0 ) { sprintf(errbuf, "Cannot retrieve the attributes. \n"); H5Epush(__FILE__, "HE5_PTinqlocattrsF", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return (nattr); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTnumtypeinfoF (FORTRAN wrapper) | | | | DESCRIPTION: Returns the number type about a given level. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID int point structure ID | | level int level number (0 - based) | | | | | | OUTPUTS: | | numtype int Number types of each of the fields | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 04 S.Zhao Original development | | Dec 05 T.Roegner NCR 44092 - Added CYGWIN capability | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTnumtypeinfoF(int pointID, int level, int numtype[]) { herr_t status = FAIL;/* routine return status variable */ hid_t PointID = FAIL;/* HDF-EOS Point ID */ HE5_CmpDTSinfo dtsinfo; int ret = FAIL;/* (int) Return status variable */ int i = 0; long nfields = FAIL;/* Number of fields in the level*/ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* error message buffer */ PointID = (hid_t)pointID; /* Call HE5_PTlevelinfo to get information structure */ /* ------------------------------------------------- */ status = HE5_PTlevelinfo(PointID, level, &dtsinfo); if (status == FAIL) { sprintf(errbuf, "Call to HE5_PTlevelinfo failed.\n"); H5Epush(__FILE__, "HE5_PTnumtypeinfoF", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } nfields = (long)dtsinfo.nfields; for( i = 0; i < nfields; i++ ) { numtype[i] = (int)dtsinfo.numtype[i]; } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTgetdtypesize | | | | DESCRIPTION: Returns size of datatype for a member in a given level. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return size if SUCCEED, (-1) FAIL | | | | INPUTS: | | levelID hid_t level dataset ID | | fieldnum int member number in the level | | structure (0 - based) | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Dec 05 Abe Taaheri Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PTgetdtypesize(hid_t levelID, int i) { hid_t typeID = FAIL; /* compound datatype ID */ hid_t mdt = FAIL; /* Member data type ID */ int ret = FAIL; char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ int status; typeID = H5Dget_type(levelID); mdt = H5Tget_member_type(typeID, i); ret = H5Tget_size(mdt); if (ret == FAIL) { sprintf(errbuf, "Cannot get the size of member daat type ID.\n"); H5Epush(__FILE__, "HE5_PTgetdtypesize", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } status = H5Tclose(mdt); if (status == FAIL) { sprintf(errbuf, "Cannot release the field data type ID.\n"); H5Epush(__FILE__, "HE5_PTgetdtypesize", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } status = H5Tclose(typeID); if (status == FAIL) { sprintf(errbuf, "Cannot release the data type ID.\n"); H5Epush(__FILE__, "HE5_PTgetdtypesize", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PTgetlevelname_fromSM | | | | DESCRIPTION: Returns name of a given level from Structure Metadata | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | pointID hid_t point structure ID | | level int level number (0 - based) | | | | OUTPUTS: | | LevelName char string Name for rquested level obtained from | | Structure Metadata | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 12/28/05 Abe Taaheri created . | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_PTgetlevelname_fromSM(hid_t pointID, int level, char *LevelName) { herr_t status = FAIL; /* Return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t pID = FAIL; /* Point ID - offset */ hid_t gid = FAIL; hid_t idOffset = HE5_PTIDOFFSET; /* Point ID offset */ long idx = FAIL; /* Point index */ char *metabuf = NULL; /* Pointer to SM */ char *metaptrs[2]={NULL,NULL}; /* Ptrs to begin/end of SM */ char name1[HE5_HDFE_NAMBUFSIZE]; /* Name string 1 */ char level_subgroupname[HE5_HDFE_NAMBUFSIZE]; char utlbuf[HE5_HDFE_UTLBUFSIZE];/* Utility buffer */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error messg buffer */ strcpy(LevelName,""); /* Check for valid point ID */ /* ------------------------ */ status = HE5_PTchkptid(pointID, "HE5_PTgetlevelname_fromSM", &fid, &gid, &idx); if (status == FAIL ) { sprintf(errbuf, "Checking for point ID failed. \n"); H5Epush(__FILE__, "HE5_PTgetlevelname_fromSM", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Compute "reduced" point ID */ /* -------------------------- */ pID = pointID % idOffset; /* construct level's group name */ /* -------------------------- */ sprintf(level_subgroupname, "Level_%d", level); /* Get specific level's structural metadata */ /* ---------------------------------- */ metabuf = (char *)HE5_EHmetagroup(fid, HE5_PTXPoint[pID].ptname, "p", level_subgroupname, metaptrs); if (metabuf == NULL ) { status = FAIL; sprintf(errbuf, "Cannot get pointer to metadata buffer for the \"%s\" point. \n", HE5_PTXPoint[pID].ptname); H5Epush(__FILE__, "HE5_PTgetlevelname_fromSM", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Search for LevelName= entry */ /* ---------------------------- */ status = HE5_EHgetmetavalue(metaptrs, "LevelName", LevelName); if (status == FAIL ) { sprintf(errbuf, "Cannot get \"LevelName\" metavalue for the \"%s\" point. \n", HE5_PTXPoint[pID].ptname); H5Epush(__FILE__, "HE5_PTgetlevelname_fromSM", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(metabuf); return(status); } free(metabuf); return(status); } #ifndef __cplusplus /* HDF types used in FORTRAN bindings */ #define INT32 INT #define INT32V INTV #define PINT32 PINT /* File/Point access routines */ FCALLSCFUN2(INT, HE5_PTopenF, HE5_PTOPEN, he5_ptopen, STRING, INT) FCALLSCFUN2(INT, HE5_PTcreateF, HE5_PTCREATE, he5_ptcreate, INT, STRING) FCALLSCFUN2(INT, HE5_PTattachF, HE5_PTATTACH, he5_ptattach, INT, STRING) FCALLSCFUN1(INT, HE5_PTdetachF, HE5_PTDETACH, he5_ptdetach, INT) FCALLSCFUN1(INT, HE5_PTcloseF, HE5_PTCLOSE, he5_ptclose, INT) /* Definition routines */ FCALLSCFUN7(INT, HE5_PTdeflevelF,HE5_PTDEFLEVEL, he5_ptdeflevel, INT, STRING, INTV, STRING, PLONG, INTV, INTV) FCALLSCFUN4(INT, HE5_PTdeflinkageF,HE5_PTDEFLINKAGE, he5_ptdeflinkage, INT, STRING, STRING, STRING) /* I/O routines */ FCALLSCFUN5(INT, HE5_PTreadlevelF,HE5_PTREADLEVEL, he5_ptreadlevel, INT, INT, STRING, INT, PVOID) FCALLSCFUN7(INT, HE5_PTupdatelevelF, HE5_PTUPDATELEVEL, he5_ptupdatelevel, INT, INT, STRING, LONG, LONGV, INT, PVOID) FCALLSCFUN6(INT, HE5_PTwritelevelF, HE5_PTWRITELEVEL, he5_ptwritelevel, INT, INT, LONGV, STRING, INT, PVOID) FCALLSCFUN5(INT, HE5_PTwriteattrF, HE5_PTWRITEATTR, he5_ptwriteattr, INT, STRING, INT, LONGV, PVOID) FCALLSCFUN5(INT, HE5_PTwritegrpattrF, HE5_PTWRITEGRPATTR, he5_ptwritegrpattr, INT, STRING, INT, LONGV, PVOID) FCALLSCFUN6(INT, HE5_PTwritelocattrF, HE5_PTWRITELOCATTR, he5_ptwritelocattr, INT, STRING, STRING, INT, LONGV, PVOID) FCALLSCFUN3(INT, HE5_PTreadattrF, HE5_PTREADATTR, he5_ptreadattr, INT, STRING, PVOID) FCALLSCFUN3(INT, HE5_PTreadgrpattrF, HE5_PTREADGRPATTR, he5_ptreadgrpattr, INT, STRING, PVOID) FCALLSCFUN4(INT, HE5_PTreadlocattrF, HE5_PTREADLOCATTR, he5_ptreadlocattr, INT, STRING, STRING, PVOID) FCALLSCFUN2(INT, HE5_PTwrbckptrF, HE5_PTWRBCKPTR, he5_ptwrbckptr, INT, INT) FCALLSCFUN2(INT, HE5_PTwrfwdptrF, HE5_PTWRFWDPTR, he5_ptwrfwdptr, INT, INT) /* Point inquiry routines */ FCALLSCFUN2(INT, HE5_PTnrecsF,HE5_PTNRECS, he5_ptnrecs, INT, INT) FCALLSCFUN1(INT, HE5_PTnlevelsF,HE5_PTNLEVELS, he5_ptnlevels, INT) FCALLSCFUN4(INT, HE5_PTnfieldsF,HE5_PTNFIELDS, he5_ptnfields, INT, INT, PSTRING, PLONG) FCALLSCFUN2(INT, HE5_PTlevelindxF,HE5_PTLEVELINDX, he5_ptlevelindx, INT, PSTRING) FCALLSCFUN4(INT, HE5_PTgetlevelnameF,HE5_PTGETLEVELNAME, he5_ptgetlevelname, INT, INT, PSTRING, PLONG) FCALLSCFUN3(INT, HE5_PTbcklinkinfoF,HE5_PTBCKLINKINFO, he5_bcklinkinfo, INT, INT, PSTRING) FCALLSCFUN3(INT, HE5_PTfwdlinkinfoF,HE5_PTFWDLINKINFO, he5_fwdlinkinfo, INT, INT, PSTRING) FCALLSCFUN9(INT, HE5_PTlevelinfoF, HE5_PTLEVELINFO, he5_ptlevelinfo, INT, INT, PSTRING, INTV, PSTRING, PLONG, PLONG, LONGV, INTV) FCALLSCFUN8(INT, HE5_PTinqdatatypeF, HE5_PTINQDATATYPE, he5_ptinqdatatype, INT, PSTRING, PSTRING, INT, PINT, PINT, PINT, PLONG) FCALLSCFUN3(INT, HE5_PTinqpointF,HE5_PTINQPOINT, he5_inqpoint, PSTRING, PSTRING, PLONG) FCALLSCFUN4(INT, HE5_PTattrinfoF,HE5_PTATTRINFO, he5_ptattrinfo, INT, PSTRING, PINT, PLONG) FCALLSCFUN4(INT, HE5_PTgrpattrinfoF,HE5_PTGRPATTRINFO, he5_ptgrpattrinfo, INT, PSTRING, PINT, PLONG) FCALLSCFUN5(INT, HE5_PTlocattrinfoF,HE5_PTLOCATTRINFO, he5_ptlocattrinfo, INT, PSTRING, PSTRING, PINT, PLONG) FCALLSCFUN5(INT, HE5_PTattrinfoF2,HE5_PTATTRINFO2, he5_ptattrinfo2, INT, PSTRING, PINT, PLONG, PLONG) FCALLSCFUN5(INT, HE5_PTgrpattrinfoF2,HE5_PTGRPATTRINFO2, he5_ptgrpattrinfo2, INT, PSTRING, PINT, PLONG, PLONG) FCALLSCFUN6(INT, HE5_PTlocattrinfoF2,HE5_PTLOCATTRINFO2, he5_ptlocattrinfo2, INT, PSTRING, PSTRING, PINT, PLONG, PLONG) FCALLSCFUN3(LONG, HE5_PTinqattrsF,HE5_PTINQATTRS, he5_ptinqattrs, INT, PSTRING, PLONG) FCALLSCFUN3(LONG, HE5_PTinqgrpattrsF,HE5_PTINQGRPATTRS, he5_ptinqgrpattrs, INT, PSTRING, PLONG) FCALLSCFUN4(LONG, HE5_PTinqlocattrsF,HE5_PTINQLOCATTRS, he5_ptinqlocattrs, INT, PSTRING, PSTRING, PLONG) FCALLSCFUN3(INT, HE5_PTnumtypeinfoF, HE5_PTNUMTYPEINFO, he5_ptnumtypeinfo, INT, INT, INTV) /* Point utility routines */ FCALLSCFUN5(LONG, HE5_PTc2fort,HE5_PTC2FORT, he5_ptc2fort, LONGV, INT, INT, PVOID, PVOID) FCALLSCFUN5(LONG, HE5_PTfort2c,HE5_PTFORT2C, he5_ptfort2c, LONGV, INT, INT, PVOID, PVOID) #endif hdf-eos5-2.0/src/SWapi.c000077500000000000000000054112431507520047200147620ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 1999 Emergent IT Inc. and Raytheon Systems Company | | | | Permission to use, 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 and that both that | | copyright notice and this permission notice appear in supporting | | documentation. | ---------------------------------------------------------------------------- */ #include #include #include #include #define HE5_SWIDOFFSET 671088642 #define HE5_NSWATH 400 #define HE5_NSWATHREGN 512 #define HE5_MAXNREGIONS 2048 #ifndef MAX_NAME #define MAX_NAME 1024 #endif int HE5_timeflag = 0; int HE5_GDsetflddimlabel(hid_t gridID, char *fieldname, char *dimname, char *dimlabel); /* Swath Structure External Arrays */ struct HE5_swathStructure { hid_t fid; /* HDF-EOS file ID */ hid_t obj_id; /* "SWATHS" group ID */ hid_t sw_id; /* specified swath group ID */ hid_t data_id; /* "Data Fields" group ID */ hid_t geo_id; /* "Geo Fields" group ID */ hid_t prof_id; /* "Profile Fields" group ID */ hid_t plist; /* current dataset creation property */ int active; /* Flag: file active or not */ int compcode; /* compression mode */ int compparm[5]; /* compression level */ HE5_DTSinfo *gdataset; /* pointer to Geo field info */ HE5_DTSinfo *ddataset; /* pointter to Data field info */ HE5_DTSinfo *pdataset; /* pointer to Profile field info */ long nGFLD; /* number of geo fields */ long nDFLD; /* number of data fields */ long nPROF; /* number of profile fields */ char swname[HE5_OBJNAMELENMAX];/* swath name */ }; struct HE5_swathStructure HE5_SWXSwath[HE5_NSWATH]; struct HE5_swathRegion { hid_t fid; hid_t swathID; long nRegions; long StartRegion[HE5_MAXNREGIONS]; long StopRegion[HE5_MAXNREGIONS]; long StartVertical[HE5_DTSETRANKMAX]; long StopVertical[HE5_DTSETRANKMAX]; char *DimNamePtr[HE5_DTSETRANKMAX]; }; struct HE5_swathRegion *HE5_SWXRegion[HE5_NSWATHREGN]; struct HE5_dtsIDs { hid_t type_id; hid_t space_id; hid_t plist_id; }; struct HE5_dtsIDs profile; /* INTERNAL FUNCTION PROTOTYPES */ int HE5_szip_can_encode(void ); static herr_t HE5_SWchkswid(hid_t swathID, const char *routname, hid_t *fid, hid_t *gid, long *idx); static long HE5_SWinqfields(hid_t swathID, char *fieldtype, char *fieldlist, int rank[], hid_t ntype[]); static size_t HE5_SWfieldsizeID(hid_t swathID, char *fieldname, hid_t *fieldID); static herr_t HE5_SWdefinefield(hid_t swathID, char *fieldtype, const char *fieldname, char *dimlist, char *maxdimlist, hid_t typeID, int merge); static herr_t HE5_SWwrrdfield(hid_t swathID, char *fieldname, char *code, const hssize_t start[], const hsize_t stride[], const hsize_t count[], void * datbuf); static herr_t HE5_SWfinfo(hid_t swathID, char *fieldtype, char *fieldname, int *rank, hsize_t dims[], hid_t ntype[], char *dimlist, char *maxdimlist); static int HE5_SWfldnameinfo(hid_t swathID, char *fieldname, char *fldactualname); static herr_t HE5_SWupdatedim(hid_t swathID, char *dimname, hsize_t dim); static herr_t HE5_SWllmapedidxinfo(hid_t swathID, char *object, long *index0, long *index1); static herr_t HE5_SWflddiminfo(hid_t SwathID, char *fieldname, int *rank, hsize_t dims[], hsize_t maxdims[]); /* CUSTOM MEMORY MANAGEMENT ROUTINES */ /* void * vltypes_alloc_custom(size_t size, void *info); void vltypes_free_custom(void *mem, void *info); */ /* FORTRAN WRAPPER PROTOTYPES */ /* File/Swath access routines */ int HE5_SWopenF(char *filename, int flags); int HE5_SWcreateF(int fileID, char *swathname); int HE5_SWattachF(int fileID, char *swathname); int HE5_SWdetachF(int swathID); int HE5_SWcloseF(int fileID); /* Definition routines */ int HE5_SWdefdimF(int swathID, char *dimname, long dim); int HE5_SWdefdimmapF(int swathID, char *geodim, char *datadim, long offset, long increment); int HE5_SWdefidxmapF(int swathID, char *geodim, char *datadim, long index[]); int HE5_SWdefgfld(int swathID, char *fieldname, char *fortdimlist, char *fortmaxdimlist, int numtype, int create_plist_id); int HE5_SWdefdfld(int swathID, char *fieldname, char *fortdimlist, char *fortmaxdimlist, int numtype, int create_plist_id); int HE5_SWdefchunkF(int swathID, int ndims, long *dim); int HE5_SWdefcompF(int swathID, int compcode, int *compparm); int HE5_SWdefcomchunkF(int swathID, int compcode, int *compparm, int rank, long *dim); long HE5_SWupimap(int swathID, int regionID, long indexin[], long indexout[], long indicies[]); int HE5_SWfldrenameF(int swathID, char *oldfieldname, char *newfieldname); int HE5_SWsetflddimlabel(hid_t swathID, char *fieldname, char *dimname, char *label); int HE5_SWgetflddimlabel(hid_t swathID, char *fieldname, char *dimname, char *label); herr_t HE5_SWsetdimscale2(hid_t swathID, char *fieldname, char *dimname, char *dimscalename, const hsize_t dimsize, hid_t numbertype_in, void * data); /* I/O routines */ int HE5_SWwrfld(int swathID, char *fieldname, long fortstart[], long fortstride[], long fortedge[], void *data); int HE5_SWwrcharfld(int swathID, char *fieldname, int elemlen, int numelem, long fortstart[], long fortstride[], long fortedge[], void *data); int HE5_SWrdfld(int swathID, char *fieldname, long fortstart[], long fortstride[], long fortedge[], void *buffer); int HE5_SWrdcharfld(int swathID, char *fieldname, int elemlen, int numelem, long fortstart[], long fortstride[], long fortedge[], void *buffer); int HE5_SWsetfill(int swathID, char *fieldname, int ntype, void *fillval); int HE5_SWgetfill(int swathID, char *fieldname, void *fillval); int HE5_SWwrattr(int swathID, char *attrname, int ntype, long fortcount[], void * datbuf); int HE5_SWwrgattr(int swathID, char *attrname, int ntype, long fortcount[], void *datbuf); int HE5_SWwrgeogattr(int swathID, char *attrname, int ntype, long fortcount[], void *datbuf); int HE5_SWwrlattr(int swathID, char *fieldname, char *attrname, int ntype, long fortcount[], void *datbuf); int HE5_SWrdattr(int swathID, char *attrname, void *datbuf); int HE5_SWrdgattr(int swathID, char *attrname, void *datbuf); int HE5_SWrdgeogattr(int swathID, char *attrname, void *datbuf); int HE5_SWrdlattr(int swathID, char *fieldname, char *attrname, void *datbuf); int HE5_SWsetaliasF(int swathID, char *fieldname, char *fortaliaslist); int HE5_SWdropaliasF(int swathID, int fldgroup, char *aliasname); /* Inquiry routines */ long HE5_SWinqswathF(char *filename, char *swathlist, long *strbufsize); long HE5_SWnentriesF(int swathID, int entrycode, long *strbufsize); long HE5_SWdiminfoF(int swathID, char *dimname); int HE5_SWfldinfoF(int swathID, char *fieldname, int *rank, long dims[], int *ntype, char *fortdimlist, char *fortmaxdimlist); long HE5_SWinqmapsF(int swathID, char *dimmaps, long offset[], long increment[]); long HE5_SWinqimapsF(int swathID, char *idxmaps, long idxsizes[]); long HE5_SWinqdimsF(int swathID, char *dimnames, long dims[]); long HE5_SWinqgflds(int swathID, char *fieldlist, int rank[], int ntype[]); long HE5_SWinqdflds(int swathID, char *fieldlist, int rank[], int ntype[]); int HE5_SWmapinfoF(int swathID, char *geodim, char *datadim, long *offset, long *increment); int HE5_SWgmapinfo(int swathID, char *geodim); long HE5_SWidxmapinfoF(int swathID, char *geodim, char *datadim, long index[]); int HE5_SWatinfo(int swathID, char *attrname, int *ntype, long *fortcount); int HE5_SWgatinfo(int swathID, char *attrname, int *ntype, long *fortcount); int HE5_SWgeogatinfo(int swathID, char *attrname, int *ntype, long *fortcount); int HE5_SWlatinfo(int swathID, char *fieldname, char *attrname, int *ntype, long *fortcount); int HE5_SWatinfo2(int swathID, char *attrname, int *ntype, long *fortcount, long *fortsize); int HE5_SWgatinfo2(int swathID, char *attrname, int *ntype, long *fortcount, long *fortsize); int HE5_SWgeogatinfo2(int swathID, char *attrname, int *ntype, long *fortcount, long *fortsize); int HE5_SWlatinfo2(int swathID, char *fieldname, char *attrname, int *ntype, long *fortcount, long *fortsize); long HE5_SWinqattrsF(int swathID, char *attrnames, long *strbufsize); long HE5_SWinqgattrs(int swathID, char *attrnames, long *strbufsize); long HE5_SWinqgeogattrs(int swathID, char *attrnames, long *strbufsize); long HE5_SWinqlattrs(int swathID, char *fieldname, char *attrnames, long *strbufsize); int HE5_SWcompinfoF(int swathID, char *fieldname, int *compcode, int compparm[]); int HE5_SWreginfo(int swathID, int regionID, char *fieldname, int *ntype, int *rank, long dims[], long *size); int HE5_SWperinfo(int swathID, int periodID, char *fieldname, int *ntype, int *rank, long dims[], long *size); int HE5_SWidtype(int swathID, char *fieldname, char *attrname, int fieldgroup, int *Type, int *Class, int *Order, long *size); int HE5_SWaliasinfoF(int swathID, int fldgroup, char *aliasname, int *length, char *buffer); long HE5_SWinqdfldaliasF(int swathID, char *fldalias, long *strbufsize); long HE5_SWinqgfldaliasF(int swathID, char *fldalias, long *strbufsize); int HE5_SWchunkinfoF(int swathID, char *fieldname, int *ndims, long dims[]); long HE5_SWgetaliaslistF(int swathID, int fldgroup, char *aliaslist, long *strbufsize); /* Subsetting routines */ int HE5_SWdefboxreg(int swathID, double cornerlon[], double cornerlat[], int mode); int HE5_SWdefvrtreg(int rwathID, int regionID, char *vertObj, double fortrange[]); int HE5_SWdeftmeper(int swathID, double starttime, double stoptime, int mode); int HE5_SWextreg(int swathID, int regionID, char *fieldname, int externalflag, void *buffer); int HE5_SWextper(int swathID, int periodID, char *fieldname, int externalflag, void *buffer); int HE5_SWregidx(int swathID, double cornerlon[], double cornerlat[], int mode, char *geodim, long idxrange[]); int HE5_SWdupreg(int oldregionID); int HE5_SWupscene(int swathID, int regionID); int HE5_SWindexinfoF(int regionID, char *object, int *rank, char *fortdimlist, long *fortindices); /* PROFILE INTERFACE */ int HE5_PRdefineF(int swathID, char *profilename, char *fortdimlist, char *fortmaxdimlist, int datatype_id); int HE5_PRwriteF(int swathID, char *profilename, long fortstart[], long fortstride[], long fortedge[], long size, long len[], void *buffer); int HE5_PRreadF(int swathID, char *profilename, long fortstart[], long fortstride[], long fortedge[], long len[], void *buffer); long HE5_PRinquireF(int swathID, char *profnames, int *rank, int *ntype); int HE5_PRinfoF(int swathID, char *profname, int *rank, long dims[], long maxdims[], int *ntype, char *fortdimlist, char *fortmaxdimlist); int HE5_PRwrgattrF(int swathID, char *attrname, int ntype, long fortcount[], void *datbuf); int HE5_PRrdgattrF(int swathID, char *attrname, void *datbuf); int HE5_PRgattrinfoF(int swathID, char *attrname, int *ntype, long *fortcount); int HE5_PRgattrinfoF2(int swathID, char *attrname, int *ntype, long *fortcount, long *fortsize); long HE5_PRinqgattrsF(int swathID, char *attrnames, long *strbufsize); /* EXTERNAL DATA FILE INTERFACE */ int HE5_SWsetextdataF(int swathID, char *fortfilelist, long offset[], long size[]); int HE5_SWgetextdataF(int swathID, char *fieldname, long namelength, char *fortfilelist, long offset[], long size[]); /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWopen | | | | DESCRIPTION: | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | fid hid_t None HDF-EOS file ID | | | | INPUTS: | | filename char* None File name string | | flags uintn None File access code | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ======== ============ ================================================= | | July 00 A.Muslimov Unmasked hdf5 data types. | | | | | | END_PROLOG | -----------------------------------------------------------------------------*/ hid_t HE5_SWopen(const char *filename, uintn flags) { hid_t fid = FAIL;/* hdf5 type file ID */ char *errbuf = NULL;/* Error message buffer */ /* Allocate memory for error buffer */ /* -------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_SWopen", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory to error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Call HE5_EHopen to open file */ /* ---------------------------- */ fid = HE5_EHopen(filename,flags, H5P_DEFAULT ); if(fid == FAIL) { sprintf(errbuf, "Cannot open the file \"%s\". Check the file name. \n", filename); H5Epush(__FILE__, "HE5_SWopen", __LINE__, H5E_FILE, H5E_CANTOPENFILE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } free(errbuf); return (fid); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWcreate | | | | DESCRIPTION: Creates a new swath structure and returns swath ID | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | swathID hid_t None Swath ID | | | | INPUTS: | | fid hid_t None HDF-EOS file ID | | swathname const char* None Swath name string | | | | OUTPUTS: | | None | | | | NOTES: | | ___________ | | | Swath | | | ----------- | | / | \ | | Data Profile Geolocation | | Fields Fields Fields | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 7/20/99 A. Muslimov Replaced parameter gid by fid in the call to | | EHinsertmeta(). | | 8/20/99 A. Muslimov Fixed a bug associated with a swath numbering: | | within the 'if(nswathopen < NSWATH ){}' block | | initialized NSWATH to NSWATHopen. Checked for the | | statuses returned by H5Gclose() calls. | | 8/31/99 A. Muslimov Disabled assignment NSWATH = NSWATHopen. Replaced | | the call to EHattrcat() by EHdatasetcat(). Added | | error hadling after the calls to EHinsertmeta() and | | EHdatasetcat(). | | 02/08/00 A. Muslimov Added more error checkings. | | 04/05/00 A. Muslimov Removed "Ragged Arrays" group. | | July 00 A. Muslimov Unmasked hdf5 data types. | | Sep 00 A. Muslimov Added "PRofile Fields" group. | | Dec 00 A. Muslimov Added "ProfileField" section to the metadata. | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | Feb 03 S. Zhao Removed the creation of the "Profile Fields" group | | to HE5_PRdefine(). | | | | END_PROLOG | -----------------------------------------------------------------------------*/ hid_t HE5_SWcreate(hid_t fid, const char *swathname) { hid_t swathID = FAIL;/* return value of Swath ID */ hid_t HDFfid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t sw_id = FAIL;/* HDF-EOS swath ID */ hid_t geo_id = FAIL;/* "Geolocation Fields" group ID */ hid_t data_id = FAIL;/* "Data Fields" group ID */ hid_t prof_id = FAIL;/* "Profile Fields" group ID */ hid_t SWATHS_ID = FAIL;/* "SWATHS" group ID */ hid_t i; /* Loop index */ int nswathopen = 0; /* # of swath structures open */ herr_t status = FAIL;/* routine return status variable */ uintn access = 0; /* Read/Write file access code */ long nSwath = FAIL;/* Swath counter */ char *errbuf =(char *)NULL;/* Buffer for error message */ char *utlbuf =(char *)NULL;/* Utility buffer */ char *utlbuf2=(char *)NULL;/* Utility buffer 2 */ HE5_LOCK; CHECKNAME(swathname); /* Allocate memory for error buffer */ /* -------------------------------- */ errbuf = (char *)calloc( HE5_HDFE_DIMBUFSIZE, sizeof(char ) ) ; if ( errbuf == NULL ) { H5Epush(__FILE__, "HE5_SWcreate", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* * Check HDF-EOS file ID, get HDFEOS group ID and * access code */ status = HE5_EHchkfid(fid, "HE5_SWcreate", &HDFfid, &gid, &access); /* Check file access */ /* ------------------*/ if ( access == 0 ) { status = FAIL; sprintf(errbuf, "Cannot call HE5_SWcreate on a file opened read-only.\n"); H5Epush(__FILE__, "HE5_SWcreate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } if ( status == FAIL ) { sprintf(errbuf, "Checking for file ID failed.\n"); H5Epush(__FILE__, "HE5_SWcreate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Check swathname for length */ /* -------------------------- */ if ( strlen(swathname) > HE5_OBJNAMELENMAX) { sprintf(errbuf, "Swath name \"%s\" must be less than %d characters.\n", swathname, HE5_OBJNAMELENMAX); H5Epush(__FILE__, "HE5_SWcreate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Determine number of swaths currently opened */ /* ------------------------------------------- */ for (i = 0; i < HE5_NSWATH; i++) nswathopen += HE5_SWXSwath[i].active; if(nswathopen < HE5_NSWATH) { /* Probe , check if "SWATHS" group exists */ /* -------------------------------------- */ H5E_BEGIN_TRY { SWATHS_ID = H5Gopen(gid, "SWATHS"); } H5E_END_TRY; if(SWATHS_ID == FAIL ) { nSwath = 0; /* Create the "SWATHS" group */ /* ------------------------- */ SWATHS_ID = H5Gcreate(gid,"SWATHS",0); if(SWATHS_ID == FAIL) { sprintf(errbuf,"Cannot create the \"SWATHS\" group.\n"); H5Epush(__FILE__, "HE5_SWcreate", __LINE__, H5E_OHDR, H5E_CANTCREATE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } } else { /* Probe , check if swathname group exist */ /* -------------------------------------- */ H5E_BEGIN_TRY{ sw_id = H5Gopen(SWATHS_ID, swathname); } H5E_END_TRY; if( sw_id == FAIL ) { /* Get the number of swaths in "SWATHS" group */ /* ------------------------------------------ */ nSwath = HE5_EHdatasetcat(fid, "/HDFEOS/SWATHS", NULL, NULL); if (nSwath == FAIL) { sprintf(errbuf,"Cannot retrieve the number of swaths.\n"); H5Epush(__FILE__, "HE5_SWcreate", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); status = H5Gclose(SWATHS_ID); free(errbuf); return(FAIL); } } else { sprintf(errbuf, "Swath \"%s\" already exists.\n", swathname); H5Epush(__FILE__, "HE5_SWcreate", __LINE__, H5E_OHDR, H5E_EXISTS, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); status = H5Gclose(SWATHS_ID); free(errbuf); return(FAIL); } } /* Swath does not exist */ /* -------------------- */ /* Create swathname group */ /* ---------------------- */ sw_id = H5Gcreate( SWATHS_ID, swathname, 0); if(sw_id == FAIL) { sprintf(errbuf,"Cannot create the \"%s\" group.\n", swathname); H5Epush(__FILE__, "HE5_SWcreate", __LINE__, H5E_OHDR, H5E_CANTCREATE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); status = H5Gclose(SWATHS_ID); free(errbuf); return(FAIL); } /* Create "/SWATH/swathname/Geolocation Fields" group */ /* -------------------------------------------------- */ geo_id = H5Gcreate( sw_id, "Geolocation Fields", 0); if(geo_id == FAIL) { sprintf(errbuf,"Cannot create the \"Geolocation Fields\" group.\n"); H5Epush(__FILE__, "HE5_SWcreate", __LINE__, H5E_OHDR, H5E_CANTCREATE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); status = H5Gclose(SWATHS_ID); free(errbuf); return(FAIL); } /* Create /SWATH/swathname/Data Fields group */ /* ----------------------------------------- */ data_id = H5Gcreate( sw_id, "Data Fields", 0); if(data_id == FAIL) { sprintf(errbuf,"Cannot create the \"Data Fields\" group.\n"); H5Epush(__FILE__, "HE5_SWcreate", __LINE__, H5E_OHDR, H5E_CANTCREATE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); status = H5Gclose(SWATHS_ID); free(errbuf); return(FAIL); } /* Create /SWATH/swathname/Profile Fields group */ /* -------------------------------------------- */ /* prof_id = H5Gcreate( sw_id, "Profile Fields", 0); if(prof_id == FAIL) { sprintf(errbuf,"Cannot create the \"Profile Fields\" group.\n"); H5Epush(__FILE__, "HE5_SWcreate", __LINE__, H5E_OHDR, H5E_CANTCREATE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); status = H5Gclose(SWATHS_ID); free(errbuf); return(FAIL); } */ /* Allocate memory for utility buffers */ /* ----------------------------------- */ utlbuf = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char ) ) ; if ( utlbuf == NULL ) { H5Epush(__FILE__, "HE5_SWcreate", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for utility buffer.\n"); HE5_EHprint("Error: Cannot allocate memory for utility buffer, occured", __FILE__, __LINE__); status = H5Gclose(SWATHS_ID); free(errbuf); return(FAIL); } utlbuf2 = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char ) ) ; if ( utlbuf2 == NULL ) { H5Epush(__FILE__, "HE5_SWcreate", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for utility buffer2.\n"); HE5_EHprint("Error: Cannot allocate memory for utility buffer2, occured", __FILE__, __LINE__); status = H5Gclose(SWATHS_ID); free(errbuf); free(utlbuf); return(FAIL); } /* Establish Swath in "Structural MetaData" Block */ /* ---------------------------------------------- */ sprintf(utlbuf, "%s%li%s%s%s", "\tGROUP=SWATH_", nSwath + 1, "\n\t\tSwathName=\"", swathname, "\"\n"); strcat(utlbuf, "\t\tGROUP=Dimension\n"); strcat(utlbuf, "\t\tEND_GROUP=Dimension\n"); strcat(utlbuf, "\t\tGROUP=DimensionMap\n"); strcat(utlbuf, "\t\tEND_GROUP=DimensionMap\n"); strcat(utlbuf, "\t\tGROUP=IndexDimensionMap\n"); strcat(utlbuf, "\t\tEND_GROUP=IndexDimensionMap\n"); strcat(utlbuf, "\t\tGROUP=GeoField\n"); strcat(utlbuf, "\t\tEND_GROUP=GeoField\n"); strcat(utlbuf, "\t\tGROUP=DataField\n"); strcat(utlbuf, "\t\tEND_GROUP=DataField\n"); strcat(utlbuf, "\t\tGROUP=ProfileField\n"); strcat(utlbuf, "\t\tEND_GROUP=ProfileField\n"); strcat(utlbuf, "\t\tGROUP=MergedFields\n"); strcat(utlbuf, "\t\tEND_GROUP=MergedFields\n"); sprintf(utlbuf2, "%s%li%s","\tEND_GROUP=SWATH_", nSwath + 1, "\n"); strcat(utlbuf, utlbuf2); /* Insert metadata buffer to the "StructMetadata" */ /* ---------------------------------------------- */ status = HE5_EHinsertmeta(fid, (char*)swathname, "s", 1001L, utlbuf, NULL); if (status == FAIL ) { sprintf(errbuf,"Cannot insert metadata buffer to \"StructMetadata\".\n"); H5Epush(__FILE__, "HE5_SWcreate", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); status = H5Gclose(SWATHS_ID); free(errbuf); free(utlbuf); free(utlbuf2); return(FAIL); } /* Release "SWATHS" group ID */ /* ------------------------- */ status = H5Gclose(SWATHS_ID); if(status == FAIL ) { sprintf(errbuf,"Cannot release the \"SWATHS\" group ID.\n"); H5Epush(__FILE__, "HE5_SWcreate", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); status = H5Gclose(SWATHS_ID); free(utlbuf); free(utlbuf2); free(errbuf); return(FAIL); } /* Assign swathID & Load swath and SWXSwath table entries */ /* ------------------------------------------------------ */ for (i = 0; i < HE5_NSWATH; i++) { if (HE5_SWXSwath[i].active == 0) { /* * Set sw_id, Set swath entry active, Store root group * ID, Store sub group IDs, Store HDF-EOS file ID */ HE5_SWXSwath[i].active = 1; HE5_SWXSwath[i].sw_id = sw_id; HE5_SWXSwath[i].data_id = data_id; HE5_SWXSwath[i].prof_id = prof_id; HE5_SWXSwath[i].geo_id = geo_id; HE5_SWXSwath[i].fid = fid; HE5_SWXSwath[i].obj_id = SWATHS_ID; HE5_SWXSwath[i].plist = FAIL; strcpy(HE5_SWXSwath[i].swname, swathname); HE5_SWXSwath[i].compcode = HE5_HDFE_COMP_NONE; swathID = i + HE5_SWIDOFFSET; break; } } } else { /* Too many files opened */ /* --------------------- */ swathID = FAIL; sprintf(errbuf,"\n Illegal attempt to open more than %d swaths simultaneously.\n", HE5_NSWATH); H5Epush(__FILE__, "HE5_SWcreate", __LINE__, H5E_OHDR, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } /* Release allocated memory */ /* ------------------------ */ free(errbuf); free(utlbuf); free(utlbuf2); COMPLETION: HE5_UNLOCK; return (swathID); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWattach | | | | DESCRIPTION: Attaches to an existing swath within the file. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | swathID hid_t swath structure ID | | | | INPUTS: | | fid hid_t HDF-EOS file ID | | swathname char swath structure name | | | | OUTPUTS: | | None | | | | NOTES: | | (02/23/00 A.M.) The iteration over the "Data Fields" group has | | the followings side effect: it counts as an object (which is | | supposed to be a dataset) the group "Ragged Arrays". So the | | external structure "ddataset" gets filled with a fake member | | and nDFLD gets incremented by one. This shouldn't affect the | | other interfacing routines unless someone tries to access the | | datasets in "Data Fields" group directly through their IDs | | retrieved from external "ddataset" structure, or use "nDFLD" | | data member of to retrieve the actual number of data sets | | (fields). To avoid potential problems, the dataset counter is | | decremented by one and the corresponding error checking are | | inserted to handle this case. | | | | | | | | Date Programmer Description | | ========= ============ ============================================== | | Aug 6,99 A. Muslimov In the first block if( inout.name != NULL){} | | changed the statement next to the last one from | | "if(inout.name==NULL) free(inout.name);" onto | | "if(inout.name!=NULL) free(inout.name);".Changed | | the type of datid from int32_t to hid_t. | | 10/18/99 A.Muslimov Replaced memcpy() by memmove() to avoid a problem| | when arguments 1 and 2 overlap in memory. | | 10/28/99 A.Muslimov Added ragged array stuff. | | 02/08/00 A.Muslimov Added more error checkings. | | 04/05/00 A.Muslimov Removed "Ragged Arrays" group. | | July 00 A.Muslimov Unmasked hdf5 data types. | | Sep 00 A.Muslimov Added "PRofile Fields group" and stuff | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ hid_t HE5_SWattach(hid_t fid, const char *swathname) { hid_t swathID = FAIL;/* Swath ID (return value) */ hid_t i; /* Loop index */ hid_t emptyslot = 0; /* Spare swath index */ herr_t status = FAIL;/* Return status variable */ int nswathopen = 0; /* # of swath structures open */ int idx = FAIL;/* return value from an operator */ uintn acs = 0; /* Read/Write file access code */ hid_t HDFfid = FAIL;/* HDF-EOS file ID */ hid_t datid = FAIL;/* Dataset ID */ hid_t profid = FAIL;/* Profile dataset ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t geo_id = FAIL;/* "Geolocation Fields" Group ID */ hid_t data_id = FAIL;/* "Data Fields" Group ID */ hid_t prof_id = FAIL;/* "PRofile Fields" Group ID */ hid_t sw_id = FAIL;/* Swath ID */ HE5_OBJINFO inout; /* IN/OUT operator data */ char *grpname =NULL;/* Ptr to a group name string */ char *tmpname1=NULL;/* ..... temporary name 1 ... */ char *tmpname2=NULL;/* ..... temporary name 2 ... */ char *tmpname3=NULL;/* ..... temporary name 3 ... */ char *namebuf =NULL;/* ..... temporary name ... */ char *fldname =NULL;/* ..... temporary field name ... */ char *comma =NULL; char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer*/ HE5_LOCK; CHECKPOINTER(swathname); /* Check HDF-EOS file ID, get back HDF file ID and access code */ /* ----------------------------------------------------------- */ status = HE5_EHchkfid(fid, "HE5_SWattach", &HDFfid, &gid, &acs); if ( status == FAIL ) { H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_ARGS, H5E_BADRANGE, "Checking for file ID failed.\n"); HE5_EHprint("Error: Checking for file ID failed, occured", __FILE__, __LINE__); return(FAIL); } /* Determine number of swaths currently opened */ /* ------------------------------------------- */ for (i = 0; i < HE5_NSWATH; i++) nswathopen += HE5_SWXSwath[i].active; /* Is there a room for more ? */ /* -------------------------- */ if (nswathopen < HE5_NSWATH) { /* Search for group "/SWATHS/swathname" */ /* ==================================== */ grpname = (char *) calloc( (strlen(swathname)+40), sizeof(char) ); if (grpname == NULL) { sprintf(errbuf, "Cannot allocate memory for grpname.\n") ; H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } strcpy( grpname, "/HDFEOS/SWATHS/"); strcat( grpname, swathname); /* * If group with swathname found, open the group, load tables */ H5E_BEGIN_TRY{ sw_id = H5Gopen(HDFfid, grpname); } H5E_END_TRY; if( sw_id == FAIL ) { sprintf(errbuf, "Swath \"%s\" does not exist within HDF-EOS file.\n",swathname) ; H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } /* Attach to "Geolocation Fields" */ /* ============================= */ geo_id = H5Gopen( sw_id, "Geolocation Fields"); if (geo_id == FAIL) { sprintf(errbuf, "Cannot open the \"Geolocation Fields\" group.\n") ; H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } /* Attach to "Data Fields" */ /* ======================= */ data_id = H5Gopen( sw_id, "Data Fields"); if (data_id == FAIL) { sprintf(errbuf, "Cannot open the \"Data Fields\" group. \n") ; H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } /* Attach to "Profile Fields" */ /* ========================== */ H5Eset_auto(NULL, NULL); prof_id = H5Gopen( sw_id, "Profile Fields"); /* if (prof_id == FAIL) { sprintf(errbuf, "Cannot open the \"Profile Fields\" group. \n") ; H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } */ /* Setup External Arrays */ /* --------------------- */ for (i = 0; i < HE5_NSWATH; i++) { /* Find empty entry in array */ /* ------------------------- */ if (HE5_SWXSwath[i].active == 0) { /* Set IDs, codes., etc */ /* ==================== */ HE5_SWXSwath[i].active = 1; HE5_SWXSwath[i].data_id = data_id; HE5_SWXSwath[i].prof_id = prof_id; HE5_SWXSwath[i].geo_id = geo_id; HE5_SWXSwath[i].fid = fid; HE5_SWXSwath[i].sw_id = sw_id; HE5_SWXSwath[i].plist = FAIL; HE5_SWXSwath[i].compcode = HE5_HDFE_COMP_NONE; swathID = i + HE5_SWIDOFFSET; strcpy(HE5_SWXSwath[i].swname, swathname); break; } } emptyslot = i; /* Access swath "Data Fields" datasets */ /* -------------------------------------- */ tmpname1 = (char *) calloc( (strlen(grpname)+ 20), sizeof(char)); if (tmpname1 == NULL) { sprintf(errbuf, "Cannot allocate memory for tmpname1. \n") ; H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } strcpy(tmpname1,grpname); strcat(tmpname1,"/Data Fields"); /* Get the number of OBJECTS in "Data Fields" group */ /* ================================================ */ inout.count = 0; inout.name = NULL; inout.strsize = 0; idx = H5Giterate(data_id, tmpname1 , NULL, HE5_EHobj_info, &inout); if ( idx == FAIL ) { sprintf(errbuf, "Iteration of \"HE5_EHobj_info()\" operation failed. \n") ; H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); free(tmpname1); return(FAIL); } free(tmpname1); /* Set the data members of external structure */ /* ========================================== */ HE5_SWXSwath[emptyslot].nDFLD = inout.count; /*------------------------------------------------------*/ /* Loop through all data field datasets and open it */ /* Allocate space for namebuf, copy inout.name into it, */ /* and append comma */ /*------------------------------------------------------*/ if( inout.name != NULL && inout.count > 0 ) { /* Allocate memory to ddataset struct */ /* ---------------------------------- */ HE5_SWXSwath[emptyslot].ddataset = (HE5_DTSinfo *)realloc((void *)HE5_SWXSwath[emptyslot].ddataset,(HE5_SWXSwath[emptyslot].nDFLD) * sizeof(HE5_DTSinfo)); /* Allocate memory to the list of dataset names */ /* -------------------------------------------- */ namebuf = (char *) calloc(strlen(inout.name) + 2, sizeof(char)); if (namebuf == NULL) { sprintf(errbuf, "Cannot allocate memory for namebuf. \n") ; H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } strcpy(namebuf, inout.name); strcat(namebuf, ","); /* Find comma */ /* ---------- */ comma = strchr(namebuf, ','); i = 0; /* Parse the list of dataset names */ /* ------------------------------- */ while (comma != NULL) { /* Allocate memory for fldname buffer */ /* ---------------------------------- */ fldname = (char *) calloc(comma - namebuf + 1, sizeof(char)); if (fldname == NULL) { sprintf(errbuf, "Cannot allocate memory for fldname. \n") ; H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); free(namebuf); return(FAIL); } /* Copy field list entry to fldname */ /* -------------------------------- */ memmove(fldname, namebuf, comma - namebuf); fldname[comma-namebuf]=0; /* open dataset fldname */ /* -------------------- */ H5E_BEGIN_TRY{ datid = H5Dopen(data_id, fldname); }H5E_END_TRY; if ( datid == FAIL ) { sprintf(errbuf, "Cannot open the dataset \"%s\". \n",fldname ); H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); free(namebuf); free(fldname); return(FAIL); } /* allocate memory to the dataset name */ /* ----------------------------------- */ HE5_SWXSwath[emptyslot].ddataset[i].name = (char *)calloc((strlen(fldname)+1), sizeof(char) ); if (HE5_SWXSwath[emptyslot].ddataset[i].name == NULL) { sprintf(errbuf, "Cannot allocate memory for the dataset name. \n") ; H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); free(namebuf); free(fldname); return(FAIL); } /* Set the data members of external structure */ /* ========================================== */ HE5_SWXSwath[emptyslot].ddataset[i].ID = datid; strcpy(HE5_SWXSwath[emptyslot].ddataset[i].name, fldname); /* Go to next field entry, find next comma, ... */ /* ============================================ */ memmove(namebuf, comma + 1, strlen(comma + 1) + 1); comma = strchr(namebuf, ','); if (fldname != NULL) free(fldname); i++; } if (namebuf != NULL) free(namebuf); if(inout.name != NULL ) free( inout.name); } /* end if(inout.name!=NULL) */ /* Access swath "Geolocation Fields" datasets */ /* ------------------------------------------- */ tmpname2 = (char *)calloc( (strlen(grpname)+60), sizeof(char) ); if (tmpname2 == NULL) { sprintf(errbuf, "Cannot allocate memory for tmpname2. \n") ; H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } strcpy(tmpname2,grpname); strcat(tmpname2,"/Geolocation Fields"); /* Get the number of OBJECTS in "Geolocation Fileds" group */ /* ======================================================= */ inout.count = 0; inout.name = NULL; inout.strsize = 0; idx = H5Giterate(geo_id, tmpname2 , NULL, HE5_EHobj_info, &inout); if ( idx == FAIL ) { sprintf(errbuf, "Iteration of \"HE5_EHobj_info()\" operation failed. \n") ; H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); free(tmpname2); return(FAIL); } /* Set the data members of external structure */ /* ========================================== */ HE5_SWXSwath[emptyslot].nGFLD = inout.count; if (tmpname2 != NULL) free(tmpname2); /*-----------------------------------------------------*/ /* Loop through all data fileds dataset and open it */ /* Allocate space for namebuf, copy inout.name into it */ /* and append comma */ /*-----------------------------------------------------*/ if( inout.name != NULL && inout.count > 0) { /* allocate memory to gdataset struct */ /* ---------------------------------- */ HE5_SWXSwath[emptyslot].gdataset = (HE5_DTSinfo *)realloc((void *)HE5_SWXSwath[emptyslot].gdataset, (HE5_SWXSwath[emptyslot].nGFLD) * sizeof(HE5_DTSinfo)); /* Allocate memory to the list of dataset names */ /* -------------------------------------------- */ namebuf = (char *) calloc(strlen(inout.name) + 2, sizeof(char)); if (namebuf == NULL) { sprintf(errbuf, "Cannot allocate memory for namebuf. \n") ; H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } strcpy(namebuf, inout.name); strcat(namebuf, ","); /* Find comma */ /* ---------- */ comma = strchr(namebuf, ','); i = 0; /* Parse the list of dataset names */ /* ------------------------------- */ while (comma != NULL) { /* Copy field list entry to fldname */ /* -------------------------------- */ fldname = (char *) calloc(comma - namebuf + 1, sizeof(char)); if (fldname == NULL) { sprintf(errbuf, "Cannot allocate memory for fldname. \n") ; H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); free(namebuf); return(FAIL); } memmove(fldname, namebuf, comma - namebuf); fldname[comma-namebuf]='\0'; /* open dataset fldname */ /* -------------------- */ datid = H5Dopen(geo_id,fldname); if ( datid == FAIL ) { sprintf(errbuf, "Cannot open the dataset \"%s\". \n",fldname ); H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); free(namebuf); free(fldname); return(FAIL); } /* Allocate memory to the dataset name */ /* ----------------------------------- */ HE5_SWXSwath[emptyslot].gdataset[i].name = (char *)calloc( (strlen(fldname)+1), sizeof(char) ); if (HE5_SWXSwath[emptyslot].gdataset[i].name == NULL) { sprintf(errbuf, "Cannot allocate memory for name. \n") ; H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); free(namebuf); free(fldname); return(FAIL); } /* Set the data members of external structure */ /* ========================================== */ HE5_SWXSwath[emptyslot].gdataset[i].ID = datid; strcpy(HE5_SWXSwath[emptyslot].gdataset[i].name, fldname); /* Go to next field entry, ... */ /* ============================= */ memmove(namebuf, comma + 1, strlen(comma + 1) + 1); comma = strchr(namebuf, ','); if (fldname != NULL) free(fldname); i++; } if (namebuf != NULL) free(namebuf); if(inout.name != NULL) free(inout.name); inout.name = NULL; } /* end if(inout.name!==NULL) */ /* Access swath "Profile Fields" datasets */ /* ----------------------------------------- */ if (prof_id != FAIL) { tmpname3 = (char *) calloc( (strlen(grpname)+ 20), sizeof(char)); if (tmpname3 == NULL) { sprintf(errbuf, "Cannot allocate memory for tmpname3. \n") ; H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } strcpy(tmpname3,grpname); strcat(tmpname3,"/Profile Fields"); /* Get the number of OBJECTS in "PRofile Fields" group */ /* =================================================== */ inout.count = 0; inout.name = NULL; inout.strsize = 0; idx = H5Giterate(HE5_SWXSwath[emptyslot].prof_id, tmpname3 , NULL, HE5_EHobj_info, &inout); if ( idx == FAIL ) { sprintf(errbuf, "Iteration of \"HE5_EHobj_info()\" operation failed. \n") ; H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); free(tmpname3); return(FAIL); } free(tmpname3); /* Set the data members of external structure */ /* ========================================== */ HE5_SWXSwath[emptyslot].nPROF = inout.count; /*-----------------------------------------------------------*/ /* Loop through all "Profile Field" datasets and open it */ /* Allocate space for namebuf, copy inout.name into it, */ /* and append comma */ /*-----------------------------------------------------------*/ if( inout.name != NULL && inout.count > 0 ) { /* Allocate memory to ddataset struct */ /* ---------------------------------- */ HE5_SWXSwath[emptyslot].pdataset = (HE5_DTSinfo *)realloc((void *)HE5_SWXSwath[emptyslot].pdataset,(HE5_SWXSwath[emptyslot].nPROF) * sizeof(HE5_DTSinfo)); /* Allocate memory to the list of dataset names */ /* -------------------------------------------- */ namebuf = (char *) calloc(strlen(inout.name) + 2, sizeof(char)); if (namebuf == NULL) { sprintf(errbuf, "Cannot allocate memory for namebuf. \n") ; H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } strcpy(namebuf, inout.name); strcat(namebuf, ","); /* Find comma */ /* ---------- */ comma = strchr(namebuf, ','); i = 0; /* Parse the list of dataset names */ /* ------------------------------- */ while (comma != NULL) { /* Allocate memory for fldname buffer */ /* ---------------------------------- */ fldname = (char *) calloc(comma - namebuf + 1, sizeof(char)); if (fldname == NULL) { sprintf(errbuf, "Cannot allocate memory for fldname buffer. \n") ; H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); free(namebuf); return(FAIL); } /* Copy field list entry to fldname */ /* -------------------------------- */ memmove(fldname, namebuf, comma - namebuf); fldname[comma-namebuf]=0; /* open dataset fldname */ /* -------------------- */ H5E_BEGIN_TRY{ profid = H5Dopen(prof_id, fldname); }H5E_END_TRY; if ( profid == FAIL ) { sprintf(errbuf, "Cannot open the profile dataset \"%s\". \n",fldname ); H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); free(namebuf); free(fldname); return(FAIL); } /* allocate memory to the dataset name */ /* ----------------------------------- */ HE5_SWXSwath[emptyslot].pdataset[i].name = (char *)calloc((strlen(fldname)+1), sizeof(char) ); if (HE5_SWXSwath[emptyslot].pdataset[i].name == NULL) { sprintf(errbuf, "Cannot allocate memory for profile name. \n") ; H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); free(namebuf); free(fldname); return(FAIL); } /* Set the data members of external structure */ /* ========================================== */ HE5_SWXSwath[emptyslot].pdataset[i].ID = profid; strcpy(HE5_SWXSwath[emptyslot].pdataset[i].name, fldname); /* Go to next field entry, find next comma, ... */ /* ============================================ */ memmove(namebuf, comma + 1, strlen(comma + 1) + 1); comma = strchr(namebuf, ','); if (fldname != NULL) free(fldname); i++; } if (namebuf != NULL) free(namebuf); if(inout.name != NULL ) free( inout.name); } /* end if(inout.name!=NULL) */ } if (grpname != NULL) free(grpname); } else { /* Too many swaths opened */ /* ---------------------- */ swathID = FAIL; sprintf(errbuf,"\n Illegal attempt to open more than %d swaths simultaneously. \n", HE5_NSWATH); H5Epush(__FILE__, "HE5_SWattach", __LINE__, H5E_OHDR, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } COMPLETION: HE5_UNLOCK; return(swathID); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWchkswid | | | | DESCRIPTION: Checks for valid swathID and returns file ID and | | "HDFEOS" group ID | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | | | OUTPUTS: | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 8/23/99 A. Muslimov Checked for the status returned by EHchkfid(). | | Initialized status to -1. | | July 00 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ static herr_t HE5_SWchkswid(hid_t swathID, const char *routname, hid_t *fid, hid_t *gid, long *idx ) { herr_t status = FAIL;/* routine return status variable */ uintn access = 0; /* Read/Write access code */ hid_t HDFfid = FAIL;/* HDF-EOS file ID */ hid_t idOffset = HE5_SWIDOFFSET; char message1[] = "Invalid swath id: %d in routine \"%s\". ID must be >= %d and < %d.\n"; char message2[] = "Swath id %d in routine \"%s\" not active.\n"; char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ /* Check for valid swath ID */ /* ------------------------ */ if (swathID < idOffset || swathID >= HE5_NSWATH + idOffset) { status = FAIL; sprintf(errbuf, message1, swathID, routname, idOffset, HE5_NSWATH + idOffset); H5Epush(__FILE__, "HE5_SWchkswid", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } else { /* Check for active swath ID */ /* ------------------------- */ if (HE5_SWXSwath[swathID % idOffset].active == 0) { status = FAIL; sprintf(errbuf, message2, swathID, routname); H5Epush(__FILE__, "HE5_SWchkswid", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } else { *idx = HE5_EHhid2long(swathID % idOffset); if (*idx == FAIL) { status = FAIL; sprintf(errbuf,"Cannot set up the swath index.\n"); H5Epush(__FILE__, "HE5_SWchkswid", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } /* Get HDF file ID & "HDFEOS" group ID */ /* ------------------------------------ */ *fid = HE5_SWXSwath[*idx].fid; status = HE5_EHchkfid(*fid,"", &HDFfid, gid, &access); if (status == FAIL) { sprintf(errbuf,"Checking for file ID failed.\n"); H5Epush(__FILE__, "HE5_SWchkswid", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } } return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWdefdim | | | | DESCRIPTION: Defines numerical value of dimension | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t swath structure ID | | dimname char Dimension name | | dim hsize_t Dimension size | | | | OUTPUTS: | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 7/16/99 A.Muslimov In call to EHinsertmeta() replaced 'gid' by 'fid'. | | 01/06/00 A.Muslimov Changed the datatype of "dim" parameter from int32_t| | to hsize_t to handle an Unlimited dimension size. | | 02/08/00 A.Muslimov Added error checking after the EHinsertmeta() call. | | July 00 A.Muslimov Unmasked hdf5 data types. | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWdefdim(hid_t swathID, char *dimname, hsize_t dim) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ long idx = FAIL;/* Swath index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKNAME(dimname); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWdefdim", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for Swath ID failed.\n"); H5Epush(__FILE__, "HE5_SWdefdim", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Make certain that dim != 0 */ /* -------------------------- */ if ( dim == 0 ) { status = FAIL; sprintf(errbuf, "Invalid (zero) dimension size.\n"); H5Epush(__FILE__, "HE5_SWdefdim", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Write dimension to the dataset "StructMetadata.0" */ /* ------------------------------------------------- */ status = HE5_EHinsertmeta(fid, HE5_SWXSwath[idx].swname,"s", 0L, dimname, &dim); if ( status == FAIL ) { sprintf(errbuf, "Cannot insert the value for \"%s\" dimension into Metadata.\n", dimname); H5Epush(__FILE__, "HE5_SWdefdim", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWupdatedim | | | | DESCRIPTION: Updates numerical value of dimension | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t Swath structure ID | | dimname char* Dimension name | | dim hsize_t Dimension size | | | | OUTPUTS: | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Oct 02 S. ZHAO Original development | | Dec 02 H. LO Update the dimension size | | Feb 03 H. LO Update the dimension size | | | | END_PROLOG | -----------------------------------------------------------------------------*/ static herr_t HE5_SWupdatedim(hid_t swathID, char *dimname, hsize_t dim) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ long idx = FAIL;/* Swath index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ hsize_t predims; HE5_LOCK; CHECKNAME(dimname); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWupdatedim", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for Swath ID failed.\n"); H5Epush(__FILE__, "HE5_SWupdatedim", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Make certain that dim != 0 */ /* -------------------------- */ if ( dim == 0 ) { status = FAIL; sprintf(errbuf, "Invalid (zero) dimension size.\n"); H5Epush(__FILE__, "HE5_SWupdatedim", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } predims = HE5_SWdiminfo(swathID, dimname); if (predims == 0) { status = FAIL; sprintf(errbuf, "Failed to retrieve the size of \"%s\" dimension. \n", dimname); H5Epush(__FILE__, "HE5_SWupdatedim", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Write updated dimension back to the dataset "StructMetadata.0" */ /* -------------------------------------------------------------- */ if (dim > predims) { status = HE5_EHupdatemeta(fid, HE5_SWXSwath[idx].swname,"s", 0L, dimname, &dim); if ( status == FAIL ) { sprintf(errbuf, "Cannot update the value for \"%s\" dimension in Metadata.\n", dimname); H5Epush(__FILE__, "HE5_SWupdatedim", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWdefdimscale | | | | DESCRIPTION: Defines dimension scale for all fields that use the given | | dimesion | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t swath structure ID | | dimname char dim name | | dimsize hsize_t Dimemsion size value | | numbertype_in hid_t dim scale data type such as DFNT_INT32, | | DFNT_FLOAT64, DFNT_FLOAT32, etc. | | data void data buffer for write | | | | | | OUTPUTS: | | | | NOTES: This function finds out which field in a swath has the dimension | | and sets dimension scale for that field calling HE5_SWsetdimscale() | | User must detach swath after creating fields and attach again before| | calling the routine. | | | | | | Date Programmer Description | | ======== ============ =============================================== | | Dec 2013 Abe Taaheri Original Programmer | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWdefdimscale(hid_t swathID, char *dimname, const hsize_t dimsize, hid_t numbertype_in, void * data) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ long idx = FAIL;/* Swath index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ char *fieldlist = NULL; long strbufsize; long nflds = FAIL; HE5_LOCK; CHECKNAME(dimname); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWdefdimscale", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for Swath ID failed.\n"); H5Epush(__FILE__, "HE5_SWdefdimscale", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Make certain that dimsize != 0 */ /* ------------------------------ */ if ( dimsize == 0 ) { status = FAIL; sprintf(errbuf, "Invalid (zero) dimension size.\n"); H5Epush(__FILE__, "HE5_SWdefdimscale", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Loop over all fields in the swath and find out if field's dimension list has the dimension name. If true then set the dimension scale for the dim in that field */ /* Inquire Data Fields first*/ /* ------------------------ */ nflds = HE5_SWnentries(swathID, HE5_HDFE_NENTDFLD, &strbufsize); if (nflds == FAIL) { sprintf(errbuf, "Cannot get the number of fields in \"Data Fields\" group. \n"); H5Epush(__FILE__, "HE5_SWdefdimscale", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } else { fieldlist = (char *) calloc(strbufsize + 1, sizeof(char)); if(fieldlist == NULL) { sprintf(errbuf,"Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_SWdefdimscale", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } nflds = HE5_SWinqdatafields(swathID, fieldlist, NULL, NULL); if (nflds == FAIL) { sprintf(errbuf, "Cannot get the list of fields in \"Data Fields\" group. \n"); H5Epush(__FILE__, "HE5_SWdefdimscale", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(fieldlist); return(FAIL); } if(nflds > 0) { size_t fldnmlen[HE5_FLDNUMBERMAX]; /* Array of namelengths */ char *fldnm[HE5_FLDNUMBERMAX]; /* Array of names */ char tempdimlist[HE5_HDFE_DIMBUFSIZE];/* Dimension list */ int rank = FAIL; /* Rank of dataset */ hsize_t tempdims[HE5_DTSETRANKMAX]; /* Dimension sizes array*/ hid_t dtype[1] = {FAIL}; /* Data type */ long ntflds = 0; /* field counter */ int i; char *tempfield = NULL; unsigned int Dimindex; ntflds = HE5_EHparsestr(fieldlist, ',', fldnm,fldnmlen); if(ntflds != FAIL) { for(i = 0; i < ntflds; i++) { tempfield = (char *)calloc(fldnmlen[i] + 1, sizeof(char)); memmove(tempfield,fldnm[i],fldnmlen[i]); tempfield[fldnmlen[i]]='\0'; /* for this field see if the dimlist contains dimname */ status = HE5_SWfieldinfo(swathID, tempfield, &rank, tempdims, dtype, tempdimlist, NULL); if (status != SUCCEED) { sprintf(errbuf, "Field \"%s\" not found.\n", tempfield); H5Epush(__FILE__, "HE5_SWdefdimscale", __LINE__, H5E_ARGS, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(tempfield); free(fieldlist); return(FAIL); } Dimindex = FAIL; Dimindex = HE5_EHstrwithin(dimname, tempdimlist, ','); if (Dimindex == FAIL) /* dimension not found */ { continue; /*dimlist does not contain dim name */ } else { /* call HE5_SWsetdimscle */ status = HE5_SWsetdimscale(swathID, (char *)tempfield, dimname, dimsize, numbertype_in, data); if ( status == FAIL ) { sprintf(errbuf,"Cannot set dimension scale %s for the field %s. \n", dimname, tempfield); H5Epush(__FILE__, "HE5_SWdefdimscale", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(tempfield); free(fieldlist); return(status); } } } free(tempfield); tempfield = NULL; } } free(fieldlist); fieldlist = NULL; } /* Inquire Geo Fields */ /* -------------------*/ nflds = HE5_SWnentries(swathID, HE5_HDFE_NENTGFLD, &strbufsize); if (nflds == FAIL) { sprintf(errbuf, "Cannot get the number of fields in \"Geo Fields\" group. \n"); H5Epush(__FILE__, "HE5_SWdefdimscale", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } else { fieldlist = (char *) calloc(strbufsize + 1, sizeof(char)); if(fieldlist == NULL) { sprintf(errbuf,"Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_SWdefdimscale", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } nflds = HE5_SWinqgeofields(swathID, fieldlist, NULL, NULL); if (nflds == FAIL) { sprintf(errbuf, "Cannot get the list of fields in \"Geo Fields\" group. \n"); H5Epush(__FILE__, "HE5_SWdefdimscale", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(fieldlist); return(FAIL); } if(nflds > 0) { size_t fldnmlen[HE5_FLDNUMBERMAX]; /* Array of namelengths */ char *fldnm[HE5_FLDNUMBERMAX]; /* Array of names */ char tempdimlist[HE5_HDFE_DIMBUFSIZE];/* Dimension list */ int rank = FAIL; /* Rank of dataset */ hsize_t tempdims[HE5_DTSETRANKMAX]; /* Dimension sizes array*/ hid_t dtype[1] = {FAIL}; /* Data type */ long ntflds = 0; /* field counter */ int i; char *tempfield = NULL; unsigned int Dimindex; ntflds = HE5_EHparsestr(fieldlist, ',', fldnm,fldnmlen); if(ntflds != FAIL) { for(i = 0; i < ntflds; i++) { tempfield = (char *)calloc(fldnmlen[i] + 1, sizeof(char)); memmove(tempfield,fldnm[i],fldnmlen[i]); /* for this field see if the dimlist contains dimname */ status = HE5_SWfieldinfo(swathID, tempfield, &rank, tempdims, dtype, tempdimlist, NULL); if (status != SUCCEED) { sprintf(errbuf, "Field \"%s\" not found.\n", tempfield); H5Epush(__FILE__, "HE5_SWdefdimscale", __LINE__, H5E_ARGS, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(tempfield); free(fieldlist); return(FAIL); } Dimindex = FAIL; Dimindex = HE5_EHstrwithin(dimname, tempdimlist, ','); if (Dimindex == FAIL) /* dimension not found */ { continue; } else { /* call HE5_SWsetdimscle */ status = HE5_SWsetdimscale(swathID, (char *)tempfield, dimname, dimsize, numbertype_in, data); if ( status == FAIL ) { sprintf(errbuf,"Cannot set dimension scale %s for the field %s. \n", dimname, tempfield); H5Epush(__FILE__, "HE5_SWdefdimscale", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(tempfield); free(fieldlist); return(status); } } } free(tempfield); tempfield = NULL; } } free(fieldlist); fieldlist = NULL; } COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWdefdimscale2 | | | | DESCRIPTION: Defines dimension scale for all fields that use the given | | dimesion (with user defined dimension scale name) | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t swath structure ID | | dimname char dim name | | dimscalename char dimension scale name | | dimsize hsize_t Dimemsion size value | | numbertype_in hid_t dim scale data type such as DFNT_INT32, | | DFNT_FLOAT64, DFNT_FLOAT32, etc. | | data void data buffer for write | | | | | | OUTPUTS: | | | | NOTES: This function finds out which field in a swath has the dimension | | and sets dimension scale for that field calling HE5_SWsetdimscale2()| | User must detach swath after creating fields and attach again before| | calling the routine. | | | | | | Date Programmer Description | | ======== ============ =============================================== | | Mar 2017 Abe Taaheri Original Programmer | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWdefdimscale2(hid_t swathID, char *dimname, char *dimscalename, const hsize_t dimsize, hid_t numbertype_in, void * data) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ long idx = FAIL;/* Swath index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ char *fieldlist = NULL; long strbufsize; long nflds = FAIL; HE5_LOCK; CHECKNAME(dimname); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWdefdimscale", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for Swath ID failed.\n"); H5Epush(__FILE__, "HE5_SWdefdimscale", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Make certain that dimsize != 0 */ /* ------------------------------ */ if ( dimsize == 0 ) { status = FAIL; sprintf(errbuf, "Invalid (zero) dimension size.\n"); H5Epush(__FILE__, "HE5_SWdefdimscale", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Loop over all fields in the swath and find out if field's dimension list has the dimension name. If true then set the dimension scale for the dim in that field */ /* Inquire Data Fields first*/ /* ------------------------ */ nflds = HE5_SWnentries(swathID, HE5_HDFE_NENTDFLD, &strbufsize); if (nflds == FAIL) { sprintf(errbuf, "Cannot get the number of fields in \"Data Fields\" group. \n"); H5Epush(__FILE__, "HE5_SWdefdimscale", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } else { fieldlist = (char *) calloc(strbufsize + 1, sizeof(char)); if(fieldlist == NULL) { sprintf(errbuf,"Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_SWdefdimscale", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } nflds = HE5_SWinqdatafields(swathID, fieldlist, NULL, NULL); if (nflds == FAIL) { sprintf(errbuf, "Cannot get the list of fields in \"Data Fields\" group. \n"); H5Epush(__FILE__, "HE5_SWdefdimscale", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(fieldlist); return(FAIL); } if(nflds > 0) { size_t fldnmlen[HE5_FLDNUMBERMAX]; /* Array of namelengths */ char *fldnm[HE5_FLDNUMBERMAX]; /* Array of names */ char tempdimlist[HE5_HDFE_DIMBUFSIZE];/* Dimension list */ int rank = FAIL; /* Rank of dataset */ hsize_t tempdims[HE5_DTSETRANKMAX]; /* Dimension sizes array*/ hid_t dtype[1] = {FAIL}; /* Data type */ long ntflds = 0; /* field counter */ int i; char *tempfield = NULL; unsigned int Dimindex; ntflds = HE5_EHparsestr(fieldlist, ',', fldnm,fldnmlen); if(ntflds != FAIL) { for(i = 0; i < ntflds; i++) { tempfield = (char *)calloc(fldnmlen[i] + 1, sizeof(char)); memmove(tempfield,fldnm[i],fldnmlen[i]); tempfield[fldnmlen[i]]='\0'; /* for this field see if the dimlist contains dimname */ status = HE5_SWfieldinfo(swathID, tempfield, &rank, tempdims, dtype, tempdimlist, NULL); if (status != SUCCEED) { sprintf(errbuf, "Field \"%s\" not found.\n", tempfield); H5Epush(__FILE__, "HE5_SWdefdimscale", __LINE__, H5E_ARGS, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(tempfield); free(fieldlist); return(FAIL); } Dimindex = FAIL; Dimindex = HE5_EHstrwithin(dimname, tempdimlist, ','); if (Dimindex == FAIL) /* dimension not found */ { continue; /*dimlist does not contain dim name */ } else { /* call HE5_SWsetdimscle */ status = HE5_SWsetdimscale2(swathID, (char *)tempfield, dimname, dimscalename, dimsize, numbertype_in, data); if ( status == FAIL ) { sprintf(errbuf,"Cannot set dimension scale %s for the field %s. \n", dimscalename, tempfield); H5Epush(__FILE__, "HE5_SWdefdimscale", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(tempfield); free(fieldlist); return(status); } } } free(tempfield); tempfield = NULL; } } free(fieldlist); fieldlist = NULL; } /* Inquire Geo Fields */ /* -------------------*/ nflds = HE5_SWnentries(swathID, HE5_HDFE_NENTGFLD, &strbufsize); if (nflds == FAIL) { sprintf(errbuf, "Cannot get the number of fields in \"Geo Fields\" group. \n"); H5Epush(__FILE__, "HE5_SWdefdimscale", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } else { fieldlist = (char *) calloc(strbufsize + 1, sizeof(char)); if(fieldlist == NULL) { sprintf(errbuf,"Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_SWdefdimscale", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } nflds = HE5_SWinqgeofields(swathID, fieldlist, NULL, NULL); if (nflds == FAIL) { sprintf(errbuf, "Cannot get the list of fields in \"Geo Fields\" group. \n"); H5Epush(__FILE__, "HE5_SWdefdimscale", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(fieldlist); return(FAIL); } if(nflds > 0) { size_t fldnmlen[HE5_FLDNUMBERMAX]; /* Array of namelengths */ char *fldnm[HE5_FLDNUMBERMAX]; /* Array of names */ char tempdimlist[HE5_HDFE_DIMBUFSIZE];/* Dimension list */ int rank = FAIL; /* Rank of dataset */ hsize_t tempdims[HE5_DTSETRANKMAX]; /* Dimension sizes array*/ hid_t dtype[1] = {FAIL}; /* Data type */ long ntflds = 0; /* field counter */ int i; char *tempfield = NULL; unsigned int Dimindex; ntflds = HE5_EHparsestr(fieldlist, ',', fldnm,fldnmlen); if(ntflds != FAIL) { for(i = 0; i < ntflds; i++) { tempfield = (char *)calloc(fldnmlen[i] + 1, sizeof(char)); memmove(tempfield,fldnm[i],fldnmlen[i]); /* for this field see if the dimlist contains dimname */ status = HE5_SWfieldinfo(swathID, tempfield, &rank, tempdims, dtype, tempdimlist, NULL); if (status != SUCCEED) { sprintf(errbuf, "Field \"%s\" not found.\n", tempfield); H5Epush(__FILE__, "HE5_SWdefdimscale", __LINE__, H5E_ARGS, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(tempfield); free(fieldlist); return(FAIL); } Dimindex = FAIL; Dimindex = HE5_EHstrwithin(dimname, tempdimlist, ','); if (Dimindex == FAIL) /* dimension not found */ { continue; } else { /* call HE5_SWsetdimscle */ status = HE5_SWsetdimscale2(swathID, (char *)tempfield, dimname, dimscalename, dimsize, numbertype_in, data); if ( status == FAIL ) { sprintf(errbuf,"Cannot set dimension scale %s for the field %s. \n", dimscalename, tempfield); H5Epush(__FILE__, "HE5_SWdefdimscale", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(tempfield); free(fieldlist); return(status); } } } free(tempfield); tempfield = NULL; } } free(fieldlist); fieldlist = NULL; } COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWsetdimscale | | | | DESCRIPTION: Defines a dimension scale for a fields dimension in a swath | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t swath structure ID | | fieldname char field name | | dimname char Dimension name | | dimsize hsize_t Dimemsion size value | | numbertype_in hid_t dim scale data type such as DFNT_INT32, | | DFNT_FLOAT64, DFNT_FLOAT32, etc. | | data void data buffer for write | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | May 10 Abe Taaheri Original Programmer | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWsetdimscale(hid_t swathID, char *fieldname, char *dimname, const hsize_t dimsize, hid_t numbertype_in, void * data) { herr_t status; hid_t ntype; hsize_t dims[HE5_DTSETRANKMAX]; int rankSDS; hid_t field_ntype[1]={FAIL}; char dimlist[HE5_HDFE_DIMBUFSIZE]; char maxdimlist[HE5_HDFE_DIMBUFSIZE]; hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t did; hid_t dsid; hid_t fspace = FAIL; /* File dataspace ID */ unsigned int Dimindex; hid_t dsplist = FAIL; /* Property list ID */ H5D_layout_t layout = H5D_LAYOUT_ERROR; /* Type of storage */ hid_t data_space = FAIL; /* dataspace ID */ long idx = FAIL; /* Swath index */ char *errbuf = (char *)NULL; /* buffer for error message*/ void *data_buff; int i, found = 0; int rankds; int num_index_found; int *index_found_ptr; int *temp_index_ptr; hsize_t dimsds[1]; char *dimscalename = NULL; i = 0; found = 0; num_index_found = 0; index_found_ptr = NULL; HE5_LOCK; CHECKNAME(fieldname); CHECKNAME(dimname); /* Allocate memory for error buffer */ /* -------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_SWsetdimscale", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer ", __FILE__, __LINE__); return(FAIL); } /* Convert HDF-EOS5 datatype to HDF5 datatype */ if ( H5Tequal(numbertype_in, H5T_NATIVE_CHAR) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_SCHAR) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_UCHAR) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_SHORT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_USHORT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_INT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_UINT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_LONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_ULONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_LLONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_ULLONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_FLOAT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_DOUBLE) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_LDOUBLE)== TRUE || H5Tequal(numbertype_in, H5T_C_S1) == TRUE) { ntype = numbertype_in; } else { ntype = HE5_EHconvdatatype((int) numbertype_in); } if(ntype == FAIL) { sprintf(errbuf,"Cannot convert to HDF5 type data type ID for dimscale\n"); H5Epush(__FILE__, "HE5_SWsetdimscale", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* ********************************************************** * Check for proper swath ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Swath index * ********************************************************** */ status = HE5_SWchkswid(swathID, "HE5_SWsetdimscale", &fid, &gid, &idx); if(status == FAIL) { sprintf(errbuf,"Checking for Swath ID failed.\n"); H5Epush(__FILE__, "HE5_SWsetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } if (status == 0) { /* Check that field exists */ /* ----------------------- */ status = HE5_SWfieldinfo(swathID, fieldname, &rankSDS, dims, field_ntype, dimlist, maxdimlist); if (status != 0) { sprintf(errbuf, "Fieldname \"%s\" does not exist.\n", fieldname); H5Epush(__FILE__, "HE5_SWsetdimscale", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } data_buff = data; /* Loop through all datasets in swath */ /* ------------------------------ */ for (i = 0; i < HE5_SWXSwath[idx].nDFLD; i++) { /* Get dataset name */ if( strcmp(fieldname, HE5_SWXSwath[ idx ].ddataset[ i ].name) == 0 ) { found = 1; did = HE5_SWXSwath[ idx ].ddataset[ i ].ID; break; } } if(found != 1) /* did not find fieldname */ { /* did not find Data-field name, lets look for Geo-fieldname */ for (i = 0; i < HE5_SWXSwath[idx].nGFLD; i++) { /* Get dataset name */ if(strcmp(fieldname,HE5_SWXSwath[idx].gdataset[i].name)==0) { found = 1; did = HE5_SWXSwath[ idx ].gdataset[ i ].ID; break; } } } if(found != 1) /* did not find fieldname */ { sprintf(errbuf, "Fieldname \"%s\" does not exist.\n", fieldname); H5Epush(__FILE__, "HE5_SWsetdimscale", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Dimension index */ Dimindex = FAIL; Dimindex = HE5_EHstrwithin(dimname, dimlist, ','); /*// obtain number of the index for dimname. This is for the case temp[dimname][dimname][..] case. */ num_index_found = HE5_EHstrwithin_index(dimname,dimlist,',',NULL); /*// if we find the dimname is used multiple times, we need to retrieve all the indexes. */ if(num_index_found >1) { index_found_ptr =(int*)calloc(num_index_found,sizeof(int)); num_index_found = HE5_EHstrwithin_index(dimname,dimlist,',',index_found_ptr); } if (Dimindex == FAIL) /* dimension not found */ { status = FAIL; sprintf( errbuf, "Dimname \"%s\" does not exist for field \"%s\".\n", dimname, fieldname ); H5Epush(__FILE__, "HE5_SWsetdimscale", __LINE__, H5E_IO, H5E_SEEKERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } /* If dimension found ... */ /* Found the dimname; Use its dimid to set Dimension Scale*/ /* See if dimscale dataset already exist */ dsid = H5Dopen(HE5_SWXSwath[idx].sw_id, dimname); if(dsid < 0) { /* create Dim Scale dataset */ /* Try to open the " group */ /* ======================== */ dsplist = H5Pcreate(H5P_DATASET_CREATE); if(dsplist == FAIL) { sprintf(errbuf,"Cannot create a new property list.\n"); H5Epush(__FILE__, "HE5_SWsetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Get layout information */ /* ---------------------- */ layout = H5Pget_layout(dsplist); if(layout == H5D_LAYOUT_ERROR) { sprintf(errbuf,"Cannot get layout information for the dataset.\n"); H5Epush(__FILE__, "HE5_SWsetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } rankds = 1; dimsds[0] = dims[Dimindex]; data_space = H5Screate_simple(rankds, dimsds, NULL); if(data_space == FAIL) { sprintf(errbuf,"Cannot create dataspace for the dimension scale dataset.\n"); H5Epush(__FILE__, "HE5_SWsetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } dsid = H5Dcreate(HE5_SWXSwath[idx].sw_id,dimname,ntype, data_space, dsplist); if( dsid == FAIL ) { sprintf(errbuf, "Cannot create dataset for Dimension Scale \"%s\" field. \n", dimname); H5Epush(__FILE__, "HE5_SWsetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* write data_buff to it */ /* Get the field space ID */ /* --------------------- */ fspace = H5Dget_space(dsid); if ( fspace == FAIL) { sprintf(errbuf, "Cannot get the file data space ID.\n"); H5Epush(__FILE__, "HE5_SWsetdimscale", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } status = H5Dwrite(dsid, ntype, data_space, fspace, H5P_DEFAULT, data_buff); if( status == FAIL ) { sprintf(errbuf,"Cannot write data to the dataset.\n"); H5Epush(__FILE__, "HE5_SWsetdimscale", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } } /* Dataset exist. See if it is Dimension Scale already. If not make it */ if((H5DSis_scale(dsid)) <= 0 ) { status = H5DSset_scale(dsid, dimname); if( status < 0) { status = -1; free(errbuf); goto COMPLETION; } if(num_index_found <= 1) { if(H5DSattach_scale(did, dsid, Dimindex) < 0) { status = -1; free(errbuf); goto COMPLETION; } /* set dimscale name as dimlabel in DIMENSION_LABELS attribute for this field */ if(dimscalename == NULL) { dimscalename = (char *)malloc(strlen(dimname) + 1); strcpy(dimscalename, dimname); } if(HE5_SWsetflddimlabel(swathID, fieldname, dimname, dimscalename) < 0) { status = 0; sprintf(errbuf,"Cannot write dimscale label to the dataset.\n"); H5Epush(__FILE__, "HE5_SWsetdimscale", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if(dimscalename != NULL) { free(dimscalename); dimscalename = NULL; } free(errbuf); goto COMPLETION; } else { if(dimscalename != NULL) { free(dimscalename); dimscalename = NULL; } } } else {/*// dimname is used multiple times for this variable. Need to attach them. */ temp_index_ptr = index_found_ptr; for(i = 0; i1) { index_found_ptr =(int*)calloc(num_index_found,sizeof(int)); num_index_found = HE5_EHstrwithin_index(dimname,dimlist,',',index_found_ptr); } if (Dimindex == FAIL) /* dimension not found */ { status = FAIL; sprintf( errbuf, "Dimname \"%s\" does not exist for field \"%s\".\n", dimname, fieldname ); H5Epush(__FILE__, "HE5_SWsetdimscale", __LINE__, H5E_IO, H5E_SEEKERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } /* If dimension found ... */ /* Found the dimname; Use its dimid to set Dimension Scale*/ /* See if dimscale dataset already exist */ dsid = H5Dopen(HE5_SWXSwath[idx].sw_id, dimscalename); if(dsid < 0) { /* create Dim Scale dataset */ /* Try to open the " group */ /* ======================== */ dsplist = H5Pcreate(H5P_DATASET_CREATE); if(dsplist == FAIL) { sprintf(errbuf,"Cannot create a new property list.\n"); H5Epush(__FILE__, "HE5_SWsetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Get layout information */ /* ---------------------- */ layout = H5Pget_layout(dsplist); if(layout == H5D_LAYOUT_ERROR) { sprintf(errbuf,"Cannot get layout information for the dataset.\n"); H5Epush(__FILE__, "HE5_SWsetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } rankds = 1; /*dimsds[0] = dims[Dimindex]; */ dimsds[0] = dimsize; data_space = H5Screate_simple(rankds, dimsds, NULL); if(data_space == FAIL) { sprintf(errbuf,"Cannot create dataspace for the dimension scale dataset.\n"); H5Epush(__FILE__, "HE5_SWsetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } dsid = H5Dcreate(HE5_SWXSwath[idx].sw_id,dimscalename,ntype, data_space, dsplist); if( dsid == FAIL ) { sprintf(errbuf, "Cannot create dataset for Dimension Scale \"%s\" field. \n", dimscalename); H5Epush(__FILE__, "HE5_SWsetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* write data_buff to it */ /* Get the field space ID */ /* --------------------- */ fspace = H5Dget_space(dsid); if ( fspace == FAIL) { sprintf(errbuf, "Cannot get the file data space ID.\n"); H5Epush(__FILE__, "HE5_SWsetdimscale", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } status = H5Dwrite(dsid, ntype, data_space, fspace, H5P_DEFAULT, data_buff); if( status == FAIL ) { sprintf(errbuf,"Cannot write data to the dataset.\n"); H5Epush(__FILE__, "HE5_SWsetdimscale", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } } /* Dataset exist. See if it is Dimension Scale already. If not make it */ if((H5DSis_scale(dsid)) <= 0 ) { status = H5DSset_scale(dsid, dimscalename); if( status < 0) { status = -1; free(errbuf); goto COMPLETION; } if(num_index_found <= 1) { if(H5DSattach_scale(did, dsid, Dimindex) < 0) { status = -1; free(errbuf); goto COMPLETION; } } else {/*// dimname is used multiple times for this variable. Need to attach them. */ temp_index_ptr = index_found_ptr; for(i = 0; i metaptrs[1] || metaptrs[0] == NULL) { /* Get pointers to "GeoField" section within SM */ /* -------------------------------------------- */ metabuf = (char *)HE5_EHmetagroup(fid, HE5_SWXSwath[idx].swname, "s","GeoField", metaptrs); /* Search for field */ /* ---------------- */ sprintf(utlstr, "%s%s%s", "\"", fieldname, "\"\n"); metaptrs[0] = strstr(metaptrs[0], utlstr); } } else if (fldgroup == HE5_HDFE_PROFGROUP) { /* Get pointers to "ProfileField" section within SM */ /* ------------------------------------------------ */ metabuf = (char *)HE5_EHmetagroup(fid, HE5_SWXSwath[idx].swname, "s", "ProfileField", metaptrs); /* Search for profile */ /* ------------------ */ sprintf(utlstr, "%s%s%s", "\"", fieldname, "\"\n"); metaptrs[0] = strstr(metaptrs[0], utlstr); } else { sprintf(errbuf , "Cannot get the field group code.\n"); H5Epush(__FILE__, "HE5_SWcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (metabuf != NULL) free(metabuf); if (utlstr != NULL) free(utlstr); return(FAIL); } /* If field found and user wants compression code ... */ /* -------------------------------------------------- */ if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL) { if (compcode != NULL) { /* Set endptr at end of field's definition entry */ /* --------------------------------------------- */ metaptrs[1] = strstr(metaptrs[0], "\t\t\tEND_OBJECT"); /* Get compression type */ /* -------------------- */ statmeta = HE5_EHgetmetavalue(metaptrs, "CompressionType", utlstr); /* * Default is no compression if "CompressionType" string not * in metadata */ *compcode = HE5_HDFE_COMP_NONE; /* If compression code is found ... */ /* -------------------------------- */ if (statmeta == SUCCEED) { /* Loop through compression types until match */ /* ------------------------------------------ */ for (i = 0; i < 18; i++) { if (strcmp(utlstr, HDFcomp[i]) == 0) { *compcode = i; break; } } } } /* If user wants compression parameters ... */ /* Compression is not listed in the structure metadata. Lets see if the field is compressed by other means such as herepack where the compression is done but does not show up in the structure metadata. */ got_compparm = 0; if(*compcode == HE5_HDFE_COMP_NONE) { if (HE5_SWXSwath[swathID % idOffset].active != 0) { /* Get Swath index */ /* -------------- */ idx = HE5_EHhid2long(swathID) % idOffset; if ( idx == FAIL) { status = FAIL; sprintf(errbuf, "Cannot get the Swath index \n"); H5Epush(__FILE__, "HE5_SWcompinfo", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf) ; HE5_EHprint(errbuf, __FILE__, __LINE__); } } /* Loop through all datasets in swath */ /* ------------------------------ */ for (i = 0; i < HE5_SWXSwath[idx].nDFLD; i++) { /* Get dataset name */ if( strcmp(fieldname, HE5_SWXSwath[ idx ].ddataset[ i ].name) == 0 ) { found = 1; sdid = HE5_SWXSwath[ idx ].ddataset[ i ].ID; break; } } if(found == 1) /* did not find fieldname */ { /* * Retrieve dataset creation property list. */ dcpl = H5Dget_create_plist (sdid); numfilt = H5Pget_nfilters (plist_id); done_loop = 0; for (i=0; i 2) { *compcode = 12; /* HE5_HDFE_COMP_SHUF_SZIP_CHIP */ compparm[0] = 16; done_loop = 1; } break; /*------------------------------------------------------------------------- * H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC *------------------------------------------------------------------------- */ case H5Z_FILTER_FLETCHER32: done_loop = 1; break; /*------------------------------------------------------------------------- * H5Z_FILTER_SCALEOFFSET *------------------------------------------------------------------------- */ case H5Z_FILTER_SCALEOFFSET: done_loop = 1; break; }/*switch*/ if(done_loop == 1) break; }/*for*/ } got_compparm = 1; } /* If user wants compression parameters ... */ /* ---------------------------------------- */ if (compparm != NULL && compcode != NULL && got_compparm != 1) { /* Initialize to zero */ /* ------------------ */ for (i = 0; i < 5; i++) compparm[i] = 0; /* Get compression parameters */ /* -------------------------- */ if (*compcode == HE5_HDFE_COMP_NBIT) { statmeta = HE5_EHgetmetavalue(metaptrs, "CompressionParams", utlstr); if (statmeta == SUCCEED) { sscanf(utlstr, "(%d,%d,%d,%d)", &compparm[0], &compparm[1], &compparm[2], &compparm[3]); } else { status = FAIL; sprintf( errbuf,"\"CompressionParams\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_SWcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } else if (*compcode == HE5_HDFE_COMP_DEFLATE) { statmeta = HE5_EHgetmetavalue(metaptrs, "DeflateLevel", utlstr); if (statmeta == SUCCEED) { sscanf(utlstr, "%d", &compparm[0]); } else { status = FAIL; sprintf( errbuf,"The \"DeflateLevel\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_SWcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } else if (*compcode == HE5_HDFE_COMP_SZIP_CHIP) { statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr); if (statmeta == SUCCEED) { sscanf(utlstr, "%d", &compparm[0]); } else { status = FAIL; sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_SWcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } else if (*compcode == HE5_HDFE_COMP_SZIP_K13) { statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr); if (statmeta == SUCCEED) { sscanf(utlstr, "%d", &compparm[0]); } else { status = FAIL; sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_SWcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } else if (*compcode == HE5_HDFE_COMP_SZIP_EC) { statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr); if (statmeta == SUCCEED) { sscanf(utlstr, "%d", &compparm[0]); } else { status = FAIL; sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_SWcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } else if (*compcode == HE5_HDFE_COMP_SZIP_NN) { statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr); if (statmeta == SUCCEED) { sscanf(utlstr, "%d", &compparm[0]); } else { status = FAIL; sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_SWcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } else if (*compcode == HE5_HDFE_COMP_SZIP_K13orEC) { statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr); if (statmeta == SUCCEED) { sscanf(utlstr, "%d", &compparm[0]); } else { status = FAIL; sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_SWcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } else if (*compcode == HE5_HDFE_COMP_SZIP_K13orNN) { statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr); if (statmeta == SUCCEED) { sscanf(utlstr, "%d", &compparm[0]); } else { status = FAIL; sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_SWcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } else if (*compcode == HE5_HDFE_COMP_SHUF_DEFLATE) { statmeta = HE5_EHgetmetavalue(metaptrs, "DeflateLevel", utlstr); if (statmeta == SUCCEED) { sscanf(utlstr, "%d", &compparm[0]); } else { status = FAIL; sprintf( errbuf,"The \"DeflateLevel\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_SWcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } else if (*compcode == HE5_HDFE_COMP_SHUF_SZIP_CHIP) { statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr); if (statmeta == SUCCEED) { sscanf(utlstr, "%d", &compparm[0]); } else { status = FAIL; sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_SWcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } else if (*compcode == HE5_HDFE_COMP_SHUF_SZIP_K13) { statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr); if (statmeta == SUCCEED) { sscanf(utlstr, "%d", &compparm[0]); } else { status = FAIL; sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_SWcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } else if (*compcode == HE5_HDFE_COMP_SHUF_SZIP_EC) { statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr); if (statmeta == SUCCEED) { sscanf(utlstr, "%d", &compparm[0]); } else { status = FAIL; sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_SWcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } else if (*compcode == HE5_HDFE_COMP_SHUF_SZIP_NN) { statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr); if (statmeta == SUCCEED) { sscanf(utlstr, "%d", &compparm[0]); } else { status = FAIL; sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_SWcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } else if (*compcode == HE5_HDFE_COMP_SHUF_SZIP_K13orEC) { statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr); if (statmeta == SUCCEED) { sscanf(utlstr, "%d", &compparm[0]); } else { status = FAIL; sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_SWcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } else if (*compcode == HE5_HDFE_COMP_SHUF_SZIP_K13orNN) { statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr); if (statmeta == SUCCEED) { sscanf(utlstr, "%d", &compparm[0]); } else { status = FAIL; sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_SWcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } } } if (metabuf != NULL) free(metabuf); if (utlstr != NULL) free(utlstr); } COMPLETION: return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWfldnameinfo | | | | DESCRIPTION: Retrieves actual name of the field | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nameFlag int None return (1) actual name, (0) alias, | | (-1) FAIL | | INPUTS: | | swathID hid_t Swath structure ID | | fieldname char name of field | | | | OUTPUTS: | | actualname char field actual name | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Oct 00 A.Muslimov Original development. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ static int HE5_SWfldnameinfo(hid_t swathID, char *fieldname, char *actualname) { int nameFlag = FAIL;/* Return value of flag */ int length = 0; /* String length */ int fldgroup = FAIL;/* Field group code */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t groupID = FAIL;/* data/geo/prof fields group ID */ long idx = FAIL;/* Swath index */ H5G_stat_t *statbuf = (H5G_stat_t *)NULL;/* buffer for link info */ herr_t status = FAIL;/* routine return status variable */ char *namebuf = NULL;/* Buffer for an actual field name */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ CHECKPOINTER(fieldname); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWfldnameinfo", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for Swath ID failed.\n"); H5Epush(__FILE__, "HE5_SWfldnameinfo", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } statbuf = (H5G_stat_t *)calloc(1, sizeof(H5G_stat_t )); /* Try to get information about specified field */ /* -------------------------------------------- */ H5E_BEGIN_TRY { groupID = HE5_SWXSwath[idx].data_id; fldgroup = HE5_HDFE_DATAGROUP; status = H5Gget_objinfo(groupID, fieldname, 0, statbuf); } H5E_END_TRY; if (status == FAIL) { H5E_BEGIN_TRY { groupID = HE5_SWXSwath[idx].geo_id; fldgroup = HE5_HDFE_GEOGROUP; status = H5Gget_objinfo(groupID, fieldname, 0, statbuf); } H5E_END_TRY; if (status == FAIL) { H5E_BEGIN_TRY { groupID = HE5_SWXSwath[idx].prof_id; fldgroup = HE5_HDFE_PROFGROUP; status = H5Gget_objinfo(groupID, fieldname, 0, statbuf); } H5E_END_TRY; if (status == FAIL) { nameFlag = FAIL; sprintf(errbuf, "Cannot find \"%s\" field.\n", fieldname); H5Epush(__FILE__, "HE5_SWfldnameinfo", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(statbuf); return(nameFlag); } } } /* If the field name is an alias */ /* ----------------------------- */ if (statbuf->type == H5G_LINK) nameFlag = FALSE; else nameFlag = TRUE; if (nameFlag == FALSE) { if (actualname != NULL) { status = HE5_SWaliasinfo(swathID, fldgroup, fieldname, &length, NULL); if ( status == FAIL ) { sprintf(errbuf, "Cannot get information about alias \"%s\".\n", fieldname); H5Epush(__FILE__, "HE5_SWfldnameinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } namebuf = (char *)calloc(length, sizeof(char)); if ( namebuf == NULL ) { sprintf(errbuf, "Cannot allocate memory for namebuf.\n"); H5Epush(__FILE__, "HE5_SWfldnameinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Retrieve information about alias */ /* -------------------------------- */ status = HE5_SWaliasinfo(swathID, fldgroup, fieldname, &length, namebuf); if ( status == FAIL ) { sprintf(errbuf, "Cannot get information about alias \"%s\".\n", fieldname); H5Epush(__FILE__, "HE5_SWfldnameinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(namebuf); return(FAIL); } strcpy(actualname,""); strcpy(actualname,namebuf); free(namebuf); } } if (nameFlag == TRUE) { if (actualname != NULL) { strcpy(actualname,""); strcpy(actualname, fieldname); } } free(statbuf); COMPLETION: return(nameFlag); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWfinfo | | | | DESCRIPTION: Returns field info | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t Swath structure ID | | fieldtype char fieldtype (geo or data) | | fldname char name of field | | | | OUTPUTS: | | rank int rank of field (# of dims) | | dims hsize_t field dimensions | | numbertype hid_t field number type | | dimlist char field dimension list | | maxdimlist char field maximum dimension list | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 7/29/99 A.Muslimov In the call to EHmetagroup() replaced gid by fid. | | 7/30/99 A.Muslimov Added *rank = H5Sget_simple_extent_ndims(dspace); | | and checked for error status from H5Sget_simple_\ | | extent_dims() and H5Sclose(). Replaced maxdims | | parameter by NULL in H5Sget_simple_extent_dims(). | | 8/11/99 A.Muslimov Initialized status to -1 before "Get pointers | | to appropriate "Field" section within SM ". | | Moved the lines of code under the comments | | "Get field ID" and "Get actual dimension size " | | within the block "if (metaptrs[0] < | | metaptrs[1] && metaptrs[0] != NULL) {} " to its end.| | Initialized "statmeta" and "fieldID" to -1. | | Cleaned up some minor things (mostly cosmetic). | | 10/18/99 A.Muslimov Replaced memcpy() by memmove() to avoid a problem| | | when arguments 1 and 2 overlap in memory. | | | | 01/13/00 A.Muslimov Added "maxdimlist" parameter to make it possible | | working with the appendable datasets. Modified the | | blocks retrieving the dimension lists. Added proper | | error handlings after the function calls. | |02/04/00 A.Muslimov H5Sget_simple_extent_ndims returns "int", so the | | data type of rank was changed from int32_t to int. | |04/19/00 A.Muslimov Changed type of 'slen' from long to size_t. | | July 00 A.Muslimov Unmasked hdf5 data types. | |10/02/00 A.Muslimov Updated to include alias field name. | | June 02 S.Zhao Changed the type of 'numbertype' from an H5T_class_t | | to an hid_t. | | Oct. 03 S.Zhao Added the H5Tclose(datatype) call. | | Oct. 03 S.Zhao Modified to enable a character string dataset. | | Mar 04 S.Zhao Modified for a character string dataset. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ static herr_t HE5_SWfinfo(hid_t swathID, char *fieldtype, char *fieldname, int *rank, hsize_t dims[], hid_t numbertype[], char *dimlist, char *maxdimlist) { herr_t status = FAIL;/* routine return status variable */ herr_t statmeta = FAIL;/* EHgetmetavalue return status */ herr_t Dstatus = FAIL;/* Status for H5Dclose */ int groupflag = FAIL;/* Flag for "Geo... Fields"/"Data Fields" group */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t dspace = FAIL;/* "fieldname" Dataspace ID */ hid_t fieldID = FAIL;/* "fieldname" Dataset ID */ hid_t groupid = FAIL;/* group ID */ hid_t datasetid = FAIL;/* dataset ID */ hid_t datatype = FAIL;/* data type ID */ H5T_class_t classid = H5T_NO_CLASS;/* data type class ID */ long ndims = 0; /* Number of dimensions */ long idx = FAIL;/* Index of a swath */ long i = 0; /* Loop index */ size_t slen[HE5_DTSETRANKMAX]; /* Length of each entry in parsed string */ char *metabuf = (char *)NULL; /* Ptr to structural metadata (SM) */ char *metaptrs[2] = {NULL, NULL}; /* Ptrs to the begining and end of SM */ char utlstr[HE5_HDFE_UTLBUFSIZE]; /* Utility string */ char *ptr[HE5_DTSETRANKMAX]; /* String pointers for parsed string */ char dimstr[HE5_HDFE_DIMBUFSIZE]; /* Individual dimension entry string */ char maxdimstr[HE5_HDFE_DIMBUFSIZE]; /* Individual max. dimension entry string */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ htri_t str_is_variable; /* boolean: TRUE if string is variable lengeth FALSE if string is fixed length -1 if error in H5Tis_variavle_str() */ CHECKPOINTER(fieldtype); CHECKPOINTER(fieldname); /* Initialize rank to FAIL (error) */ /* ------------------------------- */ *rank = FAIL; /* Initialize slen[] array */ /* ----------------------- */ for ( i = 0; i < HE5_DTSETRANKMAX; i++) slen[i] = 0; /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWfinfo", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for Swath ID failed.\n"); H5Epush(__FILE__, "HE5_SWfinfo", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Reset status to FAIL */ /* -------------------- */ status = FAIL; /* Get pointers to appropriate "Field" section within SM */ /* ----------------------------------------------------- */ if (strcmp(fieldtype, "Geolocation Fields") == 0) { metabuf = (char *)HE5_EHmetagroup(fid, HE5_SWXSwath[idx].swname, "s", "GeoField", metaptrs); groupflag = 0; } else { metabuf = (char *)HE5_EHmetagroup(fid, HE5_SWXSwath[idx].swname, "s", "DataField", metaptrs); groupflag = 1; } if ( metabuf == NULL ) { status = FAIL; sprintf(errbuf, "Cannot get pointer to metabuf.\n"); H5Epush(__FILE__, "HE5_SWfinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } sprintf(utlstr, "%s%s%s", "\"", fieldname, "\"\n"); metaptrs[0] = strstr(metaptrs[0], utlstr); /* If field is found either in "Geolocation Fields" or "Data Fields" group */ /* ----------------------------------------------------------------------- */ if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL) { /* Get DataType string */ /* ------------------- */ statmeta = HE5_EHgetmetavalue(metaptrs, "DataType", utlstr); /* Convert to data type class ID */ /* ----------------------------- */ if (statmeta == SUCCEED) { if(groupflag == 0) groupid = HE5_SWXSwath[idx].geo_id; else groupid = HE5_SWXSwath[idx].data_id; /* Open the field dataset */ /* ---------------------- */ datasetid = H5Dopen(groupid, fieldname); if (datasetid == FAIL) { status = FAIL; sprintf(errbuf, "Cannot open the dataset for the \"%s\" field.\n",fieldname); H5Epush(__FILE__, "HE5_SWfinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); if (metabuf != NULL) free(metabuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get the data type ID */ /* -------------------- */ datatype = H5Dget_type(datasetid); if (datatype == FAIL) { status = FAIL; sprintf(errbuf, "Cannot get the data type for the \"%s\" field.\n",fieldname); H5Epush(__FILE__, "HE5_SWfinfo", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); if (metabuf != NULL) free(metabuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get the data type class ID */ /* -------------------------- */ classid = H5Tget_class(datatype); if (classid == H5T_NO_CLASS) { status = FAIL; sprintf(errbuf, "Cannot get the data type class ID for the \"%s\" field.\n",fieldname); H5Epush(__FILE__, "HE5_SWfinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); if (metabuf != NULL) free(metabuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } if (classid == H5T_STRING) { /* HE5T_CHARSTRING has variable length for data fields */ str_is_variable = H5Tis_variable_str(datatype); if(str_is_variable == TRUE) { numbertype[0] = HE5T_CHARSTRING; } else if(str_is_variable == FALSE) { numbertype[0] = HE5T_NATIVE_CHAR; } else { status = FAIL; sprintf(errbuf, "Failed to see if string field is varaible or fixed length for the \"%s\" field.\n",fieldname); H5Epush(__FILE__, "HE5_SWfinfo", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); if (metabuf != NULL) free(metabuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /*numbertype[0] = HE5_SWgetstringtype(swathID, fieldname,classid);*/ /*numbertype[0] = HE5T_CHARSTRING;*/ } else { /*numbertype[0] = classid;*/ numbertype[0] = HE5_EHdtype2numtype(datatype); if (numbertype[0] == FAIL) { status = FAIL; sprintf(errbuf, "Cannot get the number type for the \"%s\" field.\n",fieldname); H5Epush(__FILE__, "HE5_SWfinfo", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); if (metabuf != NULL) free(metabuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } /* Release the datatype ID */ /* ----------------------- */ status = H5Tclose(datatype); if ( status == FAIL ) { sprintf(errbuf, "Cannot release the datatype ID for the \"%s\" field.\n",fieldname); H5Epush(__FILE__, "HE5_SWfinfo", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); if (metabuf != NULL) free(metabuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release the dataset ID */ /* ---------------------- */ Dstatus = H5Dclose(datasetid); if (Dstatus == FAIL) { status = FAIL; sprintf(errbuf, "Cannot release the dataset ID for the \"%s\" field.\n",fieldname); H5Epush(__FILE__, "HE5_SWfinfo", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); if (metabuf != NULL) free(metabuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { status = FAIL; sprintf(errbuf, "The \"DataType\" string not found in metadata. \n"); H5Epush(__FILE__, "HE5_SWfinfo", __LINE__, H5E_DATASET, H5E_SEEKERROR, errbuf); if (metabuf != NULL) free(metabuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get "DimList" string, trim off "(" and ")" */ /* ------------------------------------------ */ statmeta = HE5_EHgetmetavalue(metaptrs, "DimList", utlstr); if (statmeta == SUCCEED) { memmove(utlstr, utlstr + 1, strlen(utlstr) - 2); utlstr[strlen(utlstr) - 2] = 0; /* Parse trimmed "DimList" string and get rank */ /* ------------------------------------------- */ ndims = HE5_EHparsestr(utlstr, ',', ptr, slen); *rank = HE5_EHlong2int(ndims); if (*rank == FAIL) { sprintf(errbuf, "Cannot convert from \"long\" to \"int\" data type. \n"); H5Epush(__FILE__, "HE5_SWfinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); if (metabuf != NULL) free(metabuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } else { status = FAIL; sprintf(errbuf, "The \"DimList\" string not found in metadata. \n"); H5Epush(__FILE__, "HE5_SWfinfo", __LINE__, H5E_DATASET, H5E_SEEKERROR, errbuf); if (metabuf != NULL) free(metabuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* If "DimList" IS REQUESTED ... */ /* ----------------------------- */ if (dimlist != NULL) { strcpy(dimstr,""); strcpy(dimlist,""); /* * Copy each entry in DimList and remove leading and trailing quotes. * Get dimension sizes and concatenate dimension names to dimension list. */ for (i = 0; i < ndims; i++) { memmove(dimstr, ptr[i] + 1, slen[i] - 2); dimstr[slen[i] - 2] = 0; if (i > 0) { strcat(dimlist,","); } strcat(dimlist, dimstr); } } /* If "MaxdimList" IS REQUESTED ... */ /* -------------------------------------- */ if(maxdimlist != NULL) { strcpy(utlstr,""); statmeta = HE5_EHgetmetavalue(metaptrs,"MaxdimList", utlstr); if (statmeta == SUCCEED) { memmove(utlstr, utlstr + 1, strlen(utlstr) - 2); utlstr[strlen(utlstr) - 2] = 0; ndims = HE5_EHparsestr(utlstr,',', ptr, slen); } else { status = FAIL; sprintf(errbuf, "The \"MaxdimList\" string not found in metadata. \n"); H5Epush(__FILE__, "HE5_SWfinfo", __LINE__, H5E_DATASET, H5E_SEEKERROR, errbuf); if (metabuf != NULL) free(metabuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } strcpy(maxdimstr,""); strcpy(maxdimlist,""); for (i = 0; i < ndims; i++) { memmove(maxdimstr, ptr[i] + 1, slen[i] - 2); maxdimstr[slen[i] - 2] = 0; if (maxdimlist != NULL) { if (i > 0) { strcat(maxdimlist,","); } strcat(maxdimlist, maxdimstr); } } } /* Get field ID */ /* ------------ */ HE5_SWfieldsizeID( swathID, fieldname, &fieldID); /* Get the data space ID */ /* --------------------- */ dspace = H5Dget_space( fieldID ); if(dspace == FAIL) { status = FAIL; sprintf(errbuf, "Cannot get the data space ID.\n"); H5Epush(__FILE__, "HE5_SWfinfo", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf); if (metabuf != NULL) free(metabuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get the dataset rank */ /* -------------------- */ *rank = H5Sget_simple_extent_ndims(dspace); if( *rank == FAIL) { status = FAIL; sprintf(errbuf, "Cannot get the rank of the dataset.\n"); H5Epush(__FILE__, "HE5_SWfinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); if (metabuf != NULL) free(metabuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get the dataset dimension sizes */ /* ------------------------------- */ status = H5Sget_simple_extent_dims(dspace, dims, NULL); if( status == FAIL) { sprintf(errbuf, "Cannot get the dimension array of the dataset.\n"); H5Epush(__FILE__, "HE5_SWfinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); if (metabuf != NULL) free(metabuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release the data space ID */ /* ------------------------- */ status = H5Sclose(dspace); if( status == FAIL) { sprintf(errbuf, "Cannot release the data space ID.\n"); H5Epush(__FILE__, "HE5_SWfinfo", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); if (metabuf != NULL) free(metabuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } if (metabuf != NULL) free(metabuf); COMPLETION: return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWfieldinfo | | | | DESCRIPTION: Wrapper around HE5_SWfinfo | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID herr_t swath structure ID | | fldname char* name of field | | | | OUTPUTS: | | rank int rank of field (# of dims) | | dims hsize_t field dimensions | | ntype hid_t number types | | dimlist char* field dimension list | | maxdimlist char* field maximum dimension list | | | | NOTES: | | | | | | Date Programmer Description | | ========= ============ ================================================ | | 01/13/00 A.Muslimov Added "maxdimlist" parameter to make it possible | | working with the appendable datasets. | | 05/10/00 A.Muslimov Replaced 'H5T_class_t' type by 'int' data type. | | July 00 A.Muslimov Unmasked hdf5 data types. | | Oct 5 00 A.Muslimov Added checking for actual field name (in case of | | passing an alias name as 'fldname'). | | Jan 03 S.Zhao Changed the type of 'ntype' from an H5T_class_t | | to an hid_t. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWfieldinfo(hid_t swathID, char *fldname, int *rank, hsize_t dims[], hid_t ntype[], char *dimlist, char *maxdimlist) { herr_t status = FAIL;/* routine return status variable */ int nameflag = FAIL;/* Actual(1)/Alias(0) field name */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ long idx = FAIL;/* Swath index */ char fieldname[HE5_HDFE_NAMBUFSIZE]; /* field name buffer */ char fldactualname[HE5_HDFE_NAMBUFSIZE];/* Actual field name */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ CHECKPOINTER(fldname); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWfieldinfo", &fid, &gid, &idx); if (status == SUCCEED) { /* Call HE5_SWfldnameinfo() to get actual field name */ /* ------------------------------------------------- */ nameflag = HE5_SWfldnameinfo(swathID, fldname, fldactualname); if ( nameflag == FAIL ) { sprintf(errbuf, "Cannot get actual name of the field.\n"); H5Epush(__FILE__, "HE5_SWfieldinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Name is not alias */ /* ----------------- */ if (nameflag == TRUE) { strcpy(fieldname,""); strcpy(fieldname,fldname); } /* Name is alias */ /* ------------- */ if (nameflag == FALSE) { strcpy(fieldname,""); strcpy(fieldname,fldactualname); } /* Check for field within Geolocatation Fields */ /* ------------------------------------------- */ status = HE5_SWfinfo(swathID, "Geolocation Fields", fieldname, rank, dims, ntype, dimlist, maxdimlist); /* If not there then check within Data Fields */ /* ------------------------------------------ */ if (status == FAIL) status = HE5_SWfinfo(swathID, "Data Fields", fieldname, rank, dims, ntype, dimlist, maxdimlist); /* If not there either then can't be found */ /* --------------------------------------- */ if (status == FAIL) { sprintf(errbuf,"Field \"%s\" not found. Check out the field name. \n", fieldname); H5Epush(__FILE__, "HE5_SWfieldinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWchunkinfo | | | | DESCRIPTION: Retrieves chunking information | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t Swath structure ID | | fldname char* name of field | | | | OUTPUTS: | | chunk_rank int* rank of a dataset | | chunk_dims hsize_t the array containing sizes | | of each dimension of a chunk | | NOTES: | | | | | | Date Programmer Description | | ========= ============ ============================================== | | Dec 03 S.Zhao Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWchunkinfo(hid_t swathID, char *fldname, int *chunk_rank, hsize_t chunk_dims[]) { herr_t status = FAIL;/* Return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ long idx = FAIL;/* Swath index */ hid_t fieldID = FAIL;/* field dataset ID */ hid_t plist = FAIL;/* field dataset property list ID */ hid_t dspace = FAIL;/* "fieldname" Dataspace ID */ int ndims = 0; /* Number of dimensions */ H5D_layout_t layout = H5D_LAYOUT_ERROR; /* Storage layout type */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKPOINTER(fldname); /* Initialize chunk_rank to FAIL (error) */ /* ------------------------------------- */ *chunk_rank = FAIL; /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWchunkinfo", &fid, &gid, &idx); if (status == FAIL) { sprintf(errbuf,"Checking for valid swath ID failed.\n"); H5Epush(__FILE__, "HE5_SWchunkinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Check out the field group and get field ID */ /* ------------------------------------------ */ HE5_SWfldsrch(swathID,fldname,&fieldID,NULL,NULL,NULL); if(fieldID == FAIL) { sprintf(errbuf, "Cannot get the field ID for the \"%s\" field.\n", fldname); H5Epush(__FILE__, "HE5_SWchunkinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the property list ID */ /* ------------------------ */ plist = H5Dget_create_plist(fieldID); if (plist == FAIL) { sprintf(errbuf, "Cannot get the property list ID for the \"%s\" data field.\n", fldname); H5Epush(__FILE__, "HE5_SWchunkinfo", __LINE__, H5E_PLIST, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the data space ID */ /* --------------------- */ dspace = H5Dget_space(fieldID); if(dspace == FAIL) { sprintf(errbuf, "Cannot get the data space ID for the \"%s\" data field.\n", fldname); H5Epush(__FILE__, "HE5_SWchunkinfo", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the dataset rank */ /* -------------------- */ ndims = H5Sget_simple_extent_ndims(dspace); if(ndims == FAIL) { sprintf(errbuf, "Cannot get the rank of the dataset.\n"); H5Epush(__FILE__, "HE5_SWchunkinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get Layout */ /* ---------- */ layout = H5Pget_layout(plist); if (layout == H5D_LAYOUT_ERROR) { sprintf(errbuf, "Cannot get the layout of the raw data. \n"); H5Epush(__FILE__, "HE5_SWchunkinfo", __LINE__, H5E_PLIST, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } else if (layout == H5D_CHUNKED) { /* Get chunking */ /* ------------ */ *chunk_rank = H5Pget_chunk(plist, ndims, chunk_dims); if (*chunk_rank == FAIL) { sprintf(errbuf, "Cannot get the sizes of chunks. \n"); H5Epush(__FILE__, "HE5_SWchunkinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } else { *chunk_rank = 0; } /* Release property list ID */ /* ------------------------ */ status = H5Pclose(plist); if (status == FAIL ) { sprintf(errbuf, "Cannot release property list ID. \n"); H5Epush(__FILE__, "HE5_SWchunkinfo", __LINE__, H5E_PLIST, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Release the data space ID */ /* ------------------------- */ status = H5Sclose(dspace); if( status == FAIL) { sprintf(errbuf, "Cannot release the data space ID.\n"); H5Epush(__FILE__, "HE5_SWchunkinfo", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWdefdimmap | | | | DESCRIPTION: Defines mapping between geolocation and data dimensions | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | | | INPUTS: | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 3/18/99 | | 7/29/99 A.Muslimov In the call to EHinsertmeta() replaced gid by fid. | | July 00 A.Muslimov Unmasked hdf5 data types. | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWdefdimmap(hid_t swathID, char *geodim, char *datadim, hsize_t offset, hsize_t increment) { herr_t status = FAIL; /* Routine return status */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hsize_t size = 0; /* Size of geo dim */ hsize_t metadata[2] = { 0, 0 }; /* Offset & Increment */ long idx = FAIL; /* Swath index */ char mapname[HE5_HDFE_NAMBUFSIZE];/* Mapping name buffer */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ HE5_LOCK; CHECKNAME(geodim); CHECKNAME(datadim); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWdefdimmap", &fid, &gid, &idx); if (status == SUCCEED) { /* Geolocation Dimension Search */ /* ---------------------------- */ size = HE5_SWdiminfo(swathID, geodim); if (size == 0) { status = FAIL; sprintf(errbuf, "Geolocation dimension \"%s\" not found.", geodim); H5Epush(__FILE__, "HE5_SWdefdimmap", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } /* Data Dimension Search */ /* --------------------- */ if (status == SUCCEED) { size = HE5_SWdiminfo(swathID, datadim); if (size == 0) { status = FAIL; sprintf(errbuf, "Data dimension \"%s\" not found.", datadim); H5Epush(__FILE__, "HE5_SWdefdimmap", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } /* Write "DimensionMap" to Structural MetaData */ /* ------------------------------------------- */ if (status == SUCCEED) { sprintf(mapname, "%s%s%s", geodim, "/", datadim); metadata[0] = offset; metadata[1] = increment; status = HE5_EHinsertmeta(fid, HE5_SWXSwath[idx].swname, "s", 1L, mapname, metadata); if (status == FAIL) { sprintf(errbuf, "Cannot write \"Dimension Map\" offset and increment values to Structural Metadata."); H5Epush(__FILE__, "HE5_SWdefdimmap", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } } COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWdefidxmap | | | | DESCRIPTION: Defines indexed (non-linear) mapping between geolocation | | and data dimensions | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t Swath structure ID | | geodim char Geolocation dimension | | datadim char Data dimension | | index long Index mapping array | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 3/18/99 | | 7/29/99 A.Muslimov In the call to EHinsertmeta() replaced gid by fid. | | 8/23/99 A.Muslimov Checked for the statuses returned by H5Dwrite(), | | H5Sclose(), and H5Dclose(). | | 2/08/00 A.Muslimov Added more error checkings. | | 3/03/00 A.Muslimov Changed the datatype passed to H5Dcreate() and | | H5Dwrite() from H5T_NASTIVE_INT to H5T_NATIVE_LONG. | | July 00 A.Muslimov Unmasked hdf5 data types. | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWdefidxmap(hid_t swathID, char *geodim, char *datadim, long index[]) { herr_t status = FAIL; /* Return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t dspace = FAIL; /* dataspace ID */ hid_t id = FAIL; /* dataset ID */ hid_t sw_id = FAIL; /* Swath ID */ long idx = FAIL; /* Swath index */ hsize_t metadata = 0; /* Dummy metadata buffer */ hsize_t gsize = 0; /* Size of geo dim */ hsize_t dsize = 0; /* Size of data dim */ char mapname[HE5_HDFE_NAMBUFSIZE];/* Mapping name */ char utlbuf[HE5_HDFE_DIMBUFSIZE]; /* Utility buffer */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ HE5_LOCK; CHECKNAME(geodim); CHECKNAME(datadim); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWdefidxmap", &fid, &gid, &idx); if (status == SUCCEED) { /* Geo Dimension Search */ /* -------------------- */ gsize = HE5_SWdiminfo(swathID, geodim); if (gsize == 0) { status = FAIL; sprintf(errbuf, "Geolocation dimension \"%s\" not found. \n", geodim); H5Epush(__FILE__, "HE5_SWdefidxmap", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } /* Data Dimension Search */ /* --------------------- */ if (status == SUCCEED) { dsize = HE5_SWdiminfo(swathID, datadim); if (dsize == 0) { status = FAIL; sprintf(errbuf, "Data dimension \"%s\" not found. \n", datadim); H5Epush(__FILE__, "HE5_SWdefidxmap", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } /* Define Index and Store Index Array */ /* ----------------------------------- */ if (status == SUCCEED) { sw_id = HE5_SWXSwath[idx].sw_id; /* Name: "_INDEXMAP:" + geodim + "/" + datadim */ /* ------------------------------------------- */ sprintf(utlbuf, "%s%s%s%s", "_INDEXMAP:", geodim, ",", datadim); /* Create dataspace */ /* ---------------- */ dspace = H5Screate_simple(1, &gsize, NULL); if (dspace == FAIL) { sprintf(errbuf, "Cannot create the data space. \n"); H5Epush(__FILE__, "HE5_SWdefidxmap", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* create dataset */ /* -------------- */ id = H5Dcreate(sw_id, utlbuf, H5T_NATIVE_LONG, dspace, H5P_DEFAULT); if (id == FAIL) { sprintf(errbuf, "Cannot create the dataset. \n"); H5Epush(__FILE__, "HE5_SWdefidxmap", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Write data buffer to dataset */ /* ---------------------------- */ status = H5Dwrite(id, H5T_NATIVE_LONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, index); if (status == FAIL) { sprintf(errbuf, "Cannot write data to the dataset. \n"); H5Epush(__FILE__, "HE5_SWdefidxmap", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Write to Structural Metadata */ /* ---------------------------- */ sprintf(mapname, "%s%s%s", geodim, "/", datadim); status = HE5_EHinsertmeta(fid, HE5_SWXSwath[idx].swname, "s", 2L, mapname, &metadata); if (status == FAIL) { sprintf(errbuf, "Cannot insert data to the Metadata. \n"); H5Epush(__FILE__, "HE5_SWdefidxmap", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release dataspace ID */ /* -------------------- */ status = H5Sclose(dspace); if (status == FAIL) { sprintf(errbuf, "Cannot release the data space ID. \n"); H5Epush(__FILE__, "HE5_SWdefidxmap", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release dataset ID */ /* ------------------ */ status = H5Dclose(id); if (status == FAIL) { sprintf(errbuf, "Cannot release the dataset ID. \n"); H5Epush(__FILE__, "HE5_SWdefidxmap", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWdefchunk | | | | DESCRIPTION: Defines size of chunk used to store a chunked layout dataset | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t Swath structure ID | | rank int rank of a dataset | | *dim const hsize_t pointer to the array containing sizes | | of each dimension of a chunk | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ========= ============ ============================================== | | 8/134/99 A.Muslimov Checked the statuses for H5P... calls. | | 02/08/00 A.Muslimov Added more error checkings. | | July 00 A.Muslimov Unmasked hdf5 data types. | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWdefchunk(hid_t swathID, int rank, const hsize_t *dim) { herr_t status = FAIL;/* Return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ long idx = FAIL;/* Swath index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKPOINTER(dim); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWdefchunk", &fid, &gid, &idx); if (status == SUCCEED) { /* get the current dataset creation property ID from external array */ /* if current property instance has not been created, then create it */ if( HE5_SWXSwath[idx].plist == FAIL){ HE5_SWXSwath[idx].plist = H5Pcreate(H5P_DATASET_CREATE); if (HE5_SWXSwath[idx].plist == FAIL){ sprintf(errbuf, "Cannot create the property list. \n"); H5Epush(__FILE__, "HE5_SWdefchunk", __LINE__, H5E_PLIST, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } /* Set layout */ /* ---------- */ status = H5Pset_layout( HE5_SWXSwath[idx].plist, H5D_CHUNKED); if (status == FAIL) { sprintf(errbuf, "Cannot set the \"CHUNKED\" type of storage. \n"); H5Epush(__FILE__, "HE5_SWdefchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Set chunking */ /* ------------ */ status = H5Pset_chunk( HE5_SWXSwath[idx].plist, rank, dim); if (status == FAIL) { sprintf(errbuf, "Cannot set the sizes of chunks. \n"); H5Epush(__FILE__, "HE5_SWdefchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWdefcomp | | | | DESCRIPTION: Defines compression type and parameters | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t Swath structure ID | | compcode int compression code | | compparm int compression parameters | | | | OUTPUTS: | | None | | | | NOTES: Before calling this function, storage must be CHUNKED | | Values of compression code | | HDFE_COMP_NONE 0 | | HDFE_COMP_RLE 1 | | HDFE_COMP_NBIT 2 | | HDFE_COMP_SKPHUFF 3 | | HDFE_COMP_DEFLATE 4 | | HDFE_COMP_SZIP_EC 5 | | HDFE_COMP_SZIP_NN 6 | | HDFE_COMP_SZIP_K13 7 | | HDFE_COMP_SZIP_CHIP 8 | | HDFE_COMP_SZIP_K13orEC 9 | | HDFE_COMP_SZIP_K13orNN 10 | | HDFE_COMP_SHUF_DEFLATE 11 | | HDFE_COMP_SHUF_SZIP_CHIP 12 | | HDFE_COMP_SHUF_SZIP_K13 13 | | HDFE_COMP_SHUF_SZIP_EC 14 | | HDFE_COMP_SHUF_SZIP_NN 15 | | HDFE_COMP_SHUF_SZIP_K13orEC 16 | | HDFE_COMP_SHUF_SZIP_K13orNN 17 | | | | | | Date Programmer Description | | ====== ============ ================================================= | | | | 8/13/99 A.Muslimov Changed the return type of SWdefcomp from int | | to int . Checked the statuses in the H5P... calls.| | 02/08/00 A.Muslimov Added more error checkings. | | July 00 A.Muslimov Unmasked hdf5 data types. | | June 01 A.Muslimov Added checking of the compression code/level. | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | Aug 03 S.Zhao Added Szip compression methods. | | Oct 03 S.Zhao Added the shuffling method. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWdefcomp(hid_t swathID, int compcode, int *compparm) { herr_t status = FAIL; /* routine return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ long idx = FAIL; /* Swath index */ H5D_layout_t layout = H5D_LAYOUT_ERROR; /* Storage layout type */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ int can_encode = 0; /* szip encoder presence flag */ HE5_LOCK; CHECKPOINTER(compparm); /* Check if compression code is valid */ /* ---------------------------------- */ if( compcode != HE5_HDFE_COMP_DEFLATE && compcode != HE5_HDFE_COMP_NONE && compcode != HE5_HDFE_COMP_SZIP_CHIP && compcode != HE5_HDFE_COMP_SZIP_K13 && compcode != HE5_HDFE_COMP_SZIP_EC && compcode != HE5_HDFE_COMP_SZIP_NN && compcode != HE5_HDFE_COMP_SZIP_K13orEC && compcode != HE5_HDFE_COMP_SZIP_K13orNN && compcode != HE5_HDFE_COMP_SHUF_DEFLATE && compcode != HE5_HDFE_COMP_SHUF_SZIP_CHIP && compcode != HE5_HDFE_COMP_SHUF_SZIP_K13 && compcode != HE5_HDFE_COMP_SHUF_SZIP_EC && compcode != HE5_HDFE_COMP_SHUF_SZIP_NN && compcode != HE5_HDFE_COMP_SHUF_SZIP_K13orEC && compcode != HE5_HDFE_COMP_SHUF_SZIP_K13orNN ) { status = FAIL; sprintf(errbuf,"Invalid/unsupported compression code. \n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } if( compcode == HE5_HDFE_COMP_DEFLATE || compcode == HE5_HDFE_COMP_NONE || compcode == HE5_HDFE_COMP_SHUF_DEFLATE) { /* Check GZIP compression level */ /* ---------------------------- */ if( compparm[0] < 0 || compparm[0] > 9) { status = FAIL; sprintf(errbuf,"Invalid GZIP compression level. \n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { /* Check SZIP compression block size */ /* --------------------------------- */ if( compparm[0] != 2 && compparm[0] != 4 && compparm[0] != 6 && compparm[0] != 8 && compparm[0] != 10 && compparm[0] != 12 && compparm[0] != 14 && compparm[0] != 16 && compparm[0] != 18 && compparm[0] != 20 && compparm[0] != 22 && compparm[0] != 24 && compparm[0] != 26 && compparm[0] != 28 && compparm[0] != 30 && compparm[0] != 32) { status = FAIL; sprintf(errbuf,"Invalid SZIP compression block size. \n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } #ifdef H5_HAVE_FILTER_SZIP can_encode = HE5_szip_can_encode(); #endif /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWdefcomp", &fid, &gid, &idx); if (status == SUCCEED) { /* If the current property list is not set up */ /* ------------------------------------------ */ if( HE5_SWXSwath[idx].plist == FAIL) { status = FAIL; sprintf(errbuf,"Unable to compress, dataset storage layout has not been set to CHUNKED. \n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_PLIST, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } else { layout = H5Pget_layout(HE5_SWXSwath[idx].plist); if (layout == H5D_LAYOUT_ERROR) { status = FAIL; sprintf(errbuf, "Cannot get the layout of the raw data. \n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_PLIST, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } if( layout != H5D_CHUNKED ) status = H5Pset_layout(HE5_SWXSwath[idx].plist, H5D_CHUNKED); if (status == FAIL) { sprintf(errbuf, "Cannot set the \"CHUNKED\" type of storage of the raw data. \n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } switch (compcode) { /* Set NBIT compression parameters in compression external array */ /* ------------------------------------------------------------- */ case HE5_HDFE_COMP_NBIT: HE5_SWXSwath[idx].compparm[0] = compparm[0]; HE5_SWXSwath[idx].compparm[1] = compparm[1]; HE5_SWXSwath[idx].compparm[2] = compparm[2]; HE5_SWXSwath[idx].compparm[3] = compparm[3]; break; case HE5_HDFE_COMP_DEFLATE: /* ------------------------------------------------- */ /* Set compression method to H5D_COMPRESS_DEFLATE */ /* and compression level to "compparm[0]" */ /* ------------------------------------------------- */ status = H5Pset_deflate(HE5_SWXSwath[idx].plist, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set GZIP compresssion method and level. \n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* ------------------------------------------------- */ /* Set GZIP compression method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_SWXSwath[idx].compcode = compcode; HE5_SWXSwath[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SZIP_CHIP: #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_CHIP_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_CHIP compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ----------------------------------------------- */ /* Set SZIP_CHIP compression method and compression*/ /* parameters in external array */ /* ----------------------------------------------- */ HE5_SWXSwath[idx].compcode = compcode; HE5_SWXSwath[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SZIP_K13: #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_K13 compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set SZIP_K13 compression method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_SWXSwath[idx].compcode = compcode; HE5_SWXSwath[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SZIP_EC: #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_EC_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_EC compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set SZIP_EC compression method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_SWXSwath[idx].compcode = compcode; HE5_SWXSwath[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SZIP_NN: #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_NN_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_NN compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set SZIP_NN compression method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_SWXSwath[idx].compcode = compcode; HE5_SWXSwath[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SZIP_K13orEC: #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_EC_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_K13orEC compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set SZIP_K13orEC compression method and */ /* compression parameters in external array */ /* ------------------------------------------------- */ HE5_SWXSwath[idx].compcode = compcode; HE5_SWXSwath[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SZIP_K13orNN: #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_K13orNN compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set SZIP_K13orNN compression method and */ /* compression parameters in external array */ /* ------------------------------------------------- */ HE5_SWXSwath[idx].compcode = compcode; HE5_SWXSwath[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SHUF_DEFLATE: status = H5Pset_shuffle(HE5_SWXSwath[idx].plist); if (status == FAIL) { sprintf(errbuf, "Cannot set the shuffling method. \n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Pset_deflate(HE5_SWXSwath[idx].plist, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set GZIP compresssion method and level. \n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* ------------------------------------------------- */ /* Set shuffling+GZIP method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_SWXSwath[idx].compcode = compcode; HE5_SWXSwath[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SHUF_SZIP_CHIP: status = H5Pset_shuffle(HE5_SWXSwath[idx].plist); if (status == FAIL) { sprintf(errbuf, "Cannot set the shuffling method. \n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_CHIP_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_CHIP method and block size. \n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set shuffling+SZIP_CHIP method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_SWXSwath[idx].compcode = compcode; HE5_SWXSwath[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SHUF_SZIP_K13: status = H5Pset_shuffle(HE5_SWXSwath[idx].plist); if (status == FAIL) { sprintf(errbuf, "Cannot set the shuffling method. \n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_K13 compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set shuffling+SZIP_K13 method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_SWXSwath[idx].compcode = compcode; HE5_SWXSwath[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SHUF_SZIP_EC: status = H5Pset_shuffle(HE5_SWXSwath[idx].plist); if (status == FAIL) { sprintf(errbuf, "Cannot set the shuffling method. \n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_EC_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_EC compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set shuffling+SZIP_EC method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_SWXSwath[idx].compcode = compcode; HE5_SWXSwath[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SHUF_SZIP_NN: status = H5Pset_shuffle(HE5_SWXSwath[idx].plist); if (status == FAIL) { sprintf(errbuf, "Cannot set the shuffling method. \n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_NN_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_NN compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set shuffling+SZIP_NN method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_SWXSwath[idx].compcode = compcode; HE5_SWXSwath[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SHUF_SZIP_K13orEC: status = H5Pset_shuffle(HE5_SWXSwath[idx].plist); if (status == FAIL) { sprintf(errbuf, "Cannot set the shuffling method. \n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_EC_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_K13orEC compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set shuffling+SZIP_K13orEC method and */ /* compression parameters in external array */ /* ------------------------------------------------- */ HE5_SWXSwath[idx].compcode = compcode; HE5_SWXSwath[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SHUF_SZIP_K13orNN: status = H5Pset_shuffle(HE5_SWXSwath[idx].plist); if (status == FAIL) { sprintf(errbuf, "Cannot set the shuffling method. \n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_K13orNN compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set shuffling+SZIP_K13orNN method and */ /* compression parameters in external array */ /* ------------------------------------------------- */ HE5_SWXSwath[idx].compcode = compcode; HE5_SWXSwath[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_NONE: HE5_SWXSwath[idx].compparm[0] = compparm[0]; break; default: { status = FAIL; sprintf(errbuf, "Invalid compression method \"%d\" . \n", compcode); H5Epush(__FILE__, "HE5_SWdefcomp", __LINE__, H5E_ARGS, H5E_UNSUPPORTED, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } break; } } } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWdefcomchunk | | | | DESCRIPTION: Defines compression type and parameters and sets chunking | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t Swath structure ID | | compcode int compression code | | compparm int compression parameters | | rank int rank of a dataset | | *dim const hsize_t pointer to the array containing sizes | | of each dimension of a chunk | | OUTPUTS: | | None | | | | NOTES: Before calling this function, storage must be CHUNKED | | Values of compression code | | HDFE_COMP_NONE 0 | | HDFE_COMP_RLE 1 | | HDFE_COMP_NBIT 2 | | HDFE_COMP_SKPHUFF 3 | | HDFE_COMP_DEFLATE 4 | | HDFE_COMP_SZIP_EC 5 | | HDFE_COMP_SZIP_NN 6 | | HDFE_COMP_SZIP_K13 7 | | HDFE_COMP_SZIP_CHIP 8 | | HDFE_COMP_SZIP_K13orEC 9 | | HDFE_COMP_SZIP_K13orNN 10 | | HDFE_COMP_SHUF_DEFLATE 11 | | HDFE_COMP_SHUF_SZIP_CHIP 12 | | HDFE_COMP_SHUF_SZIP_K13 13 | | HDFE_COMP_SHUF_SZIP_EC 14 | | HDFE_COMP_SHUF_SZIP_NN 15 | | HDFE_COMP_SHUF_SZIP_K13orEC 16 | | HDFE_COMP_SHUF_SZIP_K13orNN 17 | | | | | | Date Programmer Description | | ====== ============ ================================================= | | | | 8/13/99 A.Muslimov Changed the return type of SWdefcomp from int | | to int . Checked the statuses in the H5P... calls.| | 02/08/00 A.Muslimov Added more error checkings. | | July 00 A.Muslimov Unmasked hdf5 data types. | | July 00 A.Muslimov Original tayloring from SWdefcomp() & SWdefchunk(). | | June 01 A.Muslimov Added checking for validity of input parameters. | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | Aug 03 S.Zhao Added Szip compression methods. | | Oct 03 S.Zhao Added the shuffling method. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWdefcomchunk(hid_t swathID, int compcode, int *compparm, int rank, const hsize_t *dim) { herr_t status = FAIL; /* Return status variable */ int i = 0; /* Loop index */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hsize_t dims[HE5_DTSETRANKMAX]; /* Default dim. sizes */ long idx = FAIL; /* Swath index */ H5D_layout_t layout = H5D_LAYOUT_ERROR; /* Storage layout type */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ int can_encode; /* szip encoder presence flag */ HE5_LOCK; CHECKPOINTER(compparm); CHECKPOINTER(dim); /* Check if compression code is valid */ /* ---------------------------------- */ if( compcode != HE5_HDFE_COMP_DEFLATE && compcode != HE5_HDFE_COMP_NONE && compcode != HE5_HDFE_COMP_SZIP_CHIP && compcode != HE5_HDFE_COMP_SZIP_K13 && compcode != HE5_HDFE_COMP_SZIP_EC && compcode != HE5_HDFE_COMP_SZIP_NN && compcode != HE5_HDFE_COMP_SZIP_K13orEC && compcode != HE5_HDFE_COMP_SZIP_K13orNN && compcode != HE5_HDFE_COMP_SHUF_DEFLATE && compcode != HE5_HDFE_COMP_SHUF_SZIP_CHIP && compcode != HE5_HDFE_COMP_SHUF_SZIP_K13 && compcode != HE5_HDFE_COMP_SHUF_SZIP_EC && compcode != HE5_HDFE_COMP_SHUF_SZIP_NN && compcode != HE5_HDFE_COMP_SHUF_SZIP_K13orEC && compcode != HE5_HDFE_COMP_SHUF_SZIP_K13orNN ) { status = FAIL; sprintf(errbuf, "Invalid/unsupported compression code. \n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } if( compcode == HE5_HDFE_COMP_DEFLATE || compcode == HE5_HDFE_COMP_NONE || compcode == HE5_HDFE_COMP_SHUF_DEFLATE) { /* Check GZIP compression level */ /* ---------------------------- */ if( compparm[0] < 0 || compparm[0] > 9) { status = FAIL; sprintf(errbuf,"Invalid GZIP compression level. \n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { /* Check SZIP compression block size */ /* --------------------------------- */ if( compparm[0] != 2 && compparm[0] != 4 && compparm[0] != 6 && compparm[0] != 8 && compparm[0] != 10 && compparm[0] != 12 && compparm[0] != 14 && compparm[0] != 16 && compparm[0] != 18 && compparm[0] != 20 && compparm[0] != 22 && compparm[0] != 24 && compparm[0] != 26 && compparm[0] != 28 && compparm[0] != 30 && compparm[0] != 32) { status = FAIL; sprintf(errbuf,"Invalid SZIP compression block size. \n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } #ifdef H5_HAVE_FILTER_SZIP can_encode = HE5_szip_can_encode(); #endif /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWdefcomchunk", &fid, &gid, &idx); if (status == SUCCEED) { /* Initialize dims[] array */ /* ----------------------- */ for (i = 0; i < HE5_DTSETRANKMAX; i++) dims[i] = 0; /* get the current dataset creation property ID from external array */ /* ----------------------------------------------------------------- */ if(HE5_SWXSwath[idx].plist == FAIL) { /* create property list */ /* -------------------- */ HE5_SWXSwath[idx].plist = H5Pcreate(H5P_DATASET_CREATE); /* set layout to "H5D_CHUNKED" */ /* --------------------------- */ status = H5Pset_layout(HE5_SWXSwath[idx].plist, H5D_CHUNKED); if (status == FAIL) { sprintf(errbuf, "Cannot set the \"CHUNKED\" type of storage. \n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_STORAGE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { /* Get layout of the raw data */ /* -------------------------- */ layout = H5Pget_layout(HE5_SWXSwath[idx].plist); if (layout == H5D_LAYOUT_ERROR) { status = FAIL; sprintf(errbuf, "Cannot get the layout of the raw data. \n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_STORAGE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } if( layout != H5D_CHUNKED ) { /* set layout to "H5D_CHUNKED" */ /* --------------------------- */ status = H5Pset_layout( HE5_SWXSwath[idx].plist, H5D_CHUNKED); if (status == FAIL) { sprintf(errbuf, "Cannot set the \"CHUNKED\" type of storage. \n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_STORAGE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } } /* set chunking */ /* ------------ */ if ( rank > 0 && dim != (hsize_t *)NULL) { status = H5Pset_chunk(HE5_SWXSwath[idx].plist, rank, dim); if (status == FAIL) { sprintf(errbuf, "Cannot set the sizes of chunks. \n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else if ( rank > 0 && dim == (hsize_t *)NULL) { /* Set default chunk sizes */ /* ----------------------- */ for (i = 0; i < rank; i++) dims[ i ] = HE5_CHUNKSIZE; status = H5Pset_chunk(HE5_SWXSwath[idx].plist, rank, dims); if (status == FAIL) { sprintf(errbuf, "Cannot set the sizes of chunks. \n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Invalid dataset rank,\"%d\" . \n", rank); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } switch (compcode) { /* Set NBIT compression parameters in compression external array */ /* ------------------------------------------------------------- */ case HE5_HDFE_COMP_NBIT: HE5_SWXSwath[idx].compparm[0] = compparm[0]; HE5_SWXSwath[idx].compparm[1] = compparm[1]; HE5_SWXSwath[idx].compparm[2] = compparm[2]; HE5_SWXSwath[idx].compparm[3] = compparm[3]; break; case HE5_HDFE_COMP_DEFLATE: /* ------------------------------------------------- */ /* Set compression method to H5D_COMPRESS_DEFLATE */ /* and compression level to "compparm[0]" */ /* ------------------------------------------------- */ status = H5Pset_deflate(HE5_SWXSwath[idx].plist, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set GZIP compresssion method and level. \n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* ------------------------------------------------- */ /* Set GZIP compression method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_SWXSwath[idx].compcode = compcode; HE5_SWXSwath[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SZIP_CHIP: #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_CHIP_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_CHIP compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set SZIP_CHIP compression method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_SWXSwath[idx].compcode = compcode; HE5_SWXSwath[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SZIP_K13: #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_K13 compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set SZIP_K13 compression method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_SWXSwath[idx].compcode = compcode; HE5_SWXSwath[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SZIP_EC: #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_EC_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_EC compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set SZIP_EC compression method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_SWXSwath[idx].compcode = compcode; HE5_SWXSwath[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SZIP_NN: #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_NN_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_NN compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set SZIP_NN compression method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_SWXSwath[idx].compcode = compcode; HE5_SWXSwath[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SZIP_K13orEC: #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_EC_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_K13orSZIP_EC compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set SZIP_K13orEC compression method and */ /* compression parameters in external array */ /* ------------------------------------------------- */ HE5_SWXSwath[idx].compcode = compcode; HE5_SWXSwath[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SZIP_K13orNN: #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_K13orNN compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set SZIP_K13orNN compression method and */ /* compression parameters in external array */ /* ------------------------------------------------- */ HE5_SWXSwath[idx].compcode = compcode; HE5_SWXSwath[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SHUF_DEFLATE: status = H5Pset_shuffle(HE5_SWXSwath[idx].plist); if (status == FAIL) { sprintf(errbuf, "Cannot set the shuffling method. \n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Pset_deflate(HE5_SWXSwath[idx].plist, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set GZIP compresssion method and level. \n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* ------------------------------------------------- */ /* Set shuffling+GZIP method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_SWXSwath[idx].compcode = compcode; HE5_SWXSwath[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SHUF_SZIP_CHIP: status = H5Pset_shuffle(HE5_SWXSwath[idx].plist); if (status == FAIL) { sprintf(errbuf, "Cannot set the shuffling method. \n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_CHIP_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_CHIP compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set shuffling+SZIP_CHIP method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_SWXSwath[idx].compcode = compcode; HE5_SWXSwath[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SHUF_SZIP_K13: status = H5Pset_shuffle(HE5_SWXSwath[idx].plist); if (status == FAIL) { sprintf(errbuf, "Cannot set the shuffling method. \n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_K13 compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set shuffling+SZIP_K13 method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_SWXSwath[idx].compcode = compcode; HE5_SWXSwath[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SHUF_SZIP_EC: status = H5Pset_shuffle(HE5_SWXSwath[idx].plist); if (status == FAIL) { sprintf(errbuf, "Cannot set the shuffling method. \n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_EC_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_EC compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set shuffling+SZIP_EC method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_SWXSwath[idx].compcode = compcode; HE5_SWXSwath[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SHUF_SZIP_NN: status = H5Pset_shuffle(HE5_SWXSwath[idx].plist); if (status == FAIL) { sprintf(errbuf, "Cannot set the shuffling method. \n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_NN_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_NN compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set shuffling+SZIP_NN method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_SWXSwath[idx].compcode = compcode; HE5_SWXSwath[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SHUF_SZIP_K13orEC: status = H5Pset_shuffle(HE5_SWXSwath[idx].plist); if (status == FAIL) { sprintf(errbuf, "Cannot set the shuffling method. \n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_EC_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_K13orEC compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set shuffling+SZIP_K13orEC method and */ /* compression parameters in external array */ /* ------------------------------------------------- */ HE5_SWXSwath[idx].compcode = compcode; HE5_SWXSwath[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SHUF_SZIP_K13orNN: status = H5Pset_shuffle(HE5_SWXSwath[idx].plist); if (status == FAIL) { sprintf(errbuf, "Cannot set the shuffling method. \n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_SWXSwath[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_K13orNN compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set shuffling+SZIP_K13orNN method and */ /* compression parameters in external array */ /* ------------------------------------------------- */ HE5_SWXSwath[idx].compcode = compcode; HE5_SWXSwath[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_NONE: HE5_SWXSwath[idx].compparm[0] = compparm[0]; break; default: { status = FAIL; sprintf(errbuf, "Invalid (unsupported) compression method \"%d\". \n", compcode); H5Epush(__FILE__, "HE5_SWdefcomchunk", __LINE__, H5E_ARGS, H5E_UNSUPPORTED, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } break; } } COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWdefinefield | | | | DESCRIPTION: Defines geolocation or data field within swath structure | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t swath structure ID | | fieldtype char geo/data fieldtype | | fieldname char fieldname | | dimlist char Dimension (comma-separated)list | | maxdimlist char Maximum Dimension (comma-separated) list| | numbertype hid_t field data type ID | | merge int merge code | | | | OUTPUTS: | | None | | | | NOTES: H5S_UNLIMITED is -1, not 0 => unlimited extendiable dimention | | size = -1. | | (A.M.) If maxdimlist = NULL, then dimlist string is copied to the | | maxdimlist string, and corresponding information is written to | | the metadata section. | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 8/23/99 A.Muslimov Checked for the statuse returned by H5Dclose() and | | H5Sclose(). | | 10/18/99 A.Muslimov Replaced memcpy() by memmove() to avoid a problem | | when arguments 1 and 2 overlap in memory. | | 12/3/99 A.Muslimov Added a call (see last lines) to H5Pclose(). | | 01/14/00 A.Muslimov Modified setting up of the metadata strings to | | to enable the proper functioning of calls involving | | appendable fields. | | July 00 A.Muslimov Unmasked hdf5 data types. | | Nov 00 A.Muslimov Updated a block checking if the data type is valid. | | Modified to enable appendability of any dimension. | | Aug 03 S.Zhao Added Szip compression methods. | | Oct 03 S.Zhao Added to create a character string dataset. | | Mar 04 S.Zhao Modified for a character string dataset. | | Apr 04 S.Zhao Modified for a character string dataset. | | May 05 S.Zhao Added HE5_EHdtype2numtype() function call. | | Sep 11 Abe Taaheri Modified for correcting Unlimited dimension | | behavior and extension, removing hardcoded name | | Unlim | | | | END_PROLOG | -----------------------------------------------------------------------------*/ static herr_t HE5_SWdefinefield(hid_t swathID, char *fieldtype, const char *fieldname, char *dimlist, char *maxdimlist, hid_t numbertype, int merge) { herr_t status = FAIL; /* Return status variable */ int i = 0; /* Loop index */ int foundAllDim = 1; /* found all dimensions flag */ int append = FALSE;/* "Is field appendable?" flag */ int first = 1; /* first entry flag */ int fac = 0; /* Data (1)/Geo (2) Field flag */ int compcode = FAIL; /* Compression code */ int rank = 0; /* Field rank */ int maxrank = 0; /* max dim rank */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t data_space = FAIL;/* dataspace ID */ hid_t dataset = FAIL;/* dataset ID */ hid_t heos_gid = FAIL;/* "SWATHS" group ID */ hsize_t metavalue = 0; /* Metavalue to insert */ hsize_t dims[HE5_DTSETRANKMAX]; /* Dimension size array */ hsize_t maxdims[HE5_DTSETRANKMAX];/* Dimension size array */ hsize_t dimsize = 0; /* Dimension size */ hsize_t count[] = { 1 }; /* number of elements to insert */ long idx = FAIL; /* Swath index */ H5D_layout_t layout = H5D_LAYOUT_ERROR; /* Storage layout for raw data */ void *value; size_t tsize = 0; /* Size of a datatype in bytes */ hid_t ntype = FAIL; /* number type ID */ int attr = 0; /* attribute value */ hid_t numtype = FAIL; H5D_fill_value_t fill_status; /* to see if fill value is set or not */ char *dimbuf = (char *)NULL; /* Dimension buffer */ char *comma = (char *)NULL; /* Pointer to comma */ char *dimcheck = (char *)NULL; /* Dimension check buffer */ char utlbuf[HE5_HDFE_UTLBUFSIZE]; /* Utility buffer */ char utlbuf2[HE5_HDFE_UTLBUFSIZE]; /* Utility buffer 2 */ char errbuf1[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer 1 */ char errbuf2[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer 2 */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ char maxdimlstbuf[HE5_HDFE_DIMBUFSIZE]; char dimlstbuf[HE5_HDFE_DIMBUFSIZE]; char compparmbuf[HE5_HDFE_DIMBUFSIZE];/* Compression parmeter */ char *HDFcomp[18] = {"HE5_HDFE_COMP_NONE", "HE5_HDFE_COMP_RLE", "HE5_HDFE_COMP_NBIT", "HE5_HDFE_COMP_SKPHUFF", "HE5_HDFE_COMP_DEFLATE", "HE5_HDFE_COMP_SZIP_CHIP", "HE5_HDFE_COMP_SZIP_K13", "HE5_HDFE_COMP_SZIP_EC", "HE5_HDFE_COMP_SZIP_NN", "HE5_HDFE_COMP_SZIP_K13orEC", "HE5_HDFE_COMP_SZIP_K13orNN", "HE5_HDFE_COMP_SHUF_DEFLATE", "HE5_HDFE_COMP_SHUF_SZIP_CHIP", "HE5_HDFE_COMP_SHUF_SZIP_K13", "HE5_HDFE_COMP_SHUF_SZIP_EC", "HE5_HDFE_COMP_SHUF_SZIP_NN", "HE5_HDFE_COMP_SHUF_SZIP_K13orEC", "HE5_HDFE_COMP_SHUF_SZIP_K13orNN"}; /* Compression code names */ CHECKNAME(fieldname); CHECKPOINTER(fieldtype); CHECKPOINTER(dimlist); /* Setup error message strings */ /* --------------------------- */ strcpy(errbuf1, "HE5_SWXSDname array too small.\nPlease increase "); strcat(errbuf1, "size of HE5_HDFE_NAMBUFSIZE in \"HE5_HdfEosDef.h\".\n"); strcpy(errbuf2, "HE5_SWXSDdims array too small.\nPlease increase "); strcat(errbuf2, "size of HE5_HDFE_DIMBUFSIZE in \"HE5_HdfEosDef.h\".\n"); /* assuming that fillvalue is undefined for the field */ fill_status = H5D_FILL_VALUE_UNDEFINED; /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWdefinefield", &fid, &heos_gid, &idx); if(status == FAIL ) return(status); /* initialize dims and maxdims array */ /* --------------------------------- */ for(i = 0; i < HE5_DTSETRANKMAX; i++) { dims[i] = 0; maxdims[i] = 0; } /* Allocate space for dimbuf, copy dimlist into it, & append comma */ /* --------------------------------------------------------------- */ dimbuf = (char *) calloc(strlen(dimlist) + 64, sizeof(char)); if(dimbuf == NULL) { H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory. \n"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); return(FAIL); } /* ******************************************************************** * C H E C K T H E C O N T E N T O F dimlist S T R I N G * ******************************************************************** */ strcpy(dimbuf, dimlist); strcat(dimbuf, ","); /* Find comma */ /* ---------- */ comma = strchr(dimbuf, ','); /* * Loop through entries in dimension list to make sure they are * defined in swath */ while (comma != NULL) { /* Copy dimension list entry to dimcheck */ /* ------------------------------------- */ dimcheck = (char *) calloc(comma - dimbuf + 1, sizeof(char)); if(dimcheck == NULL) { H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory. \n"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); free(dimbuf); return(FAIL); } memmove(dimcheck, dimbuf, comma - dimbuf); /* Get dimension size */ /* ------------------ */ dimsize = HE5_SWdiminfo(swathID, dimcheck); if (dimsize > 0) { dims[rank] = dimsize; rank++; } else { /* * If dimension list entry not found - set error return * status, append name to utility buffer for error report */ status = FAIL; foundAllDim = 0; if (first == 1) strcpy(utlbuf, dimcheck); else { strcat(utlbuf, ","); strcat(utlbuf, dimcheck); } first = 0; } /* * Go to next dimension entry, find next comma, & free up * dimcheck buffer */ memmove(dimbuf, comma + 1, strlen(comma + 1) + 1); comma = strchr(dimbuf, ','); free(dimcheck); } free(dimbuf); /* If no dimensions found, report error */ /* ------------------------------------ */ if (foundAllDim == 0) { status = FAIL; sprintf(errbuf, "Dimension(s) \"%s\" not found for \"%s\" field. \n", utlbuf, fieldname); H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return (status); } /* ************************************************************************ * C H E C K T H E C O N T E N T O F maxdimlist S T R I N G * ************************************************************************ */ /* Allocate space for dimbuf, copy maxdimlist into it, & append comma */ /* ------------------------------------------------------------------ */ if(maxdimlist != NULL) { dimbuf = (char *) calloc(strlen(maxdimlist) + 64, sizeof(char)); if(dimbuf == NULL) { H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory. \n"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); return(FAIL); } /* Copy "maxdimlist" to "dimbuf", & append comma */ /* --------------------------------------------- */ strcpy(dimbuf, maxdimlist); strcat(dimbuf, ","); /* Find comma */ /* ---------- */ comma = strchr(dimbuf, ','); /* * Loop through entries in dimension list to make sure they are * defined in swath */ while (comma != NULL) { /* Copy dimension list entry to dimcheck */ /* ------------------------------------- */ dimcheck = (char *) calloc(comma - dimbuf + 1, sizeof(char)); if(dimcheck == NULL) { H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory. \n"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); free(dimbuf); return(FAIL); } memmove(dimcheck, dimbuf, comma - dimbuf); /* Get dimension size */ /* ------------------ */ dimsize = HE5_SWdiminfo(swathID, dimcheck); if ( (dimsize > 0) || (dimsize == H5S_UNLIMITED) ) { maxdims[maxrank] = dimsize; maxrank++; } else { /* * If dimension list entry not found - set error return * status, append name to utility buffer for error report */ status = FAIL; foundAllDim = 0; if (first == 1) strcpy(utlbuf, dimcheck); else { strcat(utlbuf, ","); strcat(utlbuf, dimcheck); } first = 0; } /* * Go to next dimension entry, find next comma, & free up * dimcheck buffer */ memmove(dimbuf, comma + 1, strlen(comma + 1) + 1); comma = strchr(dimbuf, ','); free(dimcheck); } free(dimbuf); /* If no dimensions found, report error */ /* ------------------------------------ */ if (foundAllDim == 0) { status = FAIL; sprintf(errbuf, "Dimension(s) \"%s\" not found for \"%s\" field. \n", utlbuf, fieldname); H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return (status); } /* If maxrank !=rank then report error */ /* ------------------------------------ */ if ( maxrank != rank ) { status = FAIL; sprintf(errbuf,"Dimension rank doesn't match Maximum dimension rank. \n"); H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return (status); } } /* "maxlist == NULL" ==> maxdims[]= dims[] */ /* ---------------------------------------- */ else { for(i = 0; i < rank; i++ ) maxdims[ i ] = dims[ i ]; } /* Find out if the dataset dimension is appendable */ /* ----------------------------------------------- */ for(i = 0; i < rank; i++) { if( dims[i] == maxdims[i] ) append = FALSE; else if ( (dims[i] < maxdims[i]) || (maxdims[i] == H5S_UNLIMITED)) { append = TRUE; break; } else { status = FAIL; H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_ARGS, H5E_BADRANGE, "Maximum dimension size is smaller than Dimension size. \n"); HE5_EHprint("Error: Maximum dimension size is smaller than Dimension size, occured", __FILE__, __LINE__); return(status); } } /* Check for valid data type ID ("numbertype") */ /* ------------------------------------------- */ if (numbertype != HE5T_CHARSTRING) { if ( H5Tequal(numbertype, H5T_NATIVE_CHAR) == FALSE && H5Tequal(numbertype, H5T_NATIVE_SCHAR) == FALSE && H5Tequal(numbertype, H5T_NATIVE_UCHAR) == FALSE && H5Tequal(numbertype, H5T_NATIVE_SHORT) == FALSE && H5Tequal(numbertype, H5T_NATIVE_USHORT) == FALSE && H5Tequal(numbertype, H5T_NATIVE_INT) == FALSE && H5Tequal(numbertype, H5T_NATIVE_UINT) == FALSE && H5Tequal(numbertype, H5T_NATIVE_LONG) == FALSE && H5Tequal(numbertype, H5T_NATIVE_ULONG) == FALSE && H5Tequal(numbertype, H5T_NATIVE_LLONG) == FALSE && H5Tequal(numbertype, H5T_NATIVE_ULLONG) == FALSE && H5Tequal(numbertype, H5T_NATIVE_FLOAT) == FALSE && H5Tequal(numbertype, H5T_NATIVE_DOUBLE) == FALSE && H5Tequal(numbertype, H5T_NATIVE_LDOUBLE)== FALSE && H5Tequal(numbertype, H5T_C_S1) == FALSE ) { H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, "Invalid (unsupported) data type. \n"); HE5_EHprint("Error: Invalid (unsupported) data type, occured", __FILE__, __LINE__); return(FAIL); } } /* Get the field group ID */ /*----------------------- */ if (strcmp(fieldtype, "Data Fields") == 0) { gid = HE5_SWXSwath[idx].data_id; fac = 1; } else if (strcmp(fieldtype, "Geolocation Fields") == 0) { gid = HE5_SWXSwath[idx].geo_id; fac = 2; } else { sprintf(errbuf,"Invalid (unsupported) field group. \n"); H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return (FAIL); } /* Create dataspace then create dataset */ /*------------------------------------ */ if( HE5_SWXSwath[idx].plist == FAIL ) { HE5_SWXSwath[idx].plist = H5Pcreate(H5P_DATASET_CREATE); } /* Get dataset layout */ /* ------------------ */ layout = H5Pget_layout(HE5_SWXSwath[idx].plist); if( layout == H5D_LAYOUT_ERROR) { H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_ARGS, H5E_BADVALUE, "Cannot get dataset layout.\n"); HE5_EHprint("Error: Cannot get dataset layout, occured", __FILE__, __LINE__); return(FAIL); } if(append == FALSE) data_space = H5Screate_simple(rank, dims, NULL); else { if( layout == H5D_CHUNKED) data_space = H5Screate_simple(rank, dims, maxdims); else { status = FAIL; H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_ARGS, H5E_BADVALUE, "Appendable dataset MUST BE CHUNKED first.\n"); HE5_EHprint("Error: Appendable dataset MUST BE CHUNKED first, occured", __FILE__, __LINE__); return(status); } } /* Get current compression code */ /* ---------------------------- */ compcode = HE5_SWXSwath[idx].compcode; /* Note: in inquiry routines HE5T_CHARSTRING is distinguished from HE5T_NATIVE_CHAR for the field data (not attributes) based on whether string has variable or fixed length as set below. The field data of type HE5T_NATIVE_CHAR has fixed length of 1, and the field is array of characters, not strings. However, HE5T_CHARSTRING sets array of vaiable length strings for the field data. Currently HE5_EHattr treats HE5T_NATIVE_CHAR, HE5T_CHARSTRING, and H5T_C_S1 as fixed (any size) for attributes. */ ntype = numbertype; if ((numbertype == HE5T_CHARSTRING) || (numbertype == H5T_C_S1)) { ntype = H5Tcopy(H5T_C_S1); status = H5Tset_size(ntype, H5T_VARIABLE); if( status == FAIL) { sprintf(errbuf, "Cannot set HDF5 datatype size for \"%s\" field. \n", fieldname); H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Create dataset */ /* -------------- */ dataset = H5Dcreate(gid, fieldname, ntype, data_space, HE5_SWXSwath[idx].plist); if (dataset == FAIL) { status = FAIL; sprintf(errbuf, "Cannot create dataset for \"%s\" field. \n", fieldname); H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else if (numbertype == H5T_NATIVE_CHAR) { ntype = H5Tcopy(H5T_C_S1); status = H5Tset_size(ntype, 1); if( status == FAIL) { sprintf(errbuf, "Cannot set HDF5 datatype size for \"%s\" field. \n", fieldname); H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Create dataset */ /* -------------- */ dataset = H5Dcreate(gid, fieldname, ntype, data_space, HE5_SWXSwath[idx].plist); if (dataset == FAIL) { status = FAIL; sprintf(errbuf, "Cannot create dataset for \"%s\" field. \n", fieldname); H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { /* Create dataset */ /* -------------- */ dataset = H5Dcreate(gid, fieldname, numbertype, data_space, HE5_SWXSwath[idx].plist); if (dataset == FAIL) { status = FAIL; sprintf(errbuf, "Cannot create dataset for \"%s\" field. \n", fieldname); H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } /* Extend the dataset. assure that dataset is at least dims */ /* -------------------------------------------------------- */ if( append == TRUE) { status = H5Dextend(dataset,dims); if (status == FAIL) { sprintf(errbuf, "Cannot extend the dataset for \"%s\" field.\n", fieldname); H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } /* load external array */ /* ------------------- */ if ( fac == 2 ) /*"Geo fields"*/ { /* Store dataset IDs and dataset name */ /* ---------------------------------- */ if (HE5_SWXSwath[idx].nGFLD > 0) { /* allocate memory to gdataset struct */ /* ---------------------------------- */ HE5_SWXSwath[idx].gdataset = (HE5_DTSinfo *)realloc((void *)HE5_SWXSwath[idx].gdataset, (HE5_SWXSwath[idx].nGFLD + 1) * sizeof(HE5_DTSinfo)); } else { HE5_SWXSwath[idx].gdataset = (HE5_DTSinfo *)calloc(1, sizeof(HE5_DTSinfo)); if (HE5_SWXSwath[idx].gdataset == NULL ) { status = FAIL; H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory. \n"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); return(status); } } /* Allocate memory to name */ /* ----------------------- */ HE5_SWXSwath[idx].gdataset[HE5_SWXSwath[idx].nGFLD].name = (char *)calloc( (strlen(fieldname)+1), sizeof(char) ); if (HE5_SWXSwath[idx].gdataset[HE5_SWXSwath[idx].nGFLD].name == NULL) { status = FAIL; H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory.\n"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); return(status); } /* Load table */ /* ---------- */ HE5_SWXSwath[idx].gdataset[HE5_SWXSwath[idx].nGFLD].ID = dataset; strcpy(HE5_SWXSwath[idx].gdataset[HE5_SWXSwath[idx].nGFLD].name, fieldname); HE5_SWXSwath[idx].nGFLD++; } else /* "Data Fields" */ { /* store dataset IDs and dataset name */ /* ---------------------------------- */ if (HE5_SWXSwath[idx].nDFLD > 0) { /* Allocate memory to ddataset struct */ /* ---------------------------------- */ HE5_SWXSwath[idx].ddataset = (HE5_DTSinfo *)realloc((void *)HE5_SWXSwath[idx].ddataset,(HE5_SWXSwath[idx].nDFLD + 1) * sizeof(HE5_DTSinfo)); } else { HE5_SWXSwath[idx].ddataset = (HE5_DTSinfo *)calloc(1, sizeof(HE5_DTSinfo)); if (HE5_SWXSwath[idx].ddataset == NULL ) { status = FAIL; H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory. \n"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); return(status); } } /* Allocate memory to name */ /* ----------------------- */ HE5_SWXSwath[idx].ddataset[HE5_SWXSwath[idx].nDFLD].name = (char *)calloc( (strlen(fieldname)+1), sizeof(char) ); if (HE5_SWXSwath[idx].ddataset[HE5_SWXSwath[idx].nDFLD].name == NULL) { status = FAIL; H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory.\n"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); return(status); } /* load table */ /* ---------- */ HE5_SWXSwath[idx].ddataset[HE5_SWXSwath[idx].nDFLD].ID = dataset; strcpy(HE5_SWXSwath[idx].ddataset[HE5_SWXSwath[idx].nDFLD].name, fieldname); HE5_SWXSwath[idx].nDFLD++; } if ((numbertype != HE5T_CHARSTRING) && (numbertype != H5T_NATIVE_CHAR) && (numbertype != H5T_C_S1)) { /* Get the size of a datatype in bytes */ /* ----------------------------------- */ tsize = H5Tget_size( numbertype); if( tsize == 0) { sprintf(errbuf, "Cannot get the size of a datatype. \n"); H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return (FAIL); } /* allocate memory for "fill" value */ /* -------------------------------- */ value = (void *)calloc(1, tsize); if( value == (void *)NULL) { sprintf(errbuf, "Cannot allocate memory for fill value.\n"); H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return (FAIL); } /* Try to retrieve the fill value (in case it's already defined) */ /* ------------------------------------------------------------- */ H5E_BEGIN_TRY { status = H5Pfill_value_defined(HE5_SWXSwath[idx].plist, &fill_status ); } H5E_END_TRY; if (fill_status == H5D_FILL_VALUE_USER_DEFINED) { H5E_BEGIN_TRY { status = H5Pget_fill_value(HE5_SWXSwath[idx].plist, numbertype, value); } H5E_END_TRY; /* Store fill value in the dataset attribute "_FillValue" */ /* ----------------------------------------------------- */ if( status != FAIL) { status = HE5_EHattr( dataset, "_FillValue", numbertype, count, "w", value); if( status == FAIL ) { sprintf(errbuf, "Cannot store fill value in the attribute \"_FillValue\"."); H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(value); return (status); } } } free( value); } /* ****************************************************************** * SET UP METADATA STRINGS * ****************************************************************** */ /* set up "DimList" string content */ /* ------------------------------- */ strcpy(utlbuf,""); sprintf(utlbuf, "%s%s%s", fieldname,":",dimlist); /* set up "MaxdimList" string content */ /* ----------------------------------- */ if ( maxdimlist != NULL) { status = HE5_EHmetalist(maxdimlist,maxdimlstbuf); if (status == FAIL) { sprintf(errbuf, "Cannot convert the input \"%s\" list to the metadata list. \n", maxdimlist); H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return (status); } sprintf(utlbuf2,"%s%s",":\n\t\t\t\tMaxdimList=", maxdimlstbuf); strcat(utlbuf,utlbuf2); } if (maxdimlist == NULL) { status = HE5_EHmetalist(dimlist,dimlstbuf); if (status == FAIL) { sprintf(errbuf, "Cannot convert the input \"%s\" list to the metadata list.\n", dimlist); H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return (status); } sprintf(utlbuf2,"%s%s",":\n\t\t\t\tMaxdimList=", dimlstbuf); strcat(utlbuf,utlbuf2); } /* setup "CompressionType" & "CompressionParams" strings content */ /* ------------------------------------------------------------- */ if (compcode != HE5_HDFE_COMP_NONE) { sprintf(utlbuf2,"%s%s","\n\t\t\t\tCompressionType=", HDFcomp[compcode]); switch (compcode) { case HE5_HDFE_COMP_NBIT: sprintf(compparmbuf, "%s%d,%d,%d,%d%s", "\n\t\t\t\tCompressionParams=(", HE5_SWXSwath[idx].compparm[0], HE5_SWXSwath[idx].compparm[1], HE5_SWXSwath[idx].compparm[2], HE5_SWXSwath[idx].compparm[3], ")"); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_DEFLATE: sprintf(compparmbuf,"%s%d","\n\t\t\t\tDeflateLevel=", HE5_SWXSwath[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SZIP_CHIP: sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SZIP_K13: sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SZIP_EC: sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SZIP_NN: sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SZIP_K13orEC: sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SZIP_K13orNN: sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SHUF_DEFLATE: sprintf(compparmbuf,"%s%d","\n\t\t\t\tDeflateLevel=", HE5_SWXSwath[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SHUF_SZIP_CHIP: sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SHUF_SZIP_K13: sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SHUF_SZIP_EC: sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SHUF_SZIP_NN: sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SHUF_SZIP_K13orEC: sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SHUF_SZIP_K13orNN: sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; default: { sprintf(errbuf,"Compression code \"%d\" is not supported. \n", compcode); H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_ARGS, H5E_UNSUPPORTED, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } break; } /* Concatanate compression parameters with compression code */ /* -------------------------------------------------------- */ strcat(utlbuf, utlbuf2); } /* ****************************************************************** * Insert metadata information to Structural Metadata section * ****************************************************************** */ numtype = HE5_EHdtype2numtype(numbertype); if (numtype == FAIL) { sprintf(errbuf, "Cannot get the number type ID. \n"); H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } else if (numtype == 0) { metavalue = 0; } else { metavalue = HE5_EHhid2hsize(numtype); if (metavalue == 0) { sprintf(errbuf, "Cannot convert \"hid_t\" to \"hsize_t\" data type. \n"); H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } if (strcmp(fieldtype, "Geolocation Fields") == 0) status = HE5_EHinsertmeta(fid, HE5_SWXSwath[idx].swname, "s", 3L, utlbuf, &metavalue); else status = HE5_EHinsertmeta(fid, HE5_SWXSwath[idx].swname, "s", 4L, utlbuf, &metavalue); if (status == FAIL) { sprintf(errbuf, "Cannot insert metadata for \"%s\" field.\n", fieldname); H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release data space ID */ /* --------------------- */ status = H5Sclose(data_space); if (status == FAIL) { H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, "Cannot release the data space ID.\n"); HE5_EHprint("Error: Cannot release the data space ID, occured", __FILE__, __LINE__); return(status); } /* Release property list ID */ /* ------------------------ */ status = H5Pclose(HE5_SWXSwath[idx].plist); if (status == FAIL) { H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_PLIST, H5E_CLOSEERROR, "Cannot release the property list ID.\n"); HE5_EHprint("Error: Cannot release the property list ID, occured", __FILE__, __LINE__); return(status); } /* Reset external array entry for next dataset creation */ /* ==================================================== */ HE5_SWXSwath[idx].plist = FAIL; HE5_SWXSwath[idx].compcode = HE5_HDFE_COMP_NONE; if ((numbertype == HE5T_CHARSTRING) || (numbertype == H5T_C_S1)) { attr = HE5T_CHARSTRING; status = HE5_SWwritelocattr(swathID, fieldname, "ARRAYOFSTRINGS", H5T_NATIVE_INT, count, &attr); if (status == FAIL) { sprintf(errbuf, "Cannot write attribute to the field \"%s\".",fieldname) ; H5Epush(__FILE__, "HE5_SWdefinefield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWdefgeofield | | | | DESCRIPTION: Defines geolocation field within swath structure (wrapper) | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | July 00 A.Muslimov Unmasked hdf5 data types. | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWdefgeofield(hid_t swathID, const char *fieldname, char *dimlist, char *maxdimlist, hid_t numbertype_in , int merge) { herr_t status = FAIL; /* Return status variable */ hid_t numbertype; char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKNAME(fieldname); CHECKPOINTER(dimlist); /* Convert HDF-EOS5 datatype to HDF5 datatype */ if ( H5Tequal(numbertype_in, H5T_NATIVE_CHAR) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_SCHAR) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_UCHAR) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_SHORT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_USHORT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_INT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_UINT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_LONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_ULONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_LLONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_ULLONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_FLOAT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_DOUBLE) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_LDOUBLE)== TRUE || H5Tequal(numbertype_in, H5T_C_S1) == TRUE) { numbertype = numbertype_in; } else { numbertype = HE5_EHconvdatatype((int) numbertype_in); } if(numbertype == FAIL) { sprintf(errbuf,"Cannot convert to HDF5 type data type ID for Geolocation Field.\n"); H5Epush(__FILE__, "HE5_SWdefdatafield", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Call HE5_SWdefinefield routine */ /* ============================== */ status = HE5_SWdefinefield(swathID, "Geolocation Fields", fieldname, dimlist, maxdimlist, numbertype, merge); COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWdefdatafield | | | | DESCRIPTION: Defines data field within swath structure (wrapper) | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | July 00 A.Muslimov Unmasked hdf5 data types. | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWdefdatafield(hid_t swathID, const char *fieldname, char *dimlist, char *maxdimlist, hid_t numbertype_in, int merge) { herr_t status = FAIL; /* routine return status variable */ hid_t numbertype; char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKNAME(fieldname); CHECKPOINTER(dimlist); /* Convert HDF-EOS5 datatype to HDF5 datatype */ if ( H5Tequal(numbertype_in, H5T_NATIVE_CHAR) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_SCHAR) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_UCHAR) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_SHORT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_USHORT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_INT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_UINT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_LONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_ULONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_LLONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_ULLONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_FLOAT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_DOUBLE) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_LDOUBLE)== TRUE || H5Tequal(numbertype_in, H5T_C_S1) == TRUE) { numbertype = numbertype_in; } else { numbertype = HE5_EHconvdatatype((int) numbertype_in); } if(numbertype == FAIL) { sprintf(errbuf,"Cannot convert to HDF5 type data type ID for Data Field.\n"); H5Epush(__FILE__, "HE5_SWdefdatafield", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Call HE5_SWdefinefield routine */ /* ============================== */ status = HE5_SWdefinefield(swathID, "Data Fields", fieldname, dimlist,maxdimlist,numbertype, merge); COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWwritedatameta | | | | DESCRIPTION: Defines structural metadata for pre-existing data | | field within swath structure | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t Swath object ID | | fieldname char fieldname | | dimlist char Dimension list (comma-separated list) | | mvalue hid_t metavalue to insert | | | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | July 00 A.Muslimov Unmasked hdf5 data types. | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | May 05 S.Zhao Added HE5_EHdtype2numtype() function call. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWwritedatameta(hid_t swathID, const char *fieldname, char *dimlist, hid_t mvalue) { herr_t status = FAIL; /* Return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hsize_t metavalue = 0; /* Metavalue to insert */ long idx = FAIL; /* Swath index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ char utlbuf[HE5_HDFE_DIMBUFSIZE];/* Utility buffer */ hid_t numtype = FAIL; /* Number type ID */ HE5_LOCK; CHECKNAME(fieldname); CHECKPOINTER(dimlist); numtype = HE5_EHdtype2numtype(mvalue); if (numtype == FAIL) { sprintf(errbuf, "Cannot get the number type ID. \n"); H5Epush(__FILE__, "HE5_SWwritedatameta", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } else if (numtype == 0) { metavalue = 0; } else { /* Convert 'numtype' to 'metavalue' */ /* -------------------------------- */ metavalue = HE5_EHhid2hsize(numtype); if ( metavalue == 0 ) { sprintf(errbuf, "Cannot convert metadata value. \n"); H5Epush(__FILE__, "HE5_SWwritedatameta", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWwritedatameta", &fid, &gid, &idx); if (status == SUCCEED) { /* Setup and write field metadata */ /* ------------------------------ */ sprintf(utlbuf, "%s%s%s", fieldname, ":", dimlist); status = HE5_EHinsertmeta(gid, HE5_SWXSwath[idx].swname, "s", 4L, utlbuf, &metavalue); if ( status == FAIL ) { sprintf(errbuf, "Cannot insert metadata value. \n"); H5Epush(__FILE__, "HE5_SWwritedatameta", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWwritegeometa | | | | DESCRIPTION: Defines structural metadata for pre-existing data | | field within swath structure | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t Swath object ID | | fieldname char fieldname | | dimlist char Dimension list (comma-separated list) | | mvalue hid_t metadata value to write | | | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | July 00 A.Muslimov Unmasked hdf5 data types. | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | May 05 S.Zhao Added HE5_EHdtype2numtype() function call. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWwritegeometa(hid_t swathID, const char *fieldname, char *dimlist, hid_t mvalue) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hsize_t metavalue = 0; /* Metavalue to insert */ long idx = FAIL;/* Swath index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ char utlbuf[HE5_HDFE_DIMBUFSIZE];/* Utility buffer */ hid_t numtype = FAIL; /* Number type ID */ HE5_LOCK; CHECKNAME(fieldname); CHECKPOINTER(dimlist); numtype = HE5_EHdtype2numtype(mvalue); if (numtype == FAIL) { sprintf(errbuf, "Cannot get the number type ID. \n"); H5Epush(__FILE__, "HE5_SWwritegeometa", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } else if (numtype == 0) { metavalue = 0; } else { /* Convert 'numtype' to 'metavalue' */ /* -------------------------------- */ metavalue = HE5_EHhid2hsize(numtype); if ( metavalue == 0 ) { sprintf(errbuf, "Cannot convert metadata value. \n"); H5Epush(__FILE__, "HE5_SWwritegeometa", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWwritegeometa", &fid, &gid, &idx); if (status == SUCCEED) { /* Setup and write field metadata */ /* ------------------------------ */ sprintf(utlbuf, "%s%s%s", fieldname, ":", dimlist); status = HE5_EHinsertmeta(gid, HE5_SWXSwath[idx].swname, "s", 3L, utlbuf, &metavalue); if ( status == FAIL ) { sprintf(errbuf, "Cannot insert metadata value. \n"); H5Epush(__FILE__, "HE5_SWwritegeometa", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWwriteattr | | | | DESCRIPTION: Writes/updates attribute in a swath. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t Swath structure ID | | attrname char attribute name | | numtype hid_t attribute dataset datatype ID | | count[] hsize_t Number of attribute elements | | datbuf void I/O buffer | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | July 00 A.Muslimov Unmasked hdf5 data types. | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWwriteattr(hid_t swathID, const char *attrname, hid_t numtype, hsize_t count[], void *datbuf) { herr_t status = FAIL; /* Return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ long idx = FAIL; /* Swath index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ hid_t numbertype; HE5_LOCK; CHECKNAME(attrname); CHECKPOINTER(count); CHECKPOINTER(datbuf); /* if numtype is HE5 numbertype, rather than H5 numbertype, then convert it, otherwise use numtype itself */ numbertype = HE5_EHconvdatatype(numtype); if(numbertype == FAIL) { numbertype = numtype; } /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWwriteattr", &fid, &gid, &idx); if (status == SUCCEED) { /* Call HE5_EHattr to perform I/O */ /* ------------------------------ */ status = HE5_EHattr(HE5_SWXSwath[idx].sw_id, attrname, numbertype, count,"w", datbuf); if ( status == FAIL ) { sprintf(errbuf, "Cannot write the attribute value. \n"); H5Epush(__FILE__, "HE5_SWwriteattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWrdadattr | | | | DESCRIPTION: Reads attribute from a swath. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t Swath structure ID | | attrname char attribute name | | | | OUTPUTS: | | datbuf void I/O buffer | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | July 00 A.Muslimov Unmasked hdf5 data types. | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWreadattr(hid_t swathID, const char *attrname, void *datbuf) { herr_t status = FAIL; /* Return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t ntype = FAIL; /* Data type ID */ long idx = FAIL; /* Swath index */ hsize_t count[] ={0}; /* Number of elements */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKPOINTER(attrname); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWreadattr", &fid, &gid, &idx); if (status == SUCCEED) { /* Call HE5_EHattr to perform I/O */ /* ------------------------------ */ status = HE5_EHattr(HE5_SWXSwath[idx].sw_id, attrname, ntype, count,"r", datbuf); if ( status == FAIL ) { sprintf(errbuf, "Cannot read the attribute value. \n"); H5Epush(__FILE__, "HE5_SWreadattr", __LINE__, H5E_ATTR, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWattrinfo | | | | DESCRIPTION: | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t Swath structure ID | | attrname const char* attribute name | | | | OUTPUTS: | | ntype hid_t Data type ID | | count hsize_t Number of attribute elements | | | | NOTES: | | | | | | Date Programmer Description | | ======== ============ ================================================= | | 05/10/00 A.Muslimov Replaced 'H5T_class_t' type by 'int' data type. | | July 00 A.Muslimov Unmasked hdf5 data types. | | Feb 03 S.Zhao Changed the type of 'ntype' from an H5T_class_t | | to an hid_t. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWattrinfo(hid_t swathID, const char *attrname, hid_t *ntype, hsize_t *count) { herr_t status = FAIL; /* Return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ long idx = FAIL; /* Swath index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ CHECKPOINTER(attrname); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWattrinfo", &fid, &gid, &idx); if (status == SUCCEED) { /* Get attribute group ID and call HE5_EHattrinfo */ /* ---------------------------------------------- */ status = HE5_EHattrinfo(HE5_SWXSwath[idx].sw_id, attrname, ntype, count); if ( status == FAIL ) { sprintf(errbuf, "Cannot retrieve information about attribute. \n"); H5Epush(__FILE__, "HE5_SWattrinfo", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWattrinfo2 | | | | DESCRIPTION: | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t Swath structure ID | | attrname const char* attribute name | | | | OUTPUTS: | | ntype hid_t Data type ID | | count hsize_t Number of attribute elements | | size hsize_t buf size of attribute elements | | | | NOTES: | | | | | | Date Programmer Description | | ======== ============ ================================================= | | 05/10/00 A.Muslimov Replaced 'H5T_class_t' type by 'int' data type. | | July 00 A.Muslimov Unmasked hdf5 data types. | | Feb 03 S.Zhao Changed the type of 'ntype' from an H5T_class_t | | to an hid_t. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWattrinfo2(hid_t swathID, const char *attrname, hid_t *ntype, hsize_t *count, hsize_t *size) { herr_t status = FAIL; /* Return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ long idx = FAIL; /* Swath index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ CHECKPOINTER(attrname); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWattrinfo", &fid, &gid, &idx); if (status == SUCCEED) { /* Get attribute group ID and call HE5_EHattrinfo */ /* ---------------------------------------------- */ status = HE5_EHattrinfo2(HE5_SWXSwath[idx].sw_id, attrname, ntype, count, size); if ( status == FAIL ) { sprintf(errbuf, "Cannot retrieve information about attribute. \n"); H5Epush(__FILE__, "HE5_SWattrinfo2", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWinqattrs | | | | DESCRIPTION: | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nattr long Number of attributes in swath struct | | | | INPUTS: | | swath ID hid_t Swath structure ID | | | | OUTPUTS: | | attrnames char Attribute names in swath struct | | (Comma-separated list) | | strbufsize long Attributes name list string length | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | July 00 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_SWinqattrs(hid_t swathID, char *attrnames, long *strbufsize) { long nattr = FAIL;/* Number of attributes (return) */ long idx = FAIL;/* Swath index */ herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* swath group ID */ char *grpname = (char *)NULL;/* Group name string */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWinqattrs", &fid, &gid, &idx); if(status == SUCCEED ) { grpname = (char *)calloc( HE5_HDFE_NAMBUFSIZE, sizeof(char) ); if( grpname == NULL) { H5Epush(__FILE__, "HE5_SWinqattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); return(FAIL); } strcpy(grpname,"/HDFEOS/SWATHS/"); strcat(grpname, HE5_SWXSwath[idx].swname); nattr = HE5_EHattrcat(fid, grpname, attrnames, strbufsize); if ( nattr == FAIL ) { sprintf(errbuf, "Cannot find the attributes. \n"); H5Epush(__FILE__, "HE5_SWinqattrs", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); } if (grpname != NULL) free(grpname); } return (nattr); } #define REMQUOTE \ \ memmove(utlstr, utlstr + 1, strlen(utlstr) - 2); \ utlstr[strlen(utlstr) - 2] = 0; /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWinqdims | | | | DESCRIPTION: Returns dimension names and values defined in swath structure | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nDim long Number of defined dimensions | | | | INPUTS: | | swathID hid_t Swath structure ID | | | | OUTPUTS: | | dimnames char Dimension names (comma-separated) | | dims hsize_t Dimension values | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 3/22/99 | | 7/29/99 A.Muslimov In the call to EHmetagroup() replace gid by fid. | | July 00 A.Muslimov Unmasked hdf5 data types. | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_SWinqdims(hid_t swathID, char *dimnames, hsize_t dims[]) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ long idx = FAIL;/* Swath index */ long nDim = 0; /* Number of dimensions */ hsize_t size = 0; /* Dimension size */ char *metabuf = (char *)NULL; /* Pointer to SM */ char *metaptrs[2]={NULL,NULL}; /* Ptrs to start/end of SM */ char utlstr[HE5_HDFE_UTLBUFSIZE]; /* Utility string */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWinqdims", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for Swath ID failed.\n"); H5Epush(__FILE__, "HE5_SWinqdims", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* If dimension names or sizes are desired ... */ /* ------------------------------------------- */ if (dimnames != NULL || dims != NULL) { /* Get pointers to "Dimension" section within SM */ /* --------------------------------------------- */ metabuf = (char *)HE5_EHmetagroup(fid, HE5_SWXSwath[idx].swname, "s", "Dimension", metaptrs); /* If dimension names are desired then "clear" name buffer */ /* ------------------------------------------------------- */ if (dimnames != NULL) dimnames[0] = 0; /* Begin loop through dimension entries in metadata */ /* ------------------------------------------------ */ while (1) { /* Search for OBJECT string */ /* ------------------------ */ metaptrs[0] = strstr(metaptrs[0], "\t\tOBJECT="); /* If found within "Dimension" metadata section ... */ /* ------------------------------------------------ */ if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL) { /* Get Dimension Name (if desired) */ /* ------------------------------- */ if (dimnames != NULL) { /* Check 1st for old meta data then new */ /* ------------------------------------ */ HE5_EHgetmetavalue(metaptrs, "OBJECT", utlstr); /* * If OBJECT value begins with double quote then old * metadata, dimension name is OBJECT value. * Otherwise search for "DimensionName" string */ if (utlstr[0] != '"') { metaptrs[0] = strstr(metaptrs[0], "\t\t\t\tDimensionName="); HE5_EHgetmetavalue(metaptrs, "DimensionName", utlstr); } /* Strip off double quotes */ /* ----------------------- */ REMQUOTE /* If not first name then add comma delimitor */ /* ------------------------------------------ */ if (nDim > 0) { strcat(dimnames, ","); } /* Add dimension name to dimension list */ /* ------------------------------------ */ strcat(dimnames, utlstr); } /* Get Dimension Size (if desired) */ /* ------------------------------- */ if (dims != NULL) { HE5_EHgetmetavalue(metaptrs, "Size", utlstr); size = (hsize_t)atol(utlstr); dims[ nDim ] = size; } /* Increment dimension counter */ /* --------------------------- */ nDim++; } else /* No more dimensions found */ /* ------------------------ */ break; } free(metabuf); } return(nDim); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWinqmaps | | | | DESCRIPTION: Returns dimension mappings and offsets and increments | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nMap long Number of dimension mappings | | | | INPUTS: | | swathID hid_t swath structure ID | | | | OUTPUTS: | | dimmaps char dimension mappings (comma-separated) | | offset long array of offsets | | increment long array of increments | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | | | 7/29/99 A.Muslimov In the call to EHmetagroup() replace gid by fid. | | July 00 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_SWinqmaps(hid_t swathID, char *dimmaps, long offset[], long increment[]) { herr_t status = FAIL; /* Return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ long idx = FAIL; /* Swath index */ long off = 0; /* Mapping Offset */ long incr = 0; /* Mapping Increment */ long nMap = 0; /* Number of mappings */ char *metabuf = (char *)NULL; /* Pntr to SM */ char *metaptrs[2]={NULL,NULL}; /* Ptrs to start/end of SM */ char utlstr[HE5_HDFE_UTLBUFSIZE];/* Utility string */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWinqmaps", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for Swath ID failed.\n"); H5Epush(__FILE__, "HE5_SWinqmaps", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* If mapping names or offsets or increments desired ... */ /* ----------------------------------------------------- */ if (dimmaps != NULL || offset != NULL || increment != NULL) { /* Get pointers to "DimensionMap" section within SM */ /* ------------------------------------------------ */ metabuf = (char *)HE5_EHmetagroup(fid, HE5_SWXSwath[idx].swname, "s", "DimensionMap", metaptrs); /* If mapping names are desired then "clear" name buffer */ /* ----------------------------------------------------- */ if (dimmaps != NULL) dimmaps[0] = 0; /* Begin loop through mapping entries in metadata */ /* ---------------------------------------------- */ while (1) { /* Search for OBJECT string */ /* ------------------------ */ metaptrs[0] = strstr(metaptrs[0], "\t\tOBJECT="); /* If found within "DimensionMap" metadata section ... */ /* --------------------------------------------------- */ if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL) { /* Get Geo & Data Dimensions (if desired) */ /* -------------------------------------- */ if (dimmaps != NULL) { /* Get Geo Dim, remove quotes, add "/" */ /* ----------------------------------- */ HE5_EHgetmetavalue(metaptrs, "GeoDimension", utlstr); REMQUOTE strcat(utlstr, "/"); /* if not first map then add comma delimitor */ /* ----------------------------------------- */ if (nMap > 0) { strcat(dimmaps, ","); } /* Add to map list */ /* --------------- */ strcat(dimmaps, utlstr); /* Get Data Dim, remove quotes */ /* --------------------------- */ HE5_EHgetmetavalue(metaptrs, "DataDimension", utlstr); REMQUOTE /* Add to map list */ /* --------------- */ strcat(dimmaps, utlstr); } /* Get Offset (if desired) */ /* ----------------------- */ if (offset != NULL) { HE5_EHgetmetavalue(metaptrs, "Offset", utlstr); off = atol(utlstr); offset[nMap] = off; } /* Get Increment (if desired) */ /* -------------------------- */ if (increment != NULL) { HE5_EHgetmetavalue(metaptrs, "Increment", utlstr); incr = atol(utlstr); increment[nMap] = incr; } /* Increment map counter */ /* --------------------- */ nMap++; } else /* No more mappings found */ /* ---------------------- */ break; } free(metabuf); } return (nMap); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWinqidxmaps | | | | DESCRIPTION: Returns indexed mappings and index sizes | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nMap long Number of indexed dimension mappings | | | | INPUTS: | | swathID hid_t swath structure ID | | | | OUTPUTS: | | idxmaps char indexed dimension mappings | | (comma-separated) | | idxsizes hsize_t Number of elements in each mapping | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | | | 7/29/99 A.Muslimov In the call to EHmetagroup() replace gid by fid. | | 8/20/99 A.Muslimov Checked for the statuses returned by EHgetmetavalue.| | July 00 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_SWinqidxmaps(hid_t swathID, char *idxmaps, hsize_t idxsizes[]) { herr_t status = FAIL; /* Return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ long idx = FAIL; /* Swath index */ long nMap = 0; /* Number of mappings */ char *metabuf = (char *)NULL; /* Pntr to SM */ char *metaptrs[2]={NULL,NULL}; /* Pntrs to start/end of SM */ char *utlstr = (char *)NULL; /* Utility string */ char *slash = (char *)NULL; /* Pointer to slash */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWinqidxmaps", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for Swath ID failed.\n"); H5Epush(__FILE__, "HE5_SWinqidxmaps", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Allocate space for utility string */ /* --------------------------------- */ utlstr = (char *) calloc(HE5_HDFE_DIMBUFSIZE, sizeof(char)); if ( utlstr == NULL ) { sprintf( errbuf,"Cannot allocate memory for utility string.\n"); H5Epush(__FILE__, "HE5_SWinqidxmaps", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* If mapping names or index sizes desired ... */ /* ------------------------------------------- */ if (idxmaps != NULL || idxsizes != NULL) { /* Get pointers to "IndexDimensionMap" section within SM */ metabuf = (char *)HE5_EHmetagroup(fid, HE5_SWXSwath[idx].swname, "s", "IndexDimensionMap", metaptrs); /* If mapping names are desired then "clear" name buffer */ /* ----------------------------------------------------- */ if (idxmaps != NULL) idxmaps[ 0 ] = 0; /* Begin loop through mapping entries in metadata */ /* ---------------------------------------------- */ while (1) { /* Search for OBJECT string */ /* ------------------------ */ metaptrs[0] = strstr(metaptrs[0], "\t\tOBJECT="); /* If found within "IndexDimensionMap" metadata section ... */ /* -------------------------------------------------------- */ if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL) { /* Get Geo & Data Dimensions and # of indices */ /* ------------------------------------------ */ if (idxmaps != NULL) { /* Get Geo Dim, remove quotes, add "/" */ /* ----------------------------------- */ status = HE5_EHgetmetavalue(metaptrs, "GeoDimension", utlstr); REMQUOTE strcat(utlstr, "/"); /* if not first map then add comma delimitor */ /* ----------------------------------------- */ if(nMap > 0) strcat(idxmaps, ","); /* Add to map list */ /* --------------- */ strcat(idxmaps, utlstr); /* Get Index size (if desired) */ /* --------------------------- */ if (idxsizes != NULL) { /* Parse off geo dimension and find its size */ /* ----------------------------------------- */ slash = strchr(utlstr, '/'); *slash = 0; idxsizes[ nMap ] = HE5_SWdiminfo(swathID, utlstr); } /* Get Data Dim, remove quotes */ /* --------------------------- */ status = HE5_EHgetmetavalue(metaptrs, "DataDimension", utlstr); REMQUOTE /* Add to map list */ /* --------------- */ strcat(idxmaps, utlstr); } /* Increment map counter */ /* --------------------- */ nMap++; } else /* No more mappings found */ /* ---------------------- */ break; } if (metabuf != NULL) free(metabuf); } if(utlstr != NULL) free(utlstr); return (nMap); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWinqfields | | | | DESCRIPTION: Returns fieldnames, ranks and numbertypes defined in swath. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nFld long Number of (geo/data) fields in swath | | | | INPUTS: | | swathID hid_t Swath structure ID | | fieldtype char field type (geo or data) | | | | OUTPUTS: | | fieldlist char Field names (comma-separated) | | rank int Array of ranks | | numbertype hid_t Array of HDF number types | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 7/29/99 A.Muslimov In the call to EHmetagroup() replace gid by fid. | | 4/19/00 A.Muslimov Changed type of 'slen' and 'fldnmlen' from long to | | size_t. | | July 00 A.Muslimov Unmasked hdf5 data types. | | June 02 S.Zhao Changed the type of 'numbertype' from an H5T_class_t| | to an hid_t. | | Oct. 03 S.Zhao Added the H5Tclose(datatype) call. | | Oct. 03 S.Zhao Modified to enable a character string dataset. | | Mar 04 S.Zhao Modified for a character string dataset. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ static long HE5_SWinqfields(hid_t swathID, char *fieldtype, char *fieldlist, int rank[], hid_t numbertype[]) { long nFld = 0; /* Return number of mappings */ long i = 0; /* Loop index */ long idx = FAIL; /* Swath index */ long ntflds = 0; /* field counter */ herr_t status = FAIL;/* routine return status variable */ herr_t Dstatus = FAIL;/* Status for H5Dclose */ int groupflag = FAIL;/* "0" - geolocation, "1" - data */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t datasetid = FAIL;/* Dataset ID */ hid_t datatype = FAIL;/* Data type ID */ hid_t groupid = FAIL;/* Group ID */ H5T_class_t classid = H5T_NO_CLASS; /* Data type class ID */ size_t slen[HE5_DTSETRANKMAX]; /* String length array */ size_t fldnmlen[HE5_FLDNUMBERMAX]; /* Array of namelengths */ char *fldnm[HE5_FLDNUMBERMAX]; /* Array of names */ char *metabuf = (char *)NULL; /* Pntr to SM */ char *metaptrs[2]={NULL,NULL}; /* Start/end of SM */ char utlstr[HE5_HDFE_UTLBUFSIZE]; /* Utility string */ char utlstr2[HE5_HDFE_UTLBUFSIZE];/* Utility string 2 */ char *ptr[HE5_DTSETRANKMAX]; /* String pointer array */ char *tempfield = (char *)NULL; char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ htri_t str_is_variable; /* boolean: TRUE if string is variable lengeth FALSE if string is fixed length -1 if error in H5Tis_variavle_str() */ CHECKPOINTER(fieldtype); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWinqfields", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for Swath ID failed.\n"); H5Epush(__FILE__, "HE5_SWinqfields", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Initialize slen[] array */ /* ----------------------- */ for (i = 0; i < HE5_DTSETRANKMAX; i++) slen[i] = 0; /* Initialize fldnmlen[] array */ /* --------------------------- */ for (i = 0; i < HE5_FLDNUMBERMAX; i++) fldnmlen[i] = 0; /* If field names, ranks, or number types desired ... */ /* --------------------------------------------------- */ if (fieldlist != NULL || rank != NULL || numbertype != NULL) { /* Get pointers to "GeoField" or "DataField" section within SM */ /* ----------------------------------------------------------- */ if (strcmp(fieldtype, "Geolocation Fields") == 0) { metabuf = (char *)HE5_EHmetagroup(fid, HE5_SWXSwath[idx].swname, "s", "GeoField", metaptrs); strcpy(utlstr2, "GeoFieldName"); groupflag = 0; } else { metabuf = (char *)HE5_EHmetagroup( fid, HE5_SWXSwath[idx].swname, "s", "DataField", metaptrs); strcpy(utlstr2, "DataFieldName"); groupflag = 1; } /* If field names are desired then "clear" name buffer */ /* --------------------------------------------------- */ if (fieldlist != NULL) fieldlist[0] = 0; /* Begin loop through mapping entries in metadata */ /* ---------------------------------------------- */ while (1) { /* Search for OBJECT string */ /* ------------------------ */ metaptrs[0] = strstr(metaptrs[0], "\t\tOBJECT="); /* If found within "Geo" or "Data" Field metadata section ... */ /* ---------------------------------------------------------- */ if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL) { /* Get field names (if desired) */ /* ---------------------------- */ if (fieldlist != NULL) { /* Check 1st for old meta data then new */ /* ------------------------------------ */ HE5_EHgetmetavalue(metaptrs, "OBJECT", utlstr); /* * If OBJECT value begins with double quote then old * metadata, field name is OBJECT value. Otherwise * search for "GeoFieldName" or "DataFieldName" * string */ if (utlstr[0] != '"') { strcpy(utlstr, "\t\t\t\t"); strcat(utlstr, utlstr2); strcat(utlstr, "="); metaptrs[0] = strstr(metaptrs[0], utlstr); HE5_EHgetmetavalue(metaptrs, utlstr2, utlstr); } /* Strip off double quotes */ /* ----------------------- */ REMQUOTE /* Add to fieldlist */ /* ---------------- */ if (nFld > 0) strcat(fieldlist, ","); strcat(fieldlist, utlstr); } /* If numbertype are desired then "clear" name buffer */ /* --------------------------------------------------- */ if (numbertype != NULL) { ntflds = HE5_EHparsestr(fieldlist, ',', fldnm,fldnmlen); if(ntflds != FAIL) { if(groupflag == 0) groupid = HE5_SWXSwath[idx].geo_id; else groupid = HE5_SWXSwath[idx].data_id; for(i = 0; i < ntflds; i++) { tempfield = (char *)calloc(fldnmlen[i] + 1, sizeof(char)); memmove(tempfield,fldnm[i],fldnmlen[i]); /* Open the dataset */ /* ---------------- */ datasetid = H5Dopen(groupid, tempfield); if ( datasetid == FAIL ) { sprintf(errbuf, "Cannot open the dataset \"%s\". \n", tempfield); H5Epush(__FILE__, "HE5_SWinqfields", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (metabuf != NULL) free(metabuf); free(tempfield); return(FAIL); } /* Get the data type */ /* ----------------- */ datatype = H5Dget_type(datasetid); if ( datatype == FAIL ) { sprintf(errbuf, "Cannot get the data type ID. \n"); H5Epush(__FILE__, "HE5_SWinqfields", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (metabuf != NULL) free(metabuf); free(tempfield); return(FAIL); } /* Get the data type class ID */ /* -------------------------- */ classid = H5Tget_class(datatype); if ( classid == H5T_NO_CLASS ) { sprintf(errbuf, "Cannot get the data type class ID. \n"); H5Epush(__FILE__, "HE5_SWinqfields", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (metabuf != NULL) free(metabuf); free(tempfield); return(FAIL); } if (classid == H5T_STRING) { /* HE5T_CHARSTRING has variable length for data fields */ str_is_variable = H5Tis_variable_str(datatype); if(str_is_variable == TRUE) { numbertype[i] = HE5T_CHARSTRING; } else if(str_is_variable == FALSE) { numbertype[i] = HE5T_NATIVE_CHAR; } else { status = FAIL; sprintf(errbuf, "Failed to see if string field is varaible or fixed length.\n"); H5Epush(__FILE__, "HE5_SWinqfields", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); if (metabuf != NULL) free(metabuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /*HE5_SWgetstringtype(swathID, fieldname,classid);*/ /*numbertype[i] = HE5T_CHARSTRING;*/ } else { /*numbertype[i] = classid;*/ numbertype[i] = HE5_EHdtype2numtype(datatype); if ( numbertype[i] == FAIL ) { sprintf(errbuf, "Cannot get the number type ID. \n"); H5Epush(__FILE__, "HE5_SWinqfields", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (metabuf != NULL) free(metabuf); free(tempfield); return(FAIL); } } /* Release the datatype ID */ /* ----------------------- */ status = H5Tclose(datatype); if ( status == FAIL ) { sprintf(errbuf, "Cannot close the datatype \"%s\". \n", tempfield); H5Epush(__FILE__, "HE5_SWinqfields", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (metabuf != NULL) free(metabuf); free(tempfield); return(FAIL); } /* Release the dataset ID */ /* ---------------------- */ Dstatus = H5Dclose(datasetid); if ( Dstatus == FAIL ) { sprintf(errbuf, "Cannot close the dataset \"%s\". \n", tempfield); H5Epush(__FILE__, "HE5_SWinqfields", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (metabuf != NULL) free(metabuf); free(tempfield); return(FAIL); } free(tempfield); } } } /* * Get Rank (if desired) by counting # of dimensions in * "DimList" string */ if (rank != NULL) { HE5_EHgetmetavalue(metaptrs, "DimList", utlstr); rank[nFld] = HE5_EHlong2int(HE5_EHparsestr(utlstr, ',', ptr, slen) ); if (rank[nFld] == FAIL ) { sprintf(errbuf, "Cannot convert data type. \n"); H5Epush(__FILE__, "HE5_SWinqfields", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if(metabuf != NULL) free(metabuf); return(FAIL); } } /* Increment field counter */ /* ----------------------- */ nFld++; } else /* No more fields found */ /* -------------------- */ break; } if (metabuf != NULL) free(metabuf); } COMPLETION: return(nFld); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWinqdatafields | | | | DESCRIPTION: Inquires about data fields in swath | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nflds long Number of data fields in swath | | | | INPUTS: | | swathID hid_t Swath structure ID | | | | OUTPUTS: | | fieldlist char Field names (comma-separated) | | rank int Array of ranks | | ntype hid_t number types | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 8/23/99 A.Muslimov Changed datatype of nflds from int to int32_t. | | 05/10/00 A.Muslimov Replaced 'H5T_class_t' type by 'int' data type. | | July 00 A.Muslimov Unmasked hdf5 data types. | | Jan 03 S.Zhao Changed the type of 'ntype' from an H5T_class_t to | | an hid_t. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_SWinqdatafields(hid_t swathID, char *fieldlist, int rank[], hid_t ntype[]) { long nflds = FAIL; /* Number of Data fields */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ /* Call "HE5_SWinqfields" routine to get number of fields */ /* ------------------------------------------------------ */ nflds = HE5_SWinqfields(swathID, "Data Fields", fieldlist, NULL, NULL); if (nflds == FAIL) { sprintf(errbuf, "Cannot get the number of fields in \"Data Fields\" group. \n"); H5Epush(__FILE__, "HE5_SWinqdatafields", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Call "HE5_SWinqfields" routine to get other parameters */ /* ------------------------------------------------------ */ nflds = HE5_SWinqfields(swathID, "Data Fields", fieldlist, rank, ntype); if (nflds == FAIL) { sprintf(errbuf, "Inquiry about fields in \"Data Fields\" group fails. \n"); H5Epush(__FILE__, "HE5_SWinqdatafields", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } return(nflds); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWinqgeofields | | | | DESCRIPTION: Inquires about geo fields in swath | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nflds long Number of geo fields in swath | | | | INPUTS: | | swathID hid_t Swath structure ID | | | | OUTPUTS: | | fieldlist char Field names (comma-separated) | | rank int Array of ranks | | ntype hid_t number types | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 05/10/00 A.Muslimov Replaced 'H5T_class_t' type by 'int' data type. | | July 00 A.Muslimov Unmasked hdf5 data types. | | Jan 03 S.Zhao Changed the type of 'ntype' from an H5T_class_t to | | an hid_t. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_SWinqgeofields(hid_t swathID, char *fieldlist, int rank[], hid_t ntype[]) { long nflds = FAIL; /* Number of Geo fields */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ /* Call "HE5_SWinqfields" routine to get number of fields */ /* ------------------------------------------------------ */ nflds = HE5_SWinqfields(swathID, "Geolocation Fields", fieldlist, NULL, NULL); if (nflds == FAIL) { sprintf(errbuf, "Cannot get the number of fields in \"Geolocation Fields\" group. \n"); H5Epush(__FILE__, "HE5_SWinqgeofields", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Call "HE5_SWinqfields" routine to get other parameters */ /* ------------------------------------------------------ */ nflds = HE5_SWinqfields(swathID, "Geolocation Fields", fieldlist, rank, ntype); if (nflds == FAIL) { sprintf(errbuf, "Inquiry about fields in \"Geolocation Fields\" group fails. \n"); H5Epush(__FILE__, "HE5_SWinqgeofields", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } return (nflds); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWinqdatatype | | | | DESCRIPTION: Inquires about geo/data/prof fields in swath | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t | | fieldname char * | | attrname char * | | group int Group flag: | | ...GEOGROUP, ...DATAGROUP, | | ...PROFGROUP - for the field | | ...ATTRGROUP, ...GRPATTRGROUP, | | ...PROFGRPATTRGROUP, | | ...GEOGRPATTRGROUP, | | ...LOCATTRGROUP - for the attribute | | | | OUTPUTS: | | datatype hid_t | | classid H5T_class_t | | order H5T_order_t | | size size_t | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Oct 99 D.Wynne Original Programmer | | Dec 99 A.Muslimov Changed the status data type from hid_t to int . | | Feb 00 A.Muslimov Added error checking after the function calls. | | Mar 00 A.Muslimov Updated to include Group/Local Attributes options. | | May 00 A.Muslimov Replaced 'H5T_class_t' type by 'int' data type. | | Jul 00 A.Muslimov Unmasked hdf5 data types. | | Set 00 A.Muslimov Updated to incorporate profile datasets. | | Feb 04 S.Zhao Added a group flag for the "Profile Fields" group | | attribute. | | Feb 04 S.Zhao Added a group flag for the "Geolocation Fields" | | group attribute. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWinqdatatype(hid_t swathID, const char *fieldname, const char *attrname, int group, hid_t *datatype, H5T_class_t *classid, H5T_order_t *order, size_t *size) { herr_t status = FAIL; /* routine return status */ int fldgroup = FAIL; /* Field group flag */ hid_t datasetid = FAIL; /* Dataset ID */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t attr = FAIL; /* attribute dataset ID */ hid_t fldgroupID = FAIL; /* Field group ID */ hid_t fieldID = FAIL; /* Field dataset ID */ long idx = FAIL; /* swath index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWinqdatatype", &fid, &gid, &idx); if(status == SUCCEED) { if(group == HE5_HDFE_GEOGROUP) fldgroupID = HE5_SWXSwath[idx].geo_id; else if(group == HE5_HDFE_DATAGROUP) fldgroupID = HE5_SWXSwath[idx].data_id; else if(group == HE5_HDFE_PROFGROUP) fldgroupID = HE5_SWXSwath[idx].prof_id; else if(group == HE5_HDFE_ATTRGROUP) fldgroupID = HE5_SWXSwath[idx].sw_id; else if(group == HE5_HDFE_GRPATTRGROUP) fldgroupID = HE5_SWXSwath[idx].data_id; else if(group == HE5_HDFE_GEOGRPATTRGROUP) fldgroupID = HE5_SWXSwath[idx].geo_id; else if(group == HE5_HDFE_PROFGRPATTRGROUP) fldgroupID = HE5_SWXSwath[idx].prof_id; else if(group == HE5_HDFE_LOCATTRGROUP) { /* Get the field group flag */ /* ------------------------ */ fldgroup = HE5_SWfldsrch(swathID,(char *)fieldname,NULL,NULL,NULL,NULL); if(fldgroup == FAIL) { sprintf(errbuf,"Cannot get the group flag for \"%s\" field.\n",fieldname); H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } if (fldgroup == HE5_HDFE_DATAGROUP) fldgroupID = HE5_SWXSwath[idx].data_id; if (fldgroup == HE5_HDFE_GEOGROUP) fldgroupID = HE5_SWXSwath[idx].geo_id; if (fldgroup == HE5_HDFE_PROFGROUP) fldgroupID = HE5_SWXSwath[idx].prof_id; } else { sprintf(errbuf, "Invalid group flag (\"%d\"). \n", group); H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_FUNC, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get data type information for the field */ /* --------------------------------------- */ if( group == HE5_HDFE_GEOGROUP || group == HE5_HDFE_DATAGROUP || group == HE5_HDFE_PROFGROUP) { datasetid = H5Dopen(fldgroupID, fieldname); if (datasetid == FAIL) { sprintf(errbuf, "Cannot open the dataset for the \"%s\" field.\n", fieldname); H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_DATASET, H5E_NOTFOUND , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } *datatype = H5Dget_type(datasetid); if (*datatype == FAIL) { sprintf(errbuf, "Cannot get the datatype for the \"%s\" field.\n", fieldname); H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_DATATYPE, H5E_NOTFOUND , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } *classid = H5Tget_class(*datatype); if (*classid == H5T_NO_CLASS) { sprintf(errbuf, "Cannot get the data type class ID for the \"%s\" field.\n", fieldname); H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } *order = H5Tget_order(*datatype); if (*order == H5T_ORDER_ERROR) { sprintf(errbuf, "Cannot get the data type order for the \"%s\" field.\n", fieldname); H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } if (*classid == H5T_STRING) { *size = H5Tget_size(*datatype); } else { *size = H5Tget_size(*datatype); if (*size == 0) { sprintf(errbuf, "Cannot get the data type size for the \"%s\" field.\n", fieldname); H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } status = H5Dclose(datasetid); if (status == FAIL) { sprintf(errbuf, "Cannot release the dataset ID for the \"%s\" field.\n", fieldname); H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_DATASET, H5E_CLOSEERROR , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } /* Get data type information about global/group attribute */ /* ------------------------------------------------------ */ else if(group == HE5_HDFE_ATTRGROUP || group == HE5_HDFE_GRPATTRGROUP || group == HE5_HDFE_PROFGRPATTRGROUP || group == HE5_HDFE_GEOGRPATTRGROUP) { attr = H5Aopen_name(fldgroupID, attrname); if (attr == FAIL) { sprintf(errbuf, "Cannot open the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } *datatype = H5Aget_type(attr); if (*datatype == FAIL) { sprintf(errbuf, "Cannot get the data type for the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } *classid = H5Tget_class(*datatype); if (*classid == H5T_NO_CLASS) { sprintf(errbuf, "Cannot get the data type class ID for the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } *order = H5Tget_order(*datatype); if (*order == H5T_ORDER_ERROR) { sprintf(errbuf, "Cannot get the data type order for the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } if (*classid == H5T_STRING) { *size = H5Tget_size(*datatype); } else { *size = H5Tget_size(*datatype); if (*size == 0) { sprintf(errbuf, "Cannot get the data type size for the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } status = H5Aclose(attr); if (status == FAIL) { sprintf(errbuf, "Cannot release the dataset ID for the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_DATASET, H5E_CLOSEERROR , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } /* Get data type information for local attribute */ /* --------------------------------------------- */ else if(group == HE5_HDFE_LOCATTRGROUP) { fieldID = H5Dopen(fldgroupID, fieldname); if(fieldID == FAIL) { sprintf(errbuf,"Cannot open the \"%s\" field dataset.\n", fieldname); H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } attr = H5Aopen_name(fieldID, attrname); if (attr == FAIL) { sprintf(errbuf, "Cannot open the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } *datatype = H5Aget_type(attr); if (*datatype == FAIL) { sprintf(errbuf, "Cannot get the data type for the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } *classid = H5Tget_class(*datatype); if (*classid == H5T_NO_CLASS) { sprintf(errbuf, "Cannot get the data type class ID for the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } *order = H5Tget_order(*datatype); if (*order == H5T_ORDER_ERROR) { sprintf(errbuf, "Cannot get the data type order for the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } if (*classid == H5T_STRING) { *size = H5Tget_size(*datatype); } else { *size = H5Tget_size(*datatype); if (*size == 0) { sprintf(errbuf, "Cannot get the data type size for the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } status = H5Aclose(attr); if (status == FAIL) { sprintf(errbuf, "Cannot release the dataset ID for the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_DATASET, H5E_CLOSEERROR , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } status = H5Dclose(fieldID); if (status == FAIL) { sprintf(errbuf, "Cannot release the dataset ID for the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_SWinqdatatype", __LINE__, H5E_DATASET, H5E_CLOSEERROR , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } } return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWnentries | | | | DESCRIPTION: Returns number of entries and string buffer size | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nEntries long Number of entries | | | | INPUTS: | | swathID hid_t Swath structure ID | | entrycode int Entry code: | | | | HDFE_NENTDIM (0) | | HDFE_NENTMAP (1) | | HDFE_NENTIMAP (2) | | HDFE_NENTGFLD (3) | | HDFE_NENTDFLD (4) | | | | | | OUTPUTS: | | strbufsize long Length of comma-separated list | | (Does not include null-terminator | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | | | 7/29/99 A.Muslimov In the call to EHmetagroup() replace gid by fid. | | 9/01/99 A.Muslimov Initialized metabuf pointer. Added error handling | | right after the calls to EHmetagroup() and | | EHmetavalue(). Initialized nEntries to -1, and set | | nEntries to 0 in 'if( status == 0 ){}' block. | | July 00 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_SWnentries(hid_t swathID, int entrycode, long *strbufsize) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ long idx = FAIL;/* Swath index */ long nEntries = 0; /* Number of entries */ long metaflag = FAIL;/* Old (0), New (1) metadata flag) */ long nVal = 0; /* Number of strings to search for */ long i; /* Loop index */ char *metabuf = (char *)NULL; /* Ptr to SM */ char *metaptrs[2]={NULL,NULL}; /* Start/end of SM */ char utlstr[HE5_HDFE_UTLBUFSIZE];/* Utility string */ char valName[2][32]; /* Strings to search for */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWnentries", &fid, &gid, &idx); if (status == SUCCEED) { /* Zero out string buffer size */ /* --------------------------- */ *strbufsize = 0; /* * Get pointer to relevant section within SM and Get names of * metadata strings to inquire about */ switch (entrycode) { case HE5_HDFE_NENTDIM: /* Dimensions */ /* ---------- */ { metabuf = (char *)HE5_EHmetagroup(fid, HE5_SWXSwath[idx].swname, "s", "Dimension", metaptrs); nVal = 1; strcpy(&valName[0][0], "DimensionName"); } break; case HE5_HDFE_NENTMAP: /* Dimension Maps */ /* -------------- */ { metabuf = (char *)HE5_EHmetagroup(fid, HE5_SWXSwath[idx].swname, "s", "DimensionMap", metaptrs); nVal = 2; strcpy(&valName[0][0], "GeoDimension"); strcpy(&valName[1][0], "DataDimension"); } break; case HE5_HDFE_NENTIMAP: /* Indexed Dimension Maps */ /* ---------------------- */ { metabuf = (char *)HE5_EHmetagroup(fid, HE5_SWXSwath[idx].swname, "s","IndexDimensionMap", metaptrs); nVal = 2; strcpy(&valName[0][0], "GeoDimension"); strcpy(&valName[1][0], "DataDimension"); } break; case HE5_HDFE_NENTGFLD: /* Geolocation Fields */ /* ------------------ */ { metabuf = (char *)HE5_EHmetagroup(fid, HE5_SWXSwath[idx].swname, "s", "GeoField", metaptrs); nVal = 1; strcpy(&valName[0][0], "GeoFieldName"); } break; case HE5_HDFE_NENTDFLD: /* Data Fields */ /* ----------- */ { metabuf = (char *)HE5_EHmetagroup(fid, HE5_SWXSwath[idx].swname, "s", "DataField", metaptrs); nVal = 1; strcpy(&valName[0][0], "DataFieldName"); } break; default: { sprintf(errbuf,"Invalid (unsupported) entry code \"%d\". \n", entrycode); H5Epush(__FILE__, "HE5_SWnentries", __LINE__, H5E_ARGS, H5E_UNSUPPORTED, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } break; } if ( metabuf == NULL ) { nEntries = FAIL; sprintf(errbuf,"Cannot get the number of entries. \n"); H5Epush(__FILE__, "HE5_SWnentries", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(nEntries); } /* * Check for presence of 'GROUP="' string If found then old metadata, * search on OBJECT string */ metaflag = (strstr(metabuf, "GROUP=\"") == NULL) ? 1 : 0; if (metaflag == 0) { nVal = 1; strcpy(&valName[0][0], "\t\tOBJECT"); } /* Begin loop through entries in metadata */ /* -------------------------------------- */ while (1) { /* Search for first string */ /* ----------------------- */ strcpy(utlstr, &valName[0][0]); strcat(utlstr, "="); metaptrs[0] = strstr(metaptrs[0], utlstr); /* If found within relevant metadata section ... */ /* --------------------------------------------- */ if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL) { for (i = 0; i < nVal; i++) { /* * Get all string values Don't count quotes */ status = HE5_EHgetmetavalue(metaptrs, &valName[i][0], utlstr); if ( status == FAIL ) { nEntries = FAIL; sprintf(errbuf,"Cannot get metavalue. \n"); H5Epush(__FILE__, "HE5_SWnentries", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(metabuf); return(nEntries); } *strbufsize += strlen(utlstr) - 2; } /* Increment number of entries */ /* --------------------------- */ nEntries++; /* Go to end of OBJECT */ /* ------------------- */ metaptrs[0] = strstr(metaptrs[0], "END_OBJECT"); } else /* No more entries found */ /* --------------------- */ { break; } } if (metabuf != NULL) free(metabuf); /* Count comma separators & slashes (if mappings) */ /* ---------------------------------------------- */ if (nEntries > 0) { *strbufsize += nEntries - 1; *strbufsize += (nVal - 1) * nEntries; } } return(nEntries); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWinqswath | | | | DESCRIPTION: Returns number and names of swath structures in file | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nSwath long Number of swath structures in file | | | | INPUTS: | | filename char HDF-EOS filename | | | | OUTPUTS: | | swathlist char List of swath names (comma-separated) | | strbufsize long Length of swathlist | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | July 00 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_SWinqswath(const char *filename, char *swathlist, long *strbufsize) { long nSwath = FAIL; /* Number of swaths in file */ herr_t status = FAIL; /* Return status variable */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ CHECKPOINTER(filename); /* Call "HE5_EHinquire" routine */ /* ---------------------------- */ nSwath = HE5_EHinquire(filename, "/HDFEOS/SWATHS", swathlist, strbufsize); if ( nSwath == FAIL ) { sprintf(errbuf,"Cannot get information about Swath. \n"); H5Epush(__FILE__, "HE5_SWinqswath", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } COMPLETION: return(nSwath); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWextend | | | | DESCRIPTION: | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t swath structure ID | | fieldname char fieldname | | | | OUTPUTS: | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 8/23/99 A. Muslimov Checked for the status returned by H5Dextend(). | | July 00 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWextend(hid_t swathID, char *fieldname, hsize_t size[]) { herr_t status = FAIL;/* Routine return status */ hid_t gid = FAIL;/* Swath group ID */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t fieldID = FAIL;/* fieldname dataset ID */ long idx = FAIL;/* Swath index */ /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWextend", &fid, &gid, &idx); HE5_SWfieldsizeID( swathID, fieldname, &fieldID); status = H5Dextend(fieldID, size); return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWwrrdfield | | | | DESCRIPTION: Writes/Reads fields | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t swath structure ID | | fldname char field name | | code char Write/Read code (w/r) | | start hssize_t start array | | stride hsize_t stride array | | count hsize_t edge array | | datbuf void data buffer for read | | | | OUTPUTS: | | datbuf void data buffer for write | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | | | 8/23/99 A. Muslimov Added error checkings after the function calls. | | July 00 A.Muslimov Unmasked hdf5 data types. | | 7/12/00 A.Muslimov Added conversion from disk/file data type ID to | | memory data type ID before H5Dread() call. | | 10/5/00 A.Muslimov Added checking for the field name (in case of pas- | | sing an alias as a "fldname"). | | Nov 00 A.Muslimov Modified a block checking if the dataset is | | appendable. Added "break" statement. | | Dec 00 A.Muslimov Modified to fix a problem with appending data to the| | extendible datset. | | Apr 03 S.Zhao Added conversion from data type ID to memory data | | type ID before H5Dwrite() call. | | Oct 03 S.Zhao Added to write/read a character string dataset. | | Apr 04 S.Zhao Modified for a character string dataset. | | Feb 05 S.Zhao Replaced the "count" array by the "dims" array if | | it was declared larger than the dimension size. | | Sep 11 Abe Taaheri Modified for correcting Unlimited dimension | | behavior and extension | | | | END_PROLOG | -----------------------------------------------------------------------------*/ static herr_t HE5_SWwrrdfield(hid_t swathID, char *fldname, char *code, const hssize_t start[], const hsize_t stride[], const hsize_t count[], void *datbuf) { herr_t status = FAIL; /* routine return status variable */ int i; /* Loop index */ int startf = 0; /* flag (if start is NULL) */ int countf = 0; /* flag (if counf is NULL) */ int bothf = 0; /* flag (if start and count are NULL) */ int append = FALSE;/* FLAG (if field is appendable) */ int rank = FAIL; /* Rank of dataset */ int maxrank = 0; /* Rank dummy variable */ int nameflag = FAIL; /* Actual (1)/Alias (0) field name */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t fieldID = FAIL;/* fieldname Dataset ID */ hid_t fspace = FAIL;/* file data space ID */ hid_t mid = FAIL;/* memory data space ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t tid = FAIL;/* datatype ID */ hid_t mtype = FAIL;/* Memory data type ID */ long idx = FAIL;/* Swath index */ hsize_t dims[HE5_DTSETRANKMAX]; /* Field dimensions */ hsize_t maxdims[HE5_DTSETRANKMAX];/* Field maximum dimensions */ hssize_t *tstart =(hssize_t *)NULL;/* Not NULL "start" value */ hsize_t *tcount = (hsize_t *)NULL;/* Not NULL "count" value */ hsize_t *lcount = (hsize_t *)NULL; hsize_t dimsize = 0; /* Field dimension size */ hsize_t size[HE5_DTSETRANKMAX]; /* Extended dimension size */ hid_t ntype[1] = {FAIL}; /* numbertype */ char *dimbuf = (char *)NULL; char *comma = (char *)NULL; char *dimcheck = (char *)NULL; char fieldname[HE5_HDFE_NAMBUFSIZE]; /* Field name buffer */ char fldactualname[HE5_HDFE_NAMBUFSIZE];/* Actual field name */ char maxdimlist[HE5_HDFE_DIMBUFSIZE]; /* Maximum dimension list */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ H5T_class_t classid = H5T_NO_CLASS; /* data type class ID */ char dimlist[HE5_HDFE_DIMBUFSIZE]; char *dimbuf1 = (char *)NULL; char *dimbuf2 = (char *)NULL; char *comma1 = (char *)NULL; char *comma2 = (char *)NULL; char *newname = (char *)NULL; char *newname1 = (char *)NULL; int ibuf; /* Loop index */ char **chardatbuf = NULL; /* string data buffer */ int maxlen = 0; /* max length in array of string */ int strsize = 0; /* each str length in array of str */ hsize_t numattr[1]; /* number of attribute elements */ int mycount = 0; /* flag */ long strbufsize1; /* string buffer size */ long strbufsize2; /* string buffer size */ long nattr = 0; /* number of attributes */ char *attrlist1 = (char *)NULL;/* attribute list */ char *attrlist2 = (char *)NULL;/* attribute list */ char *attptr = (char *)NULL; /* attribute pointer */ hsize_t dimsize_dim, dimsize_maxdim; int extend_flag = 0; CHECKNAME(fldname); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWwrrdfield", &fid, &gid, &idx); if (status == FAIL) return(status); /* Get field info */ /* --------------- */ status = HE5_SWfieldinfo(swathID, fldname, &rank, dims, ntype, NULL, NULL); if( status == FAIL ) { sprintf(errbuf,"Cannot get information about \"%s\" field. \n", fldname); H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } for (i=0; i 0) /* we may want to extend a dataset */ { extend_flag = 1; break; } } /* since in hdf5 all dimension can be appendable, the following was modified so that any dimension is extedned. In HDF4 only the first dimension is appenable, so start[0] > 0 is valid only for HDF4 based hdfeos if (start != NULL && start[0] > 0 && (strcmp(code,"w") == 0)) */ if (start != NULL && extend_flag == 1 && (strcmp(code,"w") == 0)) { /* Check whether fieldname is in dataset (multi-dim field) */ /* ------------------------------------------------------- */ status = HE5_SWfieldinfo(swathID, fldname, &rank, dims, ntype, dimlist, maxdimlist); if( status == FAIL ) { sprintf(errbuf,"Cannot get information about \"%s\" field. \n", fldname); H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } dimbuf1 = (char *) calloc((strlen(dimlist) + 2), sizeof(char)); if(dimbuf1 == NULL) { sprintf(errbuf,"Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } memcpy(dimbuf1,dimlist, strlen(dimlist)); dimbuf2 = (char *) calloc((strlen(maxdimlist) + 2), sizeof(char)); if(dimbuf2 == NULL) { sprintf(errbuf,"Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(dimbuf1); return(FAIL); } memcpy(dimbuf2,maxdimlist, strlen(maxdimlist)); for (i = 1; i < rank + 1; i++) { strcat(dimbuf1,","); comma1 = strchr(dimbuf1,','); newname = (char *) calloc(comma1 - dimbuf1 + 1, sizeof(char)); if(newname == NULL) { sprintf(errbuf,"Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(dimbuf1); free(dimbuf2); return(FAIL); } memmove(newname,dimbuf1,comma1 - dimbuf1); memmove(dimbuf1, comma1 + 1, strlen(comma1 + 1) + 1); strcat(dimbuf2,","); comma2 = strchr(dimbuf2,','); newname1 = (char *) calloc(comma2 - dimbuf2 + 1, sizeof(char)); if(newname1 == NULL) { sprintf(errbuf,"Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(dimbuf1); free(dimbuf2); free(newname); return(FAIL); } memmove(newname1,dimbuf2,comma2 - dimbuf2); memmove(dimbuf2, comma2 + 1, strlen(comma2 + 1) + 1); /* get dimsize for newname1, and dimsize for the dimension whose maxdim is newname1 */ dimsize_dim = HE5_SWdiminfo(swathID, newname); dimsize_maxdim = HE5_SWdiminfo(swathID, newname1); /* Find out if the dataset dimension is appendable */ /* ----------------------------------------------- */ if ( (dimsize_dim < dimsize_maxdim) || (dimsize_maxdim == H5S_UNLIMITED)) { /* update dim if new dim is still <= maxdim */ if((start[i]+1) > dimsize_maxdim && (dimsize_maxdim != H5S_UNLIMITED)) { sprintf(errbuf, "Cannot update the dimension, new dimension size is larger than the max dimension size in the datafiled.\n"); H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(dimbuf1); free(dimbuf2); free(newname); free(newname1); return(FAIL); } else { /*// i starts from 1, but start should be from 0. // Without this fix, the updated unlimited dimension size is undefined!! */ status = HE5_SWupdatedim(swathID, newname, start[i-1]+1); if( status == FAIL ) { sprintf(errbuf, "Cannot update the dimension.\n"); H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(dimbuf1); free(dimbuf2); free(newname); free(newname1); return(FAIL); } } } free(newname); free(newname1); newname = NULL; newname1 = NULL; } free(dimbuf1); free(dimbuf2); dimbuf1 = NULL; dimbuf2 = NULL; } /* Call HE5_SWfldnameinfo() to get actual field name */ /* --------------------------------------------- */ nameflag = HE5_SWfldnameinfo(swathID, fldname, fldactualname); if ( nameflag == FAIL ) { sprintf(errbuf, "Cannot get actual name of the field.\n"); H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Name is not alias */ /* ----------------- */ if (nameflag == TRUE) { strcpy(fieldname,""); strcpy(fieldname,fldname); } /* Name is an alias */ /* ---------------- */ if (nameflag == FALSE) { strcpy(fieldname,""); strcpy(fieldname,fldactualname); } /* Initialize dims[]/maxdims[]/size[] arrays */ /* ----------------------------------------- */ for (i = 0; i < HE5_DTSETRANKMAX; i++) { dims[i] = 0; maxdims[i] = 0; size[i] = 0; } /* Check whether fieldname is in dataset (multi-dim field) */ /* ------------------------------------------------------- */ status = HE5_SWfieldinfo(swathID, fieldname, &rank, dims, ntype, NULL, maxdimlist); if( status == FAIL ) { sprintf(errbuf,"Cannot get information about \"%s\" field. \n", fieldname); H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Find out if the field is appendable */ /* ----------------------------------- */ dimbuf = (char *) calloc(strlen(maxdimlist) + 64, sizeof(char)); if(dimbuf == NULL) { sprintf(errbuf,"Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } strcpy(dimbuf,maxdimlist); strcat(dimbuf,","); comma = strchr(dimbuf,','); while(comma != NULL) { dimcheck = (char *) calloc(comma - dimbuf + 1, sizeof(char)); if(dimcheck == NULL) { sprintf(errbuf,"Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(dimbuf); return(FAIL); } memmove(dimcheck,dimbuf,comma-dimbuf); /* Get dimension size */ /* ------------------ */ dimsize = HE5_SWdiminfo(swathID, dimcheck); if((dimsize == H5S_UNLIMITED) || (dims[maxrank] <= dimsize)) { maxdims[maxrank] = dimsize; maxrank++; } memmove(dimbuf, comma + 1, strlen(comma + 1) + 1); comma = strchr(dimbuf,','); free(dimcheck); } free(dimbuf); for(i = 0; i < rank; i++) { if( dims[i] == maxdims[i] ) append = FALSE; else if ( (dims[i] < maxdims[i]) || (maxdims[i] == H5S_UNLIMITED)) { append = TRUE; break; } else { sprintf(errbuf,"Maximum dimension size is smaller than dimension size.\n"); H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } /* ============================================================== */ /* start and count are being passed as NULL from SWdefvrtregion */ /* which calls SWreadfield, which have NULL for start and count. */ /* H5Sselect_hyperslab won't take NULL values for start and count */ /* ============================================================== */ if(start == NULL) { tstart = (hssize_t *)calloc(rank, sizeof(hssize_t)); for(i = 0; i < rank; i++) tstart[ i ] = 0; startf = 1; } if(count == NULL) { tcount = (hsize_t *)calloc(rank, sizeof(hsize_t)); for(i = 0; i < rank; i++) tcount[ i ] = dims[ i ]; if(startf == 1) bothf = 1; else countf = 1; } else { lcount = (hsize_t *)calloc(rank, sizeof(hsize_t)); for(i = 0; i < rank; i++) { if(count[ i ] > dims[ i ]) lcount[ i ] = dims[ i ]; else lcount[ i ] = count[ i ]; } } if (append == TRUE) { /* Get the field-related dataset ID */ /* -------------------------------- */ HE5_SWfieldsizeID(swathID, fieldname, &fieldID); if(bothf == 1) status = H5Dextend(fieldID, tcount); else if(startf == 1) status = H5Dextend(fieldID, lcount); else if(countf == 1) status = H5Dextend(fieldID, tcount); else { for(i = 0; i < rank; i++) size[ i ] = start[ i ] + lcount[ i ]; /* Extend the dataset size */ /* ----------------------- */ status = H5Dextend(fieldID, size); } if( status == FAIL) { sprintf(errbuf,"Cannot extend the dataset. \n"); H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } } if (append == FALSE) { /* Get the field-related dataset ID */ /* -------------------------------- */ HE5_SWfieldsizeID(swathID, fieldname, &fieldID); } /* Get the file space ID */ /* --------------------- */ fspace = H5Dget_space(fieldID ); if( fspace == FAIL) { sprintf(errbuf,"Cannot get data space ID. \n"); H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } /* Select the hyperslab */ /* -------------------- */ if(bothf == 1) status = H5Sselect_hyperslab( fspace, H5S_SELECT_SET, (const hsize_t *)tstart,stride,tcount,NULL); else if(startf == 1) status = H5Sselect_hyperslab( fspace, H5S_SELECT_SET, (const hsize_t *)tstart,stride,lcount,NULL); else if(countf == 1) status = H5Sselect_hyperslab( fspace, H5S_SELECT_SET, (const hsize_t *)start,stride,tcount,NULL); else status = H5Sselect_hyperslab( fspace, H5S_SELECT_SET, (const hsize_t *)start,stride,lcount,NULL) ; if( status == FAIL ) { sprintf(errbuf,"Cannot select a hyperslab. \n"); H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } /* Define memory space */ /* =================== */ if(countf == 1 || bothf == 1) mid = H5Screate_simple(rank, tcount, NULL); else mid = H5Screate_simple(rank, lcount, NULL); if( mid == FAIL) { sprintf(errbuf,"Cannot create the data space.\n"); H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATASPACE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } /* Get the data type ID */ /* -------------------- */ tid = H5Dget_type(fieldID ); if( tid == FAIL ) { sprintf(errbuf,"Cannot get the data type ID.\n"); H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } /* Get the data type class ID */ /* -------------------------- */ classid = H5Tget_class(tid); if (classid == H5T_NO_CLASS) { sprintf(errbuf,"Cannot get the data type class ID.\n"); H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } /* Write/read whole data to/from the dataset */ /* ========================================= */ if( strcmp(code,"w") == 0) { strbufsize1 = 0; nattr = HE5_SWinqlocattrs(swathID, fieldname, NULL, &strbufsize1); if ( nattr < 0 ) { sprintf(errbuf, "Cannot retrieve the attributes. \n"); H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } attrlist1 = (char *) calloc(strbufsize1 + 2, sizeof(char)); if (attrlist1 == NULL) { sprintf(errbuf, "Cannot allocate memory for attrlist1.\n") ; H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } nattr = HE5_SWinqlocattrs(swathID, fieldname, attrlist1, &strbufsize1); if ( nattr < 0 ) { sprintf(errbuf, "Cannot retrieve the attributes. \n"); H5Epush(__FILE__,"HE5_SWwrrdfield", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (attrlist1 != NULL) { free(attrlist1); attrlist1 = NULL; } if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } attptr = strstr(attrlist1,"ARRAYOFSTRINGS"); if ( (classid == H5T_STRING) && (attptr == NULL) ) { status = H5Dwrite(fieldID, tid, mid, fspace, H5P_DEFAULT, datbuf); if( status == FAIL ) { sprintf(errbuf,"Cannot write data to the dataset.\n"); H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (attrlist1 != NULL) { free(attrlist1); attrlist1 = NULL; } if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(status); } } else if ( (classid == H5T_STRING) && (attptr != NULL) ) { strbufsize2 = 0; nattr = HE5_SWinqlocattrs(swathID, fieldname, NULL, &strbufsize2); if ( nattr < 0 ) { sprintf(errbuf, "Cannot retrieve the attributes. \n"); H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (attrlist1 != NULL) { free(attrlist1); attrlist1 = NULL; } if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } attrlist2 = (char *) calloc(strbufsize2 + 2, sizeof(char)); if (attrlist2 == NULL) { sprintf(errbuf, "Cannot allocate memory for attrlist2.\n") ; H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (attrlist1 != NULL) { free(attrlist1); attrlist1 = NULL; } if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } nattr = HE5_SWinqlocattrs(swathID, fieldname, attrlist2, &strbufsize2); if ( nattr < 0 ) { sprintf(errbuf, "Cannot retrieve the attributes. \n"); H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (attrlist1 != NULL) { free(attrlist1); attrlist1 = NULL; } if (attrlist2 != NULL) { free(attrlist2); attrlist2 = NULL; } if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } if ( (nattr == 0) || ((attptr = strstr(attrlist2,"StringLengthAttribute")) == NULL) ) { chardatbuf = (char **)datbuf; if (count == NULL) mycount = tcount[0]; if (count != NULL) mycount = *lcount; for (ibuf = 0; ibuf < mycount; ibuf++) { if (chardatbuf[ibuf] == NULL) strsize = 0; else strsize = strlen(chardatbuf[ibuf]); if (strsize > maxlen) maxlen = strsize; } numattr[0] = 1; status = HE5_SWwritelocattr(swathID, fieldname, "StringLengthAttribute", H5T_NATIVE_INT, numattr, &maxlen); if (status == FAIL) { sprintf(errbuf, "Cannot write attribute to the field \"%s\".",fieldname) ; H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (attrlist1 != NULL) { free(attrlist1); attrlist1 = NULL; } if (attrlist2 != NULL) { free(attrlist2); attrlist2 = NULL; } if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(status); } } status = H5Dwrite(fieldID, tid, mid, fspace, H5P_DEFAULT, datbuf); if( status == FAIL ) { sprintf(errbuf,"Cannot write data to the dataset.\n"); H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (attrlist1 != NULL) { free(attrlist1); attrlist1 = NULL; } if (attrlist2 != NULL) { free(attrlist2); attrlist2 = NULL; } if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(status); } } else { /* Get memory data type ID */ /* ----------------------- */ mtype = HE5_EHdtype2mtype(tid); if( mtype == FAIL ) { sprintf(errbuf,"Cannot convert to memory data type.\n"); status = FAIL; H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (attrlist1 != NULL) { free(attrlist1); attrlist1 = NULL; } if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(status); } status = H5Dwrite(fieldID, mtype, mid, fspace, H5P_DEFAULT, datbuf); if( status == FAIL ) { sprintf(errbuf,"Cannot write data to the dataset.\n"); H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (attrlist1 != NULL) { free(attrlist1); attrlist1 = NULL; } if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(status); } } if (attrlist1 != NULL) { free(attrlist1); attrlist1 = NULL; } if (attrlist2 != NULL) { free(attrlist2); attrlist2 = NULL; } } else { if (classid == H5T_STRING) { /* Read the data buffer */ /* -------------------- */ status = H5Dread(fieldID, tid, mid, fspace , H5P_DEFAULT, datbuf); if( status == FAIL ) { sprintf(errbuf,"Cannot read data from the dataset.\n"); H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(status); } } else { /* Get memory data type ID */ /* ----------------------- */ mtype = HE5_EHdtype2mtype(tid); if( mtype == FAIL ) { sprintf(errbuf,"Cannot convert to memory data type.\n"); status = FAIL; H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(status); } /* Read the data buffer */ /* -------------------- */ status = H5Dread(fieldID, mtype, mid, fspace , H5P_DEFAULT, datbuf); if( status == FAIL ) { sprintf(errbuf,"Cannot read data from the dataset.\n"); H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(status); } } } if ( count == NULL) { if(tcount != NULL) free(tcount); } if( start == NULL) { if(tstart != NULL) free(tstart); } if (lcount != NULL) free(lcount); /* Release data space ID */ /* --------------------- */ status = H5Sclose(mid); if( status == FAIL ) { sprintf(errbuf,"Cannot release memory data space ID.\n"); H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release data space ID */ /* --------------------- */ status = H5Sclose(fspace); if( status == FAIL ) { sprintf(errbuf,"Cannot release the file data space ID.\n"); H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release data type ID */ /* -------------------- */ status = H5Tclose(tid); if( status == FAIL ) { sprintf(errbuf,"Cannot release the data type ID.\n"); H5Epush(__FILE__, "HE5_SWwrrdfield", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } COMPLETION: return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWwritefield | | | | DESCRIPTION: Writes data to field | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t swath structure ID | | fieldname char fieldname | | start hssize_t start array | | stride hsize_t stride array | | edge hsize_t edge array | | | | OUTPUTS: | | data void data buffer for write | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | July 00 A.Muslimov Unmasked hdf5 data types. | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | Sep 11 Abe Taaheri Modified for correcting Unlimited dimension | | behavior and extension | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWwritefield(hid_t swathID, char *fieldname, const hssize_t start[], const hsize_t stride[], const hsize_t edge[], void *data) { herr_t status = FAIL; /* return status variable */ hsize_t dims[HE5_DTSETRANKMAX]; /* Field dimensions */ int rank = 0; /* Field rank */ int unlimdim; hsize_t maxdims[HE5_DTSETRANKMAX];/* Field maximum dimensions */ int append = FALSE; /* FLAG (if field is appendable)*/ int i; /* Loop index */ char *errbuf = (char *)NULL; /* error message buffer */ HE5_LOCK; CHECKNAME(fieldname); CHECKPOINTER(data); /* If a field is appendable and need to be extended, do extension here before writing extended data into it */ /* get maxdims for the field */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_SWwritefield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } status = HE5_SWflddiminfo(swathID, fieldname, &rank, dims, maxdims); /* see if we need first to extend data dimensions for unlimited dimensions */ for (i = 0; i < rank; i++) { if( dims[i] == maxdims[i] ) append = FALSE; else if ( (dims[i] < maxdims[i]) || (maxdims[i] == H5S_UNLIMITED)) { append = TRUE; break; } } unlimdim = i; if((append == TRUE) && (edge[unlimdim] > dims[unlimdim])) { hssize_t newstart[8]; hsize_t newedge[8]; for (i = 0; i < rank; i++) { if (start != NULL) { newstart[i]=start[i]; } else { newstart[i]= 0; } if (edge!= NULL) { newedge[i] = edge[i]; } else { newedge[i]=dims[i]; } } newstart[unlimdim]=edge[unlimdim]-1; newedge[unlimdim] = 1; status = HE5_SWwrrdfield(swathID, fieldname, "w", newstart, stride, newedge,data); if (status == FAIL) { sprintf(errbuf, "Cannot write data to the field \"%s\".",fieldname) ; H5Epush(__FILE__, "HE5_SWwritefield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } else { for (i = 0; i < rank; i++) { dims[i]=edge[i]; } } } status = HE5_SWwrrdfield(swathID, fieldname, "w", start, stride, edge, data); if (status == FAIL) { sprintf(errbuf, "Cannot write data to the field \"%s\".",fieldname) ; H5Epush(__FILE__, "HE5_SWwritefield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } else { status = SUCCEED; free(errbuf); } COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWreadfield | | | | DESCRIPTION: Reads data from field | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t swath structure ID | | fieldname char fieldname | | start hssize_t start array | | stride hsize_t stride array | | edge hsize_t edge array | | buffer void data buffer for read | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | July 00 A.Muslimov Unmasked hdf5 data types. | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWreadfield(hid_t swathID, char *fieldname,const hssize_t start[], const hsize_t stride[], const hsize_t edge[], void *data) { herr_t status = FAIL;/* routine return status variable */ HE5_LOCK; CHECKPOINTER(fieldname); status = HE5_SWwrrdfield(swathID, fieldname, "r", start, stride, edge, data); COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWfldsrch | | | | DESCRIPTION: Retrieves information about field DATASET | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | fldgroup int Flag representing one of the groups: | | (0) "Data Fields", (1)"Geolocation | | Fields", and (5) "HE5_PRofile Fields". | | (-1) FAILS. | | | | INPUTS: | | swathID hid_t swath structure ID | | fldname char field name | | | | OUTPUTS: | | fieldID hid_t Field dataset ID | | rank int dataset Rank | | dims hsize_t Dimensions of field | | typeID hid_t Data type ID | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 9/23/99 A.Muslimov Checked for the status returned by H5Sclose(). | | 4/18/00 A.Muslimov Added more error handlings. | | July 00 A.Muslimov Unmasked hdf5 data types. | | Sep 00 A.Muslimov Modified to incorporate "PRofile Fields" group. | | Changed the coding scheme. | | Oct 00 A.Muslimov Added the case where fieldname is an alias. | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWfldsrch(hid_t swathID, char *fldname, hid_t *fieldID, int *rank, hsize_t dims[], hid_t *typeID) { int fldgroup = FAIL; /* Field group flag (return value) */ int i; /* Loop index */ int nameflag = FAIL; /* Alias (0) /actual (1) name flag */ herr_t status = FAIL; /* routine return status variable */ hid_t idx = FAIL; /* Swath index */ hid_t idOffset = HE5_SWIDOFFSET;/* Swath ID offset */ hid_t spaceID = FAIL; /* File data space ID */ char fieldname[HE5_HDFE_NAMBUFSIZE]; /* Buffer for name of a field */ char fldactualname[HE5_HDFE_NAMBUFSIZE];/* Actual name of a field */ char fldtype ='n'; /* Internal group discriminating flag */ char name[HE5_HDFE_NAMBUFSIZE]; /* Field Name buffer */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Buffer for error message */ CHECKPOINTER(fldname); /* Compute "reduced" swath ID */ /* -------------------------- */ idx = swathID % idOffset; /* Call HE5_SWfldnameinfo() to get actual field name */ /* --------------------------------------------- */ nameflag = HE5_SWfldnameinfo(swathID, fldname, fldactualname); if (nameflag == FAIL) { sprintf(errbuf, "Cannot get actual name of the field.\n"); H5Epush(__FILE__, "HE5_SWfldsrch", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } if (nameflag == FALSE) { strcpy(fieldname,""); strcpy(fieldname,fldactualname); } if (nameflag == TRUE) { strcpy(fieldname,""); strcpy(fieldname,fldname); } /* Loop through all geo datasets in swath */ /* -------------------------------------- */ for (i = 0; i < HE5_SWXSwath[idx].nGFLD; i++) { /* get dataset name */ /* ---------------- */ strcpy(name, HE5_SWXSwath[idx].gdataset[i].name); if( strcmp(fieldname, name) == 0 ) { fldtype ='g'; fldgroup = HE5_HDFE_GEOGROUP; break; } } /* not found in geo fields */ /* ----------------------- */ if( fldtype == 'n') { /* Loop through all data datasets in swath */ /* --------------------------------------- */ for (i = 0; i < HE5_SWXSwath[idx].nDFLD; i++) { /* get dataset name */ /* ---------------- */ strcpy(name, HE5_SWXSwath[idx].ddataset[i].name); if( strcmp(fieldname, name) == 0 ) { fldtype ='d'; fldgroup = HE5_HDFE_DATAGROUP; break; } } } /* not found in data fields */ /* ------------------------ */ if( fldtype == 'n') { /* Loop through all profile datasets in swath */ /* ------------------------------------------ */ for (i = 0; i < HE5_SWXSwath[idx].nPROF; i++) { /* get dataset name */ /* ---------------- */ strcpy(name, HE5_SWXSwath[idx].pdataset[i].name); if( strcmp(fieldname, name) == 0 ) { fldtype ='p'; fldgroup = HE5_HDFE_PROFGROUP; break; } } } if (fieldID != NULL) { /* Get dataset ID */ /* ============== */ if( fldtype =='g') *fieldID = HE5_SWXSwath[idx].gdataset[i].ID; else if (fldtype =='d') *fieldID = HE5_SWXSwath[idx].ddataset[i].ID; else if (fldtype =='p') *fieldID = HE5_SWXSwath[idx].pdataset[i].ID; else { sprintf(errbuf,"Cannot find \"%s\" field in Swath. Check the spelling.\n", fieldname); H5Epush(__FILE__, "HE5_SWfldsrch", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get data space ID */ /* ----------------- */ spaceID = H5Dget_space(*fieldID); if (spaceID == FAIL) { sprintf(errbuf,"Cannot get the data space ID.\n"); H5Epush(__FILE__, "HE5_SWfldsrch", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } if (rank != NULL) { /* Get dataset rank */ /* ---------------- */ *rank = H5Sget_simple_extent_ndims(spaceID); if (*rank == FAIL) { sprintf(errbuf,"Cannot get the dataset rank.\n"); H5Epush(__FILE__, "HE5_SWfldsrch", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } if (typeID != NULL || dims != NULL) { /* Get data type ID */ /* ---------------- */ *typeID = H5Dget_type(*fieldID); if (*typeID == FAIL) { sprintf(errbuf,"Cannot get the data type ID.\n"); H5Epush(__FILE__, "HE5_SWfldsrch", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get dimension sizes */ /* ------------------- */ status = H5Sget_simple_extent_dims(spaceID, dims, NULL); if (status == FAIL) { sprintf(errbuf,"Cannot get the data space dimension sizes.\n"); H5Epush(__FILE__, "HE5_SWfldsrch", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Release data type ID */ /* -------------------- */ status = H5Tclose(*typeID); if (status == FAIL) { sprintf(errbuf,"Cannot release the data type ID.\n"); H5Epush(__FILE__, "HE5_SWfldsrch", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Release data space ID */ /* --------------------- */ status = H5Sclose(spaceID); if (status == FAIL) { sprintf(errbuf,"Cannot release the data space ID.\n"); H5Epush(__FILE__, "HE5_SWfldsrch", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } } COMPLETION: return(fldgroup); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWdetach | | | | DESCRIPTION: Detachs swath structure and performs housekeeping | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t swath structure ID | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 8/23/99 A. Muslimov Checked for the statuses returned by H5Dclose() | | and H5Gclose(). | | 10/28/99 A.Muslimov Added a block 'Close previously opened ragged | | arrays'. Added a call to | | H5Gclose(SWXSwath[sID].ra_id), and the lines, cor- | | responding to the ragged arrays in the block | | 'Delete entries from External Arrays'. | | Feb,2000 A.Muslimov Fixed a bug-prone release of IDs. | | Apr,2000 A.Muslimov Removed "Ragged Arrays" group. | | July 00 A.Muslimov Unmasked hdf5 data types. | | Sep 00 A.Muslimov Added "PRofile Fields" group. | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWdetach(hid_t swathID) { herr_t status = FAIL; /* Return status variable */ long idx = FAIL; /* Swath index */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ int i, k; /* Loop indices */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWdetach", &fid, &gid, &idx); if (status == SUCCEED) { /* "Detach" from previously attached "Data Fields" datasets */ /* -------------------------------------------------------- */ if( HE5_SWXSwath[idx].nDFLD > 0 ) { for (k = 0; k < HE5_SWXSwath[idx].nDFLD; k++) { if ( HE5_SWXSwath[idx].ddataset[k].ID > 0 ) { status = H5Dclose(HE5_SWXSwath[idx].ddataset[k].ID); if (status == FAIL) { sprintf(errbuf, "Cannot release the data dataset ID. \n") ; H5Epush(__FILE__, "HE5_SWdetach", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } if(HE5_SWXSwath[idx].ddataset[k].name != NULL) free(HE5_SWXSwath[idx].ddataset[k].name); } if (HE5_SWXSwath[idx].ddataset != NULL) free(HE5_SWXSwath[idx].ddataset); } /* "Detach" from previously attached "PRofile Fields" datasets */ /* ----------------------------------------------------------- */ if( HE5_SWXSwath[idx].nPROF > 0 ) { for (k = 0; k < HE5_SWXSwath[idx].nPROF; k++) { if ( HE5_SWXSwath[idx].pdataset[k].ID > 0 ) { status = H5Dclose(HE5_SWXSwath[idx].pdataset[k].ID); if (status == FAIL) { sprintf(errbuf, "Cannot release the profile dataset ID. \n") ; H5Epush(__FILE__, "HE5_SWdetach", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } if(HE5_SWXSwath[idx].pdataset[k].name != NULL) free(HE5_SWXSwath[idx].pdataset[k].name); } if (HE5_SWXSwath[idx].pdataset != NULL) free(HE5_SWXSwath[idx].pdataset); } /* "Detach" from previously attached "Geolocation Fields" datasets */ /* --------------------------------------------------------------- */ if( HE5_SWXSwath[idx].nGFLD > 0 ) { for (k = 0; k < HE5_SWXSwath[idx].nGFLD; k++) { if ( HE5_SWXSwath[idx].gdataset[k].ID > 0 ) { status = H5Dclose(HE5_SWXSwath[idx].gdataset[k].ID); if (status == FAIL) { sprintf(errbuf, "Cannot release the geolocation dataset ID. \n") ; H5Epush(__FILE__, "HE5_SWdetach", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } if (HE5_SWXSwath[idx].gdataset[k].name != NULL) free(HE5_SWXSwath[idx].gdataset[k].name); } if (HE5_SWXSwath[idx].gdataset != NULL) free(HE5_SWXSwath[idx].gdataset); } /* Detach from the Swath groups */ /* ---------------------------- */ if ( HE5_SWXSwath[idx].geo_id > 0 ) { status = H5Gclose(HE5_SWXSwath[idx].geo_id); if (status == FAIL) { sprintf(errbuf, "Cannot release the \"Geolocation Fields\" group ID. \n") ; H5Epush(__FILE__, "HE5_SWdetach", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } if ( HE5_SWXSwath[idx].data_id > 0 ) { status = H5Gclose(HE5_SWXSwath[idx].data_id); if (status == FAIL) { sprintf(errbuf, "Cannot release the \"Data Fields\" group ID. \n") ; H5Epush(__FILE__, "HE5_SWdetach", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } if ( HE5_SWXSwath[idx].prof_id > 0 ) { status = H5Gclose(HE5_SWXSwath[idx].prof_id); if (status == FAIL) { sprintf(errbuf, "Cannot release the \"Profile Fields\" group ID.") ; H5Epush(__FILE__, "HE5_SWdetach", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } if ( HE5_SWXSwath[idx].sw_id > 0 ) { status = H5Gclose(HE5_SWXSwath[idx].sw_id); if (status == FAIL) { sprintf(errbuf, "Cannot release the swath group ID. \n") ; H5Epush(__FILE__, "HE5_SWdetach", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } /* Delete entries from External Arrays */ /* ----------------------------------- */ HE5_SWXSwath[idx].active = 0; HE5_SWXSwath[idx].geo_id = 0; HE5_SWXSwath[idx].data_id = 0; HE5_SWXSwath[idx].prof_id = 0; HE5_SWXSwath[idx].ddataset = NULL; HE5_SWXSwath[idx].pdataset = NULL; HE5_SWXSwath[idx].gdataset = NULL; HE5_SWXSwath[idx].fid = 0; HE5_SWXSwath[idx].sw_id = 0; HE5_SWXSwath[idx].obj_id = 0; HE5_SWXSwath[idx].nDFLD = 0; HE5_SWXSwath[idx].nPROF = 0; HE5_SWXSwath[idx].nGFLD = 0; /* Free Region Pointers */ /* -------------------- */ for (k = 0; k < HE5_NSWATHREGN; k++) { if (HE5_SWXRegion[k] != NULL && HE5_SWXRegion[k]->swathID == swathID) { for (i = 0; i < HE5_DTSETRANKMAX; i++) { if (HE5_SWXRegion[k]->DimNamePtr[i] != NULL) { free(HE5_SWXRegion[k]->DimNamePtr[i]); } } free(HE5_SWXRegion[k]); HE5_SWXRegion[k] = NULL; } } } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWdefboxregion | | | | DESCRIPTION: Finds swath cross tracks within area of interest and returns | | region ID | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | regionID hid_t Region ID | | | | INPUTS: | | swathID hid_t Swath structure ID | | cornerlon double dec deg Longitude of opposite corners of box | | cornerlat double dec deg Latitude of opposite corners of box | | mode int Search mode | | HDFE_MIDPOINT - Use midpoint of Xtrack | | HDFE_ENDPOINT - Use endpoints of Xtrack | | HDFE_ANYPOINT - Use all points of Xtrack| | | | OUTPUTS: | | None | | | | NOTES: | | | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 98 Abe Taaheri Fixed core dump in SWregioninfo associated with | | SWXRegion[k]->nRegions exceeding MAXNREGIONS in | | this function | | | | Aug 3,99 A.Muslimov Changed the type of lonArr[] and latArr[] from char | | to float64. Changed types of fid, idx from int32_t | | to hid_t. | | Aug 11,99 A.Muslimov Left out a factor 8 in front of "(i * edge[1] + j)" | | in "memcpy(&lonTestVal,&lonArr[i*edge[1]+j],8);" | | and "memcpy(&latTestVal,&latArr[i*edge[1]+j],8);". | | Made similar changes in the calls to | | "memcpy(&lonTestVal,&lonArr[j],8);" and | | "memcpy(&latTestVal,&latArr[j],8);", and in all | | other calls to memcpy(). | | 10/18/99 A.Muslimov Replaced memcpy() by memmove() to avoid a problem | | when arguments 1 and 2 overlap in memory. | | 02/08/00 A.Muslimov Added more error checkings. | | 03/13/00 A.Muslimov Modified to convert non-native datatypes to native | | ones. | | July 00 A.Muslimov Unmasked hdf5 data types. | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | Jan 05 S. Zhao Modified to include a region starts and stops with | | the same index on the track. | | Jan 05 S. Zhao Returned error if regionID exceeded HE5_NSWATHREGN. | | END_PROLOG | -----------------------------------------------------------------------------*/ hid_t HE5_SWdefboxregion(hid_t swathID, double cornerlon[], double cornerlat[], int mode) { hid_t regionID = FAIL;/* Region ID (return) */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t tid = FAIL;/* Longitude/Latitude Datatype ID */ hid_t fieldID = FAIL;/* Longitude/Latitude Dataset ID */ hid_t k; /* Loop index */ herr_t status = FAIL;/* routine return status variable */ herr_t statLon = FAIL;/* Status from SWfieldinfo for longitude */ herr_t statLat = FAIL;/* Status from SWfieldinfo for latitude */ herr_t statCoLat = FAIL;/* Status from SWfieldinfo for */ int validReg = FAIL; /* validReg flag */ int rank = FAIL; /* Rank of dataset */ hid_t nt[1] ={FAIL}; /* number types */ unsigned found = 0; /* Found flag */ unsigned char *flag = (unsigned char *)NULL;/* Track flag array */ long idx = FAIL; /* Swath index */ long bndflag = FAIL; /* +/-180 boundary flag */ long lonTest = FAIL; /* Longitude test flag */ long latTest = FAIL; /* Latitude test flag */ long i = 0, j = 0; /* Loop indices */ size_t tsize = 0; /* Data type size (bytes)*/ hssize_t start[2] = {FAIL, FAIL}; /* Start array (read) */ hssize_t anyStart[2]= {FAIL, FAIL}; /* ANYPOINT start array */ hsize_t nElem = 0; /* Number of elements to read */ hsize_t dims[HE5_DTSETRANKMAX];/* Dims of geolocation fields */ hsize_t stride[2] = {1, 1}; /* Stride array (read) */ hsize_t edge[2] = {0, 0}; /* Edge array (read) */ hsize_t anyEdge[2] = {0, 0}; /* ANYPOINT edge array (read) */ float tempFloat = 0.; /* Temporary float variable */ double tempDouble = 0.; /* Temporary double variable */ double lonTestVal = 0.; /* Longitude test value */ double latTestVal = 0.; /* Latitude test value */ char *lonArr = (char *)NULL;/* Longitude data array */ char *latArr = (char *)NULL;/* Latitude data array */ char dimlist[HE5_HDFE_DIMBUFSIZE];/* Dimension list */ char latName[16]; /* Latitude field name */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKPOINTER(cornerlon); CHECKPOINTER(cornerlat); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWdefboxregion", &fid, &gid, &idx); /* Inclusion mode must be between 0 and 2 */ /* -------------------------------------- */ if (mode < 0 || mode > 2) { status = FAIL; sprintf(errbuf, "Improper Inclusion Mode: %d.\n", mode); H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } strcpy(dimlist,""); if (status == SUCCEED) { /* Initialize dims[] array */ /* ----------------------- */ for (i = 0; i < HE5_DTSETRANKMAX; i++) dims[i] = 0; /* Get "Longitude" field info */ /* -------------------------- */ statLon = HE5_SWfieldinfo(swathID, "Longitude", &rank, dims, nt, dimlist, NULL); if (statLon == FAIL) { status = FAIL; sprintf(errbuf,"\"Longitude\" field not found.\n"); H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } /* Get "Latitude" field info */ /* -------------------------- */ statLat = HE5_SWfieldinfo(swathID, "Latitude", &rank, dims, nt, dimlist, NULL); if (statLat == FAIL) { /* If not found check for "Colatitude" field info */ /* ---------------------------------------------- */ statCoLat = HE5_SWfieldinfo(swathID, "Colatitude", &rank, dims, nt,dimlist, NULL); if (statCoLat == FAIL) { /* Neither "Latitude" nor "Colatitude" field found */ /* ----------------------------------------------- */ status = FAIL; sprintf( errbuf, "Neither \"Latitude\" nor \"Colatitude\" fields found.\n"); H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } else { /* Latitude field is "Colatitude" */ /* ------------------------------ */ strcpy(latName, "Colatitude"); } } else { /* Latitude field is "Latitude" */ /* ---------------------------- */ strcpy(latName, "Latitude"); } /* Get "Latitude" or "Longitude" datatype */ tsize = HE5_SWfieldsizeID(swathID, "Latitude", &fieldID); if (tsize == 0) { status = FAIL; sprintf(errbuf,"The size of a data type = 0.\n"); H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } tid = H5Dget_type( fieldID); if (tid == FAIL) { status = FAIL; sprintf(errbuf,"Cannot get the dataset data type ID.\n"); H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } if (status == SUCCEED) { /* Search along entire "Track" dimension from beginning to end */ /* ----------------------------------------------------------- */ start[0] = 0; edge[0] = dims[0]; /* If 1D geolocation fields then set mode to MIDPOINT */ /* -------------------------------------------------- */ if (rank == 1) mode = HE5_HDFE_MIDPOINT; switch (mode) { /* If MIDPOINT search single point in middle of "CrossTrack" */ /* --------------------------------------------------------- */ case HE5_HDFE_MIDPOINT: start[1] = HE5_EHlong2hssize( (dims[ 1 ] / 2) ); edge[1] = 1; break; /* If ENDPOINT search 2 points at either end of "CrossTrack" */ /* --------------------------------------------------------- */ case HE5_HDFE_ENDPOINT: start[1] = 0; stride[1] = dims[1] - 1; edge[1] = 2; break; /* If ANYPOINT do initial MIDPOINT search */ /* -------------------------------------- */ case HE5_HDFE_ANYPOINT: start[1] = HE5_EHlong2hssize( (dims[1] / 2) ); if ( start[1] == FAIL ) { sprintf(errbuf, "Cannot convert data type. \n"); H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } edge[1] = 1; break; } /* Compute number of elements */ /* -------------------------- */ nElem = edge[ 0 ] * edge[ 1 ]; /* Allocate space for longitude and latitude */ /* ------------------------------------------ */ lonArr = (char *)calloc(nElem, sizeof(double)); if(lonArr == NULL) { H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); return(FAIL); } latArr = (char *)calloc(nElem, sizeof(double)); if(latArr == NULL) { H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); free(lonArr); lonArr = NULL; return(FAIL); } /* Allocate space for flag array */ /* ----------------------------- */ flag = (unsigned char *) calloc(edge[0] + 1, sizeof(unsigned char )); if(flag == NULL) { H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); free(lonArr); free(latArr); lonArr = NULL; latArr = NULL; return(FAIL); } /* Read Longitude and Latitude fields */ /* ---------------------------------- */ status = HE5_SWreadfield(swathID, "Longitude", start, stride, edge, lonArr); if( status == FAIL ) { H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot read the \"Longitude\" field."); HE5_EHprint("Error: Cannot read the \"Longitude\" field, occured", __FILE__, __LINE__); free(lonArr); free(latArr); free(flag); lonArr = NULL; latArr = NULL; flag = NULL; return(FAIL); } status = HE5_SWreadfield(swathID, latName, start, stride, edge, latArr); if( status == FAIL ) { H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot read the \"Latitude\" field."); HE5_EHprint("Error: Cannot read the \"Latitude\" field, occured", __FILE__, __LINE__); free(lonArr); free(latArr); free(flag); lonArr = NULL; latArr = NULL; flag = NULL; return(FAIL); } /* * If geolocation fields are FLOAT then cast each entry as DOUBLE */ if ( H5Tequal( tid, H5T_NATIVE_FLOAT) || H5Tequal( tid, H5T_IEEE_F32LE) || H5Tequal( tid, H5T_IEEE_F32BE) ) { for (i = nElem - 1; i >= 0; i--) { memmove(&tempFloat, lonArr + sizeof(float) * i, sizeof(float)); tempDouble = (double)tempFloat; memmove(lonArr + sizeof(double) * i, &tempDouble, sizeof(double)); memmove(&tempFloat, latArr + sizeof(float) * i, sizeof(float)); tempDouble = (double) tempFloat; memmove(latArr + sizeof(double) * i, &tempDouble, sizeof(double)); } } /* Set boundary flag */ /* ----------------- */ /* * This variable is set to 1 if the region of interest crosses * the +/- 180 longitude boundary */ bndflag = (cornerlon[0] < cornerlon[1]) ? 0 : 1; /* Main Search Loop */ /* ---------------- */ /* For each track ... */ /* ------------------ */ for (i = 0; i < edge[0]; i++) { /* For each value from Cross Track ... */ /* ----------------------------------- */ for (j = 0; j < edge[1]; j++) { /* Read in single lon & lat values from data buffers */ /* ------------------------------------------------- */ memmove(&lonTestVal, &lonArr[sizeof(double) * (i * edge[1] + j)], sizeof(double)); memmove(&latTestVal, &latArr[sizeof(double) * (i * edge[1] + j)], sizeof(double)); /* If longitude value > 180 convert to -180 to 180 range */ /* ----------------------------------------------------- */ if (lonTestVal > 180) lonTestVal = lonTestVal - 360; /* If Colatitude value convert to latitude value */ /* --------------------------------------------- */ if (statCoLat == 0) latTestVal = 90 - latTestVal; /* Test if lat value is within range */ /* --------------------------------- */ latTest = (latTestVal >= cornerlat[0] && latTestVal <= cornerlat[1]); if (bndflag == 1) { /* * If boundary flag set test whether longitude value * is outside region and then flip */ lonTest = (lonTestVal >= cornerlon[1] && lonTestVal <= cornerlon[0]); lonTest = 1 - lonTest; } else { lonTest = (lonTestVal >= cornerlon[0] && lonTestVal <= cornerlon[1]); } /* * If both longitude and latitude are within region set * flag on for this track */ if ( (lonTest + latTest) == 2 ) { flag[i] = 1; found = 1; break; } } } /* ANYPOINT search */ /* --------------- */ if ( (mode == HE5_HDFE_ANYPOINT) && (rank > 1) ) { free(lonArr); free(latArr); lonArr = NULL; latArr = NULL; /* Allocate space for an entire single cross track */ /* ----------------------------------------------- */ lonArr = (char *) calloc(dims[1], sizeof(double)); if(lonArr == NULL) { H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); return(FAIL); } latArr = (char *) calloc(dims[1], sizeof(double)); if(latArr == NULL) { H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); free(lonArr); lonArr = NULL; return(FAIL); } /* Setup start and edge */ /* -------------------- */ anyStart[1] = 0; anyEdge[0] = 1; anyEdge[1] = dims[1]; /* For each track starting from 0 */ /* ------------------------------ */ for (i = 0; i < edge[0]; i++) { /* If cross track not in region (with MIDPOINT search ... */ /* ------------------------------------------------------ */ if (flag[i] == 0) { /* Setup track start */ /* ----------------- */ anyStart[0] = HE5_EHlong2hssize(i); if (anyStart[0] == FAIL ) { sprintf(errbuf, "Cannot convert data type. \n"); H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(lonArr); free(latArr); lonArr = NULL; latArr = NULL; return(FAIL); } /* Read in lon and lat values for cross track */ /* ------------------------------------------ */ status = HE5_SWreadfield(swathID, "Longitude", anyStart, NULL, anyEdge, lonArr); if(status == FAIL) { H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot read the \"Longitude\" field. \n"); HE5_EHprint("Error: Cannot read the \"Longitude\" field, occured", __FILE__, __LINE__); free(lonArr); free(latArr); lonArr = NULL; latArr = NULL; return(FAIL); } status = HE5_SWreadfield(swathID, latName, anyStart, NULL, anyEdge, latArr); if(status == FAIL) { H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot read the \"Latitude\" field. \n"); HE5_EHprint("Error: Cannot read the \"Latitude\" field, occured", __FILE__, __LINE__); free(lonArr); free(latArr); lonArr = NULL; latArr = NULL; return(FAIL); } /* * If geolocation fields are FLOAT then cast each entry as DOUBLE */ if ( H5Tequal( tid, H5T_NATIVE_FLOAT) || H5Tequal( tid, H5T_IEEE_F32LE) || H5Tequal( tid, H5T_IEEE_F32BE) ) { for (j = dims[1] - 1; j >= 0; j--) { memmove(&tempFloat, lonArr + sizeof(float) * j, sizeof(float)); tempDouble = (double)tempFloat; memmove(lonArr + sizeof(double) * j, &tempDouble, sizeof(double)); memmove(&tempFloat, latArr + sizeof(float) * j, sizeof(float)); tempDouble = (double)tempFloat; memmove(latArr + sizeof(double) * j, &tempDouble, sizeof(double)); } } /* For each value from Cross Track ... */ /* ----------------------------------- */ for (j = 0; j < dims[1]; j++) { /* Read in single lon & lat values from buffers */ /* -------------------------------------------- */ memmove(&lonTestVal, &lonArr[sizeof(double) * j], sizeof(double)); memmove(&latTestVal, &latArr[sizeof(double) * j], sizeof(double)); /* If lon value > 180 convert to -180 - 180 range */ /* ---------------------------------------------- */ if (lonTestVal > 180) lonTestVal = lonTestVal - 360; /* If Colatitude value convert to latitude value */ /* --------------------------------------------- */ if (statCoLat == 0) latTestVal = 90 - latTestVal; /* Test if lat value is within range */ /* --------------------------------- */ latTest = (latTestVal >= cornerlat[0] && latTestVal <= cornerlat[1]); if (bndflag == 1) { /* * If boundary flag set test whether * longitude value is outside region and then * flip */ lonTest = (lonTestVal >= cornerlon[1] && lonTestVal <= cornerlon[0]); lonTest = 1 - lonTest; } else { lonTest = (lonTestVal >= cornerlon[0] && lonTestVal <= cornerlon[1]); } /* * If both longitude and latitude are within * region set flag on for this track */ if ( (lonTest + latTest) == 2 ) { flag[i] = 1; found = 1; break; } } } } } /* If within region setup Region Structure */ /* --------------------------------------- */ if (found == 1) { /* For all entries in SWXRegion array ... */ /* -------------------------------------- */ for (k = 0; k < HE5_NSWATHREGN; k++) { /* If empty region ... */ /* ------------------- */ if (HE5_SWXRegion[k] == 0) { /* Allocate space for region entry */ /* ------------------------------- */ HE5_SWXRegion[k] = (struct HE5_swathRegion *)calloc(1, sizeof(struct HE5_swathRegion)); if(HE5_SWXRegion[k] == NULL) { H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); return(FAIL); } /* Store file and swath ID */ /* ----------------------- */ HE5_SWXRegion[k]->fid = fid; HE5_SWXRegion[k]->swathID = swathID; /* Set Start & Stop Vertical arrays to FAIL */ /* ---------------------------------------- */ for (j = 0; j < HE5_DTSETRANKMAX; j++) { HE5_SWXRegion[k]->StartVertical[j] = FAIL; HE5_SWXRegion[k]->StopVertical[j] = FAIL; } /* Set region ID */ /* ------------- */ regionID = k; break; } } if (k >= HE5_NSWATHREGN) { sprintf(errbuf, "regionID exceeded HE5_NSWATHREGN.\n"); H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_BTREE, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (lonArr != NULL) free(lonArr); if (latArr != NULL) free(latArr); if (flag != NULL) free(flag); return(FAIL); } /* Find start and stop of regions */ /* ------------------------------ */ /* Subtract previous flag value from current one */ /* --------------------------------------------- */ /* * Transisition points will have flag value (+1) start or * (255 = (uint8_t) -1) stop of region */ for (i = edge[0]; i > 0; i--) flag[i] -= flag[i - 1]; for (i = 0; i <= edge[0]; i++) { /* Start of region */ /* --------------- */ if (flag[i] == 1) { /* Increment (multiple) region counter */ /* ----------------------------------- */ j = ++HE5_SWXRegion[k]->nRegions; if ((HE5_SWXRegion[k]->nRegions) > HE5_MAXNREGIONS) { sprintf(errbuf, "HE5_SWXRegion[%d]->nRegions exceeded HE5_MAXNREGIONS = %d.\n", k, HE5_MAXNREGIONS); H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (lonArr != NULL) free(lonArr); if (latArr != NULL) free(latArr); if (flag != NULL) free(flag); return(FAIL); } HE5_SWXRegion[k]->StartRegion[j - 1] = i; } /* End of region */ /* ------------- */ if (flag[i] == 255) { HE5_SWXRegion[k]->StopRegion[j - 1] = i - 1; validReg = 0; } } } if (lonArr != NULL) free(lonArr); if (latArr != NULL) free(latArr); if (flag != NULL) free(flag); } status = H5Tclose(tid); if (status == FAIL) { sprintf(errbuf,"Cannot release the data type ID.\n"); H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } if(validReg != 0) { sprintf(errbuf,"Invalid region ID.\n"); H5Epush(__FILE__, "HE5_SWdefboxregion", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); regionID = FAIL; } COMPLETION: HE5_UNLOCK; return(regionID); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWregionindex | | | | DESCRIPTION: Finds swath cross tracks within area of interest and returns | | region index and region ID | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | regionID hid_t Region ID | | | | INPUTS: | | swathID hid_t Swath structure ID | | cornerlon double dec deg Longitude of opposite corners of box | | cornerlat double dec deg Latitude of opposite corners of box | | mode int Search mode | | HDFE_MIDPOINT - Use midpoint of Xtrack | | HDFE_ENDPOINT - Use endpoints of Xtrack | | HDFE_ANYPOINT - Use all points of Xtrack| | | | OUTPUTS: | | geodim char geolocation track dimension | | idxrange hsize_t indices of region for along track dim. | | | | NOTES: | | | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 10/18/99 A.Muslimov Replaced memcpy() by memmove() to avoid a problem | | when arguments 1 and 2 overlap in memory. | | 03/13/00 A.Muslimov Modified to convert non-native datatypes to native | | ones. | | 06/21/00 A.Muslimov Casted "flag[]" to "int". Moved "l = (hsize_t)i" out| | of the loop "if (mapstatus == 2){}". | | July 00 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ hid_t HE5_SWregionindex(hid_t swathID, double cornerlon[], double cornerlat[], int mode, char *geodim, hsize_t idxrange[]) { hid_t regionID = FAIL; /* Region ID (return value) */ hid_t k = 0; /* loop index (region counter) */ herr_t status = FAIL; /* status variable */ herr_t mapstatus = FAIL; /* status variable */ herr_t statLon = FAIL; /* status variable */ herr_t statLat = FAIL; /* status variable */ herr_t statCoLat = FAIL; /* status variable */ int validReg = FAIL; /* validReg flag */ int rank = FAIL; /* Rank of geolocation fields */ hid_t *nt = (hid_t *)NULL;/* number types */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t datasetid = FAIL; /* Dataset ID */ hid_t datatype = FAIL; /* Data type ID */ unsigned char found = 0; /* Found flag */ unsigned char *flag = (unsigned char *)NULL;/* Track flag array */ long idx = FAIL; /* Swath index */ long bndflag = FAIL; /* +/-180 boundary flag */ long lonTest = FAIL; /* Longitude test flag */ long latTest = FAIL; /* Latitude test flag */ hssize_t start[2] = {FAIL, FAIL};/* Start array (read) */ hssize_t anyStart[2] = {FAIL, FAIL};/* ANYPOINT start array (read) */ hssize_t i = 0, j = 0; /* Loop indices */ hsize_t l = 0; /* loop index */ hsize_t tmpVal = 0; /* Start region tmp value */ hsize_t dims[HE5_DTSETRANKMAX]; /* Dimension array */ hsize_t nElem = 0; /* Number of elements to read */ hsize_t stride[2] = {1, 1}; /* Stride array (read) */ hsize_t edge[2] = {0, 0}; /* Edge array (read) */ hsize_t anyEdge[2] = {0, 0}; /* ANYPOINT edge array (read) */ float tempFloat = 0.; /* Temporary float variable */ double lonTestVal = 0.; /* Longitude test value */ double latTestVal = 0.; /* Latitude test value */ double tempDouble = 0.; /* Temporary double variable */ size_t size = 0; /* Data type size (bytes) */ char *lonArr = (char *)NULL; /* Longitude data array */ char *latArr = (char *)NULL; /* Latitude data array */ char dimlist[HE5_HDFE_DIMBUFSIZE];/* Dimension list (geo fields) */ char latName[16]; /* Latitude field name */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ CHECKPOINTER(cornerlon); CHECKPOINTER(cornerlat); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWregionindex", &fid, &gid, &idx); /* Inclusion mode must be between 0 and 2 */ /* -------------------------------------- */ if (mode < 0 || mode > 2) { status = FAIL; sprintf(errbuf, "Improper Inclusion Mode: %d.\n", mode); H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } strcpy(dimlist,""); if (status == SUCCEED) { /* Initialize dims[] array */ /* ----------------------- */ for (l = 0; l < HE5_DTSETRANKMAX; l++) dims[l] = 0; /* Allocate memory for nt variable */ /* ------------------------------- */ nt = (hid_t *)calloc(1, sizeof(hid_t)); if(nt == (hid_t *)NULL) { sprintf(errbuf, "Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get "Longitude" field info */ /* -------------------------- */ statLon = HE5_SWfieldinfo(swathID, "Longitude", &rank, dims, nt, dimlist,NULL); if (statLon != SUCCEED) { status = FAIL; sprintf(errbuf, "\"Longitude\" field not found.\n"); H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(nt); } /* Get "Latitude" field info */ /* ------------------------- */ statLat = HE5_SWfieldinfo(swathID, "Latitude", &rank, dims, nt, dimlist,NULL); if (statLat != SUCCEED) { /* If not found check for "Colatitude" field info */ /* ---------------------------------------------- */ statCoLat = HE5_SWfieldinfo(swathID, "Colatitude", &rank, dims, nt, dimlist, NULL); if (statCoLat != SUCCEED) { /* Neither "Latitude" nor "Colatitude" field found */ /* ----------------------------------------------- */ status = FAIL; sprintf(errbuf, "Neither \"Latitude\" nor \"Colatitude\" fields found.\n"); H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(nt); } else { /* Latitude field is "Colatitude" */ /* ------------------------------ */ strcpy(latName, "Colatitude"); } } else { /* Latitude field is "Latitude" */ /* ---------------------------- */ strcpy(latName, "Latitude"); } /* This line modifies the dimlist variable so only the along-track */ /* dimension remains. */ /* --------------------------------------------------------------- */ strtok(dimlist,","); mapstatus = HE5_SWgeomapinfo(swathID,dimlist); if(mapstatus == FAIL) { status = FAIL; sprintf(errbuf, "Cannot retrieve geo map information.\n"); H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(nt); } strcpy(geodim,dimlist); if (status == SUCCEED) { /* Search along entire "Track" dimension from beginning to end */ /* ----------------------------------------------------------- */ start[0] = 0; edge[0] = dims[0]; /* If 1D geolocation fields then set mode to MIDPOINT */ /* -------------------------------------------------- */ if (rank == 1) { mode = HE5_HDFE_MIDPOINT; } switch (mode) { /* If MIDPOINT search single point in middle of "CrossTrack" */ /* --------------------------------------------------------- */ case HE5_HDFE_MIDPOINT: start[1] = HE5_EHhsize2hssize(dims[ 1 ]/2); if ( start[1] == FAIL ) { sprintf(errbuf, "Cannot convert data type. \n"); H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(nt); return(FAIL); } edge[1] = 1; break; /* If ENDPOINT search 2 points at either end of "CrossTrack" */ /* --------------------------------------------------------- */ case HE5_HDFE_ENDPOINT: start[1] = 0; stride[1] = dims[1] - 1; edge[1] = 2; break; /* If ANYPOINT do initial MIDPOINT search */ /* -------------------------------------- */ case HE5_HDFE_ANYPOINT: start[1] = HE5_EHhsize2hssize(dims[ 1 ]/2); if ( start[1] == FAIL ) { sprintf(errbuf, "Cannot convert data type. \n"); H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(nt); return(FAIL); } edge[1] = 1; break; } /* Compute number of elements */ /* -------------------------- */ nElem = edge[0] * edge[1]; /* Allocate space for longitude and latitude */ /* ------------------------------------------ */ lonArr = (char *)calloc(nElem, sizeof(double)); if(lonArr == NULL) { H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); free(nt); return(FAIL); } latArr = (char *) calloc(nElem, sizeof(double)); if(latArr == NULL) { H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); free(lonArr); free(nt); return(FAIL); } /* Allocate space for flag array */ /* ----------------------------- */ flag = (unsigned char *)calloc(edge[0] + 1, sizeof(unsigned char)); if(flag == NULL) { H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); free(lonArr); free(latArr); free(nt); return(FAIL); } /* Read Longitude and Latitude fields */ /* ---------------------------------- */ status = HE5_SWreadfield(swathID, "Longitude",start, stride, edge, lonArr); if( status == FAIL) { H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_DATASET, H5E_READERROR, "Cannot read the \"Longitude\" field."); HE5_EHprint("Error: Cannot read the \"Longitude\" field, occured", __FILE__, __LINE__); free(lonArr); free(latArr); free(nt); free(flag); return(FAIL); } status = HE5_SWreadfield(swathID, latName, start, stride, edge, latArr); if( status == FAIL) { H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_DATASET, H5E_READERROR, "Cannot read the \"Latitude\" field."); HE5_EHprint("Error: Cannot read the \"Latitude\" field, occured", __FILE__, __LINE__); free(lonArr); free(latArr); free(nt); free(flag); return(FAIL); } /* * If geolocation fields are FLOAT then cast each entry as DOUBLE */ datasetid = H5Dopen(HE5_SWXSwath[idx].geo_id, "Longitude"); if(datasetid == FAIL) { sprintf(errbuf, "Cannot open the dataset.\n"); H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(lonArr); free(latArr); free(nt); free(flag); return(FAIL); } datatype = H5Dget_type(datasetid); if(datatype == FAIL) { sprintf(errbuf, "Cannot get the data type ID.\n"); H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(lonArr); free(latArr); free(nt); free(flag); return(FAIL); } size = H5Tget_size(datatype); if(size == 0) { sprintf(errbuf, "Cannot get the data type size.\n"); H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(lonArr); free(latArr); free(nt); free(flag); return(FAIL); } status = H5Dclose(datasetid); if(status == FAIL) { sprintf(errbuf, "Cannot close the dataset.\n"); H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(lonArr); free(latArr); free(nt); free(flag); return(FAIL); } if ( H5Tequal( datatype, H5T_NATIVE_FLOAT) || H5Tequal( datatype, H5T_IEEE_F32LE) || H5Tequal( datatype, H5T_IEEE_F32BE) ) { for (i = nElem - 1; i >= 0; i--) { memmove(&tempFloat, lonArr + sizeof(float) * i, sizeof(float)); tempDouble = (double)tempFloat; memmove(lonArr + sizeof(double) * i, &tempDouble, sizeof(double)); memmove(&tempFloat, latArr + sizeof(float) * i, sizeof(float)); tempDouble = (double)tempFloat; memmove(latArr + sizeof(double) * i, &tempDouble, sizeof(double)); } } /* Set boundary flag */ /* ----------------- */ /* * This variable is set to 1 if the region of interest crosses * the +/- 180 longitude boundary */ bndflag = (cornerlon[0] < cornerlon[1]) ? 0 : 1; /* Main Search Loop */ /* ---------------- */ /* For each track ... */ /* ------------------ */ for (i = 0; i < edge[0]; i++) { /* For each value from Cross Track ... */ /* ----------------------------------- */ for (j = 0; j < edge[1]; j++) { /* Read in single lon & lat values from data buffers */ /* ------------------------------------------------- */ memmove(&lonTestVal, &lonArr[ sizeof(double) * (i * edge[1] + j)], sizeof(double)); memmove(&latTestVal, &latArr[ sizeof(double) * (i * edge[1] + j)], sizeof(double)); /* If longitude value > 180 convert to -180 to 180 range */ /* ----------------------------------------------------- */ if (lonTestVal > 180) lonTestVal = lonTestVal - 360; /* If Colatitude value convert to latitude value */ /* --------------------------------------------- */ if (statCoLat == 0) latTestVal = 90 - latTestVal; /* Test if lat value is within range */ /* --------------------------------- */ latTest = (latTestVal >= cornerlat[0] && latTestVal <= cornerlat[1]); if (bndflag == 1) { /* * If boundary flag set test whether longitude value * is outside region and then flip */ lonTest = (lonTestVal >= cornerlon[1] && lonTestVal <= cornerlon[0]); lonTest = 1 - lonTest; } else { lonTest = (lonTestVal >= cornerlon[0] && lonTestVal <= cornerlon[1]); } /* * If both longitude and latitude are within region set * flag on for this track */ if (lonTest + latTest == 2) { flag[i] = 1; found = 1; break; } } } /* ANYPOINT search */ /* --------------- */ if (mode == HE5_HDFE_ANYPOINT && rank > 1) { if (lonArr != NULL) free(lonArr); if (latArr != NULL) free(latArr); /* Allocate space for an entire single cross track */ /* ----------------------------------------------- */ lonArr = (char *)calloc(dims[1], sizeof(double)); if(lonArr == NULL) { H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); if (nt != NULL) free(nt); if (flag != NULL) free(flag); return(FAIL); } latArr = (char *)calloc(dims[1], sizeof(double)); if(latArr == NULL) { H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); free(lonArr); if (nt != NULL) free(nt); if (flag != NULL) free(flag); return(FAIL); } /* Setup start and edge */ /* -------------------- */ anyStart[1] = 0; anyEdge[0] = 1; anyEdge[1] = dims[1]; /* For each track ... */ /* ------------------ */ for (i = 0; i < edge[0]; i++) { /* If cross track not in region (with MIDPOINT search ... */ /* ------------------------------------------------------ */ if (flag[i] == 0) { /* Setup track start */ /* ----------------- */ anyStart[0] = i; /* Read in lon and lat values for cross track */ /* ------------------------------------------ */ status = HE5_SWreadfield(swathID, "Longitude", anyStart, NULL, anyEdge, lonArr); if( status == FAIL ) { H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_DATASET, H5E_READERROR, "Cannot read the \"Longitude\" field. \n"); HE5_EHprint("Error: Cannot read the \"Longitude\" field, occured", __FILE__, __LINE__); free(lonArr); free(latArr); if (nt != NULL) free(nt); if (flag != NULL) free(flag); return(FAIL); } status = HE5_SWreadfield(swathID, latName, anyStart, NULL, anyEdge, latArr); if( status == FAIL ) { H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_DATASET, H5E_READERROR, "Cannot read the \"Latitude\" field. \n"); HE5_EHprint("Error: Cannot read the \"Latitude\" field, occured", __FILE__, __LINE__); free(lonArr); free(latArr); if (nt != NULL) free(nt); if (flag != NULL) free(flag); return(FAIL); } /* * If geolocation fields are FLOAT32 then cast each * entry as FLOAT64 */ datasetid = H5Dopen(HE5_SWXSwath[idx].geo_id, "Longitude"); if(datasetid == FAIL) { sprintf(errbuf, "Cannot open the dataset.\n"); H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(lonArr); free(latArr); if (nt != NULL) free(nt); if (flag != NULL) free(flag); return(FAIL); } datatype = H5Dget_type(datasetid); if(datatype == FAIL) { sprintf(errbuf, "Cannot get the data type ID.\n"); H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(lonArr); free(latArr); if (nt != NULL) free(nt); if (flag != NULL) free(flag); return(FAIL); } size = H5Tget_size(datatype); if(size == 0) { sprintf(errbuf, "Cannot get the data type size.\n"); H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(lonArr); free(latArr); if (nt != NULL) free(nt); if (flag != NULL) free(flag); return(FAIL); } status = H5Dclose(datasetid); if(status == FAIL) { sprintf(errbuf, "Cannot close the dataset.\n"); H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(lonArr); free(latArr); if (nt != NULL) free(nt); if (flag != NULL) free(flag); return(FAIL); } if ( H5Tequal( datatype, H5T_NATIVE_FLOAT) || H5Tequal( datatype, H5T_IEEE_F32LE) || H5Tequal( datatype, H5T_IEEE_F32BE) ) { for (j = dims[1] - 1; j >= 0; j--) { memmove(&tempFloat, lonArr + sizeof(float) * j, sizeof(float)); tempDouble = (double)tempFloat; memmove(lonArr + sizeof(double) * j, &tempDouble, sizeof(double)); memmove(&tempFloat, latArr + sizeof(float) * j, sizeof(float)); tempDouble = (double)tempFloat; memmove(latArr + sizeof(double) * j, &tempDouble, sizeof(double)); } } /* For each value from Cross Track ... */ /* ----------------------------------- */ for (j = 0; j < dims[1]; j++) { /* Read in single lon & lat values from buffers */ /* -------------------------------------------- */ memmove(&lonTestVal, &lonArr[ sizeof(double) * j ], sizeof(double)); memmove(&latTestVal, &latArr[ sizeof(double) * j ], sizeof(double)); /* If lon value > 180 convert to -180 - 180 range */ /* ---------------------------------------------- */ if (lonTestVal > 180) { lonTestVal = lonTestVal - 360; } /* If Colatitude value convert to latitude value */ /* --------------------------------------------- */ if (statCoLat == 0) { latTestVal = 90 - latTestVal; } /* Test if lat value is within range */ /* --------------------------------- */ latTest = (latTestVal >= cornerlat[0] && latTestVal <= cornerlat[1]); if (bndflag == 1) { /* * If boundary flag set test whether * longitude value is outside region and then * flip */ lonTest = (lonTestVal >= cornerlon[1] && lonTestVal <= cornerlon[0]); lonTest = 1 - lonTest; } else { lonTest = (lonTestVal >= cornerlon[0] && lonTestVal <= cornerlon[1]); } /* * If both longitude and latitude are within * region set flag on for this track */ if (lonTest + latTest == 2) { flag[i] = 1; found = 1; break; } } } } } /* If within region setup Region Structure */ /* --------------------------------------- */ if (found == 1) { /* For all entries in SWXRegion array ... */ /* -------------------------------------- */ for (k = 0; k < HE5_NSWATHREGN; k++) { /* If empty region ... */ /* --------------------- */ if ( HE5_SWXRegion[ k ] == 0 ) { /* Allocate space for region entry */ /* ------------------------------- */ HE5_SWXRegion[ k ] = (struct HE5_swathRegion *) calloc(1, sizeof(struct HE5_swathRegion)); if( HE5_SWXRegion[ k ] == NULL ) { H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); if(lonArr != NULL) free(lonArr); if(latArr != NULL) free(latArr); if(flag != NULL) free(flag); if(nt != (hid_t *)NULL) free(nt); return(FAIL); } /* Store file and swath ID */ /* ----------------------- */ HE5_SWXRegion[ k ]->fid = fid; HE5_SWXRegion[ k ]->swathID = swathID; /* Set Start & Stop Vertical arrays to FAIL */ /* ---------------------------------------- */ for (j = 0; j < HE5_DTSETRANKMAX; j++) { HE5_SWXRegion[ k ]->StartVertical[j] = FAIL; HE5_SWXRegion[ k ]->StopVertical[j] = FAIL; } /* Set region ID */ /* ------------- */ regionID = k; break; } } /* Find start and stop of regions */ /* ------------------------------ */ /* Subtract previous flag value from current one */ /* --------------------------------------------- */ /* * Transisition points will have flag value (+1) start or * (255 = (uint8_t) -1) stop of region */ for ( i = edge[0]; i > 0; i-- ) flag[ i ] -= flag[i - 1]; for ( i = 0; i <= edge[0]; i++ ) { /* Start of region */ /* --------------- */ if ( (int)flag[i] == 1 ) { /* Delyth Jones Moved the increment of the region down */ /* to next if statement j = ++SWXRegion[k]->nRegions; */ /* using temp value, if not equal to stop region */ /* invalid region otherwise ok Delyth Jones */ tmpVal = HE5_EHhssize2hsize(i + 1); if ( tmpVal == 0 ) { sprintf(errbuf, "Cannot convert data type. \n"); H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); if(lonArr != NULL) free(lonArr); if(latArr != NULL) free(latArr); if(flag != NULL) free(flag); if(nt != (hid_t *)NULL) free(nt); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } /* End of region */ /* ------------- */ if ( (int)flag[i] == 255 ) { if( tmpVal != i ) { /* Increment (multiple) region counter */ /* ----------------------------------- */ j = ++HE5_SWXRegion[k]->nRegions; l = HE5_EHhssize2hsize(i); if (mapstatus == 2) { if ((tmpVal - 1) % 2 == 1) tmpVal = tmpVal + 1; if ((l-1) % 2 == 0) l = l - 1; } HE5_SWXRegion[k]->StartRegion[j - 1] = HE5_EHhsize2long( (tmpVal - 1) ); if ( HE5_SWXRegion[k]->StartRegion[j - 1] == FAIL ) { sprintf(errbuf, "Cannot convert data type. \n"); H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); if(lonArr != NULL) free(lonArr); if(latArr != NULL) free(latArr); if(flag != NULL) free(flag); if(nt != (hid_t *)NULL ) free(nt); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } idxrange[0] = tmpVal - 1; HE5_SWXRegion[k]->StopRegion[j - 1] = HE5_EHhsize2long( (l - 1) ); if ( HE5_SWXRegion[k]->StopRegion[j - 1] == FAIL ) { sprintf(errbuf, "Cannot convert data type. \n"); H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); if(lonArr != NULL) free(lonArr); if(latArr != NULL) free(latArr); if(flag != NULL) free(flag); if(nt != (hid_t *)NULL ) free(nt); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } idxrange[1] = l - 1; validReg = 0; } } } } if(lonArr != NULL) free(lonArr); if(latArr != NULL) free(latArr); if(flag != NULL) free(flag); } if(nt != (hid_t *)NULL) free(nt); } if(validReg != 0) { H5Epush(__FILE__, "HE5_SWregionindex", __LINE__, H5E_FUNC, H5E_CANTINIT, "Invalid Region ID. \n"); HE5_EHprint("Error: Invalid Region ID, occured", __FILE__, __LINE__); regionID = FAIL; } COMPLETION: return(regionID); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWdeftimeperiod | | | | DESCRIPTION: Finds swath cross tracks observed during time period and | | returns period ID | | | | region ID | | DESCRIPTION: | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | periodID hid_t Period ID | | | | INPUTS: | | swathID hid_t Swath structure ID | | starttime double TAI sec Start of time period | | stoptime doubel TAI sec Stop of time period | | mode int Search mode | | HDFE_MIDPOINT - Use midpoint of Xtrack | | HDFE_ENDPOINT - Use endpoints of Xtrack | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | | | 8/23/99 A.Muslimov Changed the datatype of fid from int32_t to hid_t. | | 03/13/00 A.Muslimov Modified to convert non-native datatypes to native | | ones. | | July 00 A.Muslimov Unmasked hdf5 data types. | | END_PROLOG | -----------------------------------------------------------------------------*/ hid_t HE5_SWdeftimeperiod(hid_t swathID, double starttime, double stoptime, int mode) { hid_t periodID = FAIL; /* Period ID (return) */ hid_t k = 0; /* Loop index */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ int dum = 0; /* Dummy (loop) variable */ int rank = FAIL; /* Rank of a dataset */ herr_t status = FAIL; /* status variable */ herr_t statTime = FAIL; /* status variable */ hid_t *nt = (hid_t *)NULL; /* number types */ unsigned char found = 0; /* Found flag */ long idx = FAIL; /* Swath index */ long i = 0, j = 0; /* Loop indices */ hssize_t start[2] = {FAIL, FAIL}; /* Start array (read) */ hsize_t dims[HE5_DTSETRANKMAX]; /* Dimens. of geo fields */ hsize_t stride[2] = {1, 1}; /* Stride array (read) */ hsize_t edge[2] = {0, 0}; /* Edge array (read) */ double timeTest = 0.; /* Time test value */ double *timeDouble = (double *)NULL; /* Time data array */ char dimlist[HE5_HDFE_DIMBUFSIZE]; /* Dim. list (geo flds) */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWdeftimeperiod", &fid, &gid, &idx); if (status == SUCCEED) { /* Initialize dims[] array */ /* ----------------------- */ for (i = 0; i < HE5_DTSETRANKMAX; i++) dims[i] = 0; strcpy(dimlist,""); /* Get "Time" field info */ /* --------------------- */ nt = (hid_t *)calloc(1, sizeof(hid_t)); if(nt == (hid_t *)NULL) { sprintf(errbuf, "Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_SWdeftimeperiod", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } statTime = HE5_SWfieldinfo(swathID, "Time", &rank, dims, nt, dimlist,NULL); if (statTime != SUCCEED) { status = FAIL; sprintf(errbuf, "\"Time\" field not found.\n"); H5Epush(__FILE__, "HE5_SWdeftimeperiod", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(nt); } if (status == SUCCEED) { /* Search along entire "Track" dimension from beginning to end */ /* ----------------------------------------------------------- */ start[0] = 0; edge[0] = dims[0]; /* If 1D geolocation fields then set mode to MIDPOINT */ /* -------------------------------------------------- */ if (rank == 1) { mode = HE5_HDFE_MIDPOINT; } switch (mode) { /* If MIDPOINT search single point in middle of "CrossTrack" */ /* --------------------------------------------------------- */ case HE5_HDFE_MIDPOINT: start[1] = HE5_EHhsize2hssize(dims[ 1 ]/2); if ( start[1] == FAIL ) { sprintf(errbuf, "Cannot convert data type. \n"); H5Epush(__FILE__, "HE5_SWdeftimeperiod", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); if (nt != NULL) free(nt); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } edge[1] = 1; /* Allocate space for time data */ /* ---------------------------- */ timeDouble = (double *)calloc(edge[0], sizeof(double)); if(timeDouble == NULL) { sprintf(errbuf, "Cannot allocate memory. \n"); H5Epush(__FILE__, "HE5_SWdeftimeperiod", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (nt != NULL) free(nt); return(FAIL); } /* Read "Time" field */ /* ----------------- */ status = HE5_SWreadfield(swathID,"Time",start,NULL,edge,timeDouble); break; /* If ENDPOINT search 2 points at either end of "CrossTrack" */ /* --------------------------------------------------------- */ case HE5_HDFE_ENDPOINT: start[1] = 0; stride[1] = dims[1] - 1; edge[1] = 2; /* Allocate space for time data */ /* ---------------------------- */ timeDouble = (double *)calloc(edge[0] * 2, sizeof(double)); if(timeDouble == (double *)NULL) { sprintf(errbuf, "Cannot allocate memory. \n"); H5Epush(__FILE__, "HE5_SWdeftimeperiod", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (nt != NULL) free(nt); return(FAIL); } /* Read "Time" field */ /* ----------------- */ status = HE5_SWreadfield(swathID, "Time", start, stride, edge, timeDouble); break; } /* For each track (from top) ... */ /* ----------------------------- */ for (i = 0; i < edge[0]; i++) { /* For each value from Cross Track ... */ /* ----------------------------------- */ for (j = 0; j < edge[1]; j++) { /* Get time test value */ /* ------------------- */ timeTest = timeDouble[i * edge[1] + j]; /* If within time period ... */ /* ------------------------- */ if (timeTest >= starttime && timeTest <= stoptime) { /* Set found flag */ /* -------------- */ found = 1; /* For all entries in SWXRegion array ... */ /* -------------------------------------- */ for (k = 0; k < HE5_NSWATHREGN; k++) { /* If empty region ... */ /* ------------------- */ if (HE5_SWXRegion[k] == 0) { /* Allocate space for region entry */ /* ------------------------------- */ HE5_SWXRegion[k] = (struct HE5_swathRegion *) calloc(1, sizeof(struct HE5_swathRegion)); if(HE5_SWXRegion[k] == NULL) { sprintf(errbuf, "Cannot allocate memory. \n"); H5Epush(__FILE__, "HE5_SWdeftimeperiod", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if(nt != (hid_t *)NULL) free(nt); if(timeDouble != (double *)NULL) free(timeDouble); return(FAIL); } /* Store file and swath ID */ /* ----------------------- */ HE5_SWXRegion[k]->fid = fid; HE5_SWXRegion[k]->swathID = swathID; /* Set number of isolated regions to 1 */ /* ----------------------------------- */ HE5_SWXRegion[k]->nRegions = 1; /* Set start of region to first track found */ /* ---------------------------------------- */ HE5_SWXRegion[k]->StartRegion[0] = i; /* Set Start & Stop Vertical arrays to FAIL */ /* ---------------------------------------- */ for (dum = 0; dum < HE5_DTSETRANKMAX; dum++) { HE5_SWXRegion[k]->StartVertical[dum] = FAIL; HE5_SWXRegion[k]->StopVertical[dum] = FAIL; } /* Set period ID */ /* ------------- */ periodID = k; break; /* Break from "k" loop */ } } } if (found == 1) { break; /* Break from "j" loop */ } } if (found == 1) { break; /* Break from "i" loop */ } } /* Clear found flag */ /* ---------------- */ found = 0; /* For each track (from bottom) ... */ /* -------------------------------- */ for (i = edge[0] - 1; i >= 0; i--) { /* For each value from Cross Track ... */ /* ----------------------------------- */ for (j = 0; j < edge[1]; j++) { /* Get time test value */ /* ------------------- */ timeTest = timeDouble[i * edge[1] + j]; /* If within time period ... */ /* ------------------------- */ if (timeTest >= starttime && timeTest <= stoptime) { /* Set found flag */ /* -------------- */ found = 1; /* Set start of region to first track found */ /* ---------------------------------------- */ HE5_SWXRegion[k]->StopRegion[0] = i; break; /* Break from "j" loop */ } } if (found == 1) { break; /* Break from "i" loop */ } } if (timeDouble != (double *)NULL) free(timeDouble); } } if (nt != (hid_t *)NULL) free(nt); return (periodID); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWextractregion | | | | DESCRIPTION: Retrieves data from specified region. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t Swath structure ID | | regionID hid_t Region ID | | fieldname char Fieldname | | externalflag int External geolocation fields flag | | HDFE_INTERNAL (0) | | HDFE_EXTERNAL (1) | | | | OUTPUTS: | | buffer void Data buffer containing subsetted region | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 10/18/99 A.Muslimov Replaced memcpy() by memmove() to avoid a problem | | when arguments 1 and 2 overlap in memory. | | 04/19/00 A.Muslimov Changed type of 'slen' from long to size_t. | | July 00 A.Muslimov Unmasked hdf5 data types. | | Feb. 03 Terry Haran/ | | Abe Taaheri Forced map offset to 0 so that data is extracted | | without offset consideration. This will preserve | | original mapping between geofields and the data | | field. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWextractregion(hid_t swathID, hid_t regionID, char *fieldname, int externalflag, void *buffer) { herr_t status = FAIL; /* Return status variable */ herr_t statMap = FAIL; /* status variable */ int rank = FAIL; /* Field rank */ int dum = FAIL; /* Dummy (rank) variable */ int i = 0, j = 0, k = 0; /* Loop indices */ hid_t ntype[1] = {FAIL}; /* Field number types */ hid_t dumtype[1] = {FAIL}; /* Dummy number types */ unsigned char found = 0; /* Found flag */ unsigned char vfound = 0; /* Found flag for vert.subset. */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t fieldID = FAIL; /* Field dataset ID */ long idx = FAIL; /* Swath index */ long index = FAIL; /* Geo Dim Index */ long nDim = 0; /* Number of dimensions */ long offset = FAIL; /* Mapping offset */ long incr = FAIL; /* Mapping increment */ long *idxmap = (long *)NULL; /* Index mapping array */ long nXtrk = 0; /* Number of cross tracks */ size_t bufOffset = 0; /* Output buffer offset */ size_t size = 0; /* Size of data buffer */ size_t slen[HE5_DTSETRANKMAX]; /* String length array */ hssize_t start[HE5_DTSETRANKMAX]; /* Start array for data read */ hsize_t idxMapElem = 0; /* Number of idxmap elements */ hsize_t dumsize = 0; /* Dummy size variable */ hsize_t dumdims[HE5_DTSETRANKMAX]; /* Dimensions array */ hsize_t edge[HE5_DTSETRANKMAX]; /* Edge array for data read */ hsize_t dims[HE5_DTSETRANKMAX]; /* Dimensions */ char dimlist[HE5_HDFE_DIMBUFSIZE];/* Dimension list */ char geodim[HE5_HDFE_DIMBUFSIZE]; /* Geolocation dimension list */ char tgeodim[HE5_HDFE_DIMBUFSIZE];/* Time field dimension list */ char utlbuf[HE5_HDFE_DIMBUFSIZE]; /* Utility buffer */ char *ptr[HE5_DTSETRANKMAX]; /* String pointer array */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* error message buffer */ CHECKPOINTER(fieldname); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWextractregion", &fid, &gid, &idx); /* Check for valid region ID */ /* ------------------------- */ if (status == SUCCEED) { if (regionID < 0 || regionID >= HE5_NSWATHREGN) { status = FAIL; sprintf(errbuf, "Invalid Region ID: %d.\n", regionID); H5Epush(__FILE__, "HE5_SWextractregion", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } /* Check for active region ID */ /* -------------------------- */ if (status == SUCCEED) { if (HE5_SWXRegion[regionID] == 0) { status = FAIL; sprintf(errbuf, "Inactive Region ID: %d.\n", regionID); H5Epush(__FILE__, "HE5_SWextractregion", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } /* Check that geo file and data file are same for INTERNAL subsetting */ /* ------------------------------------------------------------------ */ if (status == SUCCEED) { if (HE5_SWXRegion[regionID]->fid != fid && externalflag != HE5_HDFE_EXTERNAL) { status = FAIL; sprintf(errbuf, "Region is not defined for this file.\n"); H5Epush(__FILE__, "HE5_SWextractregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } /* Check that geo swath and data swath are same for INTERNAL subsetting */ /* -------------------------------------------------------------------- */ if (status == SUCCEED) { if (HE5_SWXRegion[regionID]->swathID != swathID && externalflag != HE5_HDFE_EXTERNAL) { status = FAIL; sprintf(errbuf, "Region is not defined for this SWath.\n"); H5Epush(__FILE__, "HE5_SWextractregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } /* Check for valid fieldname */ /* ------------------------- */ if (status == SUCCEED) { /* Initialize dims[] array */ /* ----------------------- */ for (i = 0; i < HE5_DTSETRANKMAX; i++) dims[i] = 0; /* Get data field info */ /* ------------------- */ strcpy(dimlist,""); status = HE5_SWfieldinfo(swathID, fieldname, &rank, dims, ntype, dimlist, NULL); if (status != SUCCEED) { status = FAIL; sprintf(errbuf, "Fieldname \"%s\" not found.\n", fieldname); H5Epush(__FILE__, "HE5_SWextractregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } /* No problems so proceed ... */ /* -------------------------- */ if (status == SUCCEED) { /* Initialize start and edge for all dimensions */ /* -------------------------------------------- */ for (i = 0; i < rank; i++) { start[i] = 0; edge[i] = dims[i]; } /* Vertical Subset */ /* --------------- */ for (j = 0; j < HE5_DTSETRANKMAX; j++) { /* If active vertical subset ... */ /* ----------------------------- */ if (HE5_SWXRegion[regionID]->StartVertical[j] != FAIL) { /* Find vertical dimension within dimlist */ /* -------------------------------------- */ dum = HE5_EHlong2int(HE5_EHstrwithin(HE5_SWXRegion[regionID]->DimNamePtr[j],dimlist, ',') ); if ( dum == FAIL ) { sprintf(errbuf, "Cannot convert data type. \n"); H5Epush(__FILE__, "HE5_SWextractregion", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* If dimension found ... */ /* ---------------------- */ if (dum != FAIL) { /* Compute start and edge for vertical dimension */ /* --------------------------------------------- */ vfound = 1; start[dum] = HE5_SWXRegion[regionID]->StartVertical[j]; edge[dum] = HE5_SWXRegion[regionID]->StopVertical[j] - HE5_SWXRegion[regionID]->StartVertical[j] + 1; } else { /* Vertical dimension not found */ /* ---------------------------- */ status = FAIL; sprintf(errbuf, "Vertical Dimension Not Found: \"%s\".\n", HE5_SWXRegion[regionID]->DimNamePtr[j]); H5Epush(__FILE__, "HE5_SWextractregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } } /* No problems so proceed ... */ /* -------------------------- */ if (status == SUCCEED) { /* If non-vertical subset regions defined ... */ /* ------------------------------------------ */ if (HE5_SWXRegion[regionID]->nRegions > 0) { /* Initialize dumdims[] array */ /* -------------------------- */ for ( i = 0; i < HE5_DTSETRANKMAX; i++) dumdims[i] = 0; /* Get geolocation dimension name */ /* ------------------------------ */ strcpy(geodim,""); status = HE5_SWfieldinfo(HE5_SWXRegion[regionID]->swathID, "Longitude", &dum, dumdims, dumtype, geodim, NULL); /* If Time field being used, check for dimensions */ /* ---------------------------------------------- */ if (HE5_timeflag == 1) { /* code change to fix time subset bug for Landsat7 */ strcpy(tgeodim,""); status = HE5_SWfieldinfo(HE5_SWXRegion[regionID]->swathID,"Time", &dum, dumdims, dumtype, tgeodim, NULL); if (strcmp(geodim, tgeodim) != 0) { strcpy(geodim, tgeodim); } } HE5_timeflag = 0; /* Initialize slen[] array */ /* ----------------------- */ for ( i = 0; i < HE5_DTSETRANKMAX; i++) slen[i] = 0; /* Get "Track" (first) Dimension from geo dimlist */ /* ---------------------------------------------- */ nDim = HE5_EHparsestr(geodim, ',', ptr, slen); geodim[slen[0]] = 0; /* Parse Data Field Dimlist & find mapping */ /* --------------------------------------- */ nDim = HE5_EHparsestr(dimlist, ',', ptr, slen); /* Loop through all dimensions and search for mapping */ /* -------------------------------------------------- */ strcpy(utlbuf,""); for (i = 0; i < nDim; i++) { memmove(utlbuf, ptr[i], slen[i]); utlbuf[slen[i]] = 0; statMap = HE5_SWmapinfo(swathID, geodim, utlbuf,&offset, &incr); /* * Force offset to 0. * We're not changing the mapping, so we want * the original offset to apply to the subsetted data. * Otherwise, bad things happen, such as subsetting * past the end of the original data, and being unable * to read the first elements of the * original data. * The offset is only important for aligning the * data with interpolated (incr > 0) or decimated * (incr < 0) geolocation information for the data. */ offset = 0; /* Mapping found */ /* ------------- */ if (statMap == SUCCEED) { found = 1; index = i; break; } } /* If mapping not found check for geodim within dimlist */ /* ---------------------------------------------------- */ if (found == 0) { index = HE5_EHstrwithin(geodim, dimlist, ','); /* Geo dimension found within subset field dimlist */ /* ----------------------------------------------- */ if (index != FAIL) { found = 1; offset = 0; incr = 1; } } /* If mapping not found check for indexed mapping */ /* ---------------------------------------------- */ if (found == 0) { /* Get size of geo dim & allocate space of index mapping */ /* ----------------------------------------------------- */ dumsize = HE5_SWdiminfo(swathID, geodim); if(dumsize == 0) { H5Epush(__FILE__, "HE5_SWextractregion", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot get the dimension size. \n"); HE5_EHprint("Error: Cannot get the dimension size, occured", __FILE__, __LINE__); return(FAIL); } idxmap = (long *)calloc(dumsize, sizeof(long)); if(idxmap == NULL) { H5Epush(__FILE__, "HE5_SWextractregion", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory. \n"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); return(FAIL); } /* Loop through all dimensions and search for mapping */ /* -------------------------------------------------- */ strcpy(utlbuf,""); for (i = 0; i < nDim; i++) { memmove(utlbuf, ptr[i], slen[i]); utlbuf[slen[i]] = 0; idxMapElem = HE5_SWidxmapinfo(swathID, geodim, utlbuf, idxmap); /* Mapping found */ /* ------------- */ if (idxMapElem > 0) { found = 1; index = i; break; } } } /* If regular mapping found ... */ /* ---------------------------- */ if (found == 1 && idxMapElem == 0) { for (k = 0; k < HE5_SWXRegion[regionID]->nRegions; k++) { if (k > 0) { /* Compute size in bytes of previous region */ /* ---------------------------------------- */ size = edge[0]; for (j = 1; j < rank; j++) { size *= edge[j]; } size *= HE5_SWfieldsizeID(swathID, fieldname, &fieldID); /* Compute output buffer offset */ /* ---------------------------- */ bufOffset += size; } else { /* Initialize output buffer offset */ /* ------------------------------- */ bufOffset = 0; } /* Compute number of cross tracks in region */ /* ---------------------------------------- */ nXtrk = HE5_SWXRegion[regionID]->StopRegion[k] - HE5_SWXRegion[regionID]->StartRegion[k] + 1; /* Positive increment (geodim <= datadim) */ /* -------------------------------------- */ if (incr > 0) { start[index] = HE5_SWXRegion[regionID]->StartRegion[k] * incr + offset; edge[index] = nXtrk * incr; } else { /* Negative increment (geodim > datadim) */ /* ------------------------------------- */ start[index] = HE5_SWXRegion[regionID]->StartRegion[k] / (-incr) + offset; edge[index] = nXtrk / (-incr); /* * If Xtrk not exactly divisible by incr, round * edge to next highest integer */ if (nXtrk % (-incr) != 0) { edge[index]++; } } /* Read Data into output buffer */ /* ---------------------------- */ status = HE5_SWreadfield(swathID, fieldname,start, NULL, edge,(unsigned char *) buffer + bufOffset); } } else if (found == 1 && idxMapElem > 0) { /* Indexed Mapping */ /* --------------- */ for (k = 0; k < HE5_SWXRegion[regionID]->nRegions; k++) { if (k > 0) { /* Compute size in bytes of previous region */ /* ---------------------------------------- */ size = edge[0]; for (j = 1; j < rank; j++) { size *= edge[j]; } size *= HE5_SWfieldsizeID(swathID,fieldname, &fieldID); /* Compute output buffer offset */ /* ---------------------------- */ bufOffset += size; } else { /* Initialize output buffer offset */ /* ------------------------------- */ bufOffset = 0; } /* Compute start & edge from index mappings */ /* ---------------------------------------- */ start[index] = idxmap[HE5_SWXRegion[regionID]->StartRegion[k]]; edge[index] = idxmap[HE5_SWXRegion[regionID]->StopRegion[k]] - idxmap[HE5_SWXRegion[regionID]->StartRegion[k]] + 1; /* Read Data into output buffer */ /* ---------------------------- */ status = HE5_SWreadfield(swathID, fieldname, start, NULL, edge,(unsigned char *)buffer + bufOffset); } } else if(vfound == 1) { /* Vertical subsetting found previously, */ /* read out data buffer (xhua) */ status = HE5_SWreadfield(swathID, fieldname, start, NULL, edge, (unsigned char *)buffer); } else { /* Mapping not found */ /* ----------------- */ status = FAIL; sprintf(errbuf,"Mapping Not Defined for \"%s\" Dimension.\n", geodim); } } else { /* Read Data (Vert SS only) */ /* ------------------------ */ status = HE5_SWreadfield(swathID, fieldname, start, NULL, edge,(unsigned char *)buffer); } } } /* Free index mappings if applicable */ /* --------------------------------- */ if (idxmap != NULL) free(idxmap); COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWextractperiod | | | | DESCRIPTION: Retrieves data from specified period. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t Swath structure ID | | periodID hid_t Period ID | | fieldname char Fieldname | | externalflag int External geolocation fields flag: | | | | HDFE_INTERNAL (0) | | HDFE_EXTERNAL (1) | | OUTPUTS: | | buffer void Data buffer containing subsetted region | | | | NOTES: | | | | | | Date Programmer Description | | ======= ============ ================================================= | | July 00 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWextractperiod(hid_t swathID, hid_t periodID, char *fieldname, int externalflag, void *buffer) { herr_t status = FAIL;/* routine return status variable */ HE5_timeflag = 1; CHECKPOINTER(fieldname); /* Call SWextractregion routine */ /* ---------------------------- */ status = HE5_SWextractregion(swathID, periodID, fieldname, externalflag, (char *)buffer); COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWdupregion | | | | DESCRIPTION: Duplicates a region | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | newregionID hid_t New region ID | | | | INPUTS: | | oldregionID hid_t Old region ID | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ======= ============ ================================================= | | July 00 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ hid_t HE5_SWdupregion(hid_t oldregionID) { hid_t newregionID = FAIL;/* New region ID (return) */ hid_t i; /* Loop index */ /* Find first empty (inactive) region */ /* ---------------------------------- */ for (i = 0; i < HE5_NSWATHREGN; i++) { if (HE5_SWXRegion[ i ] == 0) { /* Allocate space for new swath region entry */ /* ----------------------------------------- */ HE5_SWXRegion[ i ] = (struct HE5_swathRegion *) calloc(1, sizeof(struct HE5_swathRegion)); if(HE5_SWXRegion[ i ] == NULL) { H5Epush(__FILE__, "HE5_SWdupregion", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory. \n"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); return(FAIL); } /* Copy old region structure data to new region */ /* -------------------------------------------- */ *HE5_SWXRegion[ i ] = *HE5_SWXRegion[ oldregionID ]; /* Define new region ID */ /* -------------------- */ newregionID = i; break; } } return (newregionID); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWdefvrtregion | | | | DESCRIPTION: Finds elements of a monotonic field within a given range. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | regionID hid_t Region ID | | | | INPUTS: | | swathID hid_t Swath structure ID | | regionID hid_t Region ID | | vertObj char Vertical object to subset | | range double Vertical subsetting range | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 10/18/99 A.Muslimov Replaced memcpy() by memmove() to avoid a problem | | when arguments 1 and 2 overlap in memory. | | 03/13/00 A.Muslimov Modified to convert non-native datatypes to | | native ones. | | | | July 00 A.Muslimov Unmasked hdf5 data types. | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | Mar 04 S.Zhao Modified for supported field type. | | END_PROLOG | -----------------------------------------------------------------------------*/ /* Macro to initialize swath region entry */ /* -------------------------------------- */ /* * 1) Find empty (inactive) region. 2) Allocate space for region entry. 3) * Store file ID and swath ID. 4) Set region ID. 5) Initialize vertical * subset entries to FAIL. */ #define HE5_SETSWTHREG \ \ for (k = 0; k < HE5_NSWATHREGN; k++) \ { \ if (HE5_SWXRegion[k] == 0) \ { \ HE5_SWXRegion[k] = (struct HE5_swathRegion *) \ calloc(1, sizeof(struct HE5_swathRegion)); \ HE5_SWXRegion[k]->fid = fid; \ HE5_SWXRegion[k]->swathID = swathID; \ regionID = k; \ for (j = 0; j < HE5_DTSETRANKMAX; j++) \ { \ HE5_SWXRegion[k]->StartVertical[j] = FAIL; \ HE5_SWXRegion[k]->StopVertical[j] = FAIL; \ } \ break; \ } \ } /* Macro to fill vertical subset entry */ /* ----------------------------------- */ /* * 1) Find empty (inactive) vertical region. 2) Set start of vertical region. * 3) Allocate space for name of vertical dimension. 4) Write vertical * dimension name. */ #define HE5_FILLVERTREG \ for (j = 0; j < HE5_DTSETRANKMAX; j++) \ { \ if (HE5_SWXRegion[regionID]->StartVertical[j] == FAIL) \ { \ HE5_SWXRegion[regionID]->StartVertical[j] = i; \ HE5_SWXRegion[regionID]->DimNamePtr[j] = \ (char *)calloc( (slen + 1), sizeof(char) ); \ memmove(HE5_SWXRegion[regionID]->DimNamePtr[j], \ dimlist, slen + 1); \ break; \ } \ } hid_t HE5_SWdefvrtregion(hid_t swathID, hid_t regionID, char *vertObj, double range[]) { hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t dtype = FAIL;/* Data type ID */ hid_t fieldID = FAIL;/* Field related dataset ID */ hid_t k = 0; /* Loop index */ herr_t status = FAIL;/* routine return status variable */ int vertINT = 0; /* Temporary INT variable */ int rank = FAIL;/* Field rank */ int temp = FAIL;/* Temporary data type code */ int j = 0; /* Loop index */ hid_t *nt = (hid_t *)NULL; /* number types */ unsigned char found = 0; /* Found flag */ long idx = FAIL; /* Swath index */ long slen = 0; /* String length */ long i = 0; /* Loop index */ hsize_t dims[HE5_DTSETRANKMAX];/* Field dimensions */ size_t size = 0; /* Size of numbertype in bytes */ short vertSHT = 0; /* Temporary SHORT variable */ float vertFLT = 0.; /* Temporary FLOAT variable */ double vertDBL = 0.; /* Temporary DOUBLE variable */ char *vertArr = (char *)NULL;/* Ptr to vrt field data buffer */ char dimlist[HE5_HDFE_DIMBUFSIZE];/* Dimension list */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKPOINTER(vertObj); CHECKPOINTER(range); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWdefvrtregion", &fid, &gid, &idx); strcpy(dimlist,""); if (status == SUCCEED) { /* Copy first 4 characters of vertObj into dimlist */ /* ----------------------------------------------- */ memmove(dimlist, vertObj, 4); dimlist[4] = 0; /* If first 4 characters of vertObj = "DIM:" ... */ /* --------------------------------------------- */ /* Vertical Object is dimension name */ /* --------------------------------- */ if (strcmp(dimlist, "DIM:") == 0) { /* Get string length of vertObj (minus "DIM:) */ /* ------------------------------------------ */ slen = strlen(vertObj) - 4; /* Setup swath region entry */ /* ------------------------ */ if (regionID == FAIL) { HE5_SETSWTHREG; } /* Find first empty (inactive) vertical subset entry */ /* ------------------------------------------------- */ for (j = 0; j < HE5_DTSETRANKMAX; j++) { if (HE5_SWXRegion[regionID]->StartVertical[j] == FAIL) { /* Store start & stop of vertical region */ /* ------------------------------------- */ HE5_SWXRegion[regionID]->StartVertical[j] = (long)range[0]; HE5_SWXRegion[regionID]->StopVertical[j] = (long)range[1]; /* Store vertical dimension name */ /* ----------------------------- */ HE5_SWXRegion[regionID]->DimNamePtr[j] = (char *)calloc( (slen + 1), sizeof(char) ); if(HE5_SWXRegion[regionID]->DimNamePtr[j] == NULL) { H5Epush(__FILE__, "HE5_SWdefvrtregion", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory. \n"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); return(FAIL); } memmove(HE5_SWXRegion[regionID]->DimNamePtr[j], vertObj + 4, slen + 1); break; } } } else { /* Check for valid fieldname */ /* ------------------------- */ nt = (hid_t *)calloc(1, sizeof(hid_t)); if ( nt == (hid_t *)NULL ) { status = FAIL; sprintf( errbuf,"Cannot allocate memory for data type class ID.\n"); H5Epush(__FILE__, "HE5_SWdefvrtregion", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } /* Initialize dims[] array */ /* ----------------------- */ for ( j = 0; j < HE5_DTSETRANKMAX; j++) dims[j] = 0; /* Get field information */ /* --------------------- */ status = HE5_SWfieldinfo(swathID, vertObj, &rank, dims, nt,dimlist,NULL); if (status != SUCCEED) { status = FAIL; sprintf(errbuf,"Vertical Field: \"%s\" not found.\n", vertObj); H5Epush(__FILE__, "HE5_SWdefvrtregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (nt != NULL) free(nt); } /* Get field ID and field data type */ /* ------------------------------- */ HE5_SWfieldsizeID(swathID, vertObj, &fieldID); dtype = H5Dget_type( fieldID); /* Check for supported field type */ /* ------------------------------ */ if (!H5Tequal(dtype, H5T_NATIVE_SHORT) && !H5Tequal(dtype, H5T_STD_I16BE) && !H5Tequal(dtype, H5T_STD_I16LE) && !H5Tequal(dtype, H5T_NATIVE_INT) && !H5Tequal(dtype, H5T_STD_I32BE) && !H5Tequal(dtype, H5T_STD_I32LE) && !H5Tequal(dtype, H5T_NATIVE_FLOAT) && !H5Tequal(dtype, H5T_IEEE_F32BE) && !H5Tequal(dtype, H5T_IEEE_F32LE) && !H5Tequal(dtype, H5T_NATIVE_DOUBLE) && !H5Tequal(dtype, H5T_IEEE_F64BE) && !H5Tequal(dtype, H5T_IEEE_F64LE)) { status = FAIL; sprintf(errbuf,"Fieldtype not supported for vertical subsetting"); H5Epush(__FILE__, "HE5_SWdefvrtregion", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (nt != NULL) free(nt); } if ( H5Tequal( dtype, H5T_NATIVE_SHORT) || H5Tequal( dtype, H5T_STD_I16BE) || H5Tequal( dtype, H5T_STD_I16LE) ) temp = 1; else if ( H5Tequal(dtype, H5T_NATIVE_INT) || H5Tequal(dtype, H5T_STD_I32BE) || H5Tequal(dtype, H5T_STD_I32LE) ) temp = 2; else if ( H5Tequal( dtype, H5T_NATIVE_FLOAT) || H5Tequal( dtype, H5T_IEEE_F32BE) || H5Tequal( dtype, H5T_IEEE_F32LE) ) temp = 3; else if ( H5Tequal(dtype, H5T_NATIVE_DOUBLE) || H5Tequal(dtype, H5T_IEEE_F64BE) || H5Tequal(dtype, H5T_IEEE_F64LE) ) temp = 4; /* Check that vertical dimension is 1D */ /* ----------------------------------- */ if (status == SUCCEED) { if (rank != 1) { status = FAIL; sprintf(errbuf, "Vertical Field: \"%s\" must be 1-dim.\n", vertObj); H5Epush(__FILE__, "HE5_SWdefvrtregion", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (nt != NULL) free(nt); } } /* If no problems then continue */ /* ---------------------------- */ if (status == SUCCEED) { /* Get string length of vertical dimension */ /* --------------------------------------- */ slen = strlen(dimlist); /* Get size in bytes of vertical field numbertype */ /* ---------------------------------------------- */ size = HE5_SWfieldsizeID(swathID,vertObj, &fieldID); /* Allocate space for vertical field */ /* --------------------------------- */ vertArr = (char *)calloc(dims[0], size); if(vertArr == NULL) { H5Epush(__FILE__, "HE5_SWdefvrtregion", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); if (nt != NULL) free(nt); return(FAIL); } /* Read vertical field */ /* ------------------- */ status = HE5_SWreadfield(swathID, vertObj, NULL, NULL, NULL, vertArr); switch (temp) { case 1: for (i = 0; i < dims[0]; i++) { /* Get single element of vertical field */ /* ------------------------------------ */ memmove(&vertINT, vertArr + i * size, size); /* If within range ... */ /* ------------------- */ if (vertINT >= range[0] && vertINT <= range[1]) { /* Set found flag */ /* -------------- */ found = 1; /* Setup swath region entry */ /* ------------------------ */ if (regionID == FAIL) { HE5_SETSWTHREG; } /* Fill-in vertical region entries */ /* ------------------------------- */ HE5_FILLVERTREG; break; } } /* If found read from "bottom" of data field */ /* ----------------------------------------- */ if (found == 1) { for (i = dims[0] - 1; i >= 0; i--) { /* Get single element of vertical field */ /* ------------------------------------ */ memmove(&vertINT, vertArr + i * size, size); /* If within range ... */ /* ------------------- */ if (vertINT >= range[0] && vertINT <= range[1]) { /* Set end of vertical region */ /* -------------------------- */ HE5_SWXRegion[regionID]->StopVertical[j] = i; break; } } } else { /* No vertical entries within region */ /* --------------------------------- */ status = FAIL; sprintf(errbuf, "No vertical field entries within region.\n"); H5Epush(__FILE__, "HE5_SWdefvrtregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (nt != NULL) free(nt); } break; case 2: for (i = 0; i < dims[0]; i++) { /* Get single element of vertical field */ /* ------------------------------------ */ memmove(&vertSHT, vertArr + i * size, size); /* If within range ... */ /* ------------------- */ if (vertSHT >= range[0] && vertSHT <= range[1]) { /* Set found flag */ /* -------------- */ found = 1; /* Setup swath region entry */ /* ------------------------ */ if (regionID == FAIL) { HE5_SETSWTHREG; } /* Fill-in vertical region entries */ /* ------------------------------- */ HE5_FILLVERTREG; break; } } /* If found read from "bottom" of data field */ /* ----------------------------------------- */ if (found == 1) { for (i = dims[0] - 1; i >= 0; i--) { /* Get single element of vertical field */ /* ------------------------------------ */ memmove(&vertSHT, vertArr + i * size, size); /* If within range ... */ /* ------------------- */ if (vertSHT >= range[0] && vertSHT <= range[1]) { /* Set end of vertical region */ /* -------------------------- */ HE5_SWXRegion[regionID]->StopVertical[j] = i; break; } } } else { /* No vertical entries within region */ /* --------------------------------- */ status = FAIL; sprintf(errbuf, "No vertical field entries within region.\n"); H5Epush(__FILE__, "HE5_SWdefvrtregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (nt != NULL) free(nt); } break; case 3: for (i = 0; i < dims[0]; i++) { /* Get single element of vertical field */ /* ------------------------------------ */ memmove(&vertFLT, vertArr + i * size, size); /* If within range ... */ /* ------------------- */ if (vertFLT >= range[0] && vertFLT <= range[1]) { /* Set found flag */ /* -------------- */ found = 1; /* Setup swath region entry */ /* ------------------------ */ if (regionID == FAIL) { HE5_SETSWTHREG; } /* Fill-in vertical region entries */ /* ------------------------------- */ HE5_FILLVERTREG; break; } } /* If found read from "bottom" of data field */ /* ----------------------------------------- */ if (found == 1) { for (i = dims[0] - 1; i >= 0; i--) { /* Get single element of vertical field */ /* ------------------------------------ */ memmove(&vertFLT, vertArr + i * size, size); /* If within range ... */ /* ------------------- */ if (vertFLT >= range[0] && vertFLT <= range[1]) { /* Set end of vertical region */ /* -------------------------- */ HE5_SWXRegion[regionID]->StopVertical[j] = i; break; } } } else { /* No vertical entries within region */ /* --------------------------------- */ status = FAIL; sprintf(errbuf, "No vertical field entries within region.\n"); H5Epush(__FILE__, "HE5_SWdefvrtregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (nt != NULL) free(nt); } break; case 4: for (i = 0; i < dims[0]; i++) { /* Get single element of vertical field */ /* ------------------------------------ */ memmove(&vertDBL, vertArr + i * size, size); /* If within range ... */ /* ------------------- */ if (vertDBL >= range[0] && vertDBL <= range[1]) { /* Set found flag */ /* -------------- */ found = 1; /* Setup swath region entry */ /* ------------------------ */ if (regionID == FAIL) { HE5_SETSWTHREG; } /* Fill-in vertical region entries */ /* ------------------------------- */ HE5_FILLVERTREG; break; } } /* If found read from "bottom" of data field */ /* ----------------------------------------- */ if (found == 1) { for (i = dims[0] - 1; i >= 0; i--) { /* Get single element of vertical field */ /* ------------------------------------ */ memmove(&vertDBL, vertArr + i * size, size); /* If within range ... */ /* ------------------- */ if (vertDBL >= range[0] && vertDBL <= range[1]) { /* Set end of vertical region */ /* -------------------------- */ HE5_SWXRegion[regionID]->StopVertical[j] = i; break; } } } else { /* No vertical entries within region */ /* --------------------------------- */ status = FAIL; sprintf(errbuf, "No vertical field entries within region.\n"); H5Epush(__FILE__, "HE5_SWdefvrtregion", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (nt != NULL) free(nt); } break; } /* End of switch */ if (vertArr != NULL) free(vertArr); } } } if(nt != (hid_t *)NULL) free(nt); COMPLETION: if (status == FAIL) regionID = FAIL; HE5_UNLOCK; return(regionID); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWsetfillvalue | | | | DESCRIPTION: Sets fill value for the specified field. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t swath structure ID | | fieldname char* field name | | fillval void* fill value | | | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | 8/23/99 A.Muslimov Checked for the status returned by | | H5Pset_fill_value(). Changed the return status | | from intn to int . | | 11/9/99 A.Muslimov Modified the calls to write fill value to the | | attribute which fixed a bug resulted in a wrong | | value returned by the SWgetfillvalue(). | | 12/3/99 A.Muslimov Fixed a bug resulted in not writing a fill value | | into the dataset. | | July 00 A.Muslimov Unmasked hdf5 data types. | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | Mar 04 S.Zhao Modified for a character string dataset. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWsetfillvalue(hid_t swathID, char *fieldname, hid_t numbertype_in, void *fillval) { herr_t status = FAIL;/* return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ long idx = FAIL;/* Swath index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ hid_t numbertype; HE5_LOCK; CHECKPOINTER(fillval); /* Convert HDF-EOS5 datatype to HDF5 datatype */ if ( H5Tequal(numbertype_in, H5T_NATIVE_CHAR) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_SCHAR) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_UCHAR) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_SHORT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_USHORT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_INT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_UINT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_LONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_ULONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_LLONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_ULLONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_FLOAT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_DOUBLE) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_LDOUBLE)== TRUE || H5Tequal(numbertype_in, H5T_C_S1) == TRUE) { numbertype = numbertype_in; } else { numbertype = HE5_EHconvdatatype((int) numbertype_in); } if(numbertype == FAIL) { sprintf(errbuf,"Cannot convert to HDF5 type data type ID for fillvalue.\n"); H5Epush(__FILE__, "HE5_SWsetfillvalue", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWsetfillvalue", &fid, &gid, &idx); if(status == FAIL) { sprintf(errbuf,"Checking for valid swath ID failed.\n"); H5Epush(__FILE__, "HE5_SWsetfillvalue", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get current dataset creation property list */ /* ------------------------------------------ */ if( HE5_SWXSwath[idx].plist == FAIL) { HE5_SWXSwath[idx].plist = H5Pcreate(H5P_DATASET_CREATE); if (HE5_SWXSwath[idx].plist == FAIL) { sprintf(errbuf,"Cannot create the dataset property list.\n"); H5Epush(__FILE__, "HE5_SWsetfillvalue", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } /* Set fill value */ /* -------------- */ if ((numbertype != HE5T_CHARSTRING) && (numbertype != H5T_NATIVE_CHAR) && (numbertype != H5T_C_S1)) { status = H5Pset_fill_value(HE5_SWXSwath[idx].plist, numbertype, fillval); if(status == FAIL) { sprintf(errbuf,"Cannot set fill value for \"%s\" field.\n", fieldname); H5Epush(__FILE__, "HE5_SWsetfillvalue", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWgetfillvalue | | | | DESCRIPTION: Retrieves fill value for a specified field. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t Swath structure ID | | fieldname char* field name | | | | OUTPUTS: | | fillval void* fill value | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 8/23/99 A.Muslimov Changed the return status from intn to int . | | 11/9/99 A.Muslimov Replaced a call to H5Pget_fill_value( plist, tid, | | fillval) by EHattr(). | | July 00 A.Muslimov Unmasked hdf5 data types. | | Oct 00 A.Muslimov Updated to allow getting of a fill value for a | | profile field. Replaced two calls by HE5_SWfldsrch. | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | Aug 22,11 Abe Taaheri Add code to return error if fillvalue attribute | | not found. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWgetfillvalue(hid_t swathID, char *fieldname, void *fillval) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t fieldID = FAIL;/* field dataset ID */ hid_t tid = FAIL;/* field dataset data type ID */ hid_t plist = FAIL;/* field dataset property list ID */ long idx = FAIL;/* Swath index */ hsize_t count[1] = { 1 };/* number of attribute elements */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ long strbufsize; char *attrnames = NULL; long nattr = 0; /* number of attributes */ HE5_LOCK; /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWgetfillvalue", &fid, &gid, &idx); if(status == FAIL) { sprintf(errbuf,"Checking for valid swath ID failed.\n"); H5Epush(__FILE__, "HE5_SWgetfillvalue", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Check out the field group and get field ID */ /* ------------------------------------------ */ HE5_SWfldsrch(swathID,fieldname,&fieldID,NULL,NULL,NULL); if( fieldID == FAIL ) { sprintf(errbuf, "Cannot get the field ID for the \"%s\" field.\n", fieldname); H5Epush(__FILE__, "HE5_SWgetfillvalue", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } nattr = HE5_SWinqlocattrs(swathID, fieldname, NULL, &strbufsize); if ( nattr < 0 ) { sprintf(errbuf, "Cannot retrieve fillvalue attribute. \n"); H5Epush(__FILE__, "HE5_SWgetfillvalue", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } attrnames = (char*)malloc(sizeof(char)*(strbufsize+1)); if (attrnames == NULL) { sprintf(errbuf, "Cannot allocate memory for attrnames.\n") ; H5Epush(__FILE__, "HE5_SWgetfillvalue", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } nattr = HE5_SWinqlocattrs(swathID, fieldname, attrnames, &strbufsize); if ( nattr < 0 ) { sprintf(errbuf, "Cannot retrieve fillvalue attribute. \n"); H5Epush(__FILE__, "HE5_SWgetfillvalue", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if(attrnames != NULL) { free(attrnames); attrnames = NULL; } return(FAIL); } if(strstr(attrnames, "_FillValue")!=NULL) { /* Get the property list ID */ /* ------------------------ */ plist = H5Dget_create_plist(fieldID); if ( plist == FAIL ) { sprintf(errbuf, "Cannot get the property list ID for the \"%s\" data field.\n", fieldname); H5Epush(__FILE__, "HE5_SWgetfillvalue", __LINE__, H5E_PLIST, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if(attrnames != NULL) { free(attrnames); attrnames = NULL; } return(FAIL); } /* Get the datatype ID */ /* ------------------- */ tid = H5Dget_type(fieldID); if ( tid == FAIL ) { sprintf(errbuf, "Cannot get the data type ID for the \"%s\" data field.\n", fieldname); H5Epush(__FILE__, "HE5_SWgetfillvalue", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if(attrnames != NULL) { free(attrnames); attrnames = NULL; } return(FAIL); } /* Read out a fill value from the attribute */ /* ---------------------------------------- */ status = HE5_EHattr(fieldID, "_FillValue", tid, count, "r", fillval); if (status == FAIL ) { sprintf(errbuf, "Cannot get fill value for the \"%s\" field.\n", fieldname); H5Epush(__FILE__, "HE5_SWgetfillvalue", __LINE__, H5E_ATTR, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if(attrnames != NULL) { free(attrnames); attrnames = NULL; } return(status); } /* Release data type ID */ /* -------------------- */ status = H5Tclose(tid); if (status == FAIL ) { sprintf(errbuf, "Cannot release data type ID for the \"%s\" dataset.\n", fieldname); H5Epush(__FILE__, "HE5_SWgetfillvalue", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if(attrnames != NULL) { free(attrnames); attrnames = NULL; } return(status); } /* Release property list ID */ /* ------------------------ */ status = H5Pclose(plist); if (status == FAIL ) { sprintf(errbuf, "Cannot release property list ID for the \"%s\" dataset.\n", fieldname); H5Epush(__FILE__, "HE5_SWgetfillvalue", __LINE__, H5E_PLIST, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if(attrnames != NULL) { free(attrnames); attrnames = NULL; } return(status); } } else { sprintf(errbuf, "Cannot retrieve fillvalue attribute. \n"); H5Epush(__FILE__, "HE5_SWgetfillvalue", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if(attrnames != NULL) { free(attrnames); attrnames = NULL; } return(FAIL); } COMPLETION: HE5_UNLOCK; if(attrnames != NULL) { free(attrnames); attrnames = NULL; } return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWregioninfo | | | | DESCRIPTION: Returns size of region in bytes | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t Swath structure ID | | regionID hid_t Region ID | | fieldname char Fieldname | | | | OUTPUTS: | | ntype hid_t field number types | | rank int field rank | | dims hsize_t dimensions of field region | | size size_t size in bytes of field region | | | | NOTES: | | | | | | Date Programmer Description | | ======== ============ ================================================= | | 08/20/99 A. Muslimov Initialized return statuses to -1. | | 10/18/99 A.Muslimov Replaced memcpy() by memmove() to avoid a problem | | when arguments 1 and 2 overlap in memory. | | 04/19/00 A.Muslimov Changed type of 'slen' from long to size_t. | | 05/10/00 A.Muslimov Replaced 'H5T_class_t' type by 'int' data type. | | July 00 A.Muslimov Unmasked hdf5 data types. | | Apr 01 A.Muslimov Initialized size to 0, but "Unlim" returns -1!, | | not 0. | | Jan 03 S.Zhao Changed the type of 'ntype' from an H5T_class_t to | | an hid_t. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWregioninfo(hid_t swathID, hid_t regionID, char *fieldname, hid_t *ntype, int *rank, hsize_t dims[], size_t *size) { herr_t status = FAIL;/* routine return status variable */ herr_t statMap = FAIL;/* Status from SWmapinfo */ int i, j, k; /* Loop indices */ int dum = FAIL;/* Dummy (rank) variable */ hid_t dum2[1] ={FAIL};/* Dummy (number types) variable */ unsigned char found = 0; /* Found flag */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t fieldID = FAIL;/* fieldname Dataset ID */ long idx = FAIL;/* Swath index */ long index = FAIL;/* Geo Dim Index */ long nDim = 0; /* Number of dimensions */ long incr = 0; /* Mapping increment */ long offset = FAIL;/* Mapping offset */ long *idxmap = (long *)NULL;/* Pointer to index mapping array */ long nXtrk = 0; /* Number of cross tracks */ hsize_t idxMapElem = 0; /* Number of index map elements */ hsize_t dumsize = 0; /* Dummy size variable */ hsize_t dumdims[HE5_DTSETRANKMAX]; /* Dimensions from SWfieldinfo */ size_t slen[HE5_DTSETRANKMAX]; /* String length array */ char dimlist[HE5_HDFE_DIMBUFSIZE];/* Dimension list */ char geodim[HE5_HDFE_DIMBUFSIZE]; /* Geolocation field dimension list */ char tgeodim[HE5_HDFE_DIMBUFSIZE];/* Time Geolocation field dim. list */ char utlbuf[HE5_HDFE_DIMBUFSIZE]; /* Utility buffer */ char *ptr[HE5_DTSETRANKMAX]; /* String pointer array */ char *errMesg = "Vertical Dimension Not Found: \"%s\".\n"; char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error buffer */ CHECKPOINTER(fieldname); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWregioninfo", &fid, &gid, &idx); /* Check for valid region ID */ /* ------------------------- */ if (status == SUCCEED) { if (regionID < 0 || regionID >= HE5_NSWATHREGN) { status = FAIL; sprintf(errbuf, "Invalid Region id: %d.\n", regionID); H5Epush(__FILE__, "HE5_SWregioninfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } /* Check for active region ID */ /* -------------------------- */ if (status == SUCCEED) { if (HE5_SWXRegion[regionID] == 0) { status = FAIL; sprintf(errbuf,"Inactive Region ID: %d.\n", regionID); H5Epush(__FILE__, "HE5_SWregioninfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } /* Check for valid fieldname */ /* ------------------------- */ if (status == SUCCEED) { /* Get data field info */ /* ------------------- */ strcpy(dimlist,""); status = HE5_SWfieldinfo(swathID, fieldname, rank, dims, ntype, dimlist, NULL); if (status != SUCCEED) { status = FAIL; sprintf(errbuf,"Field \"%s\" Not Found.\n", fieldname); H5Epush(__FILE__, "HE5_SWregioninfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } /* No problems so proceed ... */ /* -------------------------- */ if (status == SUCCEED) { /* If non-vertical subset regions defined ... */ /* ------------------------------------------ */ if (HE5_SWXRegion[regionID]->nRegions > 0) { /* Initialize dumdims[] array */ /* -------------------------- */ for ( i = 0; i < HE5_DTSETRANKMAX; i++) dumdims[ i ] = 0; /* Get geolocation dimension name */ /* ------------------------------ */ strcpy(geodim,""); status = HE5_SWfieldinfo(HE5_SWXRegion[regionID]->swathID, "Longitude", &dum, dumdims, dum2, geodim,NULL); /* If Time field being used, check for dimensions */ /* ---------------------------------------------- */ if (HE5_timeflag == 1) { /* code change to fix time subset bug for Landsat7 */ strcpy(tgeodim,""); status = HE5_SWfieldinfo(HE5_SWXRegion[regionID]->swathID, "Time", &dum, dumdims, dum2, tgeodim,NULL); if (strcmp(geodim, tgeodim) != 0) { strcpy(geodim, tgeodim); } } HE5_timeflag = 0; /* Initialize slen[] array */ /* ----------------------- */ for ( i = 0; i < HE5_DTSETRANKMAX; i++) slen[ i ] = 0; /* Get "Track" (first) Dimension from geo dimlist */ /* ---------------------------------------------- */ nDim = HE5_EHparsestr(geodim, ',', ptr, slen); geodim[slen[0]] = 0; /* Parse Data Field Dimlist & find mapping */ /* --------------------------------------- */ nDim = HE5_EHparsestr(dimlist, ',', ptr, slen); /* Loop through all dimensions and search for mapping */ /* -------------------------------------------------- */ strcpy(utlbuf,""); for (i = 0; i < nDim; i++) { memmove(utlbuf, ptr[i], slen[i]); utlbuf[slen[i]] = 0; offset = HE5_EHint2long(dum); if ( offset == FAIL ) { sprintf(errbuf, "Cannot convert data type. \n"); H5Epush(__FILE__, "HE5_SWregioninfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } statMap = HE5_SWmapinfo(swathID, geodim, utlbuf, &offset, &incr); /* Mapping found */ /* ------------- */ if (statMap == SUCCEED) { found = 1; index = HE5_EHint2long(i); if ( index == FAIL ) { sprintf(errbuf, "Cannot convert data type. \n"); H5Epush(__FILE__, "HE5_SWregioninfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } break; } } /* If mapping not found check for geodim within dimlist */ /* ---------------------------------------------------- */ if (found == 0) { index = HE5_EHstrwithin(geodim, dimlist, ','); /* Geo dimension found within subset field dimlist */ /* ----------------------------------------------- */ if (index != FAIL) { found = 1; incr = 1; } } /* If mapping not found check for indexed mapping */ /* ---------------------------------------------- */ if (found == 0) { /* Get size of geo dim & allocate space of index mapping */ /* ----------------------------------------------------- */ dumsize = HE5_SWdiminfo(swathID, geodim); if(dumsize == 0) { H5Epush(__FILE__, "HE5_SWregioninfo", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot get the dimension size. \n"); HE5_EHprint("Error: Cannot get the dimension size, occured", __FILE__, __LINE__); return(FAIL); } idxmap = (long *) calloc(dumsize, sizeof(long)); if(idxmap == NULL) { H5Epush(__FILE__, "HE5_SWregioninfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); return(FAIL); } /* Loop through all dimensions and search for mapping */ /* -------------------------------------------------- */ strcpy(utlbuf,""); for (i = 0; i < nDim; i++) { memmove(utlbuf, ptr[i], slen[i]); utlbuf[slen[i]] = 0; idxMapElem = HE5_SWidxmapinfo(swathID, geodim, utlbuf, idxmap); /* Mapping found */ /* ------------- */ if (idxMapElem > 0) { found = 1; index = i; break; } } } /* Regular Mapping Found */ /* --------------------- */ if (found == 1 && idxMapElem == 0) { dims[index] = 0; /* Loop through all regions */ /* ------------------------ */ for (k = 0; k < HE5_SWXRegion[regionID]->nRegions; k++) { /* Get number of cross tracks in particular region */ /* ----------------------------------------------- */ nXtrk = HE5_SWXRegion[regionID]->StopRegion[k] - HE5_SWXRegion[regionID]->StartRegion[k] + 1; /* If increment is positive (geodim <= datadim) ... */ /* ------------------------------------------------ */ if (incr > 0) { dims[index] += nXtrk * incr; } else { /* Negative increment (geodim > datadim) */ /* ------------------------------------- */ dims[index] += nXtrk / (-incr); /* * If Xtrk not exactly divisible by incr, round dims * to next highest integer */ if (nXtrk % (-incr) != 0) { dims[index]++; } } } } else if (found == 1 && idxMapElem > 0) { /* Indexed Mapping */ /* --------------- */ dims[index] = 0; /* Loop through all regions */ /* ------------------------ */ for (k = 0; k < HE5_SWXRegion[regionID]->nRegions; k++) { /* Get number of cross tracks in particular region */ /* ----------------------------------------------- */ nXtrk = idxmap[HE5_SWXRegion[regionID]->StopRegion[k]] - idxmap[HE5_SWXRegion[regionID]->StartRegion[k]] + 1; dims[index] += nXtrk; } } else { /* Mapping not found */ /* ----------------- */ status = FAIL; sprintf( errbuf, "Mapping Not Defined for \"%s\" Dimension.\n", geodim); H5Epush(__FILE__, "HE5_SWregioninfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } /* Vertical Subset */ /* --------------- */ if (status == SUCCEED || status == FAIL) { for (j = 0; j < HE5_DTSETRANKMAX; j++) { /* If active vertical subset ... */ /* ----------------------------- */ if (HE5_SWXRegion[regionID]->StartVertical[j] != FAIL) { /* Find vertical dimension within dimlist */ /* -------------------------------------- */ index = HE5_EHstrwithin(HE5_SWXRegion[regionID]->DimNamePtr[j], dimlist, ','); /* If dimension found ... */ /* ---------------------- */ if (index != FAIL) { /* Compute dimension size */ /* ---------------------- */ dims[index] = HE5_SWXRegion[regionID]->StopVertical[j] - HE5_SWXRegion[regionID]->StartVertical[j] + 1; } else { /* Vertical dimension not found */ /* ---------------------------- */ status = FAIL; *size = 0; sprintf(errbuf, errMesg, HE5_SWXRegion[regionID]->DimNamePtr[j]); H5Epush(__FILE__, "HE5_SWregioninfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } } /* Compute size of region data buffer */ /* ---------------------------------- */ if (status == SUCCEED) { /* Compute number of total elements */ /* -------------------------------- */ *size = dims[0]; for (j = 1; j < *rank; j++) *size *= dims[j]; /* Multiply by size in bytes of numbertype */ /* --------------------------------------- */ *size *= HE5_SWfieldsizeID(swathID,fieldname, &fieldID); } } } /* Free index mappings if applicable */ /* --------------------------------- */ if (idxmap != NULL) free(idxmap); COMPLETION: return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWperiodinfo | | | | DESCRIPTION: Returns size in bytes of region | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t Swath structure ID | | periodID hid_t Period ID | | fieldname char Fieldname | | | | OUTPUTS: | | ntype hid_t field number types | | rank int field rank | | dims hsize_t dimensions of field region | | size size_t size in bytes of field region | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 8/23/99 A.Muslimov Changed the return status from intn to int . | | 05/10/00 A.Muslimov Replaced 'H5T_class_t' type by 'int' data type. | | July 00 A.Muslimov Unmasked hdf5 data types. | | Jan 03 S.Zhao Changed the type of 'ntype' from an H5T_class_t to | | an hid_t. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWperiodinfo(hid_t swathID, hid_t periodID, char *fieldname, hid_t *ntype, int *rank, hsize_t dims[], size_t *size) { herr_t status = FAIL;/* routine return status variable */ HE5_timeflag = 1; CHECKPOINTER(fieldname); /* Call HE5_SWregioninfo */ /* --------------------- */ status = HE5_SWregioninfo(swathID, periodID, fieldname, ntype, rank, dims, size); COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWclose | | | | DESCRIPTION: Closes HDF-EOS file | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | fid hid_t File ID | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | July 00 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWclose(hid_t fid) { herr_t status = FAIL;/* routine return status variable */ /* Call HE5_EHclose to perform file close */ /* -------------------------------------- */ status = HE5_EHclose(fid); return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWupdatescene | | | | DESCRIPTION: Updates the StartRegion and StopRegion values | | for a specified region. This function is for Landsat. | | The start and stop values must be set to the beginning | | and the end of a scene, fixed scene subsetting. | | | | | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t Swath structure ID | | regionID hid_t Region ID | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Nov 98 Xinmin Hua Original developing | | July 00 A.Muslimov Unmasked hdf5 data types. | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | Jan 05 S. Zhao Modified to exclude regions that have the same | | start and stop. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWupdatescene(hid_t swathID, hid_t regionID) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ long k; /* Loop index */ long idx = FAIL;/* Swath index */ long startReg= 0; /* Indexed start region */ long stopReg = 0; /* Indexed stop region */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ long index[HE5_MAXNREGIONS];/* to store indicies when stop and start are different */ long ind; /* index */ long tempnRegions; /* temp number of regions */ HE5_LOCK; /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWupdatescene", &fid, &gid, &idx); /* Check for valid region ID */ /* ------------------------- */ if (status == SUCCEED) { if (regionID < 0 || regionID >= HE5_NSWATHREGN) { status = FAIL; sprintf(errbuf, "Invalid Region ID: %d.\n", regionID); H5Epush(__FILE__, "HE5_SWupdatescene", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } /* Check for active region ID */ /* -------------------------- */ if (status == SUCCEED) { if (HE5_SWXRegion[regionID] == 0) { status = FAIL; sprintf(errbuf, "Inactive Region ID: %d.\n", regionID); H5Epush(__FILE__, "HE5_SWupdatescene", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } if (status == SUCCEED) { tempnRegions = HE5_SWXRegion[regionID]->nRegions; ind =0; for (k = 0; k < HE5_SWXRegion[regionID]->nRegions; k++) { startReg = HE5_SWXRegion[regionID]->StartRegion[k]; stopReg = HE5_SWXRegion[regionID]->StopRegion[k]; if(startReg == stopReg) { /* reduce number of regions by 1, if tempnRegions is 0 issue error and break from loop*/ tempnRegions -= 1; if(tempnRegions == 0) { /* first free allocated memory for HE5_SWXRegion[regionID] in the function HE5_SWdefboxregion and make regionID inactive */ free(HE5_SWXRegion[regionID]); HE5_SWXRegion[regionID] = 0; status = FAIL; sprintf(errbuf, "Inactive Region ID: %d.\n", regionID); H5Epush(__FILE__, "HE5_SWupdatescene", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); break; } } else { /* store index number of regions that have different start and stop */ index[ind] = k; ind += 1; } } if (status != SUCCEED) { return (status); } else { HE5_SWXRegion[regionID]->nRegions = tempnRegions; } /* keep starts and stops that are different in the structure */ for (k = 0; k < HE5_SWXRegion[regionID]->nRegions; k++) { HE5_SWXRegion[regionID]->StartRegion[k] = HE5_SWXRegion[regionID]->StartRegion[index[k]]; HE5_SWXRegion[regionID]->StopRegion[k] = HE5_SWXRegion[regionID]->StopRegion[index[k]]; } } if (status == SUCCEED) { for (k = 0; k < HE5_SWXRegion[regionID]->nRegions; k++) { startReg = HE5_SWXRegion[regionID]->StartRegion[k]; stopReg = HE5_SWXRegion[regionID]->StopRegion[k]; if(startReg % 2 == 1) { HE5_SWXRegion[regionID]->StartRegion[k] = ++startReg; } if(stopReg % 2 == 0) { HE5_SWXRegion[regionID]->StopRegion[k] = --stopReg; } } } COMPLETION: HE5_UNLOCK; return( status ); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWupdateidxmap | | | | DESCRIPTION: Updates the map index for a specified region. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nout long return Number of elements in output | | index array if SUCCEED, (-1) FAIL | | INPUTS: | | swathID hid_t Swath structure ID | | regionID hid_t Region ID | | indexin long array of index values | | | | OUTPUTS: | | indexout long array of index values | | indicies long array of start and stop in region | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 97 Abe Taaheri Original Programmer | | AUG 97 Abe Taaheri Add support for index mapping | | July 00 A.Muslimov Unmasked hdf5 data types. | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_SWupdateidxmap(hid_t swathID, hid_t regionID, long indexin[], long indexout[], long indicies[]) { long nout = FAIL;/* # of elements in output array (return) */ long i, k ; /* Loop indices */ long idx = FAIL;/* Swath index */ long startReg = 0; /* Indexed start region */ long stopReg = 0; /* Indexed stop region */ herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error buffer */ HE5_LOCK; CHECKPOINTER(indexin); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWupdateidxmap", &fid, &gid, &idx); /* Check for valid region ID */ /* ------------------------- */ if (status == SUCCEED) { if (regionID < 0 || regionID >= HE5_NSWATHREGN) { status = FAIL; sprintf(errbuf,"Invalid Region id: %d.\n", regionID); H5Epush(__FILE__, "HE5_SWupdateidxmap", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } /* Check for active region ID */ /* -------------------------- */ if (status == SUCCEED) { if (HE5_SWXRegion[regionID] == 0) { status = FAIL; sprintf(errbuf, "Inactive Region ID: %d.\n", regionID); H5Epush(__FILE__, "HE5_SWupdateidxmap", __LINE__, H5E_FILE, H5E_BADRANGE, errbuf ); HE5_EHprint(errbuf, __FILE__, __LINE__); } } if (status == SUCCEED) { /* Loop through all regions */ /* ------------------------ */ for (k = 0; k < HE5_SWXRegion[regionID]->nRegions; k++) { /* fix overlap index mapping problem for Landsat7 */ startReg = HE5_SWXRegion[regionID]->StartRegion[ k ]; stopReg = HE5_SWXRegion[regionID]->StopRegion[ k ]; /* If start of region is odd then increment */ /* ---------------------------------------- */ if (startReg % 2 == 1) { startReg++; } /* If end of region is even then decrement */ /* --------------------------------------- */ if (stopReg % 2 == 0) { stopReg--; } } indicies[0] = startReg; indicies[1] = stopReg; if (indexout != NULL) { /* get new index values */ for(i = startReg; i <= stopReg ; i++) { indexout[i - startReg] = indexin[ i ] - indexin[startReg]; } } nout = (stopReg - startReg) + 1; } COMPLETION: HE5_UNLOCK; if(status == FAIL) return(FAIL); else return(nout); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWgeomapinfo | | | | DESCRIPTION: Returns mapping information for dimension | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t 2 for indexed mapping, 1 for regular | | mapping, 0 if the dimension is not | | and (-1) FAIL | | INPUTS: | | swathID hid_t Swath structure ID | | geodim char geolocation dimension name | | | | OUTPUTS: | | NONE | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 7/29/99 A.Muslimov In the call to EHmetagroup() replace gid by fid. | | July 00 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWgeomapinfo(hid_t swathID, char *geodim) { herr_t status = FAIL; /* Return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ long idx = FAIL; /* Swath index */ char *metabufr = (char *)NULL; /* Pointer to SM */ char *metabufi = (char *)NULL; /* Pointer to SM */ char *metaptrsr[2]={NULL,NULL};/* Pntrs to begin, end of SM */ char *metaptrsi[2]={NULL,NULL};/* Pntrs to begin, end of SM */ char utlstrr[HE5_HDFE_DIMBUFSIZE]; /* Utility string */ char utlstri[HE5_HDFE_DIMBUFSIZE]; /* Utility string */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWgeomapinfo", &fid, &gid, &idx); if (status == SUCCEED) { /* Get pointers to "DimensionMap" section within SM */ metabufr = (char *)HE5_EHmetagroup(fid, HE5_SWXSwath[idx].swname, "s", "DimensionMap", metaptrsr); if (metabufr == NULL) { sprintf(errbuf, "Cannot get pointer to metabufer. \n") ; H5Epush(__FILE__, "HE5_SWgeomapinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Search for mapping - GeoDim/DataDim (surrounded by quotes) */ sprintf(utlstrr, "%s%s%s", "\t\t\t\tGeoDimension=\"", geodim, "\"\n\t\t\t\tDataDimension="); metaptrsr[0] = strstr(metaptrsr[0], utlstrr); /* Get pointers to "IndexDimensionMap" section within SM */ metabufi = (char *)HE5_EHmetagroup(fid, HE5_SWXSwath[idx].swname, "s", "IndexDimensionMap", metaptrsi); if (metabufi == NULL) { sprintf(errbuf, "Cannot allocate memory for metabufi.") ; H5Epush(__FILE__, "HE5_SWgeomapinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(metabufr); return(FAIL); } /* Search for mapping - GeoDim/DataDim (surrounded by quotes) */ sprintf(utlstri, "%s%s%s", "\t\t\t\tGeoDimension=\"", geodim, "\"\n\t\t\t\tDataDimension="); metaptrsi[0] = strstr(metaptrsi[0], utlstri); /* ** If regular mapping found add 1 to status ** If indexed mapping found add 2 */ if (metaptrsr[0] < metaptrsr[1] && metaptrsr[0] != NULL) { status = status + 1; } if (metaptrsi[0] < metaptrsi[1] && metaptrsi[0] != NULL) { status = status + 2; } free(metabufr); free(metabufi); } return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWfieldsizeID | | | | DESCRIPTION: Returns the size (in bytes) of field-related data type, | | otherwise returns 0. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | size size_t none | | | | INPUTS: | | swathID hid_t swath structure ID | | fieldname char fieldname | | | | OUTPUTS: | | fieldID hid_t field-related dataset ID | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 8/23/99 A.Muslimov Checked for the statuses returned by H5Tclose(). | | 2/08/00 A.Muslimov Added more error checkings and desciption. | | July 00 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ static size_t HE5_SWfieldsizeID( hid_t swathID, char *fieldname, hid_t *fieldID) { size_t size = 0; /* Size of field data type */ herr_t status = FAIL; /* Return status variable */ int i; /* Loop index */ int found = 0; /* Flag */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t dtype = FAIL; /* datatype ID */ long idx = FAIL; /* Swath index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Buffer for error message */ CHECKPOINTER(fieldname); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWfieldsizeID", &fid, &gid, &idx); /* Loop through all geo datasets in swath */ /* -------------------------------------- */ for (i = 0; i < HE5_SWXSwath[idx].nGFLD; i++) { if( strcmp(fieldname, HE5_SWXSwath[idx].gdataset[i].name) == 0 ) { /* Get dataset ID */ /* -------------- */ *fieldID = HE5_SWXSwath[idx].gdataset[i].ID; dtype = H5Dget_type( *fieldID); if (dtype == FAIL) { sprintf(errbuf, "Cannot get the dataset data type. \n"); H5Epush(__FILE__, "HE5_SWfieldsizeID", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(0); } size = H5Tget_size(dtype); if (size == 0) { sprintf(errbuf, "Cannot get the data type size. \n"); H5Epush(__FILE__, "HE5_SWfieldsizeID", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(0); } status = H5Tclose(dtype); if (status == FAIL) { sprintf(errbuf, "Cannot release the data type ID. \n"); H5Epush(__FILE__, "HE5_SWfieldsizeID", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(0); } found = 1; break; } } /* not found in geo field */ /* ---------------------- */ if( found == 0 ) { /* Loop through all data fields in swath */ /* ------------------------------------- */ for (i = 0; i < HE5_SWXSwath[idx].nDFLD; i++) { if( strcmp(fieldname, HE5_SWXSwath[idx].ddataset[i].name) == 0 ) { /* get dataset ID */ /* -------------- */ *fieldID = HE5_SWXSwath[idx].ddataset[i].ID; dtype = H5Dget_type(*fieldID); if (dtype == FAIL) { sprintf(errbuf, "Cannot get the dataset data type. \n"); H5Epush(__FILE__, "HE5_SWfieldsizeID", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(0); } size = H5Tget_size(dtype); if (size == 0) { sprintf(errbuf, "Cannot get the data type size. \n"); H5Epush(__FILE__, "HE5_SWfieldsizeID", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(0); } status = H5Tclose(dtype); if (status == FAIL) { sprintf(errbuf, "Cannot release the data type ID. \n"); H5Epush(__FILE__, "HE5_SWfieldsizeID", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(0); } found = 1; break; } } } if( found == 0 ) { sprintf(errbuf, "field \"%s\" is not in Swath. \n", fieldname); H5Epush(__FILE__, "HE5_SWfieldsizeID", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } COMPLETION: return(size); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWwritegrpattr | | | | DESCRIPTION: Writes/updates attribute associated with the "Data Fields" | | group in a swath. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t swath structure ID | | attrname char attribute name | | numtype hid_t attribute dataset datatype ID | | count[] hsize_t Number of attribute elements | | datbuf void I/O buffer | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jan 00 A.Muslimov | | July 00 A.Muslimov Unmasked hdf5 data types. | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWwritegrpattr(hid_t swathID, const char *attrname, hid_t numtype, hsize_t count[], void *datbuf) { herr_t status = FAIL; /* Return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t DataFieldsGrpID = FAIL; /* "Data Fields" group ID */ long idx = FAIL; /* Swath index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ hid_t numbertype; HE5_LOCK; CHECKNAME(attrname); CHECKPOINTER(count); CHECKPOINTER(datbuf); /* if numtype is HE5 numbertype, rather than H5 numbertype, then convert it, otherwise use numtype itself */ numbertype = HE5_EHconvdatatype(numtype); if(numbertype == FAIL) { numbertype = numtype; } /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWwritegrpattr", &fid, &gid, &idx); if (status == SUCCEED) { /* Get "Data Fields" group ID and call HE5_EHattr to perform I/O */ /* ------------------------------------------------------------- */ DataFieldsGrpID = H5Gopen(HE5_SWXSwath[idx].sw_id, "Data Fields"); if(DataFieldsGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"Data Fields\" group ID. \n"); H5Epush(__FILE__, "HE5_SWwritegrpattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } status = HE5_EHattr(DataFieldsGrpID, attrname, numbertype, count,"w", datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot write Attribute \"%s\"to the \"Data Fields\" group.\n", attrname); H5Epush(__FILE__, "HE5_SWwritegrpattr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Gclose(DataFieldsGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"Data Fields\" group ID. \n"); H5Epush(__FILE__, "HE5_SWwritegrpattr", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWreadgrpattr | | | | DESCRIPTION: Reads attribute from the "Data Fields" group in a swath. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t swath structure ID | | attrname char attribute name | | | | OUTPUTS: | | datbuf void I/O buffer | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jan 00 A.Muslimov | | July 00 A.Muslimov Unmasked hdf5 data types. | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWreadgrpattr(hid_t swathID, const char *attrname, void * datbuf) { herr_t status = FAIL; /* return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t ntype = FAIL; /* Data type ID */ hid_t DataFieldsGrpID = FAIL; /* "Data Fields" group ID */ long idx = FAIL; /* Swath index */ hsize_t count[] = { 0 }; /* # of attribute elements */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKPOINTER(attrname); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWreadgrpattr", &fid, &gid, &idx); if (status == SUCCEED) { /* Get "Data Fields" group ID and call HE5_EHattr to perform I/O */ /* -------------------------------------------------------------- */ DataFieldsGrpID = H5Gopen(HE5_SWXSwath[idx].sw_id, "Data Fields"); if(DataFieldsGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"Data Fields\" group ID.\n"); H5Epush(__FILE__, "HE5_SWreadgrpattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } status = HE5_EHattr(DataFieldsGrpID,attrname,ntype,count,"r", datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot read Attribute \"%s\" from the \"Data Fields\" group.\n", attrname); H5Epush(__FILE__, "HE5_SWreadgrpattr", __LINE__, H5E_ATTR, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Gclose(DataFieldsGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"Data Fields\" group ID.\n"); H5Epush(__FILE__, "HE5_SWreadgrpattr", __LINE__,H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWgrpattrinfo | | | | DESCRIPTION: Retrieves information about attributes in "Data Fields" group.| | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t swath structure ID | | attrname const char* attribute name | | | | OUTPUTS: | | ntype hid_t data type ID | | count hsize_t Number of attribute elements | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jan 00 A.Muslimov | | May 00 A.Muslimov Replaced 'H5T_class_t' type by 'int' data type. | | July 00 A.Muslimov Unmasked hdf5 data types. | | Feb 03 S.Zhao Changed the type of 'ntype' from an H5T_class_t to | | an hid_t. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWgrpattrinfo(hid_t swathID, const char *attrname, hid_t *ntype, hsize_t *count) { herr_t status = FAIL; /* routine return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t DataFieldsGrpID = FAIL; /* "Data Fields" group ID */ long idx = FAIL; /* Swath index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ CHECKPOINTER(attrname); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWgrpattrinfo", &fid, &gid, &idx); if (status == SUCCEED) { /* Get "Data Fields" group ID and call HE5_EHattrinfo */ /* --------------------------------------------------- */ DataFieldsGrpID = H5Gopen(HE5_SWXSwath[idx].sw_id, "Data Fields"); if(DataFieldsGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"Data Fields\" group ID.\n"); H5Epush(__FILE__, "HE5_SWgrpattrinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } status = HE5_EHattrinfo(DataFieldsGrpID,attrname,ntype,count); if(status == FAIL) { sprintf(errbuf,"Cannot retrieve information about Attribute \"%s\" in the \"Data Fields\" group.\n", attrname); H5Epush(__FILE__, "HE5_SWgrpattrinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Gclose(DataFieldsGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"Data Fields\" group ID.\n"); H5Epush(__FILE__, "HE5_SWgrpattrinfo", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWgrpattrinfo2 | | | | DESCRIPTION: Retrieves information about attributes in "Data Fields" group.| | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t swath structure ID | | attrname const char* attribute name | | | | OUTPUTS: | | ntype hid_t data type ID | | count hsize_t Number of attribute elements | | size hsize_t buf size of attribute elements | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jan 00 A.Muslimov | | May 00 A.Muslimov Replaced 'H5T_class_t' type by 'int' data type. | | July 00 A.Muslimov Unmasked hdf5 data types. | | Feb 03 S.Zhao Changed the type of 'ntype' from an H5T_class_t to | | an hid_t. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWgrpattrinfo2(hid_t swathID, const char *attrname, hid_t *ntype, hsize_t *count, hsize_t *size) { herr_t status = FAIL; /* routine return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t DataFieldsGrpID = FAIL; /* "Data Fields" group ID */ long idx = FAIL; /* Swath index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ CHECKPOINTER(attrname); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWgrpattrinfo2", &fid, &gid, &idx); if (status == SUCCEED) { /* Get "Data Fields" group ID and call HE5_EHattrinfo */ /* --------------------------------------------------- */ DataFieldsGrpID = H5Gopen(HE5_SWXSwath[idx].sw_id, "Data Fields"); if(DataFieldsGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"Data Fields\" group ID.\n"); H5Epush(__FILE__, "HE5_SWgrpattrinfo2", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } status = HE5_EHattrinfo2(DataFieldsGrpID,attrname,ntype,count,size); if(status == FAIL) { sprintf(errbuf,"Cannot retrieve information about Attribute \"%s\" in the \"Data Fields\" group.\n", attrname); H5Epush(__FILE__, "HE5_SWgrpattrinfo2", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Gclose(DataFieldsGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"Data Fields\" group ID.\n"); H5Epush(__FILE__, "HE5_SWgrpattrinfo2", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWinqgrpattrs | | | | DESCRIPTION: Retrieves the number of attributes and string length of | | attribute list in "Data Fields" group | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nattr long Number of attributes in "Data Fields" | | group. | | | | INPUTS: | | swath ID hid_t swath structure ID | | | | OUTPUTS: | | attrnames char Attribute names in "Data Fields" group | | (Comma-separated list) | | strbufsize long Attributes name list string length | | | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Jan 00 A.Muslimov | | July 00 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_SWinqgrpattrs(hid_t swathID, char *attrnames, long *strbufsize) { long nattr = FAIL; /* Number of attributes (return) */ long idx = FAIL; /* Swath index */ herr_t status = FAIL; /* Return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "SWATHS" group ID */ char *grpname = (char *)NULL; /* Group name string */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWinqgrpattrs", &fid, &gid, &idx); if(status == SUCCEED ) { grpname = (char *)calloc(HE5_HDFE_NAMBUFSIZE, sizeof(char) ); if( grpname == NULL) { H5Epush(__FILE__, "HE5_SWinqgrpattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Can not allocate memory"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); return(FAIL); } strcpy(grpname,"/HDFEOS/SWATHS/"); strcat(grpname, HE5_SWXSwath[idx].swname); strcat(grpname,"/Data Fields"); /* search group with grpname for the number of attributes */ /* ------------------------------------------------------ */ nattr = HE5_EHattrcat(fid, grpname, attrnames, strbufsize); if ( nattr < 0 ) { sprintf(errbuf, "Cannot find the attributes. \n"); H5Epush(__FILE__, "HE5_SWinqgrpattrs", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); } if (grpname != NULL) free(grpname); } return (nattr); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWwritegeogrpattr | | | | DESCRIPTION: Writes/updates attribute associated with the "Geolocation | | Fields" group in a swath. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t swath structure ID | | attrname char attribute name | | numtype hid_t attribute dataset datatype ID | | count[] hsize_t Number of attribute elements | | datbuf void I/O buffer | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Feb 04 S.Zhao Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWwritegeogrpattr(hid_t swathID, const char *attrname, hid_t numtype, hsize_t count[], void *datbuf) { herr_t status = FAIL; /* Return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t GeoFieldsGrpID = FAIL; /* "Geolocation Fields" group ID */ long idx = FAIL; /* Swath index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ hid_t numbertype; HE5_LOCK; CHECKNAME(attrname); CHECKPOINTER(count); CHECKPOINTER(datbuf); /* if numtype is HE5 numbertype, rather than H5 numbertype, then convert it, otherwise use numtype itself */ numbertype = HE5_EHconvdatatype(numtype); if(numbertype == FAIL) { numbertype = numtype; } /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWwritegeogrpattr", &fid, &gid, &idx); if (status == SUCCEED) { /* Get "Geolocation Fields" group ID and call HE5_EHattr to perform I/O */ /* -------------------------------------------------------------------- */ GeoFieldsGrpID = H5Gopen(HE5_SWXSwath[idx].sw_id, "Geolocation Fields"); if(GeoFieldsGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"Geolocation Fields\" group ID. \n"); H5Epush(__FILE__, "HE5_SWwritegeogrpattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } status = HE5_EHattr(GeoFieldsGrpID, attrname, numbertype, count,"w", datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot write attribute \"%s\"to the \"Geolocation Fields\" group.\n", attrname); H5Epush(__FILE__, "HE5_SWwritegeogrpattr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Gclose(GeoFieldsGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"Geolocation Fields\" group ID. \n"); H5Epush(__FILE__, "HE5_SWwritegeogrpattr", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWreadgeogrpattr | | | | DESCRIPTION: Reads attribute from the "Geolocation Fields" group | | in a swath. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t swath structure ID | | attrname char attribute name | | | | OUTPUTS: | | datbuf void I/O buffer | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Feb 04 S.Zhao Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWreadgeogrpattr(hid_t swathID, const char *attrname, void * datbuf) { herr_t status = FAIL; /* return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t ntype = FAIL; /* Data type ID */ hid_t GeoFieldsGrpID = FAIL; /* "Geolocation Fields" group ID */ long idx = FAIL; /* Swath index */ hsize_t count[] = { 0 }; /* # of attribute elements */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKPOINTER(attrname); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWreadgeogrpattr", &fid, &gid, &idx); if (status == SUCCEED) { /* Get "Geolocation Fields" group ID and call HE5_EHattr to perform I/O */ /* --------------------------------------------------------------------- */ GeoFieldsGrpID = H5Gopen(HE5_SWXSwath[idx].sw_id, "Geolocation Fields"); if(GeoFieldsGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"Geolocation Fields\" group ID.\n"); H5Epush(__FILE__, "HE5_SWreadgeogrpattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } status = HE5_EHattr(GeoFieldsGrpID,attrname,ntype,count,"r", datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot read attribute \"%s\" from the \"Geolocation Fields\" group.\n", attrname); H5Epush(__FILE__, "HE5_SWreadgeogrpattr", __LINE__, H5E_ATTR, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Gclose(GeoFieldsGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"Geolocation Fields\" group ID.\n"); H5Epush(__FILE__, "HE5_SWreadgeogrpattr", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWgeogrpattrinfo | | | | DESCRIPTION: Retrieves information about attributes in "Geolocation Fields"| | group. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t swath structure ID | | attrname const char* attribute name | | | | OUTPUTS: | | ntype hid_t data type ID | | count hsize_t Number of attribute elements | | | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Feb 04 S.Zhao Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWgeogrpattrinfo(hid_t swathID, const char *attrname, hid_t *ntype, hsize_t *count) { herr_t status = FAIL; /* routine return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t GeoFieldsGrpID = FAIL; /* "Geolocation Fields" group ID */ long idx = FAIL; /* Swath index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ CHECKPOINTER(attrname); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWgeogrpattrinfo", &fid, &gid, &idx); if (status == SUCCEED) { /* Get "Geolocation Fields" group ID and call HE5_EHattrinfo */ /* ---------------------------------------------------------- */ GeoFieldsGrpID = H5Gopen(HE5_SWXSwath[idx].sw_id, "Geolocation Fields"); if(GeoFieldsGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"Geolocation Fields\" group ID.\n"); H5Epush(__FILE__, "HE5_SWgeogrpattrinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } status = HE5_EHattrinfo(GeoFieldsGrpID,attrname,ntype,count); if(status == FAIL) { sprintf(errbuf,"Cannot retrieve information about attribute \"%s\" in the \"Geolocation Fields\" group.\n",attrname); H5Epush(__FILE__, "HE5_SWgeogrpattrinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Gclose(GeoFieldsGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"Geolocation Fields\" group ID.\n"); H5Epush(__FILE__, "HE5_SWgeogrpattrinfo", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWgeogrpattrinfo2 | | | | DESCRIPTION: Retrieves information about attributes in "Geolocation Fields"| | group. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t swath structure ID | | attrname const char* attribute name | | | | OUTPUTS: | | ntype hid_t data type ID | | count hsize_t Number of attribute elements | | size hsize_t buf size of attribute elements | | | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Feb 04 S.Zhao Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWgeogrpattrinfo2(hid_t swathID, const char *attrname, hid_t *ntype, hsize_t *count, hsize_t *size) { herr_t status = FAIL; /* routine return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t GeoFieldsGrpID = FAIL; /* "Geolocation Fields" group ID */ long idx = FAIL; /* Swath index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ CHECKPOINTER(attrname); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWgeogrpattrinfo", &fid, &gid, &idx); if (status == SUCCEED) { /* Get "Geolocation Fields" group ID and call HE5_EHattrinfo */ /* ---------------------------------------------------------- */ GeoFieldsGrpID = H5Gopen(HE5_SWXSwath[idx].sw_id, "Geolocation Fields"); if(GeoFieldsGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"Geolocation Fields\" group ID.\n"); H5Epush(__FILE__, "HE5_SWgeogrpattrinfo2", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } status = HE5_EHattrinfo2(GeoFieldsGrpID,attrname,ntype,count, size); if(status == FAIL) { sprintf(errbuf,"Cannot retrieve information about attribute \"%s\" in the \"Geolocation Fields\" group.\n",attrname); H5Epush(__FILE__, "HE5_SWgeogrpattrinfo2", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Gclose(GeoFieldsGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"Geolocation Fields\" group ID.\n"); H5Epush(__FILE__, "HE5_SWgeogrpattrinfo2", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWinqgeogrpattrs | | | | DESCRIPTION: Retrieves the number of attributes and string length of | | attribute list in "Geolocation Fields" group. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nattr long Number of attributes in "Geolocation | | Fields" group. | | | | INPUTS: | | swath ID hid_t swath structure ID | | | | OUTPUTS: | | attrnames char Attribute names in "Geolocation Fields" | | group (Comma-separated list) | | strbufsize long Attributes name list string length | | | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Feb 04 S.Zhao Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_SWinqgeogrpattrs(hid_t swathID, char *attrnames, long *strbufsize) { long nattr = FAIL; /* Number of attributes (return) */ long idx = FAIL; /* Swath index */ herr_t status = FAIL; /* Return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "SWATHS" group ID */ char *grpname = (char *)NULL; /* Group name string */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWinqgeogrpattrs", &fid, &gid, &idx); if(status == SUCCEED ) { grpname = (char *)calloc(HE5_HDFE_NAMBUFSIZE, sizeof(char) ); if( grpname == NULL) { H5Epush(__FILE__, "HE5_SWinqgeogrpattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Can not allocate memory"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); return(FAIL); } strcpy(grpname,"/HDFEOS/SWATHS/"); strcat(grpname, HE5_SWXSwath[idx].swname); strcat(grpname,"/Geolocation Fields"); /* search group with grpname for the number of attributes */ /* ------------------------------------------------------ */ nattr = HE5_EHattrcat(fid, grpname, attrnames, strbufsize); if ( nattr < 0 ) { sprintf(errbuf, "Cannot find the attributes. \n"); H5Epush(__FILE__, "HE5_SWinqgeogrpattrs", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); } if (grpname != NULL) free(grpname); } return (nattr); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWwritelocattr | | | | DESCRIPTION: Writes/updates attribute associated with a specified field in | | a swath. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t swath structure ID | | fieldname char field name | | attrname char attribute name | | numtype hid_t attribute dataset datatype ID | | count[] hsize_t Number of attribute elements | | datbuf void I/O buffer | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jan 00 A.Muslimov | | Jul 00 A.Muslimov Unmasked hdf5 data types. | | Nov 00 A.Muslimov Added writing local attribute to the field of | | "Geolocation Fields" group. | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | Jan 04 S.Zhao Added writing local attribute to the field of | | "Profile Fields" group. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWwritelocattr(hid_t swathID, const char *fieldname, const char *attrname, hid_t numtype, hsize_t count[], void *datbuf) { herr_t status = FAIL; /* Return status variable */ int fldgroup = FAIL; /* Field group flag */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t FieldGrpID = FAIL; /* Field group ID */ hid_t fieldID = FAIL; /* Field dataset ID */ long idx = FAIL; /* Swath index */ char *grpname = (char *)NULL; /* Group name buffer */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ hid_t numbertype; HE5_LOCK; CHECKPOINTER(fieldname); CHECKNAME(attrname); CHECKPOINTER(count); CHECKPOINTER(datbuf); /* if numtype is HE5 numbertype, rather than H5 numbertype, then convert it, otherwise use numtype itself */ numbertype = HE5_EHconvdatatype(numtype); if(numbertype == FAIL) { numbertype = numtype; } /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWwritelocattr", &fid, &gid, &idx); if (status == SUCCEED) { /* Allocate memory for the group name buffer */ /* ----------------------------------------- */ grpname = (char *)calloc(64, sizeof(char) ); if( grpname == NULL) { sprintf(errbuf,"Cannot allocate memory for the group name buffer.\n"); H5Epush(__FILE__, "HE5_SWwritelocattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the field group flag */ /* ------------------------ */ fldgroup = HE5_SWfldsrch(swathID,(char *)fieldname,NULL,NULL,NULL,NULL); if(fldgroup == FAIL) { sprintf(errbuf,"Cannot get the group flag for \"%s\" field.\n",fieldname); H5Epush(__FILE__, "HE5_SWwritelocattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } if (fldgroup == HE5_HDFE_GEOGROUP) strcpy(grpname,"Geolocation Fields"); else if (fldgroup == HE5_HDFE_DATAGROUP) strcpy(grpname,"Data Fields"); else if (fldgroup == HE5_HDFE_PROFGROUP) strcpy(grpname,"Profile Fields"); /* Get the Field group ID */ /* ---------------------- */ FieldGrpID = H5Gopen(HE5_SWXSwath[idx].sw_id, grpname); if(FieldGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"%s\" group.\n", grpname); H5Epush(__FILE__, "HE5_SWwritelocattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } /* Get field ID and call HE5_EHattr to perform I/O */ /* ----------------------------------------------- */ fieldID = H5Dopen(FieldGrpID, fieldname); if(fieldID == FAIL) { sprintf(errbuf,"Cannot open the \"%s\" field dataset.\n", fieldname); H5Epush(__FILE__, "HE5_SWwritelocattr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } /* Call EHattr() to perform I/O */ /* ---------------------------- */ status = HE5_EHattr(fieldID, attrname, numbertype, count,"w", datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot write Attribute \"%s\" for the \"%s\" field.\n", attrname, fieldname); H5Epush(__FILE__, "HE5_SWwritelocattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(status); } /* Release dataset ID */ /* ------------------ */ status = H5Dclose(fieldID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"%s\" field dataset ID.\n", fieldname); H5Epush(__FILE__, "HE5_SWwritelocattr", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(status); } /* Release group ID */ /* ---------------- */ status = H5Gclose(FieldGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"%s\" group ID.\n",grpname); H5Epush(__FILE__, "HE5_SWwritelocattr", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(status); } free(grpname); } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWreadlocattr | | | | DESCRIPTION: Reads attribute associated with a specified field in a swath. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t swath structure ID | | fieldname char fieldname | | attrname char attribute name | | | | OUTPUTS: | | datbuf void I/O buffer | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jan 00 A.Muslimov Original version. | | Jul 00 A.Muslimov Unmasked hdf5 data types. | | Nov 00 A.Muslimov Added reading local attribute from "Geolocation | | Fields" group. | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | Jan 04 S.Zhao Added reading local attribute from the field of | | "Profile Fields" group. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWreadlocattr(hid_t swathID, const char *fieldname, const char *attrname, void * datbuf) { herr_t status = FAIL; /* return status variable */ int fldgroup = FAIL; /* Field group flag */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t ntype = FAIL; /* Data type ID */ hid_t FieldGrpID = FAIL; /* Field group ID */ hid_t fieldID = FAIL; /* Field dataset ID */ long idx = FAIL; /* Swath index */ hsize_t count[] = { 0 }; /* number of elements */ char *grpname = (char *)NULL; /* Group name buffer */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKPOINTER(fieldname); CHECKPOINTER(attrname); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWreadlocattr", &fid, &gid, &idx); if (status == SUCCEED) { /* Allocate memory for the group name buffer */ /* ----------------------------------------- */ grpname = (char *)calloc(64, sizeof(char) ); if( grpname == NULL) { sprintf(errbuf,"Cannot allocate memory for the group name buffer.\n"); H5Epush(__FILE__, "HE5_SWreadlocattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the field group flag */ /* ------------------------ */ fldgroup = HE5_SWfldsrch(swathID,(char *)fieldname,NULL,NULL,NULL,NULL); if(fldgroup == FAIL) { sprintf(errbuf,"Cannot get the group flag for \"%s\" field. \n",fieldname); H5Epush(__FILE__, "HE5_SWreadlocattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } if (fldgroup == HE5_HDFE_GEOGROUP) strcpy(grpname,"Geolocation Fields"); else if (fldgroup == HE5_HDFE_DATAGROUP) strcpy(grpname,"Data Fields"); else if (fldgroup == HE5_HDFE_PROFGROUP) strcpy(grpname,"Profile Fields"); /* Get Field group ID */ /* -------------------- */ FieldGrpID = H5Gopen(HE5_SWXSwath[idx].sw_id, grpname); if(FieldGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"%s\" group.\n", grpname); H5Epush(__FILE__, "HE5_SWreadlocattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } /* Get field ID and call HE5_EHattr to perform I/O */ /* ----------------------------------------------- */ fieldID = H5Dopen(FieldGrpID, fieldname); if(fieldID == FAIL) { sprintf(errbuf,"Cannot open the \"%s\" field dataset.\n", fieldname); H5Epush(__FILE__, "HE5_SWreadlocattr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } /* Call EHattr() to perform I/O */ /* ---------------------------- */ status = HE5_EHattr(fieldID,attrname,ntype,count,"r", datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot read Attribute \"%s\" associated wth the \"%s\" field.\n", attrname,fieldname); H5Epush(__FILE__, "HE5_SWreadlocattr", __LINE__, H5E_ATTR, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(status); } /* Release the dataset ID */ /* ---------------------- */ status = H5Dclose(fieldID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"%s\" field dataset ID.\n", fieldname); H5Epush(__FILE__, "HE5_SWreadlocattr", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(status); } /* Release the group ID */ /* -------------------- */ status = H5Gclose(FieldGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"%s\" group ID.\n", grpname); H5Epush(__FILE__, "HE5_SWreadlocattr", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(status); } free(grpname); } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWlocattrinfo | | | | DESCRIPTION: Retrievs information about attribute associated with a | | specified field in the "Data Fields" / "Geolocation Fields" / | | "Profile Fields" group. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t swath structure ID | | fieldname char* field name | | attrname const char* attribute name | | | | OUTPUTS: | | ntype hid_t data type ID | | count hsize_t Number of attribute elements | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jan 00 A.Muslimov Original draft. | | May 00 A.Muslimov Replaced 'H5T_class_t' type by 'int' data type. | | Jul 00 A.Muslimov Unmasked hdf5 data types. | | Nov 00 A.Muslimov Added retrieving info about attribute to a | | field from the "Geolocation Fields" group. | | Feb 03 S.Zhao Changed the type of 'ntype' from an H5T_class_t to | | an hid_t. | | Jan 04 S.Zhao Added retrieving info about attribute from a field | | in the "Profile Fields" group. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWlocattrinfo(hid_t swathID, const char *fieldname, const char *attrname, hid_t *ntype, hsize_t *count) { herr_t status = FAIL; /* Return status variable */ int fldgroup = FAIL; /* Field group flag */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t FieldGrpID = FAIL; /* Field group ID */ hid_t fieldID = FAIL; /* Field dataset ID */ long idx = FAIL; /* Swath index */ char *grpname = (char *)NULL; /* Group name buffer */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ CHECKPOINTER(fieldname); CHECKPOINTER(attrname); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWlocattrinfo", &fid, &gid, &idx); if (status == SUCCEED) { /* Allocate memory for the group name buffer */ /* ----------------------------------------- */ grpname = (char *)calloc(64, sizeof(char) ); if( grpname == NULL) { sprintf(errbuf,"Cannot allocate memory for the group name buffer.\n"); H5Epush(__FILE__, "HE5_SWlocattrinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the field group flag */ /* ------------------------ */ fldgroup = HE5_SWfldsrch(swathID,(char *)fieldname,NULL,NULL,NULL,NULL); if(fldgroup == FAIL) { sprintf(errbuf,"Cannot get the group flag for \"%s\" field. \n",fieldname); H5Epush(__FILE__, "HE5_SWlocattrinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } if (fldgroup == HE5_HDFE_GEOGROUP) strcpy(grpname,"Geolocation Fields"); else if (fldgroup == HE5_HDFE_DATAGROUP) strcpy(grpname,"Data Fields"); else if (fldgroup == HE5_HDFE_PROFGROUP) strcpy(grpname,"Profile Fields"); /* Get Field group ID */ /* ------------------- */ FieldGrpID = H5Gopen(HE5_SWXSwath[idx].sw_id, grpname); if(FieldGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"%s\" group.\n", grpname); H5Epush(__FILE__, "HE5_SWlocattrinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } /* Get field ID */ /* ------------ */ fieldID = H5Dopen(FieldGrpID, fieldname); if(fieldID == FAIL) { sprintf(errbuf,"Cannot open the \"%s\" field dataset.\n", fieldname); H5Epush(__FILE__, "HE5_SWlocattrinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } /* Call EHattrinfo() to perform I/O */ /* -------------------------------- */ status = HE5_EHattrinfo(fieldID,attrname,ntype,count); if(status == FAIL) { sprintf(errbuf,"Cannot retrieve information about Attribute \"%s\" in the \"%s\" group.\n", attrname, grpname); H5Epush(__FILE__, "HE5_SWlocattrinfo", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(status); } /* Release dataset ID */ /* ------------------ */ status = H5Dclose(fieldID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"%s\" field dataset ID.\n", fieldname); H5Epush(__FILE__, "HE5_SWlocattrinfo", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(status); } /* Release group ID */ /* ---------------- */ status = H5Gclose(FieldGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the field group ID.\n"); H5Epush(__FILE__, "HE5_SWlocattrinfo", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(status); } free(grpname); } COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWlocattrinfo2 | | | | DESCRIPTION: Retrievs information about attribute associated with a | | specified field in the "Data Fields" / "Geolocation Fields" / | | "Profile Fields" group. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t swath structure ID | | fieldname char* field name | | attrname const char* attribute name | | | | OUTPUTS: | | ntype hid_t data type ID | | count hsize_t Number of attribute elements | | size hsize_t buf size of attribute elements | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jan 00 A.Muslimov Original draft. | | May 00 A.Muslimov Replaced 'H5T_class_t' type by 'int' data type. | | Jul 00 A.Muslimov Unmasked hdf5 data types. | | Nov 00 A.Muslimov Added retrieving info about attribute to a | | field from the "Geolocation Fields" group. | | Feb 03 S.Zhao Changed the type of 'ntype' from an H5T_class_t to | | an hid_t. | | Jan 04 S.Zhao Added retrieving info about attribute from a field | | in the "Profile Fields" group. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWlocattrinfo2(hid_t swathID, const char *fieldname, const char *attrname, hid_t *ntype, hsize_t *count, hsize_t *size) { herr_t status = FAIL; /* Return status variable */ int fldgroup = FAIL; /* Field group flag */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t FieldGrpID = FAIL; /* Field group ID */ hid_t fieldID = FAIL; /* Field dataset ID */ long idx = FAIL; /* Swath index */ char *grpname = (char *)NULL; /* Group name buffer */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ CHECKPOINTER(fieldname); CHECKPOINTER(attrname); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWlocattrinfo2", &fid, &gid, &idx); if (status == SUCCEED) { /* Allocate memory for the group name buffer */ /* ----------------------------------------- */ grpname = (char *)calloc(64, sizeof(char) ); if( grpname == NULL) { sprintf(errbuf,"Cannot allocate memory for the group name buffer.\n"); H5Epush(__FILE__, "HE5_SWlocattrinfo2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the field group flag */ /* ------------------------ */ fldgroup = HE5_SWfldsrch(swathID,(char *)fieldname,NULL,NULL,NULL,NULL); if(fldgroup == FAIL) { sprintf(errbuf,"Cannot get the group flag for \"%s\" field. \n",fieldname); H5Epush(__FILE__, "HE5_SWlocattrinfo2", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } if (fldgroup == HE5_HDFE_GEOGROUP) strcpy(grpname,"Geolocation Fields"); else if (fldgroup == HE5_HDFE_DATAGROUP) strcpy(grpname,"Data Fields"); else if (fldgroup == HE5_HDFE_PROFGROUP) strcpy(grpname,"Profile Fields"); /* Get Field group ID */ /* ------------------- */ FieldGrpID = H5Gopen(HE5_SWXSwath[idx].sw_id, grpname); if(FieldGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"%s\" group.\n", grpname); H5Epush(__FILE__, "HE5_SWlocattrinfo2", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } /* Get field ID */ /* ------------ */ fieldID = H5Dopen(FieldGrpID, fieldname); if(fieldID == FAIL) { sprintf(errbuf,"Cannot open the \"%s\" field dataset.\n", fieldname); H5Epush(__FILE__, "HE5_SWlocattrinfo2", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } /* Call EHattrinfo() to perform I/O */ /* -------------------------------- */ status = HE5_EHattrinfo2(fieldID,attrname,ntype,count,size); if(status == FAIL) { sprintf(errbuf,"Cannot retrieve information about Attribute \"%s\" in the \"%s\" group.\n", attrname, grpname); H5Epush(__FILE__, "HE5_SWlocattrinfo2", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(status); } /* Release dataset ID */ /* ------------------ */ status = H5Dclose(fieldID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"%s\" field dataset ID.\n", fieldname); H5Epush(__FILE__, "HE5_SWlocattrinfo2", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(status); } /* Release group ID */ /* ---------------- */ status = H5Gclose(FieldGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the field group ID.\n"); H5Epush(__FILE__, "HE5_SWlocattrinfo2", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(status); } free(grpname); } COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWinqdscaleattrs | | | | DESCRIPTION: Retrieves the number of attributes and string length of | | attribute list associated with a specified dimension scale | | in a swath. | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nattr long number of attributes (-1 if fails) | | | | INPUTS: | | swathID hid_t None HDF-EOS type swath ID | | fieldname char dimension scale name | | attrnames char attribute name(s) | | | | OUTPUTS: | | strbufsize long String length of attribute (in bytes) | | | | NOTES: | | | | None | | | | Date Programmer Description | | ====== ============ ================================================= | | June 10 Abe Taaheri Original development. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_SWinqdscaleattrs(hid_t swathID, const char *fieldname, char *attrnames, long *strbufsize) { long nattr = 0; /* Number of attributes (return) */ long idx = FAIL;/* Swath index */ herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ char *dtsname = NULL;/* Buffer for dataset name */ char errbuf[HE5_HDFE_ERRBUFSIZE]; CHECKPOINTER(fieldname); /* ********************************************************** * Check for proper swath ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Swath index * ********************************************************** */ status = HE5_SWchkswid(swathID, "HE5_SWinqdscaleattrs", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf,"Checking for swath ID failed.\n" ); H5Epush(__FILE__, "HE5_SWinqdscaleattrs", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } dtsname = (char *) calloc(HE5_HDFE_NAMBUFSIZE, 1); if( dtsname == NULL) { sprintf(errbuf, "Can not allocate memory.\n"); H5Epush(__FILE__, "HE5_SWinqdscaleattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } strcpy(dtsname,"/HDFEOS/SWATHS/"); strcat(dtsname, HE5_SWXSwath[idx].swname); strcat(dtsname,"/"); strcat(dtsname,fieldname); nattr = HE5_EHattrcat(fid, dtsname, attrnames, strbufsize); if (dtsname != NULL) free(dtsname); COMPLETION: return(nattr); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWinqlocattrs | | | | DESCRIPTION: Retrieves the number of attributes and string length of | | attribute list associated with a specified field in the | | "Data Fields" / "Geolocation Fields" / "Profile Fields" | | group. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nattr long Number of attributes in "Data Fields" | | group. | | | | INPUTS: | | swathID hid_t swath structure ID | | fieldname char field name | | | | OUTPUTS: | | attrnames char Attribute names in "Data Fields" group | | (Comma-separated list) | | strbufsize long Attributes name list string length | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Jan 00 A.Muslimov | | Jul 00 A.Muslimov Unmasked hdf5 data types. | | Nov 00 A.Muslimov Added inquiring about local attributes from | | "Geolocation Fields" group. | | Jan 04 S.Zhao Added inquiring about local attributes from | | the "Profile Fields" group. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_SWinqlocattrs(hid_t swathID, const char *fieldname, char *attrnames, long *strbufsize) { long nattr = FAIL; /* Number of attributes */ long idx = FAIL; /* Swath index */ herr_t status = FAIL; /* Return status variable */ int fldgroup = FAIL; /* Field group flag */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "SWATHS" group ID */ char *dtsname = (char *)NULL; /* Dataset name string */ char *grpname = (char *)NULL; /* Group name buffer */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ CHECKPOINTER(fieldname); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWinqlocattrs", &fid, &gid, &idx); if(status == SUCCEED ) { /* Allocate memory for the dataset name buffer */ /* ------------------------------------------- */ dtsname = (char *)calloc(HE5_HDFE_NAMBUFSIZE, sizeof(char) ); if( dtsname == NULL) { sprintf(errbuf, "Cannot allocate memory for the dataset name buffer. \n"); H5Epush(__FILE__, "HE5_SWinqlocattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Allocate memory for the group name buffer */ /* ----------------------------------------- */ grpname = (char *)calloc(64, sizeof(char) ); if( grpname == NULL) { sprintf(errbuf,"Cannot allocate memory for the group name buffer.\n"); H5Epush(__FILE__, "HE5_SWinqlocattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(dtsname); return(FAIL); } /* Get the field group flag */ /* ------------------------ */ fldgroup = HE5_SWfldsrch(swathID,(char *)fieldname,NULL,NULL,NULL,NULL); if(fldgroup == FAIL) { sprintf(errbuf,"Cannot get the group flag for \"%s\" field.\n",fieldname); H5Epush(__FILE__, "HE5_SWinqlocattrs", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); free(dtsname); return(FAIL); } if (fldgroup == HE5_HDFE_GEOGROUP) strcpy(grpname,"/Geolocation Fields/"); else if (fldgroup == HE5_HDFE_DATAGROUP) strcpy(grpname,"/Data Fields/"); else if (fldgroup == HE5_HDFE_PROFGROUP) strcpy(grpname,"/Profile Fields/"); strcpy(dtsname,"/HDFEOS/SWATHS/"); strcat(dtsname, HE5_SWXSwath[idx].swname); strcat(dtsname, grpname); strcat(dtsname, fieldname); /* search group with grpname for the number of attributes */ /* ------------------------------------------------------ */ nattr = HE5_EHattrcat(fid, dtsname, attrnames, strbufsize); if ( nattr < 0 ) { sprintf(errbuf, "Cannot find the attributes. \n"); H5Epush(__FILE__, "HE5_SWinqlocattrs", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } if (dtsname != NULL) free(dtsname); if (grpname != NULL) free(grpname); } COMPLETION: return(nattr); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PRdefine | | | | DESCRIPTION: Defines "Profile" dataset within a specified Swath, under the| | "Profile Fields" group. | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | status herr_t Return status (0) SUCCEED (-1) | | FAIL | | INPUTS: | | swathID hid_t Swath ID | | profilename const char Profile/dataset name | | dimlist char Comma separated list of dimensions | | maxdimlist char List of maximum dimensions | | datatype_id hid_t Base datatype ID | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ======= ============ ================================================= | | Jun 00 A.Muslimov Original development | | Jul 00 A.Muslimov Unmasked hdf5 data types. | | Sep 00 A.Muslimov Changed referencing the "Data Fields" to "Profile | | Fields". | | Oct 00 A.Muslimov Moved a block that tries to retrieve a fill value | | to HE5_PRwrite() interface. | | Dec 00 A.Muslimov Modified to add "dimlist" and "maxdimlist" parame- | | ters and related metadata blocks. | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | Feb 03 S. Zhao Added the creation of the "Profile Fields" group. | | Aug 03 S.Zhao Added Szip compression methods. | | May 05 S.Zhao Added HE5_EHdtype2numtype() function call. | | Sep 11 Abe Taaheri Modified for correcting Unlimited dimension | | behavior and extension, removing hardcoded name | | Unlim | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_PRdefine(hid_t swathID, const char *profilename, char *dimlist, char *maxdimlist, hid_t numbertype_in) { herr_t status = FAIL; /* Status variable (return) */ int i; /* Loop index */ int compcode = FAIL; /* Compression method flag */ int foundAllDim = 1; /* "found all dims" flag */ int append = FALSE; /* "Appendability" flag */ int first = 1; /* first entry flag */ int rank = 0; /* Profile rank */ int maxrank = 0; /* Max. dims rank */ hid_t heos_gid = FAIL; /* "SWATHS" group ID */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "Profile Fields" group ID */ hid_t dataset = FAIL; /* Profile dataset ID */ hid_t space = FAIL; /* Data space ID */ hid_t type = FAIL; /* Data type ID */ hid_t numtype = FAIL; /* Number type */ hid_t datatype_id; /* HDF5 type Number type */ hsize_t metavalue = 0; /* Metadata value to insert */ hsize_t dims[HE5_DTSETRANKMAX]; /* Dimension size array */ hsize_t maxdims[HE5_DTSETRANKMAX]; /* Dimension size array */ hsize_t dimsize = 0; /* Dimension size */ long idx = FAIL; /* Swath index */ H5D_layout_t layout = H5D_LAYOUT_ERROR; /* Type of storage layout */ char *dimbuf = (char *)NULL; /* Dimension buffer */ char *comma = (char *)NULL; /* Pointer to comma */ char *dimcheck = (char *)NULL; /* Dimension check buffer */ char maxdimlstbuf[HE5_HDFE_DIMBUFSIZE];/* Max. dim. list buffer */ char dimlstbuf[HE5_HDFE_DIMBUFSIZE]; /* Dim. list buffer */ char compparmbuf[HE5_HDFE_DIMBUFSIZE]; /* Compression parameter */ char utlbuf[HE5_HDFE_UTLBUFSIZE]; /* Utility buffer */ char utlbuf2[HE5_HDFE_UTLBUFSIZE]; /* Utility buffer 2 */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ char *HDFcomp[18] = {"HE5_HDFE_COMP_NONE", "HE5_HDFE_COMP_RLE", "HE5_HDFE_COMP_NBIT", "HE5_HDFE_COMP_SKPHUFF", "HE5_HDFE_COMP_DEFLATE", "HE5_HDFE_COMP_SZIP_CHIP", "HE5_HDFE_COMP_SZIP_K13", "HE5_HDFE_COMP_SZIP_EC", "HE5_HDFE_COMP_SZIP_NN", "HE5_HDFE_COMP_SZIP_K13orEC", "HE5_HDFE_COMP_SZIP_K13orNN", "HE5_HDFE_COMP_SHUF_DEFLATE", "HE5_HDFE_COMP_SHUF_SZIP_CHIP", "HE5_HDFE_COMP_SHUF_SZIP_K13", "HE5_HDFE_COMP_SHUF_SZIP_EC", "HE5_HDFE_COMP_SHUF_SZIP_NN", "HE5_HDFE_COMP_SHUF_SZIP_K13orEC", "HE5_HDFE_COMP_SHUF_SZIP_K13orNN"}; /* Compression code names */ HE5_LOCK; CHECKNAME(profilename); CHECKPOINTER(dimlist); /* Convert HDF-EOS5 datatype to HDF5 datatype */ if ( H5Tequal(numbertype_in, H5T_NATIVE_CHAR) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_SCHAR) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_UCHAR) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_SHORT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_USHORT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_INT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_UINT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_LONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_ULONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_LLONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_ULLONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_FLOAT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_DOUBLE) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_LDOUBLE)== TRUE || H5Tequal(numbertype_in, H5T_C_S1) == TRUE) { datatype_id = numbertype_in; } else { datatype_id = HE5_EHconvdatatype((int) numbertype_in); } if(datatype_id == FAIL) { sprintf(errbuf,"Cannot convert to HDF5 type data type ID for PR Field.\n"); H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_PRdefine", &fid, &heos_gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for swath ID failed. \n"); H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* initialize dims and maxdims array */ /* --------------------------------- */ for(i = 0; i < HE5_DTSETRANKMAX; i++) { dims[i] = 0; maxdims[i] = 0; } /* Allocate space for dimbuf, copy dimlist into it, & append comma */ /* --------------------------------------------------------------- */ dimbuf = (char *) calloc(strlen(dimlist) + 64, sizeof(char)); if(dimbuf == NULL) { H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory. \n"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); return(FAIL); } /* ******************************************************************** * C H E C K T H E C O N T E N T O F dimlist S T R I N G * ******************************************************************** */ strcpy(dimbuf, dimlist); strcat(dimbuf, ","); /* Find comma */ /* ---------- */ comma = strchr(dimbuf, ','); /* * Loop through entries in dimension list to make sure they are * defined in swath */ while (comma != NULL) { /* Copy dimension list entry to dimcheck */ /* ------------------------------------- */ dimcheck = (char *) calloc(comma - dimbuf + 1, sizeof(char)); if(dimcheck == NULL) { H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory. \n"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); free(dimbuf); return(FAIL); } memmove(dimcheck, dimbuf, comma - dimbuf); /* Get dimension size */ /* ------------------ */ dimsize = HE5_SWdiminfo(swathID, dimcheck); if (dimsize > 0) { dims[rank] = dimsize; rank++; } else { /* * If dimension list entry not found - set error return * status, append name to utility buffer for error report */ status = FAIL; foundAllDim = 0; if (first == 1) strcpy(utlbuf, dimcheck); else { strcat(utlbuf, ","); strcat(utlbuf, dimcheck); } first = 0; } /* * Go to next dimension entry, find next comma, & free up * dimcheck buffer */ memmove(dimbuf, comma + 1, strlen(comma + 1) + 1); comma = strchr(dimbuf, ','); free(dimcheck); } free(dimbuf); /* If no dimensions found, report error */ /* ------------------------------------ */ if (foundAllDim == 0) { status = FAIL; sprintf(errbuf, "Dimension(s) \"%s\" not found for \"%s\" profile. \n", utlbuf, profilename); H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return (status); } /* ************************************************************************ * C H E C K T H E C O N T E N T O F maxdimlist S T R I N G * ************************************************************************ */ /* Allocate space for dimbuf, copy maxdimlist into it, & append comma */ /* ------------------------------------------------------------------ */ if(maxdimlist != NULL) { dimbuf = (char *) calloc(strlen(maxdimlist) + 64, sizeof(char)); if(dimbuf == NULL) { H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory. \n"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); return(FAIL); } /* Copy "maxdimlist" to "dimbuf", & append comma */ /* --------------------------------------------- */ strcpy(dimbuf, maxdimlist); strcat(dimbuf, ","); /* Find comma */ /* ---------- */ comma = strchr(dimbuf, ','); /* * Loop through entries in dimension list to make sure they are * defined in swath */ while (comma != NULL) { /* Copy dimension list entry to dimcheck */ /* ------------------------------------- */ dimcheck = (char *) calloc(comma - dimbuf + 1, sizeof(char)); if(dimcheck == NULL) { H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory. \n"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); free(dimbuf); return(FAIL); } memmove(dimcheck, dimbuf, comma - dimbuf); /* Get dimension size */ /* ------------------ */ dimsize = HE5_SWdiminfo(swathID, dimcheck); if ( (dimsize > 0) || (dimsize == H5S_UNLIMITED) ) { maxdims[maxrank] = dimsize; maxrank++; } else { /* * If dimension list entry not found - set error return * status, append name to utility buffer for error report */ status = FAIL; foundAllDim = 0; if (first == 1) strcpy(utlbuf, dimcheck); else { strcat(utlbuf, ","); strcat(utlbuf, dimcheck); } first = 0; } /* * Go to next dimension entry, find next comma, & free up * dimcheck buffer */ memmove(dimbuf, comma + 1, strlen(comma + 1) + 1); comma = strchr(dimbuf, ','); free(dimcheck); } free(dimbuf); /* If no dimensions found, report error */ /* ------------------------------------ */ if (foundAllDim == 0) { status = FAIL; sprintf(errbuf, "Dimension(s) \"%s\" not found for \"%s\" profile. \n", utlbuf, profilename); H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return (status); } /* If maxrank !=rank then report error */ /* ------------------------------------ */ if ( maxrank != rank ) { status = FAIL; sprintf(errbuf,"Dimension rank doesn't match Maximum dimension rank. \n"); H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return (status); } } /* "maxdimlist == NULL" ==> maxdims[]= dims[] */ /* ------------------------------------------- */ else { for(i = 0; i < rank; i++ ) maxdims[ i ] = dims[ i ]; } /* Find out if the dataset dimension is appendable */ /* ----------------------------------------------- */ for(i = 0; i < rank; i++) { if( dims[i] == maxdims[i] ) append = FALSE; else if ( (dims[i] < maxdims[i]) || (maxdims[i] == H5S_UNLIMITED)) { append = TRUE; break; } else { status = FAIL; H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_ARGS, H5E_BADRANGE, "Maximum dimension size is smaller than Dimension size. \n"); HE5_EHprint("Error: Maximum dimension size is smaller than Dimension size, occured", __FILE__, __LINE__); return(status); } } /* Check for valid base data type ID */ /* --------------------------------- */ if (H5Tequal(datatype_id, H5T_NATIVE_CHAR) == FALSE && H5Tequal(datatype_id, H5T_NATIVE_SCHAR) == FALSE && H5Tequal(datatype_id, H5T_NATIVE_UCHAR) == FALSE && H5Tequal(datatype_id, H5T_NATIVE_SHORT) == FALSE && H5Tequal(datatype_id, H5T_NATIVE_USHORT) == FALSE && H5Tequal(datatype_id, H5T_NATIVE_INT) == FALSE && H5Tequal(datatype_id, H5T_NATIVE_UINT) == FALSE && H5Tequal(datatype_id, H5T_NATIVE_LONG) == FALSE && H5Tequal(datatype_id, H5T_NATIVE_ULONG) == FALSE && H5Tequal(datatype_id, H5T_NATIVE_LLONG) == FALSE && H5Tequal(datatype_id, H5T_NATIVE_ULLONG) == FALSE && H5Tequal(datatype_id, H5T_NATIVE_FLOAT) == FALSE && H5Tequal(datatype_id, H5T_NATIVE_DOUBLE) == FALSE && H5Tequal(datatype_id, H5T_NATIVE_LDOUBLE) == FALSE ) { H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, "Invalid (unsupported) data type. \n"); HE5_EHprint("Error: Invalid (unsupported) data type, occured", __FILE__, __LINE__); return(FAIL); } /* Check if "Profile Fields" group exists */ /* -------------------------------------- */ if (HE5_SWXSwath[idx].prof_id != FAIL) { /* Get the "Profile Fields" group ID */ /* --------------------------------- */ gid = HE5_SWXSwath[idx].prof_id; } else { /* Create /SWATH/swathname/Profile Fields group */ /* -------------------------------------------- */ gid = H5Gcreate(HE5_SWXSwath[idx].sw_id, "Profile Fields", 0); if (gid == FAIL) { sprintf(errbuf,"Cannot create the \"Profile Fields\" group.\n"); H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_OHDR, H5E_CANTCREATE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Setup External Arrays */ /* --------------------- */ HE5_SWXSwath[idx].prof_id = gid; } /* Create dataspace then create dataset */ /*------------------------------------ */ if( HE5_SWXSwath[idx].plist == FAIL ) HE5_SWXSwath[idx].plist = H5Pcreate(H5P_DATASET_CREATE); /* Get dataset layout */ /* ------------------ */ layout = H5Pget_layout(HE5_SWXSwath[idx].plist); if (layout == H5D_LAYOUT_ERROR) { status = FAIL; H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_ARGS, H5E_BADVALUE, "Cannot get dataset layout.\n"); HE5_EHprint("Error: Cannot get dataset layout, occured", __FILE__, __LINE__); return(status); } if(append == FALSE) space = H5Screate_simple(rank, dims, NULL); else { if( layout == H5D_CHUNKED) space = H5Screate_simple(rank, dims, maxdims); else { status = FAIL; H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_ARGS, H5E_BADVALUE, "Appendable dataset MUST BE CHUNKED first.\n"); HE5_EHprint("Error: Appendable dataset MUST BE CHUNKED first, occured", __FILE__, __LINE__); return(status); } } /* Create the VL data type from the base data type */ /* ----------------------------------------------- */ type = H5Tvlen_create(datatype_id); if (type == FAIL) { status = FAIL; sprintf(errbuf,"Cannot create the VL-data type for \"%s\" profile.\n", profilename); H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Create dataset */ /* -------------- */ dataset = H5Dcreate(gid, profilename, type, space, HE5_SWXSwath[idx].plist); if (dataset == FAIL) { status = FAIL; sprintf(errbuf,"Cannot create dataset for \"%s\" profile. \n", profilename); H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Extend the dataset. assure that it is at least dims size */ /* -------------------------------------------------------- */ if( append == TRUE) { status = H5Dextend(dataset, dims); if (status == FAIL) { sprintf(errbuf,"Cannot extend the dataset for \"%s\" profile.\n", profilename); H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } /* Store dataset IDs and dataset name */ /* ---------------------------------- */ if (HE5_SWXSwath[idx].nPROF > 0) { /* Allocate memory to "Profile" struct */ /* ----------------------------------- */ HE5_SWXSwath[idx].pdataset = (HE5_DTSinfo *)realloc((void *)HE5_SWXSwath[idx].pdataset,(HE5_SWXSwath[idx].nPROF + 1) * sizeof(HE5_DTSinfo)); } else { HE5_SWXSwath[idx].pdataset = (HE5_DTSinfo *)calloc(1, sizeof(HE5_DTSinfo)); if (HE5_SWXSwath[idx].pdataset == (HE5_DTSinfo *)NULL ) { status = FAIL; sprintf(errbuf,"Cannot allocate memory for \"Profile\" structure. \n"); H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } /* Allocate memory to name */ /* ----------------------- */ HE5_SWXSwath[idx].pdataset[HE5_SWXSwath[idx].nPROF].name = (char *)calloc( (strlen(profilename)+1), sizeof(char) ); if ( HE5_SWXSwath[idx].pdataset[HE5_SWXSwath[idx].nPROF].name == (char *)NULL) { status = FAIL; sprintf(errbuf,"Cannot allocate memory for \"Profile\" structure. \n"); H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(HE5_SWXSwath[idx].pdataset); return(status); } /* Load Table */ /* ---------- */ HE5_SWXSwath[idx].pdataset[HE5_SWXSwath[idx].nPROF].ID = dataset; strcpy(HE5_SWXSwath[idx].pdataset[HE5_SWXSwath[idx].nPROF].name, profilename); /* Increment the profile counter */ /* ----------------------------- */ HE5_SWXSwath[idx].nPROF++; /* ****************************************************************** * SET UP METADATA STRINGS * ****************************************************************** */ /* Set up "DimList" string content */ /* ------------------------------- */ strcpy(utlbuf,""); sprintf(utlbuf, "%s%s%s", profilename,":",dimlist); /* Set up "MaxdimList" string content */ /* ----------------------------------- */ if ( maxdimlist != NULL) { status = HE5_EHmetalist(maxdimlist,maxdimlstbuf); if (status == FAIL) { sprintf(errbuf, "Cannot convert the input \"%s\" list to the metadata list. \n", maxdimlist); H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return (status); } sprintf(utlbuf2,"%s%s",":\n\t\t\t\tMaxdimList=", maxdimlstbuf); strcat(utlbuf,utlbuf2); } if (maxdimlist == NULL) { status = HE5_EHmetalist(dimlist,dimlstbuf); if (status == FAIL) { sprintf(errbuf, "Cannot convert the input \"%s\" list to the metadata list.\n", dimlist); H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return (status); } sprintf(utlbuf2,"%s%s",":\n\t\t\t\tMaxdimList=", dimlstbuf); strcat(utlbuf,utlbuf2); } /* Get current compression code */ /* ---------------------------- */ compcode = HE5_SWXSwath[idx].compcode; /* setup "CompressionType" & "CompressionParams" strings content */ /* ------------------------------------------------------------- */ if (compcode != HE5_HDFE_COMP_NONE) { sprintf(utlbuf2,"%s%s","\n\t\t\t\tCompressionType=", HDFcomp[compcode]); switch (compcode) { case HE5_HDFE_COMP_NBIT: sprintf(compparmbuf, "%s%d,%d,%d,%d%s", "\n\t\t\t\tCompressionParams=(", HE5_SWXSwath[idx].compparm[0], HE5_SWXSwath[idx].compparm[1], HE5_SWXSwath[idx].compparm[2], HE5_SWXSwath[idx].compparm[3], ")"); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_DEFLATE: sprintf(compparmbuf,"%s%d","\n\t\t\t\tDeflateLevel=", HE5_SWXSwath[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SZIP_CHIP: sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SZIP_K13: sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SZIP_EC: sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SZIP_NN: sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SZIP_K13orEC: sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SZIP_K13orNN: sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SHUF_DEFLATE: sprintf(compparmbuf,"%s%d","\n\t\t\t\tDeflateLevel=", HE5_SWXSwath[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SHUF_SZIP_CHIP: sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SHUF_SZIP_K13: sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SHUF_SZIP_EC: sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SHUF_SZIP_NN: sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SHUF_SZIP_K13orEC: sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SHUF_SZIP_K13orNN: sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_SWXSwath[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; default: { sprintf(errbuf,"Compression code \"%d\" is not supported. \n", compcode); H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_ARGS, H5E_UNSUPPORTED, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } break; } /* Concatanate compression parameters with compression code */ /* -------------------------------------------------------- */ strcat(utlbuf, utlbuf2); } /* Generate value of "DataType" metadata */ /* ------------------------------------- */ numtype = HE5_EHdtype2numtype(datatype_id); if (numtype == FAIL) { sprintf(errbuf, "Cannot get the number type ID. \n"); H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } else if (numtype == 0) { metavalue = 0; } else { metavalue = HE5_EHhid2hsize(numtype); if (metavalue == 0) { sprintf(errbuf, "Cannot convert \"hid_t\" to \"hsize_t\" data type. \n"); H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } /* ****************************************************************** * Insert metadata information to Structural Metadata section * ****************************************************************** */ status = HE5_EHinsertmeta(fid, HE5_SWXSwath[idx].swname, "s", 5L, utlbuf, &metavalue); if (status == FAIL) { sprintf(errbuf,"Cannot insert metadata for \"%s\" profile.\n",profilename); H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release data type ID */ /* -------------------- */ status = H5Tclose(type); if ( status == FAIL) { sprintf(errbuf,"Cannot release the property list ID. \n"); H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(HE5_SWXSwath[idx].pdataset); free(HE5_SWXSwath[idx].pdataset[HE5_SWXSwath[idx].nPROF].name); return(status); } /* Release data space ID */ /* --------------------- */ status = H5Sclose(space); if ( status == FAIL) { sprintf(errbuf,"Cannot release the data space ID. \n"); H5Epush(__FILE__, "HE5_PRdefine", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(HE5_SWXSwath[idx].pdataset); free(HE5_SWXSwath[idx].pdataset[HE5_SWXSwath[idx].nPROF].name); return(status); } /* Reset external array entry */ /* -------------------------- */ /* The reset was moved to HE5_PRwrite, to make dataset property reset consistent with metadata reset. Unlike swath, grid and ZA, where the property list is reset after definition of every field, the PR APIs reset property list after first dataset writing (not definition), so if one defines several PR fields, all will have the same properties, such as compression. HE5_SWXSwath[idx].compcode = HE5_HDFE_COMP_NONE; for (i = 0; i < 5; i++) HE5_SWXSwath[idx].compparm[ i ] = 0; */ COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PRwrite | | | | DESCRIPTION: Writes data into the "Profile" dataset within a Swath. | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | status herr_t Return status (0) SUCCEED (-1) | | FAIL | | INPUTS: | | Swath_ID hid_t Swath ID | | profilename const char Name of Profile dataset | | start hssize_t start array | | stride hsize_t stride array | | edge hsize_t edge array | | size size_t Size (in bytes) of data to write | | buffer void Data buffer | | | | OUTPUTS: | | None | | | | NOTES: | | | | The "NULL" values for "start" and "edge" are not allowed. | | | | Date Programmer Description | | ======= ============ ================================================= | | 6/8/00 A.Muslimov Original development | | July 00 A.Muslimov Unmasked hdf5 data types. | | Sep 00 A.Muslimov Changed referencing the "Data Fields" by "Profile | | Fields". | | Oct 00 A.Muslimov Added conditional release of the property list ID. | | Dec 00 A.Muslimov Enhanced to add "start", "stride", and "edge" para- | | meters. | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | Apr 03 S.Zhao Added conversion from dataset base datatype ID to | | memory base datatype ID. | | Sep 06 Abe Taaheri Added H5Dclose to close opened dataset | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_PRwrite(hid_t swathID, const char *profilename, const hssize_t start[], const hsize_t stride[], const hsize_t edge[], size_t size, void *buffer) { herr_t status = FAIL; /* Status variable (return) */ int rank = FAIL; /* Rank of profile dataset */ int i; /* Loop index */ int append = FALSE; /* FLAG (appendability) */ hid_t heos_gid = FAIL; /* "SWATHS" group ID */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t dataset = FAIL; /* Profile dataset ID */ hid_t datatype = FAIL; /* Profile datatype ID */ hid_t btype = FAIL; /* Dataset base datatype ID */ hid_t space = FAIL; /* File data space ID */ hid_t mspace = FAIL; /* Memory data space ID */ hid_t xfer_list = FAIL; /* Property list ID */ hid_t grp_id = FAIL; /* "Data Fields" group ID */ hid_t mbtype = FAIL; /* "Memory" base datatype ID*/ hid_t mtype = FAIL; /* Memory data type ID */ H5D_fill_value_t fill_status; /* to see if fill value is set or not */ void *value = (void *)NULL; /* Temp fill value variable */ hsize_t count[] = { 1 }; /* Number of attr. elements */ hsize_t dims[HE5_DTSETRANKMAX]; /* Array of dimension sizes */ hsize_t maxdims[HE5_DTSETRANKMAX]; /* Array of Max. dim. sizes */ hsize_t size_ext[HE5_DTSETRANKMAX]; /* Extended dimension size */ size_t tsize = 0; /* Size of base data type */ long idx = FAIL; /* Swath index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKPOINTER(profilename); CHECKPOINTER(buffer); /* assuming that fillvalue is undefined for the field */ fill_status = H5D_FILL_VALUE_UNDEFINED; /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_PRwrite", &fid, &heos_gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for swath ID failed. \n"); H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Initialize dims[]/maxdims[]/size_ext[] arrays */ /* --------------------------------------------- */ for (i = 0; i < HE5_DTSETRANKMAX; i++) { dims[i] = 0; maxdims[i] = 0; size_ext[i] = 0; } /* Get "Profile Fields" group ID */ /* ----------------------------- */ grp_id = HE5_SWXSwath[idx].prof_id; /* Open the dataset */ /* ---------------- */ dataset = H5Dopen(grp_id, profilename); if (dataset == FAIL) { status = FAIL; sprintf(errbuf, "Cannot open the profile \"%s\". \n", profilename); H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Create property list ID */ /* ----------------------- */ xfer_list = H5Pcreate(H5P_DATASET_XFER); if (xfer_list == FAIL) { status = FAIL; sprintf(errbuf, "Cannot create the property list for the profile \"%s\". \n", profilename); H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get the dataset data type ID */ /* ---------------------------- */ datatype = H5Dget_type(dataset); if (datatype == FAIL) { status = FAIL; sprintf(errbuf, "Cannot get the datatype ID for the profile \"%s\". \n", profilename); H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get the data space ID */ /* --------------------- */ space = H5Dget_space(dataset); if (space == FAIL) { status = FAIL; sprintf(errbuf, "Cannot get the data space ID for the profile \"%s\". \n", profilename); H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get the base data type ID */ /* ------------------------- */ btype = H5Tget_super(datatype); if( btype == FAIL) { sprintf(errbuf, "Cannot get the base data type ID. \n"); H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return (FAIL); } /* Get the memory base data type ID */ /* -------------------------------- */ mbtype = HE5_EHdtype2mtype(btype); if (mbtype == FAIL) { sprintf(errbuf,"Cannot get the memory data type from the base data type.\n"); H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Create data type ID */ /* ------------------- */ mtype = H5Tvlen_create(mbtype); if (mtype == FAIL) { sprintf(errbuf,"Cannot create data type from the base data type.\n"); H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the size of a base data type in bytes */ /* ----------------------------------------- */ tsize = H5Tget_size(btype); if( tsize == 0) { sprintf(errbuf, "Cannot get the size of a base data type. \n"); H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return (FAIL); } /* Allocate memory for a fill value */ /* -------------------------------- */ value = (void *)calloc(1, tsize); if( value == (void *)NULL) { sprintf(errbuf, "Cannot allocate memory for fill value. \n"); H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Try to retrieve the fill value (in case it's already defined) */ /* ------------------------------------------------------------- */ H5E_BEGIN_TRY { status = H5Pfill_value_defined(HE5_SWXSwath[idx].plist, &fill_status ); } H5E_END_TRY; if (fill_status == H5D_FILL_VALUE_USER_DEFINED) { H5E_BEGIN_TRY { status = H5Pget_fill_value(HE5_SWXSwath[idx].plist, btype, value); } H5E_END_TRY; /* Store fill value in the dataset attribute "_FillValue" */ /* ----------------------------------------------------- */ if( status != FAIL) { status = HE5_EHattr( dataset, "_FillValue", btype, count, "w", value); if( status == FAIL ) { sprintf(errbuf, "Cannot write fill value to the attribute \"_FillValue\". \n"); H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(value); return(status); } } } free( value); /* Get the dataset rank, and dimension sizes */ /* ----------------------------------------- */ rank = H5Sget_simple_extent_dims(space, dims, maxdims); if (rank == FAIL) { sprintf(errbuf, "Cannot get the data space dimension size and maximum dimension size. \n"); H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Find out if the dataset is extendible */ /* ------------------------------------- */ for(i = 0; i < rank; i++) { if( dims[i] == maxdims[i] ) append = FALSE; else if ( (dims[i] < maxdims[i]) || (maxdims[i] == H5S_UNLIMITED)) { append = TRUE; break; } else { sprintf(errbuf,"Maximum dimension size is smaller than dimension size.\n"); H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } /* If the dataset is APPENDIBLE, extend it */ /* --------------------------------------- */ if (append == TRUE) { for(i = 0; i < rank; i++) size_ext[ i ] = start[ i ] + edge[ i ]; status = H5Dextend(dataset, size_ext); if (status == FAIL) { sprintf(errbuf, "Cannot extend the dataset. \n"); H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } /* Select the hyperslab */ /* -------------------- */ status = H5Sselect_hyperslab( space, H5S_SELECT_SET, (const hsize_t *)start, stride, edge, NULL) ; if( status == FAIL ) { sprintf(errbuf,"Cannot select a hyperslab. \n"); H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Create dataspace in memory */ /* -------------------------- */ mspace = H5Screate_simple(rank, edge, NULL); if( mspace == FAIL) { sprintf(errbuf,"Cannot create the memory data space.\n"); H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_DATASPACE, H5E_CANTCREATE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Set "write" data buffer */ /* ----------------------- */ status = H5Pset_buffer(xfer_list, size, NULL, NULL); if (status == FAIL) { sprintf(errbuf, "Cannot set data buffer for the profile \"%s\". \n", profilename); H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Write data to the dataset */ /* ------------------------- */ status = H5Dwrite(dataset, mtype, mspace, space, xfer_list, buffer); if (status == FAIL) { sprintf(errbuf, "Cannot write data to the profile \"%s\". \n", profilename); H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Reclaim the write VL data. */ /* -------------------------- */ status = H5Dvlen_reclaim(datatype, space, H5P_DEFAULT, buffer); if (status == FAIL) { sprintf(errbuf, "Cannot reclaim the write VL data for the profile \"%s\". \n", profilename); H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release the data space ID */ /* ------------------------- */ status = H5Sclose(space); if (status == FAIL) { sprintf(errbuf, "Cannot release the file data space ID. \n"); H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release the memory data space ID */ /* -------------------------------- */ status = H5Sclose(mspace); if (status == FAIL) { sprintf(errbuf, "Cannot release the memory data space ID. \n"); H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Check if the property list is "on" */ /* ---------------------------------- */ if ( HE5_SWXSwath[idx].plist != FAIL ) { /* Release property list ID */ /* ------------------------ */ status = H5Pclose(HE5_SWXSwath[idx].plist); if ( status == FAIL) { sprintf(errbuf,"Cannot release the property list ID.\n"); H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_PLIST, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Reset the externally stored property list ID */ /* -------------------------------------------- */ HE5_SWXSwath[idx].plist = FAIL; /* Reset external array entry */ /* -------------------------- */ HE5_SWXSwath[idx].compcode = HE5_HDFE_COMP_NONE; for (i = 0; i < 5; i++) HE5_SWXSwath[idx].compparm[ i ] = 0; } /* Release the xfer property list ID */ /* --------------------------------- */ status = H5Pclose(xfer_list); if (status == FAIL) { sprintf(errbuf, "Cannot release the xfer property list ID. \n"); H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_PLIST, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release the data type ID */ /* ------------------------ */ status = H5Tclose(datatype); if (status == FAIL) { sprintf(errbuf, "Cannot release the data type ID. \n"); H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release dataset ID */ /* ------------------ */ status = H5Dclose(dataset); if (status == FAIL) { sprintf(errbuf,"Cannot release dataset ID.\n"); H5Epush(__FILE__, "HE5_PRwrite", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PRread | | | | DESCRIPTION: Reads data from the profile dataset. | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | status herr_t Return status (0) SUCCEED (-1) | | FAIL | | INPUTS: | | swathID hid_t Swath ID | | profilename const char Name of profile/dataset | | start hssize_t start array | | stride hsize_t stride array | | edge hsize_t edge array | | | | OUTPUTS: | | buffer void Data buffer | | | | NOTES: | | | | | | Date Programmer Description | | ======= ============ ================================================= | | Jun 00 A.Muslimov Original development | | Jul 00 A.Muslimov Unmasked hdf5 data types. | | Jul 00 A.Muslimov Added calls to H5Tget_super() and EHdtype2mtype() | | to make sure that the data type ID passed to | | H5Dread() won't cause a portability problem. | | Sep 00 A.Muslimov Updated to change "Data Fields" group by "Profile | | Fields" group. | | Dec 00 A.Muslimov Enhanced to add "start", "stride", and "edge" para- | | meters. | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | Sep 06 Abe Taaheri Added H5Dclose to close opened dataset | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_PRread(hid_t swathID, const char *profilename, const hssize_t start[], const hsize_t stride[], const hsize_t edge[], void *buffer) { herr_t status = FAIL; /* Return status variable */ /* int mem_used = 0;*/ /* "Memory allocated" */ int rank = FAIL; /* Rank of profile dataset */ hid_t heos_gid = FAIL; /* "SWATHS" group ID */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t dataset = FAIL; /* dataset ID */ hid_t plist = FAIL; /* Property list ID */ hid_t type = FAIL; /* Datatype ID */ hid_t space = FAIL; /* File data space ID */ hid_t mspace = FAIL; /* Memory data space ID */ hid_t grp_id = FAIL; /* "Data Fields" group ID */ hid_t btype = FAIL; /* Base data type ID */ hid_t mbtype = FAIL; /* "Memory" base datatype ID */ hid_t mtype = FAIL; /* "Memory" data type ID */ long idx = FAIL; /* Swath index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKPOINTER(profilename); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_PRread", &fid, &heos_gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for swath ID failed. \n"); H5Epush(__FILE__, "HE5_PRread", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get "Profile Fields" group ID */ /* ----------------------------- */ grp_id = HE5_SWXSwath[idx].prof_id; /* Open the Profile dataset */ /* ------------------------ */ dataset = H5Dopen(grp_id, profilename); if (dataset == FAIL) { status = FAIL; sprintf(errbuf,"Cannot open the profile dataset \"%s\". \n", profilename); H5Epush(__FILE__, "HE5_PRread", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get the file data space ID */ /* -------------------------- */ space = H5Dget_space(dataset); if (space == FAIL) { status = FAIL; sprintf(errbuf,"Cannot get the space ID for the profile dataset \"%s\".\n", profilename); H5Epush(__FILE__, "HE5_PRread", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Create the property list */ /* ------------------------ */ plist = H5Pcreate(H5P_DATASET_XFER); if (plist == FAIL) { status = FAIL; sprintf(errbuf,"Cannot create the property list. \n"); H5Epush(__FILE__, "HE5_PRread", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Set up memory manager */ /* --------------------- */ /* status = H5Pset_vlen_mem_manager(plist,vltypes_alloc_custom, &mem_used,vltypes_free_custom, &mem_used); if (status == FAIL) { sprintf(errbuf,"Cannot set up the memory manager. \n"); H5Epush(__FILE__, "HE5_PRread", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } */ /* Get the datatype ID */ /* ------------------- */ type = H5Dget_type(dataset); if (type == FAIL) { status = FAIL; sprintf(errbuf,"Cannot get the data type ID.\n"); H5Epush(__FILE__, "HE5_PRread", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get the dataset base data type ID */ /* --------------------------------- */ btype = H5Tget_super(type); if (btype == FAIL) { status = FAIL; sprintf(errbuf,"Cannot get the base data type ID.\n"); H5Epush(__FILE__, "HE5_PRread", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get the memory base data type ID */ /* -------------------------------- */ mbtype = HE5_EHdtype2mtype(btype); if (mbtype == FAIL) { status = FAIL; sprintf(errbuf,"Cannot get the memory data type from the base data type.\n"); H5Epush(__FILE__, "HE5_PRread", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Create data type ID */ /* ------------------- */ mtype = H5Tvlen_create(mbtype); if (mtype == FAIL) { status = FAIL; sprintf(errbuf,"Cannot create data type from the base data type.\n"); H5Epush(__FILE__, "HE5_PRread", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get the dataset rank */ /* -------------------- */ rank = H5Sget_simple_extent_ndims(space); if (rank == FAIL) { status = FAIL; sprintf(errbuf,"Cannot get the dataset rank.\n"); H5Epush(__FILE__, "HE5_PRread", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Select the hyperslab */ /* -------------------- */ status = H5Sselect_hyperslab(space, H5S_SELECT_SET, (const hsize_t *)start, stride, edge, NULL) ; if (status == FAIL) { sprintf(errbuf,"Cannot select the hyperslab.\n"); H5Epush(__FILE__, "HE5_PRread", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Create the memory dataspace */ /* --------------------------- */ mspace = H5Screate_simple(rank, edge, NULL); if (mspace == FAIL) { status = FAIL; sprintf(errbuf,"Cannot create the memory dataspace.\n"); H5Epush(__FILE__, "HE5_PRread", __LINE__, H5E_DATASPACE, H5E_CANTCREATE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Read out the dataset from the disk */ /* ----------------------------------- */ status = H5Dread(dataset, mtype, mspace, space, plist, buffer); if (status == FAIL) { sprintf(errbuf,"Cannot read the data from profile dataset \"%s\".\n",profilename); H5Epush(__FILE__, "HE5_PRread", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Save the IDs for "reclaimspace" */ /* ------------------------------- */ profile.plist_id = plist; profile.type_id = mtype; profile.space_id = space; /* Release "disk" data type ID */ /* --------------------------- */ status = H5Tclose(type); if (status == FAIL) { sprintf(errbuf,"Cannot release data type ID.\n"); H5Epush(__FILE__, "HE5_PRread", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release memory space ID */ /* ----------------------- */ status = H5Sclose(mspace); if (status == FAIL) { sprintf(errbuf,"Cannot release memory space ID.\n"); H5Epush(__FILE__, "HE5_PRread", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release base data type ID */ /* ------------------------- */ status = H5Tclose(btype); if (status == FAIL) { sprintf(errbuf,"Cannot release base data type ID.\n"); H5Epush(__FILE__, "HE5_PRread", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } /* Release dataset ID */ /* ------------------ */ status = H5Dclose(dataset); if (status == FAIL) { sprintf(errbuf,"Cannot release dataset ID.\n"); H5Epush(__FILE__, "HE5_PRread", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } COMPLETION: HE5_UNLOCK; return (status); } /* ------------------------------------------------------------ | VL datatype custom memory allocation routine | ------------------------------------------------------------ */ /* void *vltypes_alloc_custom(size_t size, void *info) { void *ret_value = NULL; int *mem_used = (int *)info; size_t extra; extra = MAX(sizeof(void *), sizeof(int)); if ( (ret_value = malloc(extra+size)) != NULL) { *(int *)ret_value = (int)size; *mem_used += (int)size; } ret_value = ((unsigned char*)ret_value) + extra; return(ret_value); } */ /* ------------------------------------------------------------ | VL datatype custom memory freeing routine | ------------------------------------------------------------ */ /* void vltypes_free_custom(void *_mem, void *info) { unsigned char *mem; int *mem_used = (int *)info; size_t extra; extra = MAX(sizeof(void *), sizeof(int)); if (_mem != NULL) { mem = ((unsigned char *)_mem) - extra; *mem_used -= *(int *)mem; free(mem); } } */ /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PRreclaimspace | | | | DESCRIPTION: Reclaims the memory used by the read buffer. | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | status herr_t Return status (0) SUCCEED (-1) | | FAIL | | INPUTS: | | swathID hid_t Swath ID | | profilename const char Name of profile/dataset | | | | OUTPUTS: | | buffer void Data buffer | | | | NOTES: | | After passing to H5Dvlen_reclaim the IDs may change, | | so please use externally stored ID values. | | | | Date Programmer Description | | ======= ============ ================================================= | | 6/8/00 A.Muslimov Original development | | July 00 A.Muslimov Unmasked hdf5 data types. | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_PRreclaimspace(hid_t swathID, const char *profilename, void *buffer) { herr_t status = FAIL; /* Return status variable */ hid_t heos_gid = FAIL; /* "SWATHS" group ID */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t plist = FAIL; /* property list ID */ hid_t type = FAIL; /* datatype ID */ hid_t space = FAIL; /* data space ID */ long idx = FAIL; /* Swath index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKPOINTER(buffer); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_PRreclaimspace", &fid, &heos_gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for swath ID failed. \n"); H5Epush(__FILE__, "HE5_PRreclaimspace", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the stored IDs */ /* ------------------- */ type = profile.type_id; space = profile.space_id; plist = profile.plist_id; /* Reclaim the data space */ /* ---------------------- */ status = H5Dvlen_reclaim(type, space, plist, buffer); if (status == FAIL) { sprintf(errbuf, "Cannot reclaim the memory space. \n"); H5Epush(__FILE__, "HE5_PRreclaimspace", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release property list ID */ /* ------------------------ */ status = H5Pclose(profile.plist_id); if (status == FAIL) { sprintf(errbuf, "Cannot release the property list ID. \n"); H5Epush(__FILE__, "HE5_PRreclaimspace", __LINE__, H5E_PLIST, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release the data type ID */ /* ------------------------ */ status = H5Tclose(profile.type_id); if (status == FAIL) { sprintf(errbuf, "Cannot release the data type ID. \n"); H5Epush(__FILE__, "HE5_PRreclaimspace", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release the data space ID */ /* ------------------------- */ status = H5Sclose(profile.space_id); if (status == FAIL) { sprintf(errbuf, "Cannot release the data space ID. \n"); H5Epush(__FILE__, "HE5_PRreclaimspace", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Reset IDs for next buffer */ /* ------------------------- */ profile.type_id = FAIL; profile.space_id = FAIL; profile.plist_id = FAIL; COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PRinquire | | | | DESCRIPTION: Retrieves number of profiles in a swath | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | nProf long Return number of profiles | | FAIL | | INPUTS: | | swathID hid_t swath ID | | | | OUTPUTS: | | profnames char List of profile names | | rank[] int Profile/dataset rank array | | classID[] H5T_class_t Array of profile base datatype IDs | | | | NOTES: | | None | | | | | | Date Programmer Description | | ======= ============ ================================================= | | 8/30/00 A. Muslimov Original development | | Sep 00 A. Muslimov Modified to change "Data Fields" onto "Profile | | Fields" | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_PRinquire(hid_t swathID, char *profnames, int *rank, H5T_class_t *classID) { long nProf = FAIL; /* Number of profiles */ long idx = FAIL; /* Swath index */ int index = FAIL; /* Iterator index */ int i; /* Loop index */ herr_t status = FAIL; /* Status variable */ hid_t gid = FAIL; /* "SWATHS" group ID */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t groupID = FAIL; /* "Profile Fields" group ID */ hid_t profID = FAIL; /* Profile dataset ID */ hid_t typeID = FAIL; /* Dataset type ID */ hid_t spaceID = FAIL; /* Dataset space ID */ hid_t btypeID = FAIL; /* Base data type ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ char *namebuf = (char *)NULL; /* Buffer for the list */ char *prname = (char *)NULL; /* Buffer for each entry */ char *comma = (char *)NULL; /* Pntr to comma */ char *groupname = (char *)NULL; /* Group name string */ HE5_OBJINFO profdata; /* Initialize the output data structure */ /* ------------------------------------ */ profdata.count = 0; profdata.name = NULL; profdata.strsize = 0; /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_PRinquire", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for swath ID failed. \n"); H5Epush(__FILE__, "HE5_PRinquire", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } groupname = (char *)calloc(HE5_HDFE_NAMBUFSIZE, sizeof(char)); if (groupname == NULL) { sprintf(errbuf,"Cannot allocate memory for \"groupname\".\n"); H5Epush(__FILE__, "HE5_PRinquire", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } strcpy(groupname,"/HDFEOS/SWATHS/"); strcat(groupname, HE5_SWXSwath[idx].swname); strcat(groupname,"/Profile Fields"); /* Get "Profile Fields" group ID */ /* ------------------------------ */ groupID = HE5_SWXSwath[idx].prof_id; index = H5Giterate(groupID,groupname, NULL, HE5_EHobj_info, &profdata); if (index < 0) { sprintf(errbuf,"Iteration through the \"Profile Fields\" group failed.\n"); H5Epush(__FILE__, "HE5_PRinquire", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(groupname); if(profdata.name != NULL ) free(profdata.name); return(FAIL); } free(groupname); nProf = profdata.count; if (profnames != NULL) strcpy(profnames,profdata.name); if (rank != NULL || classID != NULL) { /* Allocate memory for name buffer */ /* ------------------------------- */ namebuf = (char *)calloc(strlen(profdata.name)+2, sizeof(char)); if (namebuf == NULL) { sprintf(errbuf,"Cannot allocate memory for \"namebuf\".\n"); H5Epush(__FILE__, "HE5_PRinquire", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if(profdata.name != NULL ) free(profdata.name); return(FAIL); } strcpy(namebuf, profdata.name); strcat(namebuf, ","); /* Find comma */ /* ---------- */ comma = strchr(namebuf, ','); i = 0; /* Parse the list of profiles names */ /* -------------------------------- */ while (comma != NULL) { /* Copy profile list entry to prname */ /* --------------------------------- */ prname = (char *)calloc(comma - namebuf + 1, sizeof(char)); if (prname == NULL) { sprintf(errbuf,"Cannot allocate memory for \"Profile name\".\n"); H5Epush(__FILE__, "HE5_PRinquire", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if(profdata.name != NULL ) free(profdata.name); if (namebuf != NULL) free(namebuf); return(FAIL); } memmove(prname, namebuf, comma - namebuf); prname[comma-namebuf] = 0; /* Open each profile dataset */ /* ------------------------- */ profID = H5Dopen(groupID, prname); if (profID == FAIL) { sprintf(errbuf,"Cannot open the profile \"%s\" dataset.\n", prname); H5Epush(__FILE__, "HE5_PRinquire", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (prname != NULL) free(prname); if (namebuf != NULL) free(namebuf); if (profdata.name != NULL ) free(profdata.name); return(FAIL); } if (rank != NULL) { /* Get rank of the dataset */ /* ----------------------- */ spaceID = H5Dget_space(profID); if (spaceID == FAIL) { sprintf(errbuf,"Cannot get data space ID.\n"); H5Epush(__FILE__, "HE5_PRinquire", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (prname != NULL) free(prname); if (namebuf != NULL) free(namebuf); if (profdata.name != NULL ) free(profdata.name); return(FAIL); } rank[i] = H5Sget_simple_extent_ndims(spaceID); if (rank[i] == FAIL) { sprintf(errbuf,"Cannot get dataset rank.\n"); H5Epush(__FILE__, "HE5_PRinquire", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (prname != NULL) free(prname); if (namebuf != NULL) free(namebuf); if (profdata.name != NULL ) free(profdata.name); return(FAIL); } status = H5Sclose(spaceID); if (status == FAIL) { sprintf(errbuf,"Cannot release data space ID.\n"); H5Epush(__FILE__, "HE5_PRinquire", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (prname != NULL) free(prname); if (namebuf != NULL) free(namebuf); if (profdata.name != NULL ) free(profdata.name); return(FAIL); } } if (classID != NULL) { /* Get base data type class ID */ /* --------------------------- */ typeID = H5Dget_type(profID); if (typeID == FAIL) { sprintf(errbuf,"Cannot get data type ID.\n"); H5Epush(__FILE__, "HE5_PRinquire", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (prname != NULL) free(prname); if (namebuf != NULL) free(namebuf); if (profdata.name != NULL ) free(profdata.name); return(FAIL); } btypeID = H5Tget_super(typeID); if (btypeID == FAIL) { sprintf(errbuf,"Cannot get base data type ID.\n"); H5Epush(__FILE__, "HE5_PRinquire", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (prname != NULL) free(prname); if (namebuf != NULL) free(namebuf); if (profdata.name != NULL ) free(profdata.name); return(FAIL); } /* ------------------------------------------ */ /* Call "classID[i] = H5Tget_class(btypeID);" */ /* to get dataset (VL) data type class ID */ /* ------------------------------------------ */ classID[i] = H5Tget_class(btypeID); if (classID[i] == H5T_NO_CLASS) { sprintf(errbuf,"Cannot get data type class ID.\n"); H5Epush(__FILE__, "HE5_PRinquire", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (prname != NULL) free(prname); if (namebuf != NULL) free(namebuf); if (profdata.name != NULL ) free(profdata.name); return(FAIL); } status = H5Tclose(typeID); if (status == FAIL) { sprintf(errbuf,"Cannot release data type ID.\n"); H5Epush(__FILE__, "HE5_PRinquire", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (prname != NULL) free(prname); if (namebuf != NULL) free(namebuf); if (profdata.name != NULL ) free(profdata.name); return(FAIL); } } /* Release dataset ID */ /* ------------------ */ status = H5Dclose(profID); if (status == FAIL) { sprintf(errbuf,"Cannot release dataset ID.\n"); H5Epush(__FILE__, "HE5_PRinquire", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (prname != NULL) free(prname); if (namebuf != NULL) free(namebuf); if (profdata.name != NULL ) free(profdata.name); return(FAIL); } /* Go to next list entry, find next comma, ... */ /* ------------------------------------------- */ memmove(namebuf, comma + 1, strlen(comma + 1) + 1); comma = strchr(namebuf, ','); if (prname != NULL) free(prname); i++; } free(namebuf); } free(profdata.name); return(nProf); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PRinfo | | | | DESCRIPTION: Retrieves information about specified profile. | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | status herr_t Return status | | | | INPUTS: | | swathID hid_t swath ID | | profname char Profile name | | | | OUTPUTS: | | rank[] int Profile/dataset rank array | | dims[] hsize_t dimension size array | | maxdims[] hsize_t max. dimension size array | | ntype[] hid_t Array of profile base numtype IDs | | dimlist char Dimension list | | maxdimlist char Maximum Dimension List | | | | NOTES: | | None | | | | | | Date Programmer Description | | ======= ============ ================================================= | | 8/30/00 A. Muslimov Original development | | Sep 00 A. Muslimov Modified to change the group from "Data Fields" to | | "Profile Fields". | | Dec 00 A. Muslimov Updated to set up "dimlist" and "maxdimlist" strings| | using metadata. | | May 03 S. Zhao Changed the type of 'ntype' from an H5T_class_t to | | an hid_t. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_PRinfo(hid_t swathID, const char *profname, int *rank, hsize_t dims[], hsize_t maxdims[], hid_t *ntype, char *dimlist, char *maxdimlist) { herr_t status = FAIL; /* Return status variable */ herr_t statmeta = FAIL; /* EHgetmetavalue return status */ int i = 0; /* Loop index */ long idx = FAIL; /* Swath index */ long ndims = 0; /* Number of dimensions */ hid_t groupID = FAIL; /* "Profile Fields" group ID */ hid_t gid = FAIL; /* "SWATHS" group ID */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t profID = FAIL; /* Profile dataset ID */ hid_t typeID = FAIL; /* Dataset type ID */ hid_t spaceID = FAIL; /* Dataset space ID */ hid_t btypeID = FAIL; /* Base data type ID */ H5T_class_t classid = H5T_NO_CLASS; /* data type class ID */ size_t slen[HE5_DTSETRANKMAX]; /* Length of each entry in parsed string */ char *metabuf = (char *)NULL; /* Ptr to structural metadata (SM) */ char *metaptrs[2] = {NULL,NULL}; /* Ptrs to the begining and end of SM */ char utlstr[HE5_HDFE_UTLBUFSIZE]; /* Utility string */ char *ptr[HE5_DTSETRANKMAX]; /* String pointers for parsed string */ char dimstr[HE5_HDFE_DIMBUFSIZE]; /* Individual dimension entry string */ char maxdimstr[HE5_HDFE_DIMBUFSIZE];/* Individual max. dimension entry string */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ CHECKPOINTER(profname); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_PRinfo", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for swath ID failed. \n"); H5Epush(__FILE__, "HE5_PRinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get "Profile Fields" group ID */ /* ----------------------------- */ groupID = HE5_SWXSwath[idx].prof_id; /* Open specified profile dataset */ /* ------------------------------ */ profID = H5Dopen(groupID, profname); if (profID == FAIL) { sprintf(errbuf,"Cannot open \"%s\" profile.\n", profname); H5Epush(__FILE__, "HE5_PRinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get data space ID */ /* ----------------- */ spaceID = H5Dget_space(profID); if (spaceID == FAIL) { sprintf(errbuf,"Cannot get data space ID.\n"); H5Epush(__FILE__, "HE5_PRinfo", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get dataset rank */ /* ---------------- */ *rank = H5Sget_simple_extent_dims(spaceID, dims, maxdims); if (*rank == FAIL) { sprintf(errbuf,"Cannot get rank of \"%s\" profile.\n", profname); H5Epush(__FILE__, "HE5_PRinfo", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } if (ntype != (hid_t *)NULL) { /* Get data type ID */ /* ---------------- */ typeID = H5Dget_type(profID); if (typeID == FAIL) { sprintf(errbuf,"Cannot get data type ID.\n"); H5Epush(__FILE__, "HE5_PR0info", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get base data type ID */ /* --------------------- */ btypeID = H5Tget_super(typeID); if (btypeID == FAIL) { sprintf(errbuf,"Cannot get base data type ID.\n"); H5Epush(__FILE__, "HE5_PRinfo", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get data type class ID */ /* ---------------------- */ classid = H5Tget_class(btypeID); if (classid == H5T_NO_CLASS) { sprintf(errbuf,"Cannot get data type class ID.\n"); H5Epush(__FILE__, "HE5_PRinfo", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get base number type ID */ /* ----------------------- */ *ntype = HE5_EHdtype2numtype(btypeID); if (*ntype == FAIL) { sprintf(errbuf,"Cannot get base number type ID.\n"); H5Epush(__FILE__, "HE5_PRinfo", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Release data type ID */ /* -------------------- */ status = H5Tclose(typeID); if (status == FAIL) { sprintf(errbuf,"Cannot release data type ID.\n"); H5Epush(__FILE__, "HE5_PRinfo", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } /* Release data space ID */ /* --------------------- */ status = H5Sclose(spaceID); if (status == FAIL) { sprintf(errbuf,"Cannot release data space ID.\n"); H5Epush(__FILE__, "HE5_PRinfo", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Release dataset ID */ /* ------------------ */ status = H5Dclose(profID); if (status == FAIL) { sprintf(errbuf,"Cannot release dataset ID.\n"); H5Epush(__FILE__, "HE5_PRinfo", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get pointers to "Profile Fields" section within SM */ /* -------------------------------------------------- */ metabuf = (char *)HE5_EHmetagroup(fid,HE5_SWXSwath[idx].swname,"s","ProfileField",metaptrs); if ( metabuf == NULL ) { status = FAIL; sprintf(errbuf, "Cannot get pointer to metabuf.\n"); H5Epush(__FILE__, "HE5_PRinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } sprintf(utlstr, "%s%s%s", "\"", profname, "\"\n"); metaptrs[0] = strstr(metaptrs[0], utlstr); /* If profile is found in "Profile Fields" group */ /* --------------------------------------------- */ if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL) { /* Get "DimList" string, trim off "(" and ")" */ /* ------------------------------------------ */ statmeta = HE5_EHgetmetavalue(metaptrs, "DimList", utlstr); if (statmeta == SUCCEED) { memmove(utlstr, utlstr + 1, strlen(utlstr) - 2); utlstr[strlen(utlstr) - 2] = 0; /* Initialize slen[] array */ /* ----------------------- */ for ( i = 0; i < HE5_DTSETRANKMAX; i++) slen[ i ] = 0; /* Parse trimmed "DimList" string and get rank */ /* ------------------------------------------- */ ndims = HE5_EHparsestr(utlstr, ',', ptr, slen); /*------------------------------------------------------------------------------*/ /* Metadata-based rank info (redundant) */ /*------------------------------------------------------------------------------*/ /* *rank = HE5_EHlong2int(ndims); */ /* if (*rank == FAIL) */ /* { */ /* sprintf(errbuf, "Cannot convert from \"long\" to \"int\" data type. \n"); */ /* H5Epush(__FILE__, "HE5_PRinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); */ /* if (metabuf != NULL) free(metabuf); */ /* HE5_EHprint(errbuf, __FILE__, __LINE__); */ /* return(FAIL); */ /* } */ /*------------------------------------------------------------------------------*/ } else { status = FAIL; sprintf(errbuf, "The \"DimList\" string not found in metadata. \n"); H5Epush(__FILE__, "HE5_PRinfo", __LINE__, H5E_DATASET, H5E_SEEKERROR, errbuf); if (metabuf != NULL) free(metabuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* If "DimList" IS REQUESTED ... */ /* ----------------------------- */ if (dimlist != NULL) { strcpy(dimstr,""); strcpy(dimlist,""); /* * Copy each entry in DimList and remove leading and trailing quotes. * Get dimension sizes and concatenate dimension names to dimension list. */ for (i = 0; i < ndims; i++) { memmove(dimstr, ptr[i] + 1, slen[i] - 2); dimstr[slen[i] - 2] = 0; if (i > 0) { strcat(dimlist,","); } strcat(dimlist, dimstr); } } /* If "MaxdimList" IS REQUESTED ... */ /* -------------------------------------- */ if(maxdimlist != NULL) { strcpy(utlstr,""); statmeta = HE5_EHgetmetavalue(metaptrs,"MaxdimList", utlstr); if (statmeta == SUCCEED) { memmove(utlstr, utlstr + 1, strlen(utlstr) - 2); utlstr[strlen(utlstr) - 2] = 0; ndims = HE5_EHparsestr(utlstr,',', ptr, slen); } else { status = FAIL; sprintf(errbuf, "The \"MaxdimList\" string not found in metadata. \n"); H5Epush(__FILE__, "HE5_PRinfo", __LINE__, H5E_DATASET, H5E_SEEKERROR, errbuf); if (metabuf != NULL) free(metabuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } strcpy(maxdimstr,""); strcpy(maxdimlist,""); for (i = 0; i < ndims; i++) { memmove(maxdimstr, ptr[i] + 1, slen[i] - 2); maxdimstr[slen[i] - 2] = 0; if (maxdimlist != NULL) { if (i > 0) { strcat(maxdimlist,","); } strcat(maxdimlist, maxdimstr); } } } } if (metabuf != NULL) free(metabuf); COMPLETION: return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PRwritegrpattr | | | | DESCRIPTION: Writes/updates attribute associated with the "Profile Fields" | | group in a swath. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t swath structure ID | | attrname char attribute name | | numtype hid_t attribute dataset datatype ID | | count[] hsize_t Number of attribute elements | | datbuf void I/O buffer | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Feb 04 S.Zhao Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_PRwritegrpattr(hid_t swathID, const char *attrname, hid_t numtype, hsize_t count[], void *datbuf) { herr_t status = FAIL; /* Return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t ProfFieldsGrpID = FAIL; /* "Profile Fields" group ID */ long idx = FAIL; /* Swath index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ hid_t numbertype; HE5_LOCK; CHECKNAME(attrname); CHECKPOINTER(count); CHECKPOINTER(datbuf); /* if numtype is HE5 numbertype, rather than H5 numbertype, then convert it, otherwise use numtype itself */ numbertype = HE5_EHconvdatatype(numtype); if(numbertype == FAIL) { numbertype = numtype; } /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_PRwritegrpattr", &fid, &gid, &idx); if (status == SUCCEED) { /* Get "Profile Fields" group ID and call HE5_EHattr to perform I/O */ /* ---------------------------------------------------------------- */ ProfFieldsGrpID = H5Gopen(HE5_SWXSwath[idx].sw_id, "Profile Fields"); if(ProfFieldsGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"Profile Fields\" group ID. \n"); H5Epush(__FILE__, "HE5_PRwritegrpattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } status = HE5_EHattr(ProfFieldsGrpID, attrname, numbertype, count,"w", datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot write attribute \"%s\"to the \"Profile Fields\" group.\n", attrname); H5Epush(__FILE__, "HE5_PRwritegrpattr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Gclose(ProfFieldsGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"Profile Fields\" group ID. \n"); H5Epush(__FILE__, "HE5_PRwritegrpattr", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PRreadgrpattr | | | | DESCRIPTION: Reads attribute from the "Profile Fields" group in a swath. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t swath structure ID | | attrname char attribute name | | | | OUTPUTS: | | datbuf void I/O buffer | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Feb 04 S.Zhao Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_PRreadgrpattr(hid_t swathID, const char *attrname, void * datbuf) { herr_t status = FAIL; /* return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t ntype = FAIL; /* Data type ID */ hid_t ProfFieldsGrpID = FAIL; /* "Profile Fields" group ID */ long idx = FAIL; /* Swath index */ hsize_t count[] = { 0 }; /* # of attribute elements */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKPOINTER(attrname); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_PRreadgrpattr", &fid, &gid, &idx); if (status == SUCCEED) { /* Get "Profile Fields" group ID and call HE5_EHattr to perform I/O */ /* ----------------------------------------------------------------- */ ProfFieldsGrpID = H5Gopen(HE5_SWXSwath[idx].sw_id, "Profile Fields"); if(ProfFieldsGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"Profile Fields\" group ID.\n"); H5Epush(__FILE__, "HE5_PRreadgrpattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } status = HE5_EHattr(ProfFieldsGrpID,attrname,ntype,count,"r", datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot read attribute \"%s\" from the \"Profile Fields\" group.\n", attrname); H5Epush(__FILE__, "HE5_PRreadgrpattr", __LINE__, H5E_ATTR, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Gclose(ProfFieldsGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"Profile Fields\" group ID.\n"); H5Epush(__FILE__, "HE5_PRreadgrpattr", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PRgrpattrinfo | | | | DESCRIPTION: Retrieves information about attributes in "Profile Fields" | | group. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t swath structure ID | | attrname const char* attribute name | | | | OUTPUTS: | | ntype hid_t data type ID | | count hsize_t Number of attribute elements | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Feb 04 S.Zhao Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_PRgrpattrinfo(hid_t swathID, const char *attrname, hid_t *ntype, hsize_t *count) { herr_t status = FAIL; /* routine return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t ProfFieldsGrpID = FAIL; /* "Profile Fields" group ID */ long idx = FAIL; /* Swath index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ CHECKPOINTER(attrname); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_PRgrpattrinfo", &fid, &gid, &idx); if (status == SUCCEED) { /* Get "Profile Fields" group ID and call HE5_EHattrinfo */ /* ----------------------------------------------------- */ ProfFieldsGrpID = H5Gopen(HE5_SWXSwath[idx].sw_id, "Profile Fields"); if(ProfFieldsGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"Profile Fields\" group ID.\n"); H5Epush(__FILE__, "HE5_PRgrpattrinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } status = HE5_EHattrinfo(ProfFieldsGrpID,attrname,ntype,count); if(status == FAIL) { sprintf(errbuf,"Cannot retrieve information about attribute \"%s\" in the \"Profile Fields\" group.\n", attrname); H5Epush(__FILE__, "HE5_PRgrpattrinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Gclose(ProfFieldsGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"Profile Fields\" group ID.\n"); H5Epush(__FILE__, "HE5_PRgrpattrinfo", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PRgrpattrinfo2 | | | | DESCRIPTION: Retrieves information about attributes in "Profile Fields" | | group. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t swath structure ID | | attrname const char* attribute name | | | | OUTPUTS: | | ntype hid_t data type ID | | count hsize_t Number of attribute elements | | size hsize_t buf size of attribute elements | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Feb 04 S.Zhao Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_PRgrpattrinfo2(hid_t swathID, const char *attrname, hid_t *ntype, hsize_t *count, hsize_t *size) { herr_t status = FAIL; /* routine return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t ProfFieldsGrpID = FAIL; /* "Profile Fields" group ID */ long idx = FAIL; /* Swath index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ CHECKPOINTER(attrname); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_PRgrpattrinfo2", &fid, &gid, &idx); if (status == SUCCEED) { /* Get "Profile Fields" group ID and call HE5_EHattrinfo */ /* ----------------------------------------------------- */ ProfFieldsGrpID = H5Gopen(HE5_SWXSwath[idx].sw_id, "Profile Fields"); if(ProfFieldsGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"Profile Fields\" group ID.\n"); H5Epush(__FILE__, "HE5_PRgrpattrinfo2", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } status = HE5_EHattrinfo2(ProfFieldsGrpID,attrname,ntype,count,size); if(status == FAIL) { sprintf(errbuf,"Cannot retrieve information about attribute \"%s\" in the \"Profile Fields\" group.\n", attrname); H5Epush(__FILE__, "HE5_PRgrpattrinfo2", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Gclose(ProfFieldsGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"Profile Fields\" group ID.\n"); H5Epush(__FILE__, "HE5_PRgrpattrinfo2", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PRinqgrpattrs | | | | DESCRIPTION: Retrieves the number of attributes and string length of | | attribute list in "Profile Fields" group | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nattr long Number of attributes in "Profile Fields"| | group. | | | | INPUTS: | | swath ID hid_t swath structure ID | | | | OUTPUTS: | | attrnames char Attribute names in "Profile Fields" | | group (Comma-separated list) | | strbufsize long Attributes name list string length | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Feb 04 S.Zhao Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_PRinqgrpattrs(hid_t swathID, char *attrnames, long *strbufsize) { long nattr = FAIL; /* Number of attributes (return) */ long idx = FAIL; /* Swath index */ herr_t status = FAIL; /* Return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "SWATHS" group ID */ char *grpname = (char *)NULL; /* Group name string */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_PRinqgrpattrs", &fid, &gid, &idx); if(status == SUCCEED ) { grpname = (char *)calloc(HE5_HDFE_NAMBUFSIZE, sizeof(char) ); if( grpname == NULL) { sprintf(errbuf, "Cannot allocate memory. \n"); H5Epush(__FILE__, "HE5_PRinqgrpattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } strcpy(grpname,"/HDFEOS/SWATHS/"); strcat(grpname, HE5_SWXSwath[idx].swname); strcat(grpname,"/Profile Fields"); /* search group with grpname for the number of attributes */ /* ------------------------------------------------------ */ nattr = HE5_EHattrcat(fid, grpname, attrnames, strbufsize); if ( nattr < 0 ) { sprintf(errbuf, "Cannot find the attributes. \n"); H5Epush(__FILE__, "HE5_PRinqgrpattrs", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); } if (grpname != NULL) free(grpname); } return (nattr); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWsetalias | | | | DESCRIPTION: Defines alias for a specified field name | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | status herr_t Return status | | | | INPUTS: | | swathID hid_t swath ID | | fieldname char Original field name | | | | OUTPUTS: | | aliaslist char List of aliases for the field name | | | | NOTES: | | None | | | | | | Date Programmer Description | | ======= ============ ================================================= | | Sep 00 A. Muslimov Original development | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWsetalias(hid_t swathID, char *fieldname, const char *aliaslist) { herr_t status = FAIL; /* return status variable */ int fldgroup = FAIL; /* Field group flag */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "SWATHS" group ID */ hid_t groupID = FAIL; /* Field group ID */ long idx = FAIL; /* Swath index */ char *buf = NULL; /* Pointer to temporary buffer */ char *comma = NULL; /* Pointer to comma */ char *aliasname = NULL; /* Pointer to the alias name */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKPOINTER(fieldname); CHECKPOINTER(aliaslist); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWsetalias", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for swath ID failed. \n"); H5Epush(__FILE__, "HE5_SWsetalias", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Find out the field group */ /* ------------------------ */ fldgroup = HE5_SWfldsrch(swathID,fieldname,NULL,NULL,NULL,NULL); if (fldgroup == HE5_HDFE_GEOGROUP) groupID = HE5_SWXSwath[idx].geo_id; else if (fldgroup == HE5_HDFE_DATAGROUP) groupID = HE5_SWXSwath[idx].data_id; else if (fldgroup == HE5_HDFE_PROFGROUP) groupID = HE5_SWXSwath[idx].prof_id; else { sprintf(errbuf, "Cannot find \"%s\" field in swath. \n", fieldname); H5Epush(__FILE__, "HE5_SWsetalias", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Allocate memory for temporary buffer */ /* ------------------------------------ */ buf = (char *)calloc(strlen(aliaslist)+64, sizeof(char)); if (buf == NULL) { sprintf(errbuf, "Cannot alocate memory for \"buf\". \n"); H5Epush(__FILE__, "HE5_SWsetalias", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Make a list like "name1,name2,name3," */ /* ------------------------------------- */ strcpy(buf,aliaslist); strcat(buf,","); /* Find first comma and make pointer pointing to it */ /* ------------------------------------------------ */ comma = strchr(buf, ','); while(comma != NULL) { /* Allocate memory for individual entry */ /* ------------------------------------ */ aliasname = (char *)calloc(comma-buf+1, sizeof(char)); if (aliasname == NULL) { sprintf(errbuf, "Cannot alocate memory for \"aliasname\". \n"); H5Epush(__FILE__, "HE5_SWsetalias", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (buf != NULL) free(buf); return(FAIL); } /* Pick up an individual entry and put it to the "aliasname" */ /* --------------------------------------------------------- */ memmove(aliasname,buf,comma-buf); /* Create a symbolic link for a specified object */ /* --------------------------------------------- */ status = H5Glink(groupID, H5G_LINK_SOFT, fieldname, aliasname); if (status == FAIL) { sprintf(errbuf, "Cannot create an alias \"%s\" for \"%s\" field. \n", aliasname, fieldname); H5Epush(__FILE__, "HE5_SWsetalias", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (aliasname != NULL) free(aliasname); if (buf != NULL) free(buf); return(FAIL); } /* Go to the next name entry */ /* ------------------------- */ memmove(buf, comma + 1, strlen(comma + 1) + 1); comma = strchr(buf, ','); if (aliasname != NULL) free(aliasname); } if (buf != NULL) free(buf); COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWdropalias | | | | DESCRIPTION: Removes the alias for a specified field name | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | status herr_t Return status | | | | INPUTS: | | swathID hid_t swath ID | | aliasname char alias name to remove | | fldgroup int Field group flag | | | | OUTPUTS: | | | | NOTES: | | None | | | | | | Date Programmer Description | | ======= ============ ================================================= | | Sep 00 A. Muslimov Original development | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWdropalias(hid_t swathID, int fldgroup, const char *aliasname) { herr_t status = FAIL; /* return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "SWATHS" group ID */ hid_t groupID = FAIL; /* Field group ID */ long idx = FAIL; /* Swath index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKPOINTER(aliasname); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWdropalias", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for swath ID failed. \n"); H5Epush(__FILE__, "HE5_SWdropalias", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get Group ID */ /* ------------ */ if (fldgroup == HE5_HDFE_GEOGROUP) groupID = HE5_SWXSwath[idx].geo_id; else if (fldgroup == HE5_HDFE_DATAGROUP) groupID = HE5_SWXSwath[idx].data_id; else if (fldgroup == HE5_HDFE_PROFGROUP) groupID = HE5_SWXSwath[idx].prof_id; else { sprintf(errbuf, "Invalid input group flag. \n"); H5Epush(__FILE__, "HE5_SWdropalias", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Destroy a symbolic link */ /* ----------------------- */ status = H5Gunlink(groupID, aliasname); if (status == FAIL) { sprintf(errbuf, "Cannot remove alias named \"%s\". \n", aliasname); H5Epush(__FILE__, "HE5_SWdropalias", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWinqdfldalias | | | | DESCRIPTION: Retrieves the number of fields & aliases and string length of| | fields & aliases list in "Data Fields" group | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nfldalias long Number of fields & aliases in "Data | | Fields" group. | | INPUTS: | | swathID hid_t swath structure ID | | | | OUTPUTS: | | fldalias char* Fields & aliases names in "Data Fields" | | group (Comma-separated list) | | strbufsize long* Fields & aliases name list string length| | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Mar 03 S.Zhao Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_SWinqdfldalias(hid_t swathID, char *fldalias, long *strbufsize) { long nfldalias = FAIL; /* Number of fields & aliases (return) */ long idx = FAIL; /* Swath index */ herr_t status = FAIL; /* Return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "SWATHS" group ID */ char *grpname = (char *)NULL; /* Group name string */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWinqdfldalias", &fid, &gid, &idx); if(status == SUCCEED ) { grpname = (char *)calloc(HE5_HDFE_NAMBUFSIZE, sizeof(char) ); if( grpname == NULL) { H5Epush(__FILE__, "HE5_SWinqdfldalias", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Can not allocate memory"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); return(FAIL); } strcpy(grpname,"/HDFEOS/SWATHS/"); strcat(grpname, HE5_SWXSwath[idx].swname); strcat(grpname,"/Data Fields"); /* search group with grpname for the number of fields & aliases */ /* ------------------------------------------------------------ */ nfldalias = HE5_EHdatasetcat(fid, grpname, fldalias, strbufsize); if ( nfldalias < 0 ) { sprintf(errbuf, "Cannot find the fields & aliases. \n"); H5Epush(__FILE__, "HE5_SWinqdfldalias", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); } if (grpname != NULL) free(grpname); } else { sprintf(errbuf, "Checking for swath ID failed. \n"); H5Epush(__FILE__, "HE5_SWinqdfldalias", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } return (nfldalias); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWinqgfldalias | | | | DESCRIPTION: Retrieves the number of fields & aliases and string length of| | fields & aliases list in "Geolocation Fields" group | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nfldalias long Number of fields & aliases in "Geo- | | location Fields" group. | | INPUTS: | | swathID hid_t swath structure ID | | | | OUTPUTS: | | fldalias char* Fields & aliases names in "Geolocation | | Fields" group (Comma-separated list) | | strbufsize long* Fields & aliases name list string length| | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Apr 03 S.Zhao Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_SWinqgfldalias(hid_t swathID, char *fldalias, long *strbufsize) { long nfldalias = FAIL; /* Number of fields & aliases (return) */ long idx = FAIL; /* Swath index */ herr_t status = FAIL; /* Return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "SWATHS" group ID */ char *grpname = (char *)NULL; /* Group name string */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWinqgfldalias", &fid, &gid, &idx); if(status == SUCCEED ) { grpname = (char *)calloc(HE5_HDFE_NAMBUFSIZE, sizeof(char) ); if( grpname == NULL) { H5Epush(__FILE__, "HE5_SWinqgfldalias", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Can not allocate memory"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); return(FAIL); } strcpy(grpname,"/HDFEOS/SWATHS/"); strcat(grpname, HE5_SWXSwath[idx].swname); strcat(grpname,"/Geolocation Fields"); /* search group with grpname for the number of fields & aliases */ /* ------------------------------------------------------------ */ nfldalias = HE5_EHdatasetcat(fid, grpname, fldalias, strbufsize); if ( nfldalias < 0 ) { sprintf(errbuf, "Cannot find the fields & aliases. \n"); H5Epush(__FILE__, "HE5_SWinqgfldalias", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); } if (grpname != NULL) free(grpname); } else { sprintf(errbuf, "Checking for swath ID failed. \n"); H5Epush(__FILE__, "HE5_SWinqgfldalias", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } return (nfldalias); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWaliasinfo | | | | DESCRIPTION: Retrieves information about field aliases | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | status herr_t Return status | | | | INPUTS: | | swathID hid_t swath ID | | aliasname char alias name | | fldgroup int Field group flag | | | | OUTPUTS: | | length int Buffer size | | buffer char Buffer with original field name | | | | NOTES: | | None | | | | | | Date Programmer Description | | ======= ============ ================================================= | | Sep 00 A. Muslimov Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWaliasinfo(hid_t swathID, int fldgroup, const char *aliasname, int *length, char *buffer) { herr_t status = FAIL; /* return status variable */ int type = FAIL; /* type-value of an object */ size_t size = 0; /* Size of the name buffer */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "SWATHS" group ID */ hid_t groupID = FAIL; /* Field group ID */ long idx = FAIL; /* Swath index */ H5G_stat_t *statbuf = (H5G_stat_t *)NULL; /* pointer to a structure */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ CHECKPOINTER(aliasname); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWaliasinfo", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for swath ID failed. \n"); H5Epush(__FILE__, "HE5_SWaliasinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the group ID */ /* ---------------- */ if (fldgroup == HE5_HDFE_GEOGROUP) groupID = HE5_SWXSwath[idx].geo_id; else if (fldgroup == HE5_HDFE_DATAGROUP) groupID = HE5_SWXSwath[idx].data_id; else if (fldgroup == HE5_HDFE_PROFGROUP) groupID = HE5_SWXSwath[idx].prof_id; else { sprintf(errbuf, "Invalid input group flag. \n"); H5Epush(__FILE__, "HE5_SWaliasinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } if (buffer == NULL) { /* Get the string length of a "real" name */ /* -------------------------------------- */ statbuf = (H5G_stat_t *)calloc(1, sizeof(H5G_stat_t)); if (statbuf == NULL) { sprintf(errbuf, "Cannot allocate memory for \"statbuf\". \n"); H5Epush(__FILE__, "HE5_SWaliasinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the Object Info */ /* ------------------- */ status = H5Gget_objinfo(groupID, aliasname, 0, statbuf); if (status == FAIL) { sprintf(errbuf, "Cannot get information about \"%s\" alias. \n", aliasname); H5Epush(__FILE__, "HE5_SWaliasinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* LINK name length with a null terminator */ /* --------------------------------------- */ size = statbuf->linklen; /* Object type (dataset, link, etc) */ /* -------------------------------- */ type = statbuf->type; /* Make sure that the object is a LINK */ /* ----------------------------------- */ if (type != H5G_LINK) { sprintf(errbuf,"The object named \"%s\" is not a symbolic link.\n", aliasname); H5Epush(__FILE__, "HE5_SWaliasinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } *length = (int)size; if ( statbuf != (H5G_stat_t *)NULL ) free(statbuf); } if (buffer != NULL) { size = (size_t)*length; /* Get the "real" name by an "alias" */ /* --------------------------------- */ status = H5Gget_linkval(groupID, aliasname, size, buffer); if (status == FAIL) { sprintf(errbuf,"Cannot get the real name for the alias named \"%s\".\n", aliasname); H5Epush(__FILE__, "HE5_SWaliasinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } COMPLETION: return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWgetaliaslist | | | | DESCRIPTION: Retrieves the number of aliases and the list of aliases in | | swath | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nalias long number of aliases in swath | | | | INPUTS: | | swathID hid_t swath structure ID | | fldgroup int field group flag (geo or data) | | | | OUTPUTS: | | aliaslist char* list of aliases (comma-separated list) | | strbufsize long* length of aliases list | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Jun 05 S.Zhao Original development | | Mar 06 Abe Taaheri Added code to get alias strbufsize only when user | | passes aliaslist as NULL pointer | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_SWgetaliaslist(hid_t swathID, int fldgroup, char *aliaslist, long *strbufsize) { long nalias = FAIL; /* Number of aliases (return) */ long idx = FAIL; /* Swath index */ herr_t status = FAIL; /* Return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "SWATHS" group ID */ char *fieldlist = (char *)NULL; /* List of fields */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ long fldstrbuf = FAIL; /* Buffer size for fields */ long nflds = FAIL; /* Number of fields */ long nfldalias = FAIL; /* Number of fields & aliases */ char *fldalias = (char *)NULL; /* List of fields & aliases */ long fldaliasbuf = FAIL; /* Buffer size for fields & aliases */ char *buff = (char *)NULL; /* Pointer to temporary buffer */ char *comma = (char *)NULL; /* Pointer to comma */ char *comma1 = (char *)NULL; /* Pointer to comma */ char *nameptr = (char *)NULL; /* Pointer to each name */ char *tmpbuf = (char *)NULL; /* Pointer to temp buffer */ long nameflag = FAIL; /* Name flag */ /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWgetaliaslist", &fid, &gid, &idx); if(status == SUCCEED ) { /* If aliaslist and strbufsize desired */ /* ----------------------------------- */ if (fldgroup == HE5_HDFE_DATAGROUP) { /* Call "HE5_SWnentries" routine to get number of Data fields */ /* ---------------------------------------------------------- */ nflds = HE5_SWnentries(swathID, HE5_HDFE_NENTDFLD, &fldstrbuf); if (nflds == FAIL) { sprintf(errbuf, "Cannot get the number of fields in \"Data Fields\" group. \n"); H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Allocate memory for fields list buffer */ /* -------------------------------------- */ fieldlist = (char *) calloc(fldstrbuf+6, sizeof(char)); if(fieldlist == NULL) { sprintf(errbuf,"Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Call "HE5_SWinqdatafields" routine to get the list of Data fields */ /* --------------------------------------------------------- */ nflds = HE5_SWinqdatafields(swathID, fieldlist, NULL, NULL); if (nflds == FAIL) { sprintf(errbuf, "Cannot get the list of fields in \"Data Fields\" group. \n"); H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(fieldlist); return(FAIL); } /* Call "HE5_SWinqdfldalias" routine to get number of fields & aliases */ /* --------------------------------------------------------- */ nfldalias = HE5_SWinqdfldalias(swathID, NULL, &fldaliasbuf); if (nfldalias == FAIL) { sprintf(errbuf, "Cannot get the number of fields & aliases in \"Data Fields\" group. \n"); H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(fieldlist); return(FAIL); } /* Allocate memory for fields & aliases list buffer */ /* ------------------------------------------------ */ fldalias = (char *) calloc(fldaliasbuf+6, sizeof(char)); if(fldalias == NULL) { sprintf(errbuf,"Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(fieldlist); return(FAIL); } /* Call "HE5_SWinqdfldalias" routine to get the list of fields & aliases */ /* ----------------------------------------------------------- */ nfldalias = HE5_SWinqdfldalias(swathID, fldalias, &fldaliasbuf); if (nfldalias == FAIL) { sprintf(errbuf, "Cannot get the list of fields & aliases in \"Data Fields\" group. \n"); H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(fieldlist); free(fldalias); return(FAIL); } } else if (fldgroup == HE5_HDFE_GEOGROUP) { /* Call "HE5_SWnentries" routine to get number of Geolocation fields */ /* --------------------------------------------------------- */ nflds = HE5_SWnentries(swathID, HE5_HDFE_NENTGFLD, &fldstrbuf); if (nflds == FAIL) { sprintf(errbuf, "Cannot get the number of fields in \"Geolocation Fields\" group. \n"); H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Allocate memory for fields list buffer */ /* -------------------------------------- */ fieldlist = (char *) calloc(fldstrbuf+6, sizeof(char)); if(fieldlist == NULL) { sprintf(errbuf,"Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Call "HE5_SWinqgeofields" routine to get the list of Geolocation fields */ /* -------------------------------------------------- */ nflds = HE5_SWinqgeofields(swathID, fieldlist, NULL, NULL); if (nflds == FAIL) { sprintf(errbuf, "Cannot get the list of fields in \"Geolocation Fields\" group. \n"); H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(fieldlist); return(FAIL); } /* Call "HE5_SWinqgfldalias" routine to get number of fields & aliases */ /* --------------------------------------------------------- */ nfldalias = HE5_SWinqgfldalias(swathID, NULL, &fldaliasbuf); if (nfldalias == FAIL) { sprintf(errbuf, "Cannot get the number of fields & aliases in \"Geolocation Fields\" group. \n"); H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(fieldlist); return(FAIL); } /* Allocate memory for fields & aliases list buffer */ /* ------------------------------------------------ */ fldalias = (char *) calloc(fldaliasbuf+6, sizeof(char)); if(fldalias == NULL) { sprintf(errbuf,"Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(fieldlist); return(FAIL); } /* Call "HE5_SWinqgfldalias" routine to get the list of fields & aliases */ /* ----------------------------------------------------------- */ nfldalias = HE5_SWinqgfldalias(swathID, fldalias, &fldaliasbuf); if (nfldalias == FAIL) { sprintf(errbuf, "Cannot get the list of fields & aliases in \"Geolocation Fields\" group. \n"); H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(fieldlist); free(fldalias); return(FAIL); } } else { sprintf(errbuf, "Invalid input group flag. \n"); H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } *strbufsize = strlen(fldalias) - strlen(fieldlist); if (*strbufsize <= 0) { sprintf(errbuf, "Cannot find the aliases.\n"); H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if(fieldlist != NULL) free(fieldlist); if(fldalias != NULL) free(fldalias); return(FAIL); } else { nalias = 0; /* Allocate memory for temporary buffer */ /* ------------------------------------ */ buff = (char *)calloc(strlen(fldalias)+6, sizeof(char)); if (buff == NULL) { sprintf(errbuf, "Cannot allocate memory for \"buff\". \n"); H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if(fieldlist != NULL) free(fieldlist); if(fldalias != NULL) free(fldalias); return(FAIL); } /* Allocate memory for aliases */ /* --------------------------- */ tmpbuf = (char *)calloc(*strbufsize+6, sizeof(char)); if (tmpbuf == NULL) { sprintf(errbuf, "Cannot allocate memory for \"tmpbuf\". \n"); H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if(fieldlist != NULL) free(fieldlist); if(fldalias != NULL) free(fldalias); if(buff != NULL) free(buff); return(FAIL); } strcpy(buff, fldalias); strcat(buff, ","); strcat(fieldlist, ","); /* Find first comma and make pointer pointing to it */ /* ------------------------------------------------ */ comma = strchr(buff, ','); while(comma != NULL) { /* Allocate memory for individual entry */ /* ------------------------------------ */ nameptr = (char *)calloc(comma-buff+6, sizeof(char)); if (nameptr == NULL) { sprintf(errbuf,"Cannot allocate memory for \"nameptr\". \n"); H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if(fieldlist != NULL) free(fieldlist); if(fldalias != NULL) free(fldalias); if(buff != NULL) free(buff); if(tmpbuf != NULL) free(tmpbuf); return(FAIL); } /* Pick up an individual entry and put it to the "nameptr" */ /* ------------------------------------------------------- */ memmove(nameptr,buff,comma-buff); strcat(nameptr, ","); nameflag = (strstr(fieldlist,nameptr) == NULL) ? 1 : 0; if (nameflag == 1) { comma1 = strchr(tmpbuf, ','); if(comma1 == NULL) strcpy(tmpbuf, nameptr); else strcat(tmpbuf, nameptr); nalias++; } memmove(buff, comma + 1, strlen(comma + 1) + 1); comma = strchr(buff, ','); if (nameptr != NULL) free(nameptr); } } if(aliaslist == NULL)/* just return buffersize and number of aliases */ { if(nalias > 0 ) { if (fieldlist != NULL) free(fieldlist); if (fldalias != NULL) free(fldalias); if (buff != NULL) free(buff); if (tmpbuf != NULL) free(tmpbuf); return (nalias); } else { sprintf(errbuf, "Cannot find the aliases.\n"); H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if(fieldlist != NULL) free(fieldlist); if(fldalias != NULL) free(fldalias); if (buff != NULL) free(buff); if (tmpbuf != NULL) free(tmpbuf); return(FAIL); } } else { if(nalias > 0 ) { strncpy(aliaslist, tmpbuf, *strbufsize-1); aliaslist[*strbufsize-1] = '\0'; } else { sprintf(errbuf, "Cannot find the aliases.\n"); H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if(fieldlist != NULL) free(fieldlist); if(fldalias != NULL) free(fldalias); if (buff != NULL) free(buff); if (tmpbuf != NULL) free(tmpbuf); return(FAIL); } } } else { sprintf(errbuf, "Checking for swath ID failed. \n"); H5Epush(__FILE__, "HE5_SWgetaliaslist", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } if (fieldlist != NULL) free(fieldlist); if (fldalias != NULL) free(fldalias); if (buff != NULL) free(buff); if (tmpbuf != NULL) free(tmpbuf); return (nalias); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWfldrename | | | | DESCRIPTION: Changes the field name | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | status herr_t Return status | | | | INPUTS: | | swathID hid_t swath ID | | oldfieldname char Original field name | | | | OUTPUTS: | | newfieldname char New field name | | | | NOTES: | | None | | | | | | Date Programmer Description | | ======= ============ ================================================= | | Sep 00 A. Muslimov Original development | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWfldrename(hid_t swathID, char *oldfieldname, const char *newfieldname) { herr_t status = FAIL; /* Return status variable */ int fldgroup = FAIL; /* Field group flag */ int k; /* Loop index */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "SWATHS" group ID */ hid_t groupID = FAIL; /* Field group ID */ long idx = FAIL; /* Swath index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKPOINTER(oldfieldname); CHECKNAME(newfieldname); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWfldrename", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for swath ID failed. \n"); H5Epush(__FILE__, "HE5_SWfldrename", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Find out the field group */ /* ------------------------ */ fldgroup = HE5_SWfldsrch(swathID,oldfieldname,NULL,NULL,NULL,NULL); if (fldgroup == HE5_HDFE_GEOGROUP) groupID = HE5_SWXSwath[idx].geo_id; else if (fldgroup == HE5_HDFE_DATAGROUP) groupID = HE5_SWXSwath[idx].data_id; else if (fldgroup == HE5_HDFE_PROFGROUP) groupID = HE5_SWXSwath[idx].prof_id; else { sprintf(errbuf, "Error returning field group flag. \n"); H5Epush(__FILE__, "HE5_SWfldrename", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Rename the field */ /* ---------------- */ status = H5Gmove(groupID, oldfieldname, newfieldname); if (status == FAIL) { sprintf(errbuf, "Cannot change the field name from \"%s\" to \"%s\". \n", oldfieldname, newfieldname); H5Epush(__FILE__, "HE5_SWfldrename", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Update Table */ /* ------------ */ if (fldgroup == HE5_HDFE_DATAGROUP) { for (k = 0; k < HE5_SWXSwath[idx].nDFLD; k++) { if (strcmp(HE5_SWXSwath[idx].ddataset[k].name, oldfieldname) == 0 ) strcpy(HE5_SWXSwath[idx].ddataset[k].name, newfieldname); } } if (fldgroup == HE5_HDFE_GEOGROUP) { for(k = 0; k < HE5_SWXSwath[idx].nGFLD; k++) { if (strcmp(HE5_SWXSwath[idx].gdataset[k].name, oldfieldname) == 0 ) strcpy(HE5_SWXSwath[idx].gdataset[k].name, newfieldname); } } if (fldgroup == HE5_HDFE_PROFGROUP) { for(k = 0; k < HE5_SWXSwath[idx].nPROF; k++) { if (strcmp(HE5_SWXSwath[idx].pdataset[k].name, oldfieldname) == 0 ) strcpy(HE5_SWXSwath[idx].pdataset[k].name, newfieldname); } } COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWmountexternal | | | | DESCRIPTION: Mounts external data file onto "Data Fields", "Profile | | Fields", or "Geolocation Fields" group. | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | extfID hid_t External file ID | | | | INPUTS: | | swathID hid_t swath ID | | fldgroup int Group flag | | extfilename char External File Name | | | | OUTPUTS: | | | | NOTES: | | None | | | | | | Date Programmer Description | | ======= ============ ================================================= | | Sep 00 A. Muslimov Original development | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ hid_t HE5_SWmountexternal(hid_t swathID, int fldgroup, const char *extfilename) { hid_t extfID = FAIL; /* External file ID (return) */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "SWATHS" group ID */ herr_t status = FAIL; /* Return status variable */ long idx = FAIL; /* Swath index */ char grpname[HE5_HDFE_NAMBUFSIZE];/* Group name buffer */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ HE5_LOCK; CHECKNAME(extfilename); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWmountexternal", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for swath ID failed. \n"); H5Epush(__FILE__, "HE5_SWmountexternal", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } strcpy(grpname,"/HDFEOS/SWATHS/"); strcat(grpname, HE5_SWXSwath[idx].swname); if (fldgroup == HE5_HDFE_DATAGROUP) strcat(grpname,"/Data Fields"); if (fldgroup == HE5_HDFE_PROFGROUP) strcat(grpname,"/Profile Fields"); if (fldgroup == HE5_HDFE_GEOGROUP) strcat(grpname,"/Geolocation Fields"); /* Open external data file */ /* ----------------------- */ extfID = H5Fopen(extfilename, H5F_ACC_RDONLY, H5P_DEFAULT); if ( extfID == FAIL ) { sprintf(errbuf, "Cannot open external file named \"%s\". \n", extfilename); H5Epush(__FILE__, "HE5_SWmountexternal", __LINE__, H5E_FILE, H5E_CANTOPENFILE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Mount external file */ /* ------------------- */ status = H5Fmount(fid, grpname, extfID, H5P_DEFAULT); if ( status == FAIL ) { sprintf(errbuf, "Cannot mount external file onto \"%s\" group. \n", grpname); H5Epush(__FILE__, "HE5_SWmountexternal", __LINE__, H5E_FILE, H5E_MOUNT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } COMPLETION: HE5_UNLOCK; return(extfID); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: SWunmount | | | | DESCRIPTION: Unmounts external data file from "Data Fields", "Profile | | Fields", or "Geolocation Fields" group. | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | status herr_t Return status | | | | INPUTS: | | swathID hid_t swath ID | | fldgroup int Group flag | | fileID hid_t ID of file to be unmounted | | | | OUTPUTS: | | | | NOTES: | | None | | | | | | Date Programmer Description | | ======= ============ ================================================= | | Sep 00 A. Muslimov Original development | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWunmount(hid_t swathID, int fldgroup, hid_t fileID) { herr_t status = FAIL; /* Return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "SWATHS" group ID */ long idx = FAIL; /* Swath index */ char grpname[HE5_HDFE_NAMBUFSIZE];/* Group name buffer */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ HE5_LOCK; /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWunmount", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for swath ID failed. \n"); H5Epush(__FILE__, "HE5_SWunmount", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } strcpy(grpname,"/HDFEOS/SWATHS/"); strcat(grpname, HE5_SWXSwath[idx].swname); if (fldgroup == HE5_HDFE_DATAGROUP) strcat(grpname,"/Data Fields"); if (fldgroup == HE5_HDFE_PROFGROUP) strcat(grpname,"/Profile Fields"); if (fldgroup == HE5_HDFE_GEOGROUP) strcat(grpname,"/Geolocation Fields"); status = H5Funmount(fid, grpname); if ( status == FAIL ) { sprintf(errbuf, "Cannot unmount external file from \"%s\" group. \n", grpname); H5Epush(__FILE__, "HE5_SWunmount", __LINE__, H5E_FILE, H5E_MOUNT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } status = H5Fclose(fileID); if ( status == FAIL ) { sprintf(errbuf, "Cannot close external file. \n"); H5Epush(__FILE__, "HE5_SWunmount", __LINE__, H5E_FILE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWreadexternal | | | | DESCRIPTION: Reads external dataset | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | status herr_t Return status | | | | INPUTS: | | swathID hid_t swath ID | | fldgroup int Group flag | | fieldname char Field name to read | | | | OUTPUTS: | | buffer void Output data bufer | | | | NOTES: | | None | | | | | | Date Programmer Description | | ======= ============ ================================================= | | Sep 00 A. Muslimov Original development | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWreadexternal(hid_t swathID, int fldgroup, const char *fieldname, void *buffer) { herr_t status = FAIL;/* return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "SWATHS" group ID */ hid_t groupID = FAIL;/* Group ID */ hid_t datasetID = FAIL;/* Dataset ID */ hid_t typeID = FAIL;/* File data type ID */ hid_t mtypeID = FAIL;/* Memory datatype ID */ long idx = FAIL;/* Swath index */ char grpname[HE5_HDFE_NAMBUFSIZE];/* Group name buffer */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKPOINTER(fieldname); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWreadexternal", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for swath ID failed. \n"); H5Epush(__FILE__, "HE5_SWreadexternal", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } strcpy(grpname,"/HDFEOS/SWATHS/"); strcat(grpname, HE5_SWXSwath[idx].swname); if (fldgroup == HE5_HDFE_DATAGROUP) strcat(grpname,"/Data Fields"); if (fldgroup == HE5_HDFE_PROFGROUP) strcat(grpname,"/Profile Fields"); if (fldgroup == HE5_HDFE_GEOGROUP) strcat(grpname,"/Geolocation Fields"); /* Open the group containing mounted file */ /* ---------------------------------------- */ groupID = H5Gopen(fid, grpname); if ( groupID == FAIL ) { sprintf(errbuf, "Cannot open group containing mounted file. \n"); H5Epush(__FILE__, "HE5_SWreadexternal", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Open the dataset */ /* ---------------- */ datasetID = H5Dopen(groupID, fieldname); if ( datasetID == FAIL ) { sprintf(errbuf, "Cannot open mounted dataset. \n"); H5Epush(__FILE__, "HE5_SWreadexternal", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the data type ID */ /* -------------------- */ typeID = H5Dget_type(datasetID); if ( typeID == FAIL ) { sprintf(errbuf, "Cannot get the data type ID of mounted dataset. \n"); H5Epush(__FILE__, "HE5_SWreadexternal", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get memory data type ID */ /* ----------------------- */ mtypeID = HE5_EHdtype2mtype(typeID); if (mtypeID == FAIL) { sprintf(errbuf, "Cannot convert to memory data type.") ; H5Epush(__FILE__, "HE5_SWreadexternal", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Read the mounted dataset */ /* ------------------------ */ status = H5Dread(datasetID, mtypeID, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer); if ( status == FAIL ) { sprintf(errbuf, "Cannot read mounted data.") ; H5Epush(__FILE__, "HE5_SWreadexternal", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Release data type ID */ /* -------------------- */ status = H5Tclose(typeID); if ( status == FAIL ) { sprintf(errbuf, "Cannot release data type ID.") ; H5Epush(__FILE__, "HE5_SWreadexternal", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Release dataset ID */ /* ------------------ */ status = H5Dclose(datasetID); if ( status == FAIL ) { sprintf(errbuf, "Cannot release dataset ID.") ; H5Epush(__FILE__, "HE5_SWreadexternal", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Release the group ID */ /* -------------------- */ status = H5Gclose(groupID); if ( status == FAIL ) { sprintf(errbuf, "Cannot release group ID.") ; H5Epush(__FILE__, "HE5_SWreadexternal", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWsetextdata | | | | DESCRIPTION: Sets external data files. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t swath structure ID | | filelist const char* list of external files | | offset off_t array of offsets (in bytes) from the | | beginning of the file to the location | | in the file where the data starts | | size hsize_t array of sizes (in bytes) reserved in | | the file for the data. | | | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Apr 01 A.Muslimov Original development. | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWsetextdata(hid_t swathID, const char *filelist, off_t offset[], hsize_t size[]) { herr_t status = FAIL; /* return status variable */ int i; /* Loop index */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ long idx = FAIL; /* Swath index */ char *namebuf = (char *)NULL;/* File list buffer */ char *filename = (char *)NULL;/* File name buffer */ char *comma = (char *)NULL;/* Pointer to comma */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKPOINTER(filelist); CHECKPOINTER(offset); CHECKPOINTER(size); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWsetextdata", &fid, &gid, &idx); if(status == FAIL) { sprintf(errbuf,"Checking for valid swath ID failed.\n"); H5Epush(__FILE__, "HE5_SWsetextdata", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get current dataset creation property list */ /* ------------------------------------------ */ if( HE5_SWXSwath[idx].plist == FAIL) HE5_SWXSwath[idx].plist = H5Pcreate(H5P_DATASET_CREATE); /* Allocate space for namebuf, copy dimlist into it, & append comma */ /* ---------------------------------------------------------------- */ namebuf = (char *)calloc(strlen(filelist) + 64, sizeof(char)); if(namebuf == NULL) { H5Epush(__FILE__, "HE5_SWsetextdata", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory."); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); return(FAIL); } /* ******************************************************************** * C H E C K T H E C O N T E N T O F filelist S T R I N G * ******************************************************************** */ strcpy(namebuf, filelist); strcat(namebuf, ","); /* Find comma */ /* ---------- */ comma = strchr(namebuf, ','); i = 0; /* Parse the list of file names */ /* ---------------------------- */ while (comma != NULL) { /* Allocate memory for filename buffer */ /* ----------------------------------- */ filename = (char *) calloc(comma - namebuf + 1, sizeof(char)); if (filename == NULL) { sprintf(errbuf, "Cannot allocate memory for filename. \n") ; H5Epush(__FILE__, "HE5_SWsetextdata", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(namebuf); return(FAIL); } /* Copy file list entry to filename */ /* -------------------------------- */ memmove(filename, namebuf, comma - namebuf); filename[comma-namebuf] = 0; /* Set the property list */ /* --------------------- */ status = H5Pset_external(HE5_SWXSwath[idx].plist, filename, offset[i], size[i]); if(status == FAIL) { sprintf(errbuf,"Cannot set external dataset property list.\n"); H5Epush(__FILE__, "HE5_SWsetextdata", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(namebuf); free(filename); return(status); } /* Go to next file entry, find next comma, ... */ /* ============================================ */ memmove(namebuf, comma + 1, strlen(comma + 1) + 1); comma = strchr(namebuf, ','); if (filename != NULL) free(filename); i++; } if (namebuf != NULL) free(namebuf); COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWgetextdata | | | | DESCRIPTION: Gets external data files information. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nfiles int number of external files SUCCEED, | | (-1) FAIL | | INPUTS: | | swathID hid_t swath structure ID | | fieldname char* External field name | | | | OUTPUTS: | | namelength size_t Length of each name entry | | filelist char* List of file names | | offset off_t array of offsets (in bytes) from the | | beginning of the file to the location | | in the file where the data starts | | size hsize_t array of sizes (in bytes) reserved in | | the file for the data. | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Apr 01 A.Muslimov Original development. | | Sep 01 A. Muslimov Added mutex "lock"/"unlock" calls. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWgetextdata(hid_t swathID, char *fieldname, size_t namelength, char *filelist, off_t offset[], hsize_t size[]) { int nfiles = FAIL; /* Number of ext. files */ int i; /* Loop index */ size_t slen = 0; /* String length */ herr_t status = FAIL; /* return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t fieldID = FAIL; /* Data field ID */ hid_t plist = FAIL; /* Property list ID */ off_t off = 0; /* Offset of data segment */ hsize_t sz = 0; /* Size of data segment */ long idx = FAIL; /* Swath index */ char *filename = (char *)NULL;/* File name buffer */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKPOINTER(fieldname); /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_SWgetextdata", &fid, &gid, &idx); if(status == FAIL) { sprintf(errbuf,"Checking for valid swath ID failed.\n"); H5Epush(__FILE__, "HE5_SWgetextdata", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Check out the field group and get field ID */ /* ------------------------------------------ */ HE5_SWfldsrch(swathID,fieldname,&fieldID,NULL,NULL,NULL); if( fieldID == FAIL ) { sprintf(errbuf, "Cannot get the field ID for the \"%s\" field.\n", fieldname); H5Epush(__FILE__, "HE5_SWgetextdata", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the property list ID */ /* ------------------------ */ plist = H5Dget_create_plist(fieldID); if ( plist == FAIL ) { sprintf(errbuf, "Cannot get the property list ID for the \"%s\" data field.\n", fieldname); H5Epush(__FILE__, "HE5_SWgetextdata", __LINE__, H5E_PLIST, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the number of external files */ /* -------------------------------- */ nfiles = H5Pget_external_count(plist); if ( nfiles < 0 ) { sprintf(errbuf, "Cannot get the number of external files.\n"); H5Epush(__FILE__, "HE5_SWgetextdata", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Allocate memory for file name */ /* ----------------------------- */ filename = (char *)calloc(HE5_HDFE_NAMBUFSIZE, sizeof(char)); if(filename == NULL) { H5Epush(__FILE__, "HE5_SWgetextdata", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory."); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); return(FAIL); } strcpy(filelist,""); /* Loop through all external files */ /* ------------------------------- */ for (i = 0; i < nfiles; i++) { strcpy(filename,""); /* Get the file name, offset, and size */ /* ----------------------------------- */ status = H5Pget_external(plist, i, namelength, filename, &off, &sz); if( status == FAIL) { sprintf(errbuf,"Cannot get information about external file.\n"); H5Epush(__FILE__, "HE5_SWgetextdata", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(filename); return(FAIL); } offset[i] = off; size[i] = sz; strcat(filelist, filename); /* Append comma */ /* ------------ */ if (nfiles > 1 && i < nfiles - 1) strcat(filelist,","); } slen = strlen(filelist); filelist[slen] = 0; if (filename != NULL) free(filename); /* Release property list ID */ /* ------------------------ */ status = H5Pclose(plist); if (status == FAIL ) { sprintf(errbuf, "Cannot release property list ID.\n"); H5Epush(__FILE__, "HE5_SWgetextdata", __LINE__, H5E_PLIST, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } COMPLETION: HE5_UNLOCK; return (nfiles); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWindexinfo | | | | DESCRIPTION: Returns indices of a subsetted region | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | regionID hid_t Region ID | | object char* field name | | | | OUTPUTS: | | rank int* field rank | | dimlist char* field dimension list | | indices hsize_t* indices of region for along track dim. | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | June 04 S.Zhao Original development | | Oct 11 Abe Taaheri Modified correcting indicies for fields with | | ranks larger than 2 | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWindexinfo(hid_t regionID, char *object, int *rank, char *dimlist, hsize_t *indices[HE5_DTSETRANKMAX]) { herr_t status = FAIL; /* routine return status variable */ int j,k, fi, gi; /* loop index */ hid_t *nt = (hid_t *)NULL; /* number types */ hsize_t dims[HE5_DTSETRANKMAX];/* Dimension array */ char tempdimlist[HE5_HDFE_DIMBUFSIZE];/* Dimension list */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error buffer */ long index0, index1; CHECKPOINTER(object); /* Check for valid region ID */ /* ------------------------- */ if (regionID < 0 || regionID >= HE5_NSWATHREGN) { status = FAIL; sprintf(errbuf, "Invalid Region ID: %d.\n", regionID); H5Epush(__FILE__, "HE5_SWindexinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Check for active region ID */ /* -------------------------- */ if (HE5_SWXRegion[regionID] == 0) { status = FAIL; sprintf(errbuf, "Inactive Region ID: %d.\n", regionID); H5Epush(__FILE__, "HE5_SWindexinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Initialize dims[] array */ /* ----------------------- */ for (k = 0; k < HE5_DTSETRANKMAX; k++) dims[k] = 0; /* Allocate memory for nt variable */ /* ------------------------------- */ nt = (hid_t *)calloc(1, sizeof(hid_t)); if(nt == (hid_t *)NULL) { sprintf(errbuf, "Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_SWindexinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get field info for given object */ /* -------------------------- */ status = HE5_SWfieldinfo(HE5_SWXRegion[regionID]->swathID, object, rank, dims, nt, tempdimlist, NULL); if (status != SUCCEED) { sprintf(errbuf, "Field \"%s\" not found.\n", object); H5Epush(__FILE__, "HE5_SWindexinfo", __LINE__, H5E_ARGS, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(nt); return(FAIL); } strcpy(dimlist, tempdimlist); /* Find out Field indicies corresponding to the 1st and 2nd indicies of * Longitude (which automatically will be the same for Latitude or * Colatitude) field. For 2 or multi-dimansional fields, other than * Longitude, Latitude (or Colatitude) it is important to know these * indicies. */ status = HE5_SWllmapedidxinfo(HE5_SWXRegion[regionID]->swathID,object,&index0,&index1); if (status != SUCCEED) { sprintf(errbuf, "Field \"%s\" not found.\n", object); H5Epush(__FILE__, "HE5_SWindexinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* index0 is field index correcponding to the 0 index of Longitude */ /* index1 is field index correcponding to the 1 index of Longitude */ /* Vertical Subset or regular subset */ /* --------------------------------- */ for (j = 0; j < *rank; j++) { if(j == index0) { gi = 0; fi = index0; } else if(j == index1) { gi = 1; fi = index1; } else { if (j 7) gi = 7; } else { gi = j; } fi = j; } if (HE5_SWXRegion[regionID]->StartVertical[gi] == FAIL) { if (HE5_SWXRegion[regionID]->StartRegion[gi] == 0) { indices[fi][0] = 0; } else { indices[fi][0] = HE5_EHlong2hsize(HE5_SWXRegion[regionID]->StartRegion[gi]); } } else { if (HE5_SWXRegion[regionID]->StartVertical[gi] == 0) { indices[fi][0] = 0; } else { indices[fi][0] = HE5_EHlong2hsize(HE5_SWXRegion[regionID]->StartVertical[gi]); } } if (HE5_SWXRegion[regionID]->StopVertical[gi] == FAIL) { if (HE5_SWXRegion[regionID]->StopRegion[gi] == 0) { indices[fi][1] = dims[fi] - 1; } else { indices[fi][1] = HE5_EHlong2hsize(HE5_SWXRegion[regionID]->StopRegion[gi]); } } else { if (HE5_SWXRegion[regionID]->StopVertical[gi] == 0) { indices[fi][1] = dims[fi] - 1; } else { indices[fi][1] = HE5_EHlong2hsize(HE5_SWXRegion[regionID]->StopVertical[gi]); } } } free(nt); COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWllmapedidxinfo | | | | DESCRIPTION: Returns indices of a subsetted region | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t Swath ID | | object char* field name | | | | | | OUTPUTS: | | indices long 0th and 1st indices of the field | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Oct 11 Abe Taaheri Original development, | | Jan 12 AT Fixed problem with preventing memcpy to use | | unacceptable pointrs for ptr and ptr2 | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWllmapedidxinfo(hid_t swathID, char *object, long *index0, long *index1) { herr_t status = -1; /* routine return status variable */ herr_t statMap = -1; /* Status from SWmapinfo */ char dimlist[HE5_HDFE_DIMBUFSIZE];/* Dimension list */ char maxdimlist[HE5_HDFE_DIMBUFSIZE];/* Dimension list*/ int i,j,k, iDim; /* loop index */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error buffer */ hid_t nt, ntype; /* number types */ hsize_t dims[HE5_DTSETRANKMAX]; /* Dimension array */ int rank; char dimname0[HE5_HDFE_DIMBUFSIZE],dimname1[HE5_HDFE_DIMBUFSIZE]; char geodim[HE5_HDFE_DIMBUFSIZE]; /* Geolocation field dimension list */ char maxgeodim[HE5_HDFE_DIMBUFSIZE];/* Geolocation field max dimension list */ char geodimbuf[HE5_HDFE_DIMBUFSIZE];/* Geolocation field dimension list */ long nDim; /* Number of dimensions */ long mDim; /* Number of dimensions */ size_t slen[HE5_DTSETRANKMAX],slen2[HE5_DTSETRANKMAX]; /* String length array */ char *ptr[HE5_DTSETRANKMAX],*ptr2[HE5_DTSETRANKMAX]; /* String pointer array */ hsize_t dumdims[HE5_DTSETRANKMAX]; /* Dimensions from SWfieldinfo */ unsigned found = 0; /* Found flag */ char utlbuf[HE5_HDFE_DIMBUFSIZE]; /* Utility buffer */ long incr; /* Mapping increment */ hsize_t dummy; /* Dummy variable */ long dum; /* Dummy variable */ long *idxmap = NULL; /* Pointer to index mapping array */ hsize_t idxMapElem = 0; /* Number of index map elements */ long index[HE5_DTSETRANKMAX]; long maxrank = HE5_DTSETRANKMAX; /* Get data field info */ /* ------------------- */ status = HE5_SWfieldinfo(swathID, object, &rank, dims, &ntype, dimlist, maxdimlist); if (status != 0) { status = -FAIL; sprintf(errbuf,"Cannot get information about \"%s\" field. \n", object); H5Epush(__FILE__, "HE5_SWllmapedidxinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = HE5_SWfieldinfo(swathID, "Longitude", &rank, dumdims, &nt, geodim, maxgeodim); if (status != 0) { sprintf(errbuf, "Field \"%s\" not found.\n", "Longitude"); H5Epush(__FILE__, "HE5_SWllmapedidxinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get "Track" (first) Dimension from geo dimlist */ /* ---------------------------------------------- */ for(iDim=0; iDim 0) { found = 1; index[iDim] = i; break; } } } found = 0; } *index0 = index[0]; *index1 = index[1];; return(status); } /*---------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWgetstringtype | | | | DESCRIPTION: Determines type of STRING as H5T_NATIVE_CHAR or | | HE5T_CHARSTRING. These are two two different | | types of Strings that HDF-EOS uses for data fieleds | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | String datatype int return status H5T_NATIVE_CHAR or | | HE5T_CHARSTRING if succeed, (-1) FAIL | | | | INPUTS: | | swathID hid_t Swath structure ID | | fldname char Fieldname | | classid H5T_class_t Class ID | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 08/1/06 Abe Taaheri Original programmer | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWgetstringtype(hid_t swathID, char *fldname, H5T_class_t classid) { char *attrlist1 = (char *)NULL;/* attribute list */ long strbufsize1; /* string buffer size */ char fldactualname[HE5_HDFE_NAMBUFSIZE];/* Actual field name */ char fieldname[HE5_HDFE_NAMBUFSIZE]; /* Field name buffer */ char *attptr = (char *)NULL; /* attribute pointer */ herr_t status = SUCCEED; /* return status variable */ char *errbuf = (char *)NULL; /* error message buffer */ int attr = H5T_NATIVE_CHAR; /* attribute value */ int nameflag = FAIL; /* Name flag (0-alias,1-actual) */ long nattr = FAIL; /* Number of attributes (return)*/ HE5_LOCK; CHECKPOINTER(fldname); if(classid != H5T_STRING)/* if field is not string type, return error */ { sprintf(errbuf, "Cannot get strig type for none-string field.\n"); H5Epush(__FILE__, "HE5_SWgetstringtype", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } else { /* Call HE5_SWfldnameinfo() to get actual field name */ /* --------------------------------------------- */ nameflag = HE5_SWfldnameinfo(swathID, fldname, fldactualname); if ( nameflag == FAIL ) { sprintf(errbuf, "Cannot get actual name of the field.\n"); H5Epush(__FILE__, "HE5_SWgetstringtype", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Name is not alias */ /* ----------------- */ if (nameflag == TRUE) { strcpy(fieldname,""); strcpy(fieldname,fldname); } /* Name is an alias */ /* ---------------- */ if (nameflag == FALSE) { strcpy(fieldname,""); strcpy(fieldname,fldactualname); } strbufsize1 = 0; nattr = HE5_SWinqlocattrs(swathID, fieldname, NULL, &strbufsize1); if ( nattr <= 0 )/* this means ARRAYOFSTRINGS attribute does not exist, therefore, String datatype cannot be HE5T_CHARSTRING, or H5T_C_S1 type */ { return(HE5T_NATIVE_CHAR); } attrlist1 = (char *) calloc(strbufsize1 + 2, sizeof(char)); if (attrlist1 == NULL) { sprintf(errbuf, "Cannot allocate memory for attrlist1.\n") ; H5Epush(__FILE__, "HE5_SWgetstringtype", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } nattr = HE5_SWinqlocattrs(swathID, fieldname, attrlist1, &strbufsize1); attptr = strstr(attrlist1,"ARRAYOFSTRINGS"); if ( (classid == H5T_STRING) && (attptr == NULL) ) { /* this means ARRAYOFSTRINGS attribute does not exist, therefore, String datatype cannot be HE5T_CHARSTRING, or H5T_C_S1 type */ return(HE5T_NATIVE_CHAR); } else if((classid == H5T_STRING) && (attptr != NULL) ) { status = HE5_SWreadlocattr(swathID, fieldname, "ARRAYOFSTRINGS", &attr); if(status ==FAIL) { sprintf(errbuf, "Cannot read attribute from the field \"%s\".", fieldname) ; H5Epush(__FILE__, "HE5_SWgetstringtype", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } if(attr == HE5T_CHARSTRING) { return(HE5T_CHARSTRING); } else { return(HE5T_NATIVE_CHAR); } } } COMPLETION: HE5_UNLOCK; return (attr); } /* ****************************************************************************** | | | F O R T R A N 7 7 W R A P P E R S | | | ****************************************************************************** */ /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWopenF (FORTRAN wrapper) | | | | DESCRIPTION: | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | FileID int None HDF-EOS file ID | | | | INPUTS: | | filename char* None File name string | | Flags int None File access code | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ======== ============ ================================================= | | Aug 00 A.Muslimov | | Mar 02 A.Muslimov Added "Flags" values for core methadata. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWopenF(char *filename, int Flags) { hid_t fid = FAIL;/* HDF5 file ID */ int FileID = FAIL;/* hdf-eos file ID */ uintn flags = 9999;/* HDF5 file access code */ char *errbuf = NULL;/* Error message buffer */ /* Allocate memory for error buffer */ /* -------------------------------- */ errbuf = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_SWopenF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory to error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Set up the file access flag */ /* --------------------------- */ if (Flags == HE5F_ACC_RDWR || Flags == HDF5_ACC_RDWR) flags = H5F_ACC_RDWR; else if (Flags == HE5F_ACC_RDONLY || Flags == HDF5_ACC_RDONLY) flags = H5F_ACC_RDONLY; else if (Flags == HE5F_ACC_TRUNC || Flags == HDF5_ACC_CREATE) flags = H5F_ACC_TRUNC; else { sprintf(errbuf, "File access flag is not supported. \n"); H5Epush(__FILE__, "HE5_SWopenF", __LINE__, H5E_ARGS, H5E_UNSUPPORTED, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Call HE5_EHopen to open file */ /* ---------------------------- */ fid = HE5_EHopen(filename, flags, H5P_DEFAULT); if(fid == FAIL) { sprintf(errbuf, "Cannot open the file \"%s\". Check the file name. \n", filename); H5Epush(__FILE__, "HE5_SWopenF", __LINE__, H5E_FILE, H5E_CANTOPENFILE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } free(errbuf); FileID = (int)fid; return(FileID); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWcreateF (FORTRAN wrapper) | | | | DESCRIPTION: Creates a new swath structure and returns swath ID | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | SwathID int None Swath ID | | | | INPUTS: | | FileID int None HDF-EOS file ID | | swathname char* None Swath name string | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 00 A. Muslimov | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWcreateF(int FileID, char *swathname) { hid_t swathID = FAIL;/* return value of Swath ID */ hid_t fid = FAIL;/* HDF-EOS file ID */ int SwathID = FAIL;/* int Swath ID */ char *errbuf =(char *)NULL;/* Buffer for error message */ /* Allocate memory for error buffer */ /* -------------------------------- */ errbuf = (char *)calloc(HE5_HDFE_DIMBUFSIZE, sizeof(char ) ) ; if ( errbuf == NULL ) { H5Epush(__FILE__, "HE5_SWcreateF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } fid = (hid_t)FileID; swathID = HE5_SWcreate(fid, swathname); if (swathID == FAIL) { sprintf(errbuf,"Cannot create Swath. \n"); H5Epush(__FILE__, "HE5_SWcreateF", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } SwathID = (int)swathID; /* Deallocate memory */ /* ----------------- */ free(errbuf); return(SwathID); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWattachF (FORTRAN wrapper) | | | | DESCRIPTION: Attaches to an existing swath within the file. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | SwathID int swath structure ID | | | | INPUTS: | | FileID int HDF-EOS file ID | | swathname char swath structure name | | | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ========= ============ ============================================== | | Aug 00 A.Muslimov | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWattachF(int FileID, char *swathname) { int SwathID = FAIL;/* int Swath ID (return) */ hid_t swathID = FAIL;/* Swath ID (return value) */ hid_t fid = FAIL;/* HDF-EOS file ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ fid = (hid_t)FileID; swathID = HE5_SWattach(fid, swathname); if (swathID == FAIL) { sprintf(errbuf,"Cannot attach to the Swath \"%s\". \n", swathname); H5Epush(__FILE__, "HE5_SWattachF", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } SwathID = (int)swathID; return (SwathID); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWdetachF (FORTRAN wrapper) | | | | DESCRIPTION: Detachs swath structure and performs housekeeping | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int swath structure ID | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 00 A.Muslimov | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWdetachF(int SwathID) { int ret = FAIL;/* int return status */ hid_t swathID = FAIL;/* HDF-EOS Swath ID */ herr_t status = FAIL;/* routine return status variable */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ swathID = (hid_t)SwathID; status = HE5_SWdetach(swathID); if (status == FAIL) { sprintf(errbuf,"Cannot detach from the Swath. \n"); H5Epush(__FILE__, "HE5_SWdetachF", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWcloseF (FORTRAN wrapper) | | | | DESCRIPTION: Closes HDF-EOS file | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | FileID int File ID | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 00 A.Muslimov | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWcloseF(int FileID) { int ret = FAIL;/* int return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ herr_t status = FAIL;/* routine return status variable */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ fid = (hid_t)FileID; status = HE5_SWclose(fid); if (status == FAIL) { sprintf(errbuf,"Cannot close the file. \n"); H5Epush(__FILE__, "HE5_SWcloseF", __LINE__, H5E_FILE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWdefdimF | | | | DESCRIPTION: Defines numerical value of dimension (FORTRAN wrapper) | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int swath structure ID | | dim. name char dimension name | | dim. size long dimension size | | | | OUTPUTS: | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | May 00 D.Wynne Original Version | | Sep 00 A.Muslimov Updated to reflect most recent data type changes. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWdefdimF(int SwathID, char *dimname, long dim) { int ret = SUCCEED;/* (int) return status variable */ hid_t swathID = FAIL; /* HDF5 type swath ID */ herr_t status = SUCCEED;/* HDF5 type return status */ hsize_t tdim = 0; /* temporary(dimension) variable */ char *errbuf = (char *)NULL;/* Error message buffer */ errbuf = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); tdim = (hsize_t)dim; swathID = (hid_t)SwathID; status = HE5_SWdefdim(swathID, dimname, tdim); if ( status == FAIL ) { sprintf(errbuf, "Error calling HE5_SWdefdim from FORTRAN wrapper. \n"); H5Epush(__FILE__, "HE5_SWdefdimF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWdefdimmapF | | | | DESCRIPTION: Defines mapping between geolocation and data dimensions | | (FORTRAN wrapper) | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int swath structure ID | | geo dim. char geolocation dimension | | data dim. char data dimension | | offset long offset between dimensions | | incr long increment between dimensions | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | May 00 D.Wynne Original Version | | Sep 00 A.Muslimov Updated to reflect most recent data type changes. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWdefdimmapF(int SwathID, char *geodim, char *datadim, long offset, long increment) { herr_t status = SUCCEED;/* HDF5 type status variable */ int ret = SUCCEED;/* (int) return variable */ hid_t swathID = FAIL; /* HDF5 type swath ID */ hsize_t toffset = 0; /* offset variable */ hsize_t tincrement = 0; /* increment variable */ char *errbuf = (char *)NULL;/* Error message buffer */ errbuf = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); /* Cast variable datatype to HDF5 datatype for HDF function calls */ /* -------------------------------------------------------------- */ toffset = (hsize_t)offset; tincrement = (hsize_t)increment; swathID = (int)SwathID; status = HE5_SWdefdimmap(swathID, geodim, datadim, toffset, tincrement); if ( status == FAIL ) { sprintf(errbuf, "Error calling SWdefdimmap from FORTRAN wrapper. \n"); H5Epush(__FILE__, "HE5_SWdefdimmapF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWdefidxmapF | | | | DESCRIPTION: Defines index mapping between geolocation and data dimensions | | (FORTRAN wrapper) | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int swath structure ID | | geo dim. char geolocation dimension | | data dim. char data dimension | | index long array of indices | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 00 A.Muslimov Original Version | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWdefidxmapF(int SwathID, char *geodim, char *datadim, long index[]) { herr_t status = SUCCEED;/* HDF5 type return status variable */ int ret = SUCCEED;/* (int) return status variable */ hid_t swathID = FAIL; /* HDF5 type swath ID */ char *errbuf = (char *)NULL;/* Error message buffer */ errbuf = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); swathID = (hid_t)SwathID; status = HE5_SWdefidxmap(swathID, geodim, datadim, index); if ( status == FAIL ) { sprintf(errbuf, "Error calling SWdefidxmap from FORTRAN wrapper. \n"); H5Epush(__FILE__, "HE5_SWdefidxmapF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWdefgfld | | | | DESCRIPTION: Defines geolocation field within swath structure (FORTRAN) | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID int swath structure ID | | fieldname char fieldname | | fortdimlist char Dimension list (comma-separated list) | | FORTRAN dimesion order | | fortmaxdimlist char Max Dimension list (FORTRAN order) | | numbertype int field type | | merge int merge code | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Nov 99 Abe Taaheri Modified for HDF5 | | May 00 D.Wynne Updated to reflect datatypes changes throughout | | the library | | Sep 00 A.Muslimov Updated to reflect most recent data type changes. | | Nov 00 A.Muslimov Updated to reverse order of "fortmaxdimlist"entries.| | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWdefgfld(int swathID, char *fieldname, char *fortdimlist, char *fortmaxdimlist, int numtype, int merge) { int ret = SUCCEED; /* (int) return status variable */ herr_t status = SUCCEED; /* routine return status variable */ hid_t SwathID = FAIL; /* HDF5 type swath ID */ hid_t numbertype = FAIL; /* HDF5 tyep data type ID */ char *dimlist = (char *)NULL;/* Dimension list (C order) */ char *maxdimlist= (char *)NULL;/* Max. dimension list (C) */ char *errbuf = (char *)NULL;/* error message buffer */ /* Allocate memory for error message buffers */ /* ----------------------------------------- */ errbuf = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_SWdefgfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } if(strcmp(fortmaxdimlist,"") == 0) fortmaxdimlist = NULL; /* Convert data type ID */ /* -------------------- */ numbertype = HE5_EHconvdatatype(numtype); if(numbertype == FAIL) { sprintf(errbuf,"Cannot convert \"int\" data type ID to HDF5 data type ID.\n"); H5Epush(__FILE__, "HE5_SWdefgfld", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Allocate space for C order dimension list */ /* ----------------------------------------- */ dimlist = (char *)calloc(strlen(fortdimlist) + 1, sizeof(char)); if(dimlist == NULL) { sprintf(errbuf,"Cannot allocate memory for dimlist.\n"); H5Epush(__FILE__, "HE5_SWdefgfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Reverse entries in dimension list (FORTRAN -> C) */ /* ------------------------------------------------ */ status = HE5_EHrevflds(fortdimlist, dimlist); if(status == FAIL) { sprintf(errbuf,"Cannot reverse entries in dimension list.\n"); H5Epush(__FILE__, "HE5_SWdefgfld", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); return(FAIL); } if (fortmaxdimlist != NULL) { /* Allocate space for C order maximum dimension list */ /* ------------------------------------------------- */ maxdimlist = (char *)calloc(strlen(fortmaxdimlist) + 1, sizeof(char)); if(maxdimlist == NULL) { sprintf(errbuf,"Cannot allocate memory for maxdimlist.\n"); H5Epush(__FILE__, "HE5_SWdefgfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(dimlist); free(errbuf); return(FAIL); } /* Reverse entries in maximum dimension list (FORTRAN -> C) */ /* -------------------------------------------------------- */ status = HE5_EHrevflds(fortmaxdimlist, maxdimlist); if(status == FAIL) { sprintf(errbuf,"Cannot reverse entries in maximum dimension list.\n"); H5Epush(__FILE__, "HE5_SWdefgfld", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(maxdimlist); return(FAIL); } } else { maxdimlist = NULL; } SwathID = (hid_t)swathID; /* Call Define Field routine */ /* ------------------------- */ status = HE5_SWdefinefield(SwathID, "Geolocation Fields", fieldname, dimlist, maxdimlist, numbertype, merge); if(status == FAIL) { sprintf(errbuf,"Error calling HE5_SWdefinefield() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_SWdefgfld", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); if (maxdimlist !=NULL) free(maxdimlist); return(FAIL); } free(dimlist); if (maxdimlist !=NULL) free(maxdimlist); free(errbuf); ret = (int)status; return (ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWdefdfld | | | | | | DESCRIPTION: Defines data field within swath structure (FORTRAN) | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID int swath structure ID | | fieldname char fieldname | | fortdimlist char Dimension list (comma-separated list) | | FORTRAN dimesion order | | fortmaxdimlist char Max Dimension list (FORTRAN order) | | numbertype int field type | | merge int merge code | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Sep 00 A.Muslimov Updated to reflect most recent data type changes. | | Nov 00 A.Muslimov Updated to reverse order of "fortmaxdimlist"entries.| | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWdefdfld(int swathID, char *fieldname, char *fortdimlist, char *fortmaxdimlist, int numtype, int merge) { int ret = SUCCEED;/* (int) return status variable */ herr_t status = SUCCEED;/* routine return status variable */ hid_t SwathID = FAIL; /* HDF5 type swath ID */ hid_t numbertype = FAIL; /* HDF5 type data type ID */ char *dimlist = (char *)NULL;/* Dimension list (C order) */ char *maxdimlist= (char *)NULL;/* Max. dimension list (C) */ char *errbuf = (char *)NULL;/* error message buffer */ SwathID = (hid_t)swathID; numbertype = HE5_EHconvdatatype(numtype); if(numbertype == FAIL) { H5Epush(__FILE__, "HE5_SWdefdfld", __LINE__, H5E_DATATYPE, H5E_BADVALUE, "Cannot convert datatype for FORTRAN wrapper."); HE5_EHprint("Error: Cannot convert datatype for FORTRAN wrapper, occured", __FILE__, __LINE__); return(FAIL); } if(strcmp(fortmaxdimlist,"") == 0) fortmaxdimlist = NULL; /* Allocate memory for error message buffers */ /* ----------------------------------------- */ errbuf = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_SWdefdfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Allocate space for C order dimension list */ /* ----------------------------------------- */ dimlist = (char *)calloc(strlen(fortdimlist) + 1, sizeof(char)); if(dimlist == NULL) { sprintf(errbuf,"Cannot allocate memory for dimlist.\n"); H5Epush(__FILE__, "HE5_SWdefdfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Reverse entries in dimension list (FORTRAN -> C) */ /* ------------------------------------------------ */ status = HE5_EHrevflds(fortdimlist, dimlist); if(status == FAIL) { sprintf(errbuf,"Cannot reverse entries in dimension list.\n"); H5Epush(__FILE__, "HE5_SWdefdfld", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); return(FAIL); } if (fortmaxdimlist != NULL) { /* Allocate space for C order max. dim. list */ /* ----------------------------------------- */ maxdimlist = (char *)calloc(strlen(fortmaxdimlist) + 1, sizeof(char)); if(maxdimlist == NULL) { sprintf(errbuf,"Cannot allocate memory for maxdimlist.\n"); H5Epush(__FILE__, "HE5_SWdefdfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(dimlist); free(errbuf); return(FAIL); } /* Reverse entries in dimension list (FORTRAN -> C) */ /* ------------------------------------------------ */ status = HE5_EHrevflds(fortmaxdimlist, maxdimlist); if(status == FAIL) { sprintf(errbuf,"Cannot reverse entries in maximum dimension list.\n"); H5Epush(__FILE__, "HE5_SWdefdfld", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(maxdimlist); return(FAIL); } } else { maxdimlist = NULL; } /* Call Define Field routine */ /* ------------------------- */ status = HE5_SWdefinefield(SwathID, "Data Fields", fieldname, dimlist, maxdimlist, numbertype, merge); if(status == FAIL) { sprintf(errbuf,"Cannot define \"%s\" field.\n", fieldname); H5Epush(__FILE__, "HE5_SWdefdfld", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); if (maxdimlist!=NULL) free(maxdimlist); return(FAIL); } free(dimlist); if (maxdimlist != NULL) free(maxdimlist); free(errbuf); ret = (int)status; return (ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWdefcompF (FORTRAN wrapper) | | | | DESCRIPTION: Defines compression type and parameters | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int Swath structure ID | | compcode int compression code | | compparm int compression parameters | | | | OUTPUTS: | | None | | | | NOTES: Before calling this function, storage must be CHUNKED | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 00 A.Muslimov | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWdefcompF(int SwathID, int compcode, int *compparm) { int ret = FAIL; /* routine return status variable */ herr_t status = FAIL; /* routine return status variable */ hid_t swathID = FAIL; /* HDF5 type Swath ID */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ swathID = (hid_t)SwathID; status = HE5_SWdefcomp(swathID, compcode, compparm); if(status == FAIL) { sprintf(errbuf,"Error calling SWdefcomp() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_SWdefcompF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWdefchunkF | | | | DESCRIPTION: FORTRAN wrapper for SWdefchunk | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int swath structure ID | | ndims int rank of a dataset | | *dim long pointer to the array containing sizes | | of each dimension of a chunk | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ========= ============ ============================================== | | 8/13/99 A.Muslimov Changed the return type of SWdefchunk from intn | | to herr_t. Checked the statuses for H5P... calls.| | May 00 D.Wynne Updated to reflect datatype changes in Library | | Aug 00 A.Muslimov Updated to reflect data type changes. | | Jan 01 A.Muslimov Added proper FORTRAN to C dimension order | | conversion. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWdefchunkF(int SwathID, int ndims, long *dim) { int ret = FAIL; /* return status */ int j = 0; /* Loop index */ herr_t status = FAIL; /* return status */ hid_t swathID = FAIL; /* HDF5 type swath ID */ hsize_t *tempdims = (hsize_t *)NULL;/* Temporary variable */ char *errbuf = (char *)NULL; /* error message buffer */ /* Allocate memory for error message buffer */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_SWdefchunkF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Allocate space for C order dimension list */ /* ----------------------------------------- */ tempdims = (hsize_t *)calloc(ndims, sizeof(hsize_t)); if(tempdims == NULL) { sprintf(errbuf,"Cannot allocate memory for tempdims.\n"); H5Epush(__FILE__, "HE5_SWdefchunkF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Change from FORTRAN to C dimension order */ /* ---------------------------------------- */ for (j = 0; j < ndims; j++) tempdims[j] = (hsize_t)dim[ndims - 1 - j]; swathID = (hid_t)SwathID; status = HE5_SWdefchunk(swathID, ndims, tempdims); if(status == FAIL) { sprintf(errbuf,"Error calling SWdefchunk() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_SWdefchunkF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(tempdims); return(FAIL); } free(tempdims); free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWcompinfoF (FORTRAN wrapper) | | | | DESCRIPTION: | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int None Return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int None Swath Object ID | | compcode int | | compparm int | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 00 A.Muslimov | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWcompinfoF(int SwathID, char *fieldname, int *compcode, int compparm[]) { int ret = FAIL; /* Return status variable */ herr_t status = FAIL; /* Return status variable */ hid_t swathID = FAIL; /* HDF5 type Swath ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ swathID = (hid_t)SwathID; status = HE5_SWcompinfo(swathID, fieldname, compcode, compparm); if (status == FAIL) { sprintf(errbuf , "Compression information for \"%s\" not found.\n", fieldname); H5Epush(__FILE__, "HE5_SWcompinfoF", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWwrcharfld | | | | DESCRIPTION: Writes data to a character string field (FORTRAN wrapper | | around SWwritefield) | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int swath structure ID | | fieldname char fieldname | | elemlen int each element length in array of string | | numelem int number of elements in declared buffer | | array | | fortstart long start array | | fortstride long stride array | | fortedge long edge array | | | | OUTPUTS: | | data void data buffer for write | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Feb 04 S.Zhao For an array of character string dataset. | | Jun 04 S.Zhao Added one more argument (numelem). | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWwrcharfld(int SwathID, char *fieldname, int elemlen, int numelem, long fortstart[], long fortstride[], long fortedge[], void *data) { int ret = SUCCEED; /* int return status variable */ int i; /* Loop index */ int rank = 0; /* Field rank */ herr_t status = SUCCEED; /* routine return status variable */ hid_t ntype[1] = {FAIL}; /* Field numbertypes */ hid_t swathID = FAIL; /* HDF-EOS swath ID */ hssize_t *start = (hssize_t *)NULL;/* Pointer to start array (C order) */ hsize_t dims[HE5_DTSETRANKMAX]; /* Field dimensions */ hsize_t *stride = (hsize_t *)NULL; /* Pointer to stride array (C order) */ hsize_t *edge = (hsize_t *)NULL; /* Pointer to edge array (C order) */ char *errbuf = (char *)NULL; /* error message buffer */ char **strdatabuf = NULL; /* string data buffer */ int nelem = 0; /* number of elements in array of str*/ int strsize = 0; /* each str length in array of str */ char *blankPtr = (char *)NULL; /* pointer to blank character */ char *tmpString = (char *)NULL; /* pointer to temp string */ int attr = 0; /* attribute value */ hsize_t count[1]; /* number of attribute elements */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_SWwrcharfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } swathID = (hid_t)SwathID; /* Initialize dims[] array */ /* ----------------------- */ for ( i = 0; i < HE5_DTSETRANKMAX; i++) dims[ i ] = 0; /* Get field info */ /* --------------- */ status = HE5_SWfieldinfo(swathID, fieldname, &rank, dims, ntype, NULL, NULL); if (status != FAIL) { start = (hssize_t *)calloc(rank, sizeof(hssize_t)); if(start == NULL) { sprintf(errbuf,"Cannot allocate memory for start.\n"); H5Epush(__FILE__, "HE5_SWwrcharfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } stride = (hsize_t *)calloc(rank, sizeof(hsize_t)); if(stride == NULL) { sprintf(errbuf,"Cannot allocate memory for stride.\n"); H5Epush(__FILE__, "HE5_SWwrcharfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(errbuf); return(FAIL); } edge = (hsize_t *)calloc(rank, sizeof(hsize_t)); if(edge == NULL) { sprintf(errbuf,"Cannot allocate memory for edge.\n"); H5Epush(__FILE__, "HE5_SWwrcharfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(stride); free(errbuf); return(FAIL); } /* Reverse order of dimensions (FORTRAN -> C) */ /* ------------------------------------------ */ for (i = 0; i < rank; i++) { start[i] = (hssize_t)fortstart[rank - 1 - i]; stride[i] = (hsize_t)fortstride[rank - 1 - i]; edge[i] = (hsize_t)fortedge[rank - 1 - i]; } strsize = elemlen; nelem = dims[0]; tmpString = (char *)calloc(1,strsize+1); if(tmpString == NULL) { sprintf(errbuf,"Cannot allocate memory for tmpString.\n"); H5Epush(__FILE__, "HE5_SWwrcharfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(stride); free(edge); free(errbuf); return(FAIL); } strdatabuf = (char **)malloc(nelem*sizeof(char *)); for (i = 0; i C) */ /* ------------------------------------------ */ for (i = 0; i < rank; i++) { start[i] = (hssize_t)fortstart[rank - 1 - i]; stride[i] = (hsize_t)fortstride[rank - 1 - i]; edge[i] = (hsize_t)fortedge[rank - 1 - i]; } myedge = (hsize_t *)calloc(rank, sizeof(hsize_t)); if(myedge == NULL) { sprintf(errbuf,"Cannot allocate memory for edge.\n"); H5Epush(__FILE__, "HE5_SWwrfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(stride); free(edge); free(errbuf); return(FAIL); } /* get maxdims for the field */ status = HE5_SWflddiminfo(swathID, fieldname, &rank, dims, maxdims); /* see if we need first to extend data dimensions for unlimited dimensions */ for (i = 0; i < rank; i++) { if( dims[i] == maxdims[i] ) append = FALSE; else if ( (dims[i] < maxdims[i]) || (maxdims[i] == H5S_UNLIMITED)) { append = TRUE; break; } } unlimdim = i; if(append == FALSE) { for (i = 0; i < rank; i++) { if(edge[i] > dims[i]) myedge[i] = dims[i]; else myedge[i] = edge[i]; } } else { for (i = 0; i < rank; i++) { myedge[i] = edge[i]; } } if((append == TRUE) && (edge[unlimdim] > dims[unlimdim])) { hssize_t newstart[8]; hsize_t newedge[8]; for (i = 0; i < rank; i++) { newstart[i]=start[i]; newedge[i] = edge[i]; } newstart[unlimdim]=edge[unlimdim]-1; newedge[unlimdim] = 1; status = HE5_SWwrrdfield(swathID, fieldname, "w", newstart, stride, newedge,data); if (status == FAIL) { sprintf(errbuf, "Cannot write data to the field \"%s\".",fieldname) ; H5Epush(__FILE__, "HE5_SWwrfld", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(stride); free(edge); free(myedge); free(errbuf); return(FAIL); } else { for (i = 0; i < rank; i++) { dims[i]=edge[i]; } } } status = HE5_SWwrrdfield(swathID, fieldname, "w", start, stride, myedge,data); if (status == FAIL) { sprintf(errbuf, "Cannot write data to the field \"%s\".",fieldname) ; H5Epush(__FILE__, "HE5_SWwrfld", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(stride); free(edge); free(myedge); free(errbuf); return(FAIL); } free(start); free(stride); free(edge); free(myedge); free(errbuf); } else { sprintf(errbuf, "Error calling HE5_SWfieldinfo() from FORTRAN wrapper. \n") ; H5Epush(__FILE__, "HE5_SWwrfld", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); status = FAIL; free(errbuf); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWwrattr | | | | DESCRIPTION: FORTRAN wrapper for Writes/updates attribute in a swath. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int swath structure ID | | attrname char* attribute name | | numtype int attribute HDF numbertype | | fortcount[] long Number of attribute elements | | datbuf void I/O buffer | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Oct 99 Abe Taaheri Modified data types | | Aug 00 A.Muslimov Modified to conform to HDF5 data types | | Nov 02 S.Zhao Modified to get the size of a string attribute. | | Mar 04 S.Zhao Modified for a character string attribute. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWwrattr(int SwathID, char *attrname, int numtype, long fortcount[], void * datbuf) { int ret = FAIL;/* int return status variable */ int rank = 1; /* Note: It is assumed that fortcout has just */ /* one element to agree with EHattr function */ int i; /* Loop index */ hid_t swathID = FAIL;/* HDF-EOS Swath ID */ hid_t numbertype = FAIL;/* HDF5 data type ID */ herr_t status = FAIL;/* routine return status variable */ hsize_t *count = (hsize_t *)NULL;/* Pointer to count array (C order)*/ char *errbuf = (char *)NULL; /* error message buffer */ char *tempbuf = (char *)NULL; /* temp buffer */ numbertype = HE5_EHconvdatatype(numtype); if(numbertype == FAIL) { H5Epush(__FILE__, "HE5_SWwrattr", __LINE__, H5E_DATATYPE, H5E_BADVALUE, "Error calling HE5_EHconvdatatype() from FORTRAN wrapper."); HE5_EHprint("Error: Error calling HE5_EHconvdatatype() from FORTRAN wrapper, occured", __FILE__, __LINE__); return(FAIL); } /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_SWwrattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Allocate memory for "count" array */ /* --------------------------------- */ count = (hsize_t *)calloc(rank, sizeof(hsize_t)); if( count == NULL) { sprintf(errbuf,"Cannot allocate memory for count.\n"); H5Epush(__FILE__, "HE5_SWwrattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Reverse order of dimensions (FORTRAN -> C) */ /* ------------------------------------------ */ for (i = 0; i < rank; i++) { count[i] = (hsize_t)fortcount[rank - 1 - i]; } swathID = (hid_t)SwathID; if ((numbertype == HE5T_CHARSTRING) || (numbertype == H5T_NATIVE_CHAR) || (numbertype == H5T_C_S1)) { if (strlen((char *)datbuf) < count[0]) { sprintf(errbuf,"Size of databuf is less than the number of attribute elements.\n"); H5Epush(__FILE__, "HE5_SWwrattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); return(FAIL); } /* Allocate memory for temp buffer */ /* ------------------------------- */ tempbuf = (char * )calloc((count[0]+1), sizeof(char)); if(tempbuf == NULL) { sprintf(errbuf,"Cannot allocate memory for temp buffer.\n"); H5Epush(__FILE__, "HE5_SWwrattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); return(FAIL); } strncpy(tempbuf, (char *)datbuf, count[0]); tempbuf[count[0]] = '\0'; /* Call SWwriteattr() */ /* ------------------ */ status = HE5_SWwriteattr(swathID, attrname, numbertype, count, tempbuf); if( status == FAIL) { sprintf(errbuf,"Cannot write data to the attribute \"%s\".\n", attrname); H5Epush(__FILE__, "HE5_SWwrattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); free(tempbuf); return(FAIL); } free(count); free(errbuf); free(tempbuf); } else { /* Call SWwriteattr() */ /* ------------------ */ status = HE5_SWwriteattr(swathID, attrname, numbertype, count, datbuf); if( status == FAIL) { sprintf(errbuf,"Cannot write data to the attribute \"%s\".\n", attrname); H5Epush(__FILE__, "HE5_SWwrattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); return(FAIL); } free(count); free(errbuf); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWsetfill (FORTRAN wrapper) | | | | DESCRIPTION: Sets fill value for the specified field. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int swath structure ID | | fieldname char* field name | | fillval void* fill value | | | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 00 A.Muslimov | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWsetfill(int SwathID, char *fieldname, int numtype, void *fillval) { int ret = FAIL;/* int return status variable */ herr_t status = FAIL;/* return status variable */ hid_t numbertype = FAIL;/* HDF5 data tyope ID */ hid_t swathID = FAIL;/* HDF5 Swath ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ numbertype = HE5_EHconvdatatype(numtype); if(numbertype == FAIL) { sprintf(errbuf,"Cannot convert to HDF5 type data type ID from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_SWsetfill", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } swathID = (hid_t)SwathID; status = HE5_SWsetfillvalue(swathID, fieldname, numbertype, fillval); if (status == FAIL) { sprintf(errbuf,"Cannot set fill value for the field \"%s\".\n", fieldname); H5Epush(__FILE__, "HE5_SWsetfill", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWgetfill (FORTRAN wrapper) | | | | DESCRIPTION: Retrieves fill value for a specified field. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int Swath structure ID | | fieldname char* field name | | | | OUTPUTS: | | fillval void* fill value | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 00 A.Muslimov | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWgetfill(int SwathID, char *fieldname, void *fillval) { int ret = FAIL;/* routine return status variable */ herr_t status = FAIL;/* routine return status variable */ hid_t swathID = FAIL;/* HDF5 type swath ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ swathID = (hid_t)SwathID; status = HE5_SWgetfillvalue(swathID, fieldname, fillval); if (status == FAIL) { sprintf(errbuf,"Cannot get fill value for the field \"%s\".\n", fieldname); H5Epush(__FILE__, "HE5_SWgetfill", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } ret = (int)status; return (ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWrdfld | | | | DESCRIPTION: Reads data from field (FORTRAN wrapper around SWreadfield) | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int swath structure ID | | fieldname char fieldname | | fortstart long start array | | fortstride long stride array | | fortedge long edge array | | buffer void data buffer for read | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Nov 99 Abe Taaheri Modified for HDF5 | | May 00 D.Wynne Updated to reflect data type changes | | Aug 00 A.Muslimov Updated to conform to HDF5 data types | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWrdfld(int SwathID, char *fieldname, long fortstart[], long fortstride[], long fortedge[], void *buffer) { int ret = SUCCEED; /* routine return status variable */ int i = 0; /* Loop index */ int rank = 0; /* Field rank */ hid_t ntype[1] = {FAIL}; /* Field number types */ hid_t swathID = FAIL; /* Swath HDF5 type ID */ herr_t status = SUCCEED; /* routine return status variable */ hssize_t *start = (hssize_t *)NULL;/* Pointer to start array (C order) */ hsize_t dims[HE5_DTSETRANKMAX]; /* Field dimensions */ hsize_t *stride = (hsize_t *)NULL; /* Pointer to stride array (C order) */ hsize_t *edge = (hsize_t *)NULL; /* Pointer to edge array (C order) */ char *errbuf = (char *)NULL; /* error message buffer */ /* Allocate memory for error message buffers */ /* ----------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_SWrdfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } swathID = (hid_t)SwathID; /* Initialize dims[] array */ /* ----------------------- */ for ( i = 0; i < HE5_DTSETRANKMAX; i++) dims[ i ] = 0; /* Get field info */ /* -------------- */ status = HE5_SWfieldinfo(swathID, fieldname, &rank, dims, ntype, NULL,NULL); if (status != FAIL) { start = (hssize_t *)calloc(rank, sizeof(hssize_t)); if(start == NULL) { sprintf(errbuf,"Cannot allocate memory for start.\n"); H5Epush(__FILE__, "HE5_SWrdfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } stride = (hsize_t *)calloc(rank, sizeof(hsize_t)); if(stride == NULL) { sprintf(errbuf,"Cannot allocate memory for stride.\n"); H5Epush(__FILE__, "HE5_SWrdfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(errbuf); return(FAIL); } edge = (hsize_t *)calloc(rank, sizeof(hsize_t)); if(edge == NULL) { sprintf(errbuf,"Cannot allocate memory for edge.\n"); H5Epush(__FILE__, "HE5_SWrdfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(stride); free(errbuf); return(FAIL); } /* Reverse order of dimensions (FORTRAN -> C) */ /* ------------------------------------------ */ for (i = 0; i < rank; i++) { start[i] = (hssize_t)fortstart[rank - 1 - i]; stride[i] = (hsize_t)fortstride[rank - 1 - i]; edge[i] = (hsize_t)fortedge[rank - 1 - i]; } /* Read data from the field */ /* ------------------------ */ status = HE5_SWwrrdfield(swathID, fieldname, "r", start, stride, edge, buffer); if (status == FAIL) { sprintf(errbuf, "Cannot read data from the \"%s\" field.",fieldname) ; H5Epush(__FILE__, "HE5_SWrdfld", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(stride); free(edge); free(errbuf); return(FAIL); } free(start); free(stride); free(edge); free(errbuf); } else { sprintf(errbuf, "Fieldname \"%s\" does not exist.",fieldname) ; H5Epush(__FILE__, "HE5_SWrdfld", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); status = FAIL; } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWrdcharfld | | | | DESCRIPTION: Reads data from a character string field (FORTRAN wrapper | | around SWreadfield) | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int swath structure ID | | fieldname char fieldname | | elemlen int each element length in array of string | | numelem int number of elements in declared buffer | | array | | fortstart long start array | | fortstride long stride array | | fortedge long edge array | | buffer void data buffer for read | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Apr 04 S.Zhao For an array of character string dataset. | | Jun 04 S.Zhao Added two more arguments (elemlen and numelem). | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWrdcharfld(int SwathID, char *fieldname, int elemlen, int numelem, long fortstart[], long fortstride[], long fortedge[], void *buffer) { int ret = SUCCEED; /* routine return status variable */ int i = 0; /* Loop index */ int rank = 0; /* Field rank */ hid_t ntype[1] = {FAIL}; /* Field number types */ hid_t swathID = FAIL; /* Swath HDF5 type ID */ herr_t status = SUCCEED; /* routine return status variable */ hssize_t *start = (hssize_t *)NULL;/* Pointer to start array (C order) */ hsize_t dims[HE5_DTSETRANKMAX]; /* Field dimensions */ hsize_t *stride = (hsize_t *)NULL; /* Pointer to stride array (C order) */ hsize_t *edge = (hsize_t *)NULL; /* Pointer to edge array (C order) */ char *errbuf = (char *)NULL; /* error message buffer */ char **strdatabuf = NULL; /* string data buffer */ int stlen = 0; /* whole string array length */ int nelem = 0; /* number of elements in array of str*/ int strsize = 0; /* each str length in array of str */ int attr = 0; /* attribute value */ int j = 0; /* Loop index */ int num_elem_passed_out; int numread; /* Allocate memory for error message buffers */ /* ----------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_SWrdcharfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } swathID = (hid_t)SwathID; /* Initialize dims[] array */ /* ----------------------- */ for ( i = 0; i < HE5_DTSETRANKMAX; i++) dims[ i ] = 0; /* Get field info */ /* -------------- */ status = HE5_SWfieldinfo(swathID, fieldname, &rank, dims, ntype, NULL,NULL); if (status != FAIL) { start = (hssize_t *)calloc(rank, sizeof(hssize_t)); if(start == NULL) { sprintf(errbuf,"Cannot allocate memory for start.\n"); H5Epush(__FILE__, "HE5_SWrdcharfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } stride = (hsize_t *)calloc(rank, sizeof(hsize_t)); if(stride == NULL) { sprintf(errbuf,"Cannot allocate memory for stride.\n"); H5Epush(__FILE__, "HE5_SWrdcharfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(errbuf); return(FAIL); } edge = (hsize_t *)calloc(rank, sizeof(hsize_t)); if(edge == NULL) { sprintf(errbuf,"Cannot allocate memory for edge.\n"); H5Epush(__FILE__, "HE5_SWrdcharfld", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(stride); free(errbuf); return(FAIL); } /* Reverse order of dimensions (FORTRAN -> C) */ /* ------------------------------------------ */ for (i = 0; i < rank; i++) { start[i] = (hssize_t)fortstart[rank - 1 - i]; stride[i] = (hsize_t)fortstride[rank - 1 - i]; edge[i] = (hsize_t)fortedge[rank - 1 - i]; } status = HE5_SWreadlocattr(swathID, fieldname, "StringLengthAttribute", &attr); if (status == FAIL) { sprintf(errbuf, "Cannot read attribute from the field \"%s\".",fieldname) ; H5Epush(__FILE__, "HE5_SWrdcharfld", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(stride); free(edge); free(errbuf); return(FAIL); } if(elemlen < attr ) { sprintf(errbuf, "Element length passed in is not correct. Should be same as in declration"); H5Epush(__FILE__, "HE5_SWrdcharfld", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(stride); free(edge); free(errbuf); return(FAIL); } strsize = attr; stlen = dims[0] * strsize; nelem = stlen / strsize; strdatabuf = (char **)malloc(nelem*sizeof(char *)); for (i = 0; i C) */ /* ------------------------------------------ */ for (i = 0; i < rank; i++) { count[i] = (hsize_t)fortcount[rank - 1 - i]; } swathID = (hid_t)SwathID; if ((numbertype == HE5T_CHARSTRING) || (numbertype == H5T_NATIVE_CHAR) || (numbertype == H5T_C_S1)) { if (strlen((char *)datbuf) < count[0]) { sprintf(errbuf,"Size of databuf is less than the number of local attribute elements.\n"); H5Epush(__FILE__, "HE5_SWwrlattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); return(FAIL); } /* Allocate memory for temp buffer */ /* ------------------------------- */ tempbuf = (char * )calloc((count[0]+1), sizeof(char)); if(tempbuf == NULL) { sprintf(errbuf,"Cannot allocate memory for temp buffer.\n"); H5Epush(__FILE__, "HE5_SWwrlattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); return(FAIL); } strncpy(tempbuf, (char *)datbuf, count[0]); tempbuf[count[0]] = '\0'; /* Write local attribute buffer */ /* ---------------------------- */ status = HE5_SWwritelocattr(swathID, fieldname, attrname, numbertype, count, tempbuf); if(status == FAIL) { sprintf(errbuf,"Cannot write local attribute value.\n"); H5Epush(__FILE__, "HE5_SWwrlattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); free(tempbuf); return(FAIL); } free(count); free(errbuf); free(tempbuf); } else { /* Write local attribute buffer */ /* ---------------------------- */ status = HE5_SWwritelocattr(swathID, fieldname, attrname, numbertype, count, datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot write local attribute value.\n"); H5Epush(__FILE__, "HE5_SWwrlattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); return(FAIL); } free(count); free(errbuf); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWrdlattr (FORTRAN wrapper) | | | | DESCRIPTION: Reads attribute associated with a specified field in a swath. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int swath structure ID | | fieldname char fieldname | | attrname char attribute name | | | | OUTPUTS: | | datbuf void I/O buffer | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 00 A.Muslimov | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWrdlattr(int SwathID, char *fieldname, char *attrname, void *datbuf) { int ret = FAIL;/* return status variable */ herr_t status = FAIL;/* return status variable */ hid_t swathID = FAIL;/* HDF5 type Swath ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ swathID = (hid_t)SwathID; status = HE5_SWreadlocattr(swathID,fieldname, attrname, datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot read Attribute \"%s\" associated wth the \"%s\" field.\n", attrname,fieldname); H5Epush(__FILE__, "HE5_SWrdlattr", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWinqmapsF (FORTRAN wrapper) | | | | DESCRIPTION: Returns dimension mappings and offsets and increments | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nMap long Number of dimension mappings | | | | INPUTS: | | SwathID int swath structure ID | | | | OUTPUTS: | | dimmaps char dimension mappings (comma-separated) | | offset long array of offsets | | increment long array of increments | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 00 A.Muslimov | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_SWinqmapsF(int SwathID, char *dimmaps, long offset[], long increment[]) { long nMap = FAIL;/* Number of mappings */ hid_t swathID = FAIL;/* HDF-EOS swath ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ swathID = (hid_t)SwathID; /* Call HE5_SWinqmaps */ /* ------------------ */ nMap = HE5_SWinqmaps(swathID, dimmaps, offset, increment); if(nMap == FAIL) { sprintf(errbuf,"Error calling SWinqmaps() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_SWinqmapsF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return(nMap); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWinqimapsF | | | | DESCRIPTION: Returns indexed mappings and index sizes | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nMap long Number of indexed dimension mappings | | | | INPUTS: | | SwathID int swath structure ID | | | | OUTPUTS: | | idxmaps char indexed dimension mappings | | (comma-separated) | | idxsizes long Number of elements in each mapping | | | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | May 00 D.Wynne Original Version | | Aug 00 A.Muslimov Modified to conform to HDF5 data type | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_SWinqimapsF(int SwathID, char *idxmaps, long idxsizes[]) { int i = 0; /* Loop index */ hid_t swathID = FAIL;/* HDF5 type swath ID */ long nmaps = FAIL;/* Number of index maps */ long strbufsize = 0; /* Buffer size for length of string */ hsize_t *tidxsizes = (hsize_t *)NULL;/* Size of mapping */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ swathID = (hid_t)SwathID; /* Get the number of index maps */ /* ---------------------------- */ nmaps = HE5_SWnentries(swathID, 2, &strbufsize); if(nmaps == FAIL) { sprintf(errbuf,"Error calling SWnentries() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_SWinqimapsF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Allocate space for index sizes */ /* ------------------------------ */ tidxsizes = (hsize_t *)calloc(nmaps, sizeof(hsize_t)); if(tidxsizes == NULL) { sprintf(errbuf,"Cannot allocate memory for tidxsizes.\n"); H5Epush(__FILE__, "HE5_SWinqimapsF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Retrieve the list of maps and the sizes */ /* --------------------------------------- */ nmaps = HE5_SWinqidxmaps(swathID, idxmaps, tidxsizes); if(nmaps == FAIL) { sprintf(errbuf,"Error calling SWinqidxmaps() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_SWinqimapsF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(tidxsizes); return(FAIL); } /* Convert data type */ /* ------------------ */ for(i = 0; i < nmaps; i++) idxsizes[i] = (long)tidxsizes[i]; free(tidxsizes); return(nmaps); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWinqdimsF | | | | DESCRIPTION: Returns dimension names and values defined in swath structure | | (FORTRAN Wrapper) | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nDim long Number of defined dimensions | | | | INPUTS: | | SwathID int swath structure ID | | | | OUTPUTS: | | dimnames char Dimension names (comma-separated) | | dims long Dimension values | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | May 00 D.Wynne Original Version | | Aug 00 A.Muslimov Modified to conform to HDF5 data type | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_SWinqdimsF(int SwathID, char *dimnames, long dims[]) { int i = 0; /* Loop index */ hid_t swathID = FAIL;/* HDF5 type swath ID */ long nDim = FAIL;/* (return) number of dimensions */ long strbufsize = 0; /* String size variable */ hsize_t *tdims = (hsize_t *)NULL;/* Dimension variable */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ swathID = (hid_t)SwathID; nDim = HE5_SWnentries(swathID, 0, &strbufsize); if(nDim == FAIL) { sprintf(errbuf,"Error calling SWnentries() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_SWinqdimsF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } tdims = (hsize_t *)calloc(nDim, sizeof(hsize_t)); if(tdims == NULL) { sprintf(errbuf,"Cannot allocate memory for tdims.\n"); H5Epush(__FILE__, "HE5_SWinqdimsF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } nDim = HE5_SWinqdims(swathID, dimnames, tdims); if(nDim == FAIL) { sprintf(errbuf,"Error calling HE5_SWinqdims() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_SWinqdimsF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(tdims); return(FAIL); } /* Convert data type */ /* ----------------- */ for(i = 0; i < nDim; i++) dims[i] = (long)tdims[i]; free(tdims); return (nDim); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWinqgflds (FORTRAN wrapper) | | | | DESCRIPTION: Inquires about geo fields in swath | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nflds long Number of geo fields in swath | | | | INPUTS: | | SwathID int Swath structure ID | | | | OUTPUTS: | | fieldlist char Field names (comma-separated) | | rank int Array of ranks | | ntype int number types | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 00 A.Muslimov | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_SWinqgflds(int SwathID, char *fieldlist, int rank[], int ntype[]) { long nflds = FAIL; /* Number of Geo fields */ long i; /* Loop index */ hid_t swathID = FAIL; /* HDF5 data type ID */ hid_t *dtype = (hid_t *)NULL; /* Data type */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ swathID = (hid_t)SwathID; /* Call "HE5_SWinqgeofields" routine to get number of fields */ /* ----------------------------------------------------- */ nflds = HE5_SWinqgeofields(swathID, fieldlist, NULL, NULL); if (nflds == FAIL) { sprintf(errbuf, "Cannot get information about fields in \"Geolocation Fields\" group. \n"); H5Epush(__FILE__, "HE5_SWinqgflds", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } dtype = (hid_t *)calloc(nflds,sizeof(hid_t)); if (dtype == NULL) { sprintf(errbuf, "Cannot allocate memory. \n"); H5Epush(__FILE__, "HE5_SWinqgflds", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } nflds = HE5_SWinqgeofields(swathID, fieldlist, rank, dtype); if (nflds == FAIL) { sprintf(errbuf, "Cannot get information about fields in \"Geolocation Fields\" group. \n"); H5Epush(__FILE__, "HE5_SWinqgflds", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(dtype); return(FAIL); } for (i = 0; i < nflds; i++) ntype[i] = (int)dtype[i]; free(dtype); return (nflds); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWinqdflds (FORTRAN wrapper) | | | | DESCRIPTION: Inquires about data fields in swath | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nflds long Number of data fields in swath | | | | INPUTS: | | SwathID int Swath structure ID | | | | OUTPUTS: | | fieldlist char Field names (comma-separated) | | rank int Array of ranks | | ntype int number types | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 00 A.Muslimov | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_SWinqdflds(int SwathID, char *fieldlist, int rank[], int ntype[]) { long nflds = FAIL; /* Number of Data fields */ long i; /* Looop index */ hid_t swathID = FAIL; /* HDF5 type swath ID */ hid_t *dtype = (hid_t *)NULL; /* Data type */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ swathID = (hid_t)SwathID; /* Call "HE5_SWinqdatafields" routine to get number of fields */ /* ------------------------------------------------------ */ nflds = HE5_SWinqdatafields(swathID, fieldlist, NULL, NULL); if (nflds == FAIL) { sprintf(errbuf, "Cannot get the number of fields in \"Data Fields\" group. \n"); H5Epush(__FILE__, "HE5_SWinqdflds", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } dtype = (hid_t *)calloc(nflds, sizeof(hid_t)); if (dtype == NULL) { sprintf(errbuf, "Cannot allocate memory. \n"); H5Epush(__FILE__, "HE5_SWinqdflds", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } nflds = HE5_SWinqdatafields(swathID, fieldlist, rank, dtype); if (nflds == FAIL) { sprintf(errbuf, "Cannot get the number of fields in \"Data Fields\" group. \n"); H5Epush(__FILE__, "HE5_SWinqdflds", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(dtype); return(FAIL); } for (i = 0; i < nflds; i++) ntype[i] = (int)dtype[i]; free(dtype); return(nflds); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWdiminfoF | | | | DESCRIPTION: FORTRAN wrapper for SWdiminfo to Retrieve size of specified | | dimension. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | size long None Size of dimension | | | | INPUTS: | | SwathID int None swath structure ID | | dimname char* None Dimension name | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 9/21/99 A.Muslimov In the call to EHmetagroup() replaced the argument | | gid by fid. | | Oct 99 Abe Taaheri Added to convert hsize_t to integer | | Aug 00 A.Muslimov Modified to conform to HDF5 data type | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_SWdiminfoF(int SwathID, char *dimname) { long size = 0; /* dimension size (return) */ hid_t swathID = FAIL; /* HDF5 data type ID */ hsize_t tsize = 0; /* size variable */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ swathID = (hid_t)SwathID; tsize = HE5_SWdiminfo(swathID, dimname); if (tsize == 0) { sprintf(errbuf, "Error calling SWdiminfo() from FORTRAN wrapper. \n"); H5Epush(__FILE__, "HE5_SWdiminfoF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } size = (long)tsize; return(size); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWmapinfoF (FORTRAN wrapper) | | | | DESCRIPTION: Returns dimension mapping information | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int swath structure ID | | geodim char geolocation dimension name | | datadim char data dimension name | | | | OUTPUTS: | | offset long mapping offset | | increment long mapping increment | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 00 A.Muslimov | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWmapinfoF(int SwathID, char *geodim, char *datadim, long *offset, long *increment) { int ret = FAIL; /* routine return status variable */ herr_t status = FAIL; /* routine return status variable */ hid_t swathID = FAIL; /* HDF-EOS swath ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ /* Initialize return values */ /* ------------------------ */ *offset = FAIL; *increment = FAIL; swathID = (hid_t)SwathID; status = HE5_SWmapinfo(swathID, geodim, datadim, offset, increment); if (status == FAIL) { sprintf(errbuf, "Cannot get mapping information.") ; H5Epush(__FILE__, "HE5_SWmapinfoF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWgmapinfo (FORTRAN wrapper) | | | | DESCRIPTION: Returns mapping information for dimension | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int 2 for indexed mapping, 1 for regular | | mapping, 0 if the dimension is not | | and (-1) FAIL | | | | INPUTS: | | SwathID int Swath structure ID | | geodim char geolocation dimension name | | | | OUTPUTS: | | NONE | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 00 A.Muslimov | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWgmapinfo(int SwathID, char *geodim) { int ret = FAIL; /* Return status variable */ herr_t status = FAIL; /* Return status variable */ hid_t swathID = FAIL; /* HDF5 type swath ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ swathID = (hid_t)SwathID; status = HE5_SWgeomapinfo(swathID, geodim); if (status == FAIL) { sprintf(errbuf, "Cannot get geolocation mapping information.") ; H5Epush(__FILE__, "HE5_SWgmapinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWfldinfoF | | | | DESCRIPTION: FORTRAN wrapper arount SWfieldinfo | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int swath structure id | | fieldname char name of field | | | | OUTPUTS: | | rank long rank of field (# of dims) | | dims long field dimensions | | ntype int field number type | | fortdimlist char field dimension list (FORTRAN order) | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Nov 99 Abe Taaheri Modified for HDF5 | | Aug 00 A.Muslimov Updated to conform to the HDF5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWfldinfoF(int SwathID, char *fieldname, int *rank, long dims[], int *ntype, char *fortdimlist, char *fortmaxdimlist) { int ret = SUCCEED; /* routine return status variable */ int j = 0; /* Loop Index */ herr_t status = SUCCEED; /* routine return status variable */ hid_t swathID = FAIL; /* HDF5 type data type ID */ hid_t dtype[1] = {FAIL}; /* Data type */ hsize_t tempdims[HE5_DTSETRANKMAX];/* Dimension sizes array */ hsize_t swap = 0; /* Temporary dimension size */ char *errbuf = (char *)NULL; /* error message buffer */ /* Dimension lists in C order */ /* -------------------------- */ char *dimlist = (char *)NULL; char *maxdimlist = (char *)NULL; /* Allocate memory for error message buffers */ /* ----------------------------------------- */ errbuf = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_SWfldinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Allocate space for C order dimension list */ /* ----------------------------------------- */ maxdimlist = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char)); dimlist = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char)); if(dimlist == NULL || maxdimlist == NULL) { sprintf(errbuf,"Cannot allocate memory for input list.\n"); H5Epush(__FILE__, "HE5_SWfldinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } swathID = (hid_t)SwathID; /* Initialize tempdims[] array */ /* --------------------------- */ for ( j = 0; j < HE5_DTSETRANKMAX; j++) tempdims[ j ] = 0; /* Get field info */ /* -------------- */ status = HE5_SWfieldinfo(swathID, fieldname, rank, tempdims, dtype, dimlist, maxdimlist); if (status == SUCCEED) { for (j = 0; j < *rank / 2; j++) { swap = tempdims[*rank - 1 - j]; tempdims[*rank - 1 - j] = tempdims[j]; tempdims[j] = swap; } /* change the datatype */ /* ------------------- */ for (j = 0; j < *rank; j++) dims[j] = (long)tempdims[j]; /* Reverse order of dimensions entries in dimension list */ /* ----------------------------------------------------- */ if(fortdimlist != (char *)NULL) { status = HE5_EHrevflds(dimlist, fortdimlist); if(status == FAIL) { sprintf(errbuf,"Cannot reverse entries in dimension list.\n"); H5Epush(__FILE__, "HE5_SWfldinfoF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(maxdimlist); return(FAIL); } } if(fortmaxdimlist != (char *)NULL) { status = HE5_EHrevflds(maxdimlist, fortmaxdimlist); if(status == FAIL) { sprintf(errbuf,"Cannot reverse entries in maximum dimension list.\n"); H5Epush(__FILE__, "HE5_SWfldinfoF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(maxdimlist); return(FAIL); } } } *ntype = (int)dtype[0]; free(maxdimlist); free(dimlist); free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWchunkinfoF | | | | DESCRIPTION: FORTRAN wrapper for SWchunkinfo | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int swath structure ID | | fieldname char* name of field | | | | OUTPUTS: | | ndims int* rank of a dataset | | dims long the array containing sizes | | of each dimension of a chunk | | NOTES: | | | | | | Date Programmer Description | | ========= ============ ============================================ | | Dec 03 S.Zhao Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWchunkinfoF(int SwathID, char *fieldname, int *ndims, long dims[]) { int ret = FAIL; /* return status */ int j = 0; /* Loop index */ herr_t status = FAIL; /* return status */ hid_t swathID = FAIL; /* HDF5 type swath ID */ hsize_t tempdims[HE5_DTSETRANKMAX]; /* Temporary dimension sizes array */ hsize_t swap = 0; /* Temporary dimension size */ char *errbuf = (char *)NULL; /* error message buffer */ /* Allocate memory for error message buffer */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_SWchunkinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Initialize tempdims[] array */ /* --------------------------- */ for ( j = 0; j < HE5_DTSETRANKMAX; j++) tempdims[ j ] = 0; swathID = (hid_t)SwathID; status = HE5_SWchunkinfo(swathID, fieldname, ndims, tempdims); if(status == FAIL) { sprintf(errbuf,"Error calling SWchunkinfo() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_SWchunkinfoF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } for (j = 0; j < *ndims / 2; j++) { swap = tempdims[*ndims - 1 - j]; tempdims[*ndims - 1 - j] = tempdims[j]; tempdims[j] = swap; } for (j = 0; j < *ndims; j++) dims[j] = (long)tempdims[j]; free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWidxmapinfoF | | | | DESCRIPTION: Returns indexed mapping information | | (FORTRAN Wrapper) | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | size long Number of index values (sz of geo dim) | | | | INPUTS: | | SwathID int swath structure id | | geodim char geolocation dimension name | | datadim char data dimension name | | | | OUTPUTS: | | index long array of index values | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | May 00 D.Wynne Original Version | | Aug 00 A.Muslimov Updated to conform to HDF5 data types | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_SWidxmapinfoF(int SwathID, char *geodim, char *datadim, long index[]) { long size = FAIL; /* routine return status variable */ hid_t swathID = FAIL; /* HDF5 type swath ID */ hsize_t gsize = 0; /* Temporary size variable */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ swathID = (hid_t)SwathID; gsize = HE5_SWidxmapinfo(swathID, geodim, datadim, index); if (gsize == 0) { sprintf(errbuf, "Error calling SWidxmapinfo() from FORTRAN wrapper. \n"); H5Epush(__FILE__, "HE5_SWidxmapinfoF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } size = (long)gsize; return(size); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWwrgattr | | | | DESCRIPTION: FORTRAN wrapper to Write/update group attribute in a swath. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int swath structure ID | | attrname char* group attribute name | | numtype int group attribute HDF numbertype | | fortcount[] long Number of group attribute elements | | datbuf void I/O buffer | | | | OUTPUTS: | | None | | It is assumed that fortcout has just one element to agree | | with EHattr() call. | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Apr 00 D.Wynne Original Programmer | | Aug 00 A.Muslimov Updated to reflect most recent data type changes. | | Nov 02 S.Zhao Modified to get the size of a string attribute. | | Mar 04 S.Zhao Modified for a character string attribute. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWwrgattr(int SwathID, char *attrname, int numtype, long fortcount[], void *datbuf) { int ret = FAIL; /* (int) return status variable */ int rank = 1; /* Rank variable */ int i; /* Loop index */ herr_t status = FAIL; /* routine return status variable */ hid_t swathID = FAIL; /* HDF5 type Swath ID */ hid_t numbertype = FAIL; /* HDF5 data type ID */ hsize_t *count = (hsize_t *)NULL;/* Pointer to count array (C order) */ char *errbuf = (char *)NULL; /* error message buffer */ char *tempbuf = (char *)NULL; /* temp buffer */ /* Allocate memory for error message buffers */ /* ----------------------------------------- */ errbuf = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_SWwrgattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Get HDF5 data type ID */ /* --------------------- */ numbertype = HE5_EHconvdatatype(numtype); if(numbertype == FAIL) { sprintf(errbuf,"Cannot convert to HDF5 type data type ID.\n"); H5Epush(__FILE__, "HE5_SWwrgattr", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } count = (hsize_t *)calloc(rank, sizeof(hsize_t)); if( count == NULL) { sprintf(errbuf,"Cannot allocate memory for count.\n"); H5Epush(__FILE__, "HE5_SWwrgattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Reverse order of dimensions (FORTRAN -> C) */ /* ------------------------------------------ */ for (i = 0; i < rank; i++) count[i] = (hsize_t)fortcount[rank - 1 - i]; swathID = (hid_t)SwathID; if ((numbertype == HE5T_CHARSTRING) || (numbertype == H5T_NATIVE_CHAR) || (numbertype == H5T_C_S1)) { if (strlen((char *)datbuf) < count[0]) { sprintf(errbuf,"Size of databuf is less than the number of group attribute elements.\n"); H5Epush(__FILE__, "HE5_SWwrgattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); return(FAIL); } /* Allocate memory for temp buffer */ /* ------------------------------- */ tempbuf = (char * )calloc((count[0]+1), sizeof(char)); if(tempbuf == NULL) { sprintf(errbuf,"Cannot allocate memory for temp buffer.\n"); H5Epush(__FILE__, "HE5_SWwrgattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); return(FAIL); } strncpy(tempbuf, (char *)datbuf, count[0]); tempbuf[count[0]] = '\0'; status = HE5_SWwritegrpattr(swathID, attrname, numbertype, count, tempbuf); if(status == FAIL) { sprintf(errbuf,"Cannot write group attribute value.\n"); H5Epush(__FILE__, "HE5_SWwrgattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); free(tempbuf); return(FAIL); } free(count); free(errbuf); free(tempbuf); } else { status = HE5_SWwritegrpattr(swathID, attrname, numbertype, count, datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot write group attribute value.\n"); H5Epush(__FILE__, "HE5_SWwrgattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); return(FAIL); } free(count); free(errbuf); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWwrgeogattr | | | | DESCRIPTION: FORTRAN wrapper to write/update the "Geolocation Fields" group| | attribute in a swath. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int swath structure ID | | attrname char* group attribute name | | numtype int group attribute HDF numbertype | | fortcount[] long Number of group attribute elements | | datbuf void I/O buffer | | | | OUTPUTS: | | None | | It is assumed that fortcout has just one element to agree | | with EHattr() call. | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Feb 04 S.Zhao Original development | | Mar 04 S.Zhao Modified for a character string attribute. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWwrgeogattr(int SwathID, char *attrname, int numtype, long fortcount[], void *datbuf) { int ret = FAIL; /* (int) return status variable */ int rank = 1; /* Rank variable */ int i; /* Loop index */ herr_t status = FAIL; /* routine return status variable */ hid_t swathID = FAIL; /* HDF5 type Swath ID */ hid_t numbertype = FAIL; /* HDF5 data type ID */ hsize_t *count = (hsize_t *)NULL;/* Pointer to count array (C order) */ char *errbuf = (char *)NULL; /* error message buffer */ char *tempbuf = (char *)NULL; /* temp buffer */ /* Allocate memory for error message buffers */ /* ----------------------------------------- */ errbuf = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_SWwrgeogattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Get HDF5 data type ID */ /* --------------------- */ numbertype = HE5_EHconvdatatype(numtype); if(numbertype == FAIL) { sprintf(errbuf,"Cannot convert to HDF5 type data type ID.\n"); H5Epush(__FILE__, "HE5_SWwrgeogattr", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } count = (hsize_t *)calloc(rank, sizeof(hsize_t)); if( count == NULL) { sprintf(errbuf,"Cannot allocate memory for count.\n"); H5Epush(__FILE__, "HE5_SWwrgeogattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Reverse order of dimensions (FORTRAN -> C) */ /* ------------------------------------------ */ for (i = 0; i < rank; i++) count[i] = (hsize_t)fortcount[rank - 1 - i]; swathID = (hid_t)SwathID; if ((numbertype == HE5T_CHARSTRING) || (numbertype == H5T_NATIVE_CHAR) || (numbertype == H5T_C_S1)) { if (strlen((char *)datbuf) < count[0]) { sprintf(errbuf,"Size of databuf is less than the number of group attribute elements.\n"); H5Epush(__FILE__, "HE5_SWwrgeogattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); return(FAIL); } /* Allocate memory for temp buffer */ /* ------------------------------- */ tempbuf = (char * )calloc((count[0]+1), sizeof(char)); if(tempbuf == NULL) { sprintf(errbuf,"Cannot allocate memory for temp buffer.\n"); H5Epush(__FILE__, "HE5_SWwrgeogattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); return(FAIL); } strncpy(tempbuf, (char *)datbuf, count[0]); tempbuf[count[0]] = '\0'; status = HE5_SWwritegeogrpattr(swathID, attrname, numbertype, count, tempbuf); if(status == FAIL) { sprintf(errbuf,"Cannot write group attribute value.\n"); H5Epush(__FILE__, "HE5_SWwrgeogattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); free(tempbuf); return(FAIL); } free(count); free(errbuf); free(tempbuf); } else { status = HE5_SWwritegeogrpattr(swathID, attrname, numbertype, count, datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot write group attribute value.\n"); H5Epush(__FILE__, "HE5_SWwrgeogattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); return(FAIL); } free(count); free(errbuf); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWatinfo | | | | DESCRIPTION: FORTRAN wrapper for SWattrinfo | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int swath structure ID | | attrname char* attribute name | | | | OUTPUTS: | | numbertype int attribute HDF numbertype | | fortcount long Number of attribute elements | | | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 9/28/99 A.Muslimov Changed the type of return value from intn | | to herr_t. | | Oct 99 Abe Taaheri Added for HDF5 | | May 00 D.Wynne Updated to reflect datatype changes | | Aug 00 A.Muslimov Updated to reflect yet another datatype changes | | | | | | END_PROLOG | | | -----------------------------------------------------------------------------*/ int HE5_SWatinfo(int SwathID, char *attrname, int *numbertype, long *fortcount) { int ret = FAIL; /* (int) return status variable */ herr_t status = FAIL; /* return status variable */ hid_t *ntype = (hid_t *)NULL; /* Data type class ID */ hid_t swathID = FAIL; /* HDF5 type Swath ID */ hsize_t *count = (hsize_t *)NULL; /* Pointer to count (C order) */ char *errbuf = (char *)NULL; /* error message buffer */ /* Allocate memory for error message buffers */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_SWatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } count = (hsize_t *) calloc(1, sizeof(hsize_t)); if( count == NULL) { sprintf(errbuf,"Cannot allocate memory for count.\n"); H5Epush(__FILE__, "HE5_SWatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } ntype = (hid_t *) calloc(1, sizeof(hid_t)); if(ntype == (hid_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for ntype.\n"); H5Epush(__FILE__, "HE5_SWatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); return(FAIL); } swathID = (hid_t)SwathID; status = HE5_SWattrinfo(swathID, attrname, ntype, count); if(status == FAIL) { sprintf(errbuf,"Cannot get information about attribute \"%s\".\n", attrname); H5Epush(__FILE__, "HE5_SWatinfo", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); free(ntype); return(FAIL); } *fortcount = (long)(*count); *numbertype = (int)(*ntype); free(errbuf); free(count); free(ntype); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWatinfo2 | | | | DESCRIPTION: FORTRAN wrapper for SWattrinfo2 | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int swath structure ID | | attrname char* attribute name | | | | OUTPUTS: | | numbertype int attribute HDF numbertype | | fortcount long Number of attribute elements | | fortsize long buf size of attribute elements | | | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 9/28/99 A.Muslimov Changed the type of return value from intn | | to herr_t. | | Oct 99 Abe Taaheri Added for HDF5 | | May 00 D.Wynne Updated to reflect datatype changes | | Aug 00 A.Muslimov Updated to reflect yet another datatype changes | | | | | | END_PROLOG | | | -----------------------------------------------------------------------------*/ int HE5_SWatinfo2(int SwathID, char *attrname, int *numbertype, long *fortcount, long *fortsize) { int ret = FAIL; /* (int) return status variable */ herr_t status = FAIL; /* return status variable */ hid_t *ntype = (hid_t *)NULL; /* Data type class ID */ hid_t swathID = FAIL; /* HDF5 type Swath ID */ hsize_t *count = (hsize_t *)NULL; /* Pointer to count (C order) */ hsize_t *size = (hsize_t *)NULL; /* Pointer to size (C order) */ char *errbuf = (char *)NULL; /* error message buffer */ /* Allocate memory for error message buffers */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_SWatinfo2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } count = (hsize_t *) calloc(1, sizeof(hsize_t)); if( count == NULL) { sprintf(errbuf,"Cannot allocate memory for count.\n"); H5Epush(__FILE__, "HE5_SWatinfo2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } ntype = (hid_t *) calloc(1, sizeof(hid_t)); if(ntype == (hid_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for ntype.\n"); H5Epush(__FILE__, "HE5_SWatinfo2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); return(FAIL); } size = (hsize_t *) calloc(1, sizeof(hsize_t)); if( size == NULL) { sprintf(errbuf,"Cannot allocate memory for size.\n"); H5Epush(__FILE__, "HE5_SWatinfo2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } swathID = (hid_t)SwathID; status = HE5_SWattrinfo2(swathID, attrname, ntype, count, size); if(status == FAIL) { sprintf(errbuf,"Cannot get information about attribute \"%s\".\n", attrname); H5Epush(__FILE__, "HE5_SWatinfo2", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); free(ntype); return(FAIL); } *fortcount = (long)(*count); *fortsize = (long)(*size); *numbertype = (int)(*ntype); free(errbuf); free(count); free(size); free(ntype); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWgatinfo | | | | DESCRIPTION: FORTRAN wrapper for SWgrpattrinfo | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int swath structure ID | | attrname char* attribute name | | | | OUTPUTS: | | numbertype int attribute HDF numbertype | | fortcount long Number of attribute elements | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 9/28/99 A.Muslimov Changed the type of return value from intn | | to herr_t. | | Oct 99 Abe Taaheri Added for HDF5 | | May 00 D.Wynne Updated to reflect datatype changes | | Aug 00 A.Muslimov Updated to reflect yet another datatype changes | | | | END_PROLOG | | | -----------------------------------------------------------------------------*/ int HE5_SWgatinfo(int SwathID, char *attrname, int *numbertype, long *fortcount) { int ret = FAIL; /* (int) return status variable */ herr_t status = FAIL; /* routine return status variable */ hid_t *ntype = (hid_t *)NULL; /* Data type class ID */ hid_t swathID = FAIL; /* HDF5 type Swath ID */ hsize_t *count = (hsize_t *)NULL;/* Pointer to count (C order) */ char *errbuf = (char *)NULL; /* error message buffer */ /* Allocate memory for error message buffers */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_SWgatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } count = (hsize_t *)calloc(1, sizeof(hsize_t)); if( count == NULL) { sprintf(errbuf,"Cannot allocate memory for count.\n"); H5Epush(__FILE__, "HE5_SWgatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } ntype = (hid_t *)calloc(1, sizeof(hid_t)); if( ntype == (hid_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for ntype.\n"); H5Epush(__FILE__, "HE5_SWgatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); return(FAIL); } swathID = (hid_t)SwathID; status = HE5_SWgrpattrinfo(swathID, attrname, ntype, count); if(status == FAIL) { sprintf(errbuf,"Cannot get information about group attribute.\n"); H5Epush(__FILE__, "HE5_SWgatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); free(ntype); return(FAIL); } *fortcount = (long)(*count); *numbertype = (int)(*ntype); free(errbuf); free(count); free(ntype); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWgatinfo2 | | | | DESCRIPTION: FORTRAN wrapper for SWgrpattrinfo2 | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int swath structure ID | | attrname char* attribute name | | | | OUTPUTS: | | numbertype int attribute HDF numbertype | | fortcount long Number of attribute elements | | fortsize long buf size of attribute elements | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 9/28/99 A.Muslimov Changed the type of return value from intn | | to herr_t. | | Oct 99 Abe Taaheri Added for HDF5 | | May 00 D.Wynne Updated to reflect datatype changes | | Aug 00 A.Muslimov Updated to reflect yet another datatype changes | | | | END_PROLOG | | | -----------------------------------------------------------------------------*/ int HE5_SWgatinfo2(int SwathID, char *attrname, int *numbertype, long *fortcount, long *fortsize) { int ret = FAIL; /* (int) return status variable */ herr_t status = FAIL; /* routine return status variable */ hid_t *ntype = (hid_t *)NULL; /* Data type class ID */ hid_t swathID = FAIL; /* HDF5 type Swath ID */ hsize_t *count = (hsize_t *)NULL;/* Pointer to count (C order) */ hsize_t *size = (hsize_t *)NULL;/* Pointer to size (C order) */ char *errbuf = (char *)NULL; /* error message buffer */ /* Allocate memory for error message buffers */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_SWgatinfo2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } count = (hsize_t *)calloc(1, sizeof(hsize_t)); if( count == NULL) { sprintf(errbuf,"Cannot allocate memory for count.\n"); H5Epush(__FILE__, "HE5_SWgatinfo2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } ntype = (hid_t *)calloc(1, sizeof(hid_t)); if( ntype == (hid_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for ntype.\n"); H5Epush(__FILE__, "HE5_SWgatinfo2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); return(FAIL); } size = (hsize_t *)calloc(1, sizeof(hsize_t)); if( size == NULL) { sprintf(errbuf,"Cannot allocate memory for size.\n"); H5Epush(__FILE__, "HE5_SWgatinfo2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } swathID = (hid_t)SwathID; status = HE5_SWgrpattrinfo2(swathID, attrname, ntype, count, size); if(status == FAIL) { sprintf(errbuf,"Cannot get information about group attribute.\n"); H5Epush(__FILE__, "HE5_SWgatinfo2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); free(ntype); return(FAIL); } *fortcount = (long)(*count); *fortsize = (long)(*size); *numbertype = (int)(*ntype); free(errbuf); free(count); free(size); free(ntype); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWgeogatinfo | | | | DESCRIPTION: FORTRAN wrapper for SWgeogrpattrinfo | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int swath structure ID | | attrname char* attribute name | | | | OUTPUTS: | | numbertype int attribute HDF numbertype | | fortcount long Number of attribute elements | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Feb 04 S.Zhao Original development | | | | END_PROLOG | | | -----------------------------------------------------------------------------*/ int HE5_SWgeogatinfo(int SwathID, char *attrname, int *numbertype, long *fortcount) { int ret = FAIL; /* (int) return status variable */ herr_t status = FAIL; /* routine return status variable */ hid_t *ntype = (hid_t *)NULL; /* Data type class ID */ hid_t swathID = FAIL; /* HDF5 type Swath ID */ hsize_t *count = (hsize_t *)NULL;/* Pointer to count (C order) */ char *errbuf = (char *)NULL; /* error message buffer */ /* Allocate memory for error message buffers */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_SWgeogatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } count = (hsize_t *)calloc(1, sizeof(hsize_t)); if( count == NULL) { sprintf(errbuf,"Cannot allocate memory for count.\n"); H5Epush(__FILE__, "HE5_SWgeogatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } ntype = (hid_t *)calloc(1, sizeof(hid_t)); if( ntype == (hid_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for ntype.\n"); H5Epush(__FILE__, "HE5_SWgeogatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); return(FAIL); } swathID = (hid_t)SwathID; status = HE5_SWgeogrpattrinfo(swathID, attrname, ntype, count); if(status == FAIL) { sprintf(errbuf,"Cannot get information about group attribute.\n"); H5Epush(__FILE__, "HE5_SWgeogatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); free(ntype); return(FAIL); } *fortcount = (long)(*count); *numbertype = (int)(*ntype); free(errbuf); free(count); free(ntype); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWgeogatinfo2 | | | | DESCRIPTION: FORTRAN wrapper for SWgeogrpattrinfo2 | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int swath structure ID | | attrname char* attribute name | | | | OUTPUTS: | | numbertype int attribute HDF numbertype | | fortcount long Number of attribute elements | | fortsize long buf size of attribute elements | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Feb 04 S.Zhao Original development | | | | END_PROLOG | | | -----------------------------------------------------------------------------*/ int HE5_SWgeogatinfo2(int SwathID, char *attrname, int *numbertype, long *fortcount, long *fortsize) { int ret = FAIL; /* (int) return status variable */ herr_t status = FAIL; /* routine return status variable */ hid_t *ntype = (hid_t *)NULL; /* Data type class ID */ hid_t swathID = FAIL; /* HDF5 type Swath ID */ hsize_t *count = (hsize_t *)NULL;/* Pointer to count (C order) */ hsize_t *size = (hsize_t *)NULL;/* Pointer to size (C order) */ char *errbuf = (char *)NULL; /* error message buffer */ /* Allocate memory for error message buffers */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_SWgeogatinfo2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } count = (hsize_t *)calloc(1, sizeof(hsize_t)); if( count == NULL) { sprintf(errbuf,"Cannot allocate memory for count.\n"); H5Epush(__FILE__, "HE5_SWgeogatinfo2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } ntype = (hid_t *)calloc(1, sizeof(hid_t)); if( ntype == (hid_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for ntype.\n"); H5Epush(__FILE__, "HE5_SWgeogatinfo2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); return(FAIL); } size = (hsize_t *)calloc(1, sizeof(hsize_t)); if( size == NULL) { sprintf(errbuf,"Cannot allocate memory for size.\n"); H5Epush(__FILE__, "HE5_SWgeogatinfo2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } swathID = (hid_t)SwathID; status = HE5_SWgeogrpattrinfo2(swathID, attrname, ntype, count, size); if(status == FAIL) { sprintf(errbuf,"Cannot get information about group attribute.\n"); H5Epush(__FILE__, "HE5_SWgeogatinfo2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); free(ntype); return(FAIL); } *fortcount = (long)(*count); *fortsize = (long)(*size); *numbertype = (int)(*ntype); free(errbuf); free(count); free(size); free(ntype); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWinqgattrs (FORTRAN wrapper) | | | | DESCRIPTION: Retrieves the number of attributes and string length of | | attribute list in "Data Fields" group | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nattr long Number of attributes in "Data Fields" | | group. | | INPUTS: | | SwathID int swath structure ID | | | | OUTPUTS: | | attrnames char Attribute names in "Data Fields" group | | (Comma-separated list) | | strbufsize long Attributes name list string length | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 00 A.Muslimov | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_SWinqgattrs(int SwathID, char *attrnames, long *strbufsize) { long nattr = FAIL; /* Number of attributes (return) */ hid_t swathID = FAIL; /* HDF5 type swath ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ swathID = (hid_t)SwathID; nattr = HE5_SWinqgrpattrs(swathID, attrnames, strbufsize); if ( nattr < 0 ) { sprintf(errbuf, "Cannot retrieve the attributes. \n"); H5Epush(__FILE__, "HE5_SWinqgattrs", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return(nattr); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWinqgeogattrs (FORTRAN wrapper) | | | | DESCRIPTION: Retrieves the number of attributes and string length of | | attribute list in "Geolocation Fields" group. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nattr long Number of attributes in "Geolocation | | Fields" group | | INPUTS: | | SwathID int swath structure ID | | | | OUTPUTS: | | attrnames char Attribute names in "Geolocation Fields" | | group (Comma-separated list) | | strbufsize long Attributes name list string length | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Feb 04 S.Zhao Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_SWinqgeogattrs(int SwathID, char *attrnames, long *strbufsize) { long nattr = FAIL; /* Number of attributes (return) */ hid_t swathID = FAIL; /* HDF5 type swath ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ swathID = (hid_t)SwathID; nattr = HE5_SWinqgeogrpattrs(swathID, attrnames, strbufsize); if ( nattr < 0 ) { sprintf(errbuf, "Cannot retrieve the attributes. \n"); H5Epush(__FILE__, "HE5_SWinqgeogattrs", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return(nattr); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWinqattrsF (FORTRAN wrapper) | | | | DESCRIPTION: | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nattr long Number of attributes in swath struct | | | | INPUTS: | | SwathID int Swath structure ID | | | | OUTPUTS: | | attrnames char Attribute names in swath struct | | (Comma-separated list) | | strbufsize long Attributes name list string length | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 00 A.Muslimov | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_SWinqattrsF(int SwathID, char *attrnames, long *strbufsize) { long nattr = FAIL; /* Number of attributes (return) */ hid_t swathID = FAIL; /* HDF5 type swath ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ swathID = (hid_t)SwathID; nattr = HE5_SWinqattrs(swathID, attrnames, strbufsize); if ( nattr < 0 ) { sprintf(errbuf, "Cannot retrieve the attributes. \n"); H5Epush(__FILE__, "HE5_SWinqattrsF", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return(nattr); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWlatinfo | | | | DESCRIPTION: FORTRAN wrapper for SWlocattrinfo | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int swath structure ID | | fieldname char* field name name | | | | OUTPUTS: | | attrname char* attribute name | | numbertype int attribute HDF numbertype | | fortcount long Number of attribute elements | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 9/28/99 A.Muslimov Changed the type of return value from intn | | to herr_t. | | Oct 99 Abe Taaheri Added for HDF5 | | May 00 D.Wynne Updated to reflect datatype changes | | Aug 00 A.Muslimov Updated to reflect yet another datatype changes | | | | | | END_PROLOG | | | -----------------------------------------------------------------------------*/ int HE5_SWlatinfo(int SwathID, char *fieldname, char *attrname, int *numbertype, long *fortcount) { int ret = FAIL; /* (int) return status variable */ herr_t status = FAIL; /* routine return status variable */ hid_t *ntype = (hid_t *)NULL; /* Data type class ID */ hid_t swathID = FAIL; /* HDF5 type Swath ID */ hsize_t *count = (hsize_t *)NULL;/* Pointer to count (C order) */ char *errbuf = (char *)NULL; /* error message buffer */ /* Allocate memory for error message buffers */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_SWlatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } count = (hsize_t *)calloc(1, sizeof(hsize_t)); if( count == NULL) { sprintf(errbuf,"Cannot allocate memory for count.\n"); H5Epush(__FILE__, "HE5_SWlatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } ntype = (hid_t *)calloc(1, sizeof(hid_t)); if( ntype == (hid_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for ntype.\n"); H5Epush(__FILE__, "HE5_SWlatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); return(FAIL); } swathID = (hid_t)SwathID; status = HE5_SWlocattrinfo(swathID, fieldname, attrname, ntype, count); if(status == FAIL) { sprintf(errbuf,"Cannot get information about local attribute.\n"); H5Epush(__FILE__, "HE5_SWlatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); free(ntype); return(FAIL); } *fortcount = (long)(*count); *numbertype = (int)(*ntype); free(errbuf); free(count); free(ntype); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWlatinfo2 | | | | DESCRIPTION: FORTRAN wrapper for SWlocattrinfo2 | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int swath structure ID | | fieldname char* field name name | | | | OUTPUTS: | | attrname char* attribute name | | numbertype int attribute HDF numbertype | | fortcount long Number of attribute elements | | fortsize long buf size of attribute elements | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | 9/28/99 A.Muslimov Changed the type of return value from intn | | to herr_t. | | Oct 99 Abe Taaheri Added for HDF5 | | May 00 D.Wynne Updated to reflect datatype changes | | Aug 00 A.Muslimov Updated to reflect yet another datatype changes | | | | | | END_PROLOG | | | -----------------------------------------------------------------------------*/ int HE5_SWlatinfo2(int SwathID, char *fieldname, char *attrname, int *numbertype, long *fortcount, long *fortsize) { int ret = FAIL; /* (int) return status variable */ herr_t status = FAIL; /* routine return status variable */ hid_t *ntype = (hid_t *)NULL; /* Data type class ID */ hid_t swathID = FAIL; /* HDF5 type Swath ID */ hsize_t *count = (hsize_t *)NULL;/* Pointer to count (C order) */ hsize_t *size = (hsize_t *)NULL;/* Pointer to size (C order) */ char *errbuf = (char *)NULL; /* error message buffer */ /* Allocate memory for error message buffers */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_SWlatinfo2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } count = (hsize_t *)calloc(1, sizeof(hsize_t)); if( count == NULL) { sprintf(errbuf,"Cannot allocate memory for count.\n"); H5Epush(__FILE__, "HE5_SWlatinfo2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } ntype = (hid_t *)calloc(1, sizeof(hid_t)); if( ntype == (hid_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for ntype.\n"); H5Epush(__FILE__, "HE5_SWlatinfo2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); return(FAIL); } size = (hsize_t *)calloc(1, sizeof(hsize_t)); if( size == NULL) { sprintf(errbuf,"Cannot allocate memory for size.\n"); H5Epush(__FILE__, "HE5_SWlatinfo2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } swathID = (hid_t)SwathID; status = HE5_SWlocattrinfo2(swathID, fieldname, attrname, ntype, count, size); if(status == FAIL) { sprintf(errbuf,"Cannot get information about local attribute.\n"); H5Epush(__FILE__, "HE5_SWlatinfo2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); free(ntype); return(FAIL); } *fortcount = (long)(*count); *fortsize = (long)(*size); *numbertype = (int)(*ntype); free(errbuf); free(count); free(size); free(ntype); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWinqlattrs (FORTRAN wrapper) | | | | DESCRIPTION: Retrieves the number of attributes and string length of | | attribute list associated with a specified field in the | | "Data Fields" group. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nattr long Number of attributes in "Data Fields" | | group. | | | | INPUTS: | | SwathID int swath structure ID | | fieldname char field name | | | | OUTPUTS: | | attrnames char Attribute names in "Data Fields" group | | (Comma-separated list) | | strbufsize long Attributes name list string length | | | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 00 A.Muslimov | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_SWinqlattrs(int SwathID, char *fieldname, char *attrnames, long *strbufsize) { long nattr = FAIL; /* Number of attributes */ hid_t swathID = FAIL; /* HDF5 type swath ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ swathID = (hid_t)SwathID; nattr = HE5_SWinqlocattrs(swathID, fieldname, attrnames, strbufsize); if ( nattr < 0 ) { sprintf(errbuf, "Cannot retrieve the attributes. \n"); H5Epush(__FILE__, "HE5_SWinqlattrs", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return (nattr); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWidtype | | | | DESCRIPTION: Inquires about geo/data fields in swath | | (FORTRAN Wrapper) | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int | | fieldname char * | | attrname char * | | fieldgroup int | | | | OUTPUTS: | | Type int | | Class int | | Order int | | size long | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Oct 99 D.Wynne Original Programmer | | Dec 99 A.Muslimov Changed the status data type from hid_t to int . | | Feb 00 A.Muslimov Added error checking after the function calls. | | Mar 00 A.Muslimov Updated to include Group/Local Attributes options. | | May 00 A.Muslimov Replaced 'H5T_class_t' type by 'int' data type. | | Aug 00 A.Muslimov Updated to reflect most recent data type changes. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWidtype(int SwathID, char *fieldname, char *attrname, int fieldgroup, int *Type, int *Class, int *Order, long *size) { int ret = FAIL; /* (int) status variable */ herr_t status = FAIL; /* return status variable */ size_t *tsize = (size_t *)NULL; /* data size variable */ hid_t *typeID = (hid_t *)NULL; /* HDF5 Data type ID */ hid_t swathID = FAIL; /* HDF5 type swath ID */ H5T_class_t *classID = (H5T_class_t *)NULL;/* Data type class ID */ H5T_order_t *order = (H5T_order_t *)NULL;/* Byte order of datatype */ char *errbuf = (char *)NULL; /* error message buffer */ /* Allocate memory for error message buffers */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_SWidtype", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } typeID = (hid_t *)calloc(1, sizeof(hid_t)); if(typeID == NULL) { sprintf(errbuf,"Cannot allocate memory for typeID.\n"); H5Epush(__FILE__, "HE5_SWidtype", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } tsize = (size_t *)calloc(1, sizeof(size_t)); if(tsize == NULL) { sprintf(errbuf,"Cannot allocate memory for tsize.\n"); H5Epush(__FILE__, "HE5_SWidtype", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(typeID); return(FAIL); } classID = (H5T_class_t *)calloc(1, sizeof(H5T_class_t)); if(classID == (H5T_class_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for classID.\n"); H5Epush(__FILE__, "HE5_SWidtype", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(typeID); free(tsize); return(FAIL); } order = (H5T_order_t *)calloc(1, sizeof(H5T_order_t)); if(order == (H5T_order_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for order.\n"); H5Epush(__FILE__, "HE5_SWidtype", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(typeID); free(tsize); free(classID); return(FAIL); } swathID = (hid_t)SwathID; /* Get data type information */ /* ------------------------- */ status = HE5_SWinqdatatype(swathID, fieldname, attrname, fieldgroup, typeID, classID, order, tsize); if(status == FAIL) { sprintf(errbuf,"Cannot get information about data type.\n"); H5Epush(__FILE__, "HE5_SWidtype", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(typeID); free(tsize); free(classID); free(order); return(FAIL); } *Type = (int)(*typeID); *Class = (int)(*classID); *Order = (int)(*order); *size = (long)(*tsize); free(errbuf); free(typeID); free(classID); free(order); free(tsize); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWdefboxreg (FORTRAN wrapper) | | | | DESCRIPTION: Finds swath cross tracks within area of interest and returns | | region ID | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | RegionID int Region ID | | | | INPUTS: | | SwathID int Swath structure ID | | cornerlon double dec deg Longitude of opposite corners of box | | cornerlat double dec deg Latitude of opposite corners of box | | mode int Search mode | | HDFE_MIDPOINT - Use midpoint of Xtrack | | HDFE_ENDPOINT - Use endpoints of Xtrack | | HDFE_ANYPOINT - Use all points of Xtrack| | | | OUTPUTS: | | None | | | | NOTES: | | | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 00 A.Muslimov | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWdefboxreg(int SwathID, double cornerlon[], double cornerlat[], int mode) { int RegionID = FAIL;/* Region ID (return) */ hid_t swathID = FAIL;/* HDF5 type swath ID */ hid_t regionID = FAIL;/* HDF5 type region ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error buffer string */ swathID = (hid_t)SwathID; regionID = HE5_SWdefboxregion(swathID, cornerlon, cornerlat, mode); if (regionID == FAIL) { sprintf(errbuf,"Cannot define box region.\n"); H5Epush(__FILE__, "HE5_SWdefboxreg", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } RegionID = (int)regionID; return(RegionID); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWdefvrtreg | | | | DESCRIPTION: FORTRAN wrapper arount HE5_SWdefvrtregion | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | RegionID int Region ID | | | | INPUTS: | | SwathID int Swath structure ID | | RegionID int Region ID | | vertObj char Vertical object to subset | | range double Vertical subsetting range | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Nov 99 Abe Taaheri Modified for HDF5 | | Aug 00 A.Muslimov Updated to reflect data type changes. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWdefvrtreg(int SwathID, int RegionID, char *vertObj, double fortrange[]) { hid_t swathID = FAIL; /* HDF5 type swath ID */ hid_t regionID = FAIL; /* HDF5 type region ID */ double range[2] = {0.,0.}; /* range (C) array */ char utlbuf[16]; /* Utility buffer */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ /* Copy first four character of vertObj to utlbuf */ /* ---------------------------------------------- */ memcpy(utlbuf, vertObj, 4); utlbuf[4] = 0; /* If subsetting on dimension elements convert FORTRAN indices to C */ /* ---------------------------------------------------------------- */ if (strcmp(utlbuf, "DIM:") == 0) { range[0] = fortrange[0] - 1; range[1] = fortrange[1] - 1; } else { range[0] = fortrange[0]; range[1] = fortrange[1]; } swathID = (hid_t)SwathID; regionID = (hid_t)RegionID; /* Call HE5_SWdefvrtregion */ /* ------------------- */ regionID = HE5_SWdefvrtregion(swathID, regionID, vertObj, range); if (regionID == FAIL) { sprintf(errbuf,"Cannot define vertical region.\n"); H5Epush(__FILE__, "HE5_SWdefvrtreg", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } RegionID = (int)regionID; return(RegionID); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWreginfo | | | | DESCRIPTION: FORTRAN wrapper around SWregioninfo | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int Swath structure ID | | RegionID int Region ID | | fieldname char Fieldname | | | | | | OUTPUTS: | | nunmbertype int field number type | | rank int field rank | | dims long dimensions of field region | | (FORTRAN order) | | size long size in bytes of field region | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Nov 99 Abe Taaheri Modified for HDF5 | | Aug 00 A.Muslimov Updated to reflect data type changes. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWreginfo(int SwathID, int RegionID, char *fieldname, int *numbertype, int *rank, long dims[], long *size) { int ret = FAIL;/* (int) Return status variable */ int j = 0; /* Loop index */ hid_t swathID = FAIL;/* HDF5 type swath ID */ hid_t regionID = FAIL;/* HDF5 type region ID */ herr_t status = FAIL;/* routine return status variable */ hid_t *ntype = (hid_t *)NULL;/* number types */ size_t *tsize = (size_t *)NULL; hsize_t swap = 0; /* Temporary swap variable */ hsize_t tempdims[HE5_DTSETRANKMAX]; char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error buffer string */ swathID = (hid_t)SwathID; regionID = (hid_t)RegionID; tsize = (size_t *)calloc(1, sizeof(size_t)); if (tsize == NULL) { sprintf(errbuf,"Cannot allocate memory for tsize.\n"); H5Epush(__FILE__, "HE5_SWreginfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } ntype = (hid_t *)calloc(1, sizeof(hid_t)); if (ntype == NULL) { sprintf(errbuf,"Cannot allocate memory for ntype.\n"); H5Epush(__FILE__, "HE5_SWreginfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(tsize); return(FAIL); } /* Initialize tempdims[] array */ /* --------------------------- */ for (j = 0; j < HE5_DTSETRANKMAX; j++) tempdims[ j ] = 0; /* Call SWregioninfo */ /* ----------------- */ status = HE5_SWregioninfo(swathID, regionID, fieldname, ntype, rank, tempdims, tsize); if (status == FAIL) { sprintf(errbuf,"Cannot get information about region.\n"); H5Epush(__FILE__, "HE5_SWreginfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(tsize); free(ntype); return(FAIL); } /* Change dimensions to FORTRAN order */ /* ---------------------------------- */ for (j = 0; j < *rank / 2; j++) { swap = tempdims[*rank - 1 - j]; tempdims[*rank - 1 - j] = tempdims[j]; tempdims[j] = swap; } /* cast dimension sizes */ /* -------------------- */ for (j = 0; j < *rank; j++) dims[j] = (long)tempdims[j]; *size = (long)(*tsize); *numbertype = (int)(*ntype); free(tsize); free(ntype); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWextreg (FORTRAN wrapper) | | | | DESCRIPTION: Retrieves data from specified region. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int Swath structure ID | | RegionID int Region ID | | fieldname char Fieldname | | externalflag int External geolocation fields flag | | HDFE_INTERNAL (0) | | HDFE_EXTERNAL (1) | | | | OUTPUTS: | | buffer void Data buffer containing subsetted region | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 00 A.Muslimov Updated to reflect data type changes. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWextreg(int SwathID, int RegionID, char *fieldname, int externalflag, void *buffer) { int ret = FAIL; /* routine return status variable */ hid_t swathID = FAIL; /* HDF5 type swath ID */ hid_t regionID = FAIL; /* HDF5 type region ID */ herr_t status = FAIL; /* routine return status variable */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* error message buffer */ swathID = (hid_t)SwathID; regionID = (hid_t)RegionID; status = HE5_SWextractregion(swathID, regionID, fieldname, externalflag, buffer); if (status == FAIL) { sprintf(errbuf,"Cannot extract region data.\n"); H5Epush(__FILE__, "HE5_SWextreg", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWdeftmeper (FORTRAN wrapper) | | | | DESCRIPTION: Finds swath cross tracks observed during time period and | | returns period ID | | | | | | DESCRIPTION: | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | PeriodID int Period ID | | | | INPUTS: | | SwathID int Swath structure ID | | starttime double TAI sec Start of time period | | stoptime doubel TAI sec Stop of time period | | mode int Search mode | | HDFE_MIDPOINT - Use midpoint of Xtrack | | HDFE_ENDPOINT - Use endpoints of Xtrack | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 00 A.Muslimov Updated to reflect data type changes. | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWdeftmeper(int SwathID, double starttime, double stoptime, int mode) { int PeriodID = FAIL; /* Period ID (return) */ hid_t periodID = FAIL; /* HDF5 type Period ID */ hid_t swathID = FAIL; /* HDF5 type swath ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ swathID = (hid_t)SwathID; periodID = HE5_SWdeftimeperiod(swathID, starttime, stoptime, mode); if (periodID == FAIL) { sprintf(errbuf,"Cannot define time period.\n"); H5Epush(__FILE__, "HE5_SWdeftmeper", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } PeriodID = (int)periodID; return(PeriodID); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWperinfo | | | | DESCRIPTION: FORTRAN wrapper around SWperiodinfo | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int Swath structure ID | | PeriodID int Period ID | | fieldname char Fieldname | | | | | | OUTPUTS: | | nunmbertype int field number type | | rank int field rank | | dims long dimensions of field region | | (FORTRAN order) | | size long size in bytes of field region | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Nov 99 Abe Taaheri Modified for HDF5 | | Aug 00 A.Muslimov Updated to reflect data type changes. | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWperinfo(int SwathID, int PeriodID, char *fieldname, int *numbertype,int *rank, long dims[], long *size) { int ret = SUCCEED;/* routine return status variable */ int j = 0; /* Loop index */ hid_t swathID = FAIL; /* HDF5 type swath ID */ hid_t periodID = FAIL; /* HDF5 type period ID */ hid_t *ntype = (hid_t *)NULL;/* number types */ herr_t status = SUCCEED;/* routine return status variable */ size_t *tsize = (size_t *)NULL; hsize_t swap = 0; /* Temporary swap variable */ hsize_t tempdims[HE5_DTSETRANKMAX]; char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_timeflag = 1; swathID = (hid_t)SwathID; periodID = (hid_t)PeriodID; tsize = (size_t *)calloc(1, sizeof(size_t)); if (tsize == NULL) { sprintf(errbuf,"Cannot allocate memory for tsize.\n"); H5Epush(__FILE__, "HE5_SWperinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } ntype = (hid_t *)calloc(1, sizeof(hid_t)); if (ntype == NULL) { sprintf(errbuf,"Cannot allocate memory for ntype.\n"); H5Epush(__FILE__, "HE5_SWperinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(tsize); return(FAIL); } /* Initialize tempdims[] array */ /* --------------------------- */ for (j = 0; j < HE5_DTSETRANKMAX; j++) tempdims[ j ] = 0; /* Call SWregioninfo */ /* ----------------- */ status = HE5_SWregioninfo(swathID, periodID, fieldname, ntype, rank, tempdims, tsize); if (status == FAIL) { sprintf(errbuf,"Cannot get information about region.\n"); H5Epush(__FILE__, "HE5_SWperinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(tsize); free(ntype); return(FAIL); } /* Change dimensions to FORTRAN order */ /* ---------------------------------- */ for (j = 0; j < *rank / 2; j++) { swap = tempdims[*rank - 1 - j]; tempdims[*rank - 1 - j] = tempdims[j]; tempdims[j] = swap; } for (j = 0; j < *rank; j++) dims[j] = (long)tempdims[j]; *size = (long)(*tsize); *numbertype = (int)(*ntype); free(tsize); free(ntype); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWdupreg (FORTRAN wrapper) | | | | DESCRIPTION: Duplicates a region | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | NewregionID int New region ID | | | | INPUTS: | | OldregionID int Old region ID | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ======= ============ ================================================= | | Aug 00 A.Muslimov | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWdupreg(int OldregionID) { int NewregionID = FAIL;/* New region ID (return) */ hid_t newregionID = FAIL;/* New region ID */ hid_t oldregionID = FAIL;/* Old region ID */ oldregionID = (hid_t)OldregionID; newregionID = HE5_SWdupregion(oldregionID); if(newregionID == FAIL) { H5Epush(__FILE__, "HE5_SWdupreg", __LINE__, H5E_FUNC, H5E_CANTINIT, "Cannot duplicate region."); HE5_EHprint("Error: Cannot duplicate region, occured", __FILE__, __LINE__); return(FAIL); } NewregionID = (int)newregionID; return(NewregionID); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWupscene (FORTRAN wrapper) | | | | DESCRIPTION: Updates the StartRegion and StopRegion values | | for a specified region. This function is for Landsat. | | The start and stop values must be set to the beginning | | and the end of a scene, fixed scene subsetting. | | | | | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int Swath structure ID | | RegionID int Region ID | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 00 A.Muslimov | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWupscene(int SwathID, int RegionID) { int ret = FAIL;/* routine return status variable */ herr_t status = FAIL;/* routine return status variable */ hid_t swathID = FAIL;/* HDF5 type swath ID */ hid_t regionID = FAIL;/* HDF5 type region ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ swathID = (hid_t)SwathID; regionID = (hid_t)RegionID; status = HE5_SWupdatescene(swathID, regionID); if (status == FAIL) { sprintf(errbuf, "Cannot update scene.\n"); H5Epush(__FILE__, "HE5_SWupscene", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWregidx | | | | DESCRIPTION: Finds swath cross tracks within area of interest and returns | | region index and region ID (FORTRAN Wrapper) | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | RegionID int Region ID | | | | INPUTS: | | SwathID int Swath structure ID | | cornerlon double dec deg Longitude of opposite corners of box | | cornerlat double dec deg Latitude of opposite corners of box | | mode int Search mode | | HDFE_MIDPOINT - Use midpoint of Xtrack | | HDFE_ENDPOINT - Use endpoints of Xtrack | | HDFE_ANYPOINT - Use all points of Xtrack| | | | OUTPUTS: | | geodim char geolocation track dimension | | idxrange long indices of region for along track dim. | | | | NOTES: | | | | | | | | Date Programmer Description | | ====== ============ ================================================= | | May 00 D.Wynne Original Programmer | | Aug 00 A.Muslimov | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWregidx(int SwathID, double cornerlon[], double cornerlat[], int mode, char *geodim, long idxrange[]) { int i = 0; /* Loop index */ int RegionID = SUCCEED; /* Region ID */ hid_t swathID = FAIL; /* HDF5 type swath ID */ hid_t regionID = FAIL; /* HDF5 type region ID */ hsize_t range[2] = {0, 0}; /* Index range array */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ swathID = (hid_t)SwathID; regionID = HE5_SWregionindex(swathID, cornerlon, cornerlat, mode, geodim, range); if (regionID == FAIL) { sprintf(errbuf, "Cannot get the region indices.\n"); H5Epush(__FILE__, "HE5_SWregidx", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } for(i = 0; i < 2; i++) idxrange[i] = HE5_EHhsize2long(range[i]); RegionID = (int)regionID; return(RegionID); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWextper (FORTRAN wrapper) | | | | DESCRIPTION: Retrieves data from specified period. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int Swath structure ID | | PeriodID int Period ID | | fieldname char Fieldname | | externalflag int External geolocation fields flag: | | | | HDFE_INTERNAL (0) | | HDFE_EXTERNAL (1) | | OUTPUTS: | | buffer void Data buffer containing subsetted region | | | | NOTES: | | | | | | Date Programmer Description | | ======= ============ ================================================= | | Aug 00 A.Muslimov | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWextper(int SwathID, int PeriodID, char *fieldname, int externalflag, void *buffer) { int ret = FAIL; /* return status variable */ herr_t status = FAIL; /* return status variable */ hid_t swathID = FAIL; /* HDF5 type swath ID */ hid_t periodID = FAIL; /* HDF5 type period ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_timeflag = 1; swathID = (hid_t)SwathID; periodID = (hid_t)PeriodID; /* Call SWextractregion routine */ /* ---------------------------- */ status = HE5_SWextractregion(swathID, periodID, fieldname, externalflag, (char *)buffer); if (status == FAIL) { sprintf(errbuf, "Cannot extract the period.\n"); H5Epush(__FILE__, "HE5_SWextper", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWupimap (FORTRAN wrapper) | | | | DESCRIPTION: Updates the map index for a specified region. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nout long return Number of elements in output | | index array if SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int Swath structure ID | | RegionID int Region ID | | indexin long array of index values | | | | OUTPUTS: | | indexout long array of index values | | indicies long array of start and stop in region | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 00 A.Muslimov | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_SWupimap(int SwathID, int RegionID, long indexin[], long indexout[], long indicies[]) { long nout = FAIL;/* # of elements in output array (return) */ hid_t regionID = FAIL;/* HDF5 type region ID */ hid_t swathID = FAIL;/* HDF5 type swath ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error buffer */ swathID = (hid_t)SwathID; regionID = (hid_t)RegionID; nout = HE5_SWupdateidxmap(swathID, regionID, indexin, indexout, indicies); if (nout == FAIL) { sprintf(errbuf, "Failed to update index mapping.\n"); H5Epush(__FILE__, "HE5_SWupimap", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf ); HE5_EHprint(errbuf, __FILE__, __LINE__); } return(nout); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWinqswathF (FORTRAN wrapper) | | | | DESCRIPTION: Returns number and names of swath structures in file | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nSwath long Number of swath structures in file | | | | INPUTS: | | filename char HDF-EOS filename | | | | OUTPUTS: | | swathlist char List of swath names (comma-separated) | | strbufsize long Length of swathlist | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | July 00 A.Muslimov Unmasked hdf5 data types. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_SWinqswathF(char *filename, char *swathlist, long *strbufsize) { long nSwath = FAIL;/* Number of swath structures in file */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ nSwath = HE5_SWinqswath(filename, swathlist, strbufsize); if ( nSwath < 0 ) { sprintf(errbuf,"Cannot get information about Swath."); H5Epush(__FILE__, "HE5_SWinqswathF", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return(nSwath); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWnentriesF (FORTRAN wrapper) | | | | DESCRIPTION: Returns number of entries and string buffer size | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nEntries long Number of entries | | | | INPUTS: | | SwathID int Swath structure ID | | entrycode int Entry code | | | | OUTPUTS: | | strbufsize long Length of comma-separated list | | (Does not include null-terminator | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 00 A.Muslimov | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_SWnentriesF(int SwathID, int entrycode, long *strbufsize) { long nEntries = FAIL; /* Number of entries */ hid_t swathID = FAIL; /* HDF5 type swath ID */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Buffer for error message */ swathID = (hid_t)SwathID; nEntries = HE5_SWnentries(swathID, entrycode, strbufsize); if (nEntries < 0) { sprintf(errbuf,"Failed to get number of entries in a swath."); H5Epush(__FILE__, "HE5_SWnentriesF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return(nEntries); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PRdefineF (FORTRAN wrapper) | | | | DESCRIPTION: Defines "Profile" dataset within a specified Swath, under the| | "Data Fields" group. | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | ret int Return status (0) SUCCEED (-1) | | FAIL | | INPUTS: | | SwathID int Swath ID | | profilename char Profile/dataset name | | fortdimlist char Dim. list (comma-separated list) | | FORTRAN dimesion order | | fortmaxdimlist char Max Dim. list (FORTRAN order) | | profile/dataset | | ntype int Base datatype ID | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ======= ============ ================================================= | | Aug 00 A.Muslimov Original development. | | Dec 00 A.Muslimov Updated to add "fortdimlist" and "fortmaxdimlist" | | inputs. | | May 01 C.Praderas Continued development. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PRdefineF(int SwathID, char *profilename, char *fortdimlist, char *fortmaxdimlist, int ntype) { int ret = FAIL;/* return status variable */ herr_t status = FAIL;/* return status variable */ hid_t swathID = FAIL;/* HDF5 type swath ID */ hid_t dtypeID = FAIL;/* HDF5 type data type ID */ char *dimlist = (char *)NULL; /* Dimension list (C order) */ char *maxdimlist = (char *)NULL; /* Max. dimension list (C) */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ swathID = (hid_t)SwathID; dtypeID = HE5_EHconvdatatype(ntype); if(dtypeID == FAIL) { H5Epush(__FILE__, "HE5_PRdefineF", __LINE__, H5E_DATATYPE, H5E_BADVALUE, "Cannot convert datatype for FORTRAN wrapper."); HE5_EHprint("Error: Cannot convert datatype for FORTRAN wrapper, occured", __FILE__, __LINE__); return(FAIL); } if(strcmp(fortmaxdimlist,"") == 0) fortmaxdimlist = NULL; /* Allocate space for C order dimension list */ /* ----------------------------------------- */ dimlist = (char *)calloc(strlen(fortdimlist) + 1, sizeof(char)); if(dimlist == NULL) { sprintf(errbuf,"Cannot allocate memory for dimlist.\n"); H5Epush(__FILE__, "HE5_PRdefineF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Reverse entries in dimension list (FORTRAN -> C) */ /* ------------------------------------------------ */ status = HE5_EHrevflds(fortdimlist, dimlist); if(status == FAIL) { sprintf(errbuf,"Cannot reverse entries in dimension list.\n"); H5Epush(__FILE__, "HE5_PRdefineF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(dimlist); return(FAIL); } if (fortmaxdimlist != NULL) { /* Allocate space for C order max. dim. list */ /* ----------------------------------------- */ maxdimlist = (char *)calloc(strlen(fortmaxdimlist) + 1, sizeof(char)); if(maxdimlist == NULL) { sprintf(errbuf,"Cannot allocate memory for maxdimlist.\n"); H5Epush(__FILE__, "HE5_PRdefineF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(dimlist); return(FAIL); } /* Reverse entries in dimension list (FORTRAN -> C) */ /* ------------------------------------------------ */ status = HE5_EHrevflds(fortmaxdimlist, maxdimlist); if(status == FAIL) { sprintf(errbuf,"Cannot reverse entries in maximum dimension list.\n"); H5Epush(__FILE__, "HE5_PRdefineF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(dimlist); free(maxdimlist); return(FAIL); } } else { maxdimlist = NULL; } /* Define specified profile */ /* ------------------------ */ status = HE5_PRdefine(swathID, profilename, dimlist, maxdimlist, dtypeID); if (status == FAIL) { sprintf(errbuf,"Cannot define \"%s\" profile.\n", profilename); H5Epush(__FILE__, "HE5_PRdefineF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(dimlist); if (maxdimlist!=NULL) free(maxdimlist); return(FAIL); } free(dimlist); if (maxdimlist != NULL) free(maxdimlist); ret = (int)status; return (ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PRwriteF (FORTRAN wrapper) | | | | DESCRIPTION: Writes data into the "Profile" dataset within a Swath. | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | ret int Return status (0) SUCCEED (-1) | | FAIL | | INPUTS: | | Swath_ID int Swath ID | | profilename char Name of Profile dataset | | fortstart long start array | | fortstride long stride array | | fortedge long edge array | | | | buffer void Data buffer | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ======= ============ ================================================= | | Aug 00 A.Muslimov Original development | | Dec 00 A.Muslimov Updated to add "start", "stride", and "edge" | | parameters. | | May 01 C.Praderas Continued development. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PRwriteF(int SwathID, char *profilename, long fortstart[], long fortstride[], long fortedge[], long size, long len[], void *buffer) { int ret = FAIL; /* return status variable */ int rank = 0; /* Profile rank */ int i; /* Loop index */ int nelmnts = 0; /* Number of elements in Profile */ /* field */ long begin_offset = 0; /* Used in storing to VL buffer */ long end_offset = 0; /* " " */ long length = 0; /* " " */ long idx = FAIL; /* Swath index */ herr_t status = FAIL; /* return status variable */ hid_t groupID = FAIL; /* "Profile Fields" group ID */ hid_t gid = FAIL; /* "SWATHS" group ID */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t profID = FAIL; /* Profile dataset ID */ hid_t typeID = FAIL; /* Dataset type ID */ hid_t btypeID = FAIL; /* Base data type ID */ hid_t swathID = FAIL; /* HDF5 type swath ID */ hssize_t *start = (hssize_t *)NULL; /* Ptr to start array (C order) */ hsize_t dims[HE5_DTSETRANKMAX]; /* Profile dimensions */ hsize_t maxdims[HE5_DTSETRANKMAX]; /* Profile maximum dimensions */ hsize_t *stride = (hsize_t *)NULL; /* Ptr to stride array (C order) */ hsize_t *edge = (hsize_t *)NULL; /* Ptr to edge array (C order) */ size_t dsize = 0; /* Data size variable */ size_t btype_size = 0; /* Size of base datatype */ char *buffer_char=NULL; char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ hvl_t *profile_buffer; /*Data buffer for the profile */ dsize = (size_t)size; swathID = (hid_t)SwathID; /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_PRinfo", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for swath ID failed. \n"); H5Epush(__FILE__, "HE5_PRwriteF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get "Profile Fields" group ID */ /* ----------------------------- */ groupID = HE5_SWXSwath[idx].prof_id; /* Open specified profile dataset */ /* ------------------------------ */ profID = H5Dopen(groupID, profilename); if (profID == FAIL) { sprintf(errbuf,"Cannot open \"%s\" profile.\n", profilename); H5Epush(__FILE__, "HE5_PRwriteF", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get data type ID */ /* ---------------- */ typeID = H5Dget_type(profID); if (typeID == FAIL) { sprintf(errbuf,"Cannot get data type ID.\n"); H5Epush(__FILE__, "HE5_PRwriteF", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get base data type ID */ /* --------------------- */ btypeID = H5Tget_super(typeID); if (btypeID == FAIL) { sprintf(errbuf,"Cannot get base data type ID.\n"); H5Epush(__FILE__, "HE5_PRwriteF", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get size of base data type */ /* -------------------------- */ btype_size = H5Tget_size(btypeID); if (btype_size == FAIL) { sprintf(errbuf,"Cannot get size of base data type.\n"); H5Epush(__FILE__, "HE5_PRwriteF", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Release data type ID */ /* -------------------- */ status = H5Tclose(typeID); if (status == FAIL) { sprintf(errbuf,"Cannot release data type ID.\n"); H5Epush(__FILE__, "HE5_PRwriteF", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Release dataset ID */ /* ------------------ */ status = H5Dclose(profID); if (status == FAIL) { sprintf(errbuf,"Cannot release dataset ID.\n"); H5Epush(__FILE__, "HE5_PRwriteF", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Initialize dims[]/maxdims[] arrays */ /* ---------------------------------- */ for ( i = 0; i < HE5_DTSETRANKMAX; i++) { dims[ i ] = 0; maxdims[ i ] = 0; } /* Get profile rank */ /* ----------------- */ status = HE5_PRinfo(swathID, profilename, &rank, dims, maxdims, NULL, NULL, NULL); if (status != FAIL) { start = (hssize_t *)calloc(rank, sizeof(hssize_t)); if(start == NULL) { sprintf(errbuf,"Cannot allocate memory for start.\n"); H5Epush(__FILE__, "HE5_PRwriteF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } stride = (hsize_t *)calloc(rank, sizeof(hsize_t)); if(stride == NULL) { sprintf(errbuf,"Cannot allocate memory for stride.\n"); H5Epush(__FILE__, "HE5_PRwriteF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); return(FAIL); } edge = (hsize_t *)calloc(rank, sizeof(hsize_t)); if(edge == NULL) { sprintf(errbuf,"Cannot allocate memory for edge.\n"); H5Epush(__FILE__, "HE5_PRwriteF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(stride); return(FAIL); } /* Reverse order of dimensions (FORTRAN -> C) */ /* ------------------------------------------ */ for (i = 0; i < rank; i++) { start[i] = (hssize_t)fortstart[rank - 1 - i]; stride[i] = (hsize_t)fortstride[rank - 1 - i]; edge[i] = (hsize_t)fortedge[rank - 1 - i]; } /* Determine number of elements in Profile Field */ /* --------------------------------------------- */ nelmnts = 0; for (i = 0; i < rank; i++) { nelmnts = (int)fortedge[i] + nelmnts; } buffer_char = (char *)calloc(size*btype_size,1); if(buffer_char == NULL) { sprintf(errbuf,"Cannot allocate memory for buffer_char.\n"); H5Epush(__FILE__, "HE5_PRwriteF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(stride); free(edge); return(FAIL); } memmove(buffer_char, buffer, size*btype_size); profile_buffer = (hvl_t *)calloc(nelmnts, sizeof(hvl_t)); if(profile_buffer == NULL) { sprintf(errbuf,"Cannot allocate memory for profile_buffer.\n"); H5Epush(__FILE__, "HE5_PRwriteF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(stride); free(edge); free(buffer_char); return(FAIL); } begin_offset = 0; end_offset = -1; for (i = 0; i < nelmnts; i++) { profile_buffer[i].p = malloc(len[i]*((long)btype_size)); begin_offset = end_offset + 1; end_offset = begin_offset + len[i]*((long)btype_size) - 1; length = end_offset - begin_offset + 1; memmove(profile_buffer[i].p, &buffer_char[begin_offset], length); profile_buffer[i].len = (size_t)len[i]; } free(buffer_char); /* Write data buffer to the profile dataset */ /* ----------------------------------------- */ status = HE5_PRwrite(swathID, profilename, start, stride, edge, dsize, profile_buffer); if ( status == FAIL ) { sprintf(errbuf, "Cannot write data to \"%s\" profile. \n", profilename); H5Epush(__FILE__, "HE5_PRwriteF", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(stride); free(edge); free(profile_buffer); return(FAIL); } free(start); free(stride); free(edge); free(profile_buffer); } else { sprintf(errbuf, "Error calling HE5_PRinfo() from FORTRAN wrapper. \n") ; H5Epush(__FILE__, "HE5_PRwriteF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); status = FAIL; } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PRreadF (FORTRAN wrapper) | | | | DESCRIPTION: Reads data from the profile dataset. | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | ret int Return status (0) SUCCEED (-1) | | FAIL | | INPUTS: | | SwathID int Swath ID | | profilename char Name of profile/dataset | | fortstart long start array | | fortstride long stride array | | fortedge long edge array | | len long lengths of each element in the | | profile field | | | | OUTPUTS: | | buffer_output void Data buffer | | | | NOTES: | | | | | | Date Programmer Description | | ======= ============ ================================================= | | Aug 00 A.Muslimov Original development | | Dec 00 A.Muslimov Updated to add "start", "stride", and "edge" | | parameters. | | May 01 C.Praderas Continued development. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PRreadF(int SwathID, char *profilename, long fortstart[], long fortstride[], long fortedge[],long len[], void *buffer_output) { int ret = FAIL; /* Status variable */ int rank = FAIL; /* Rank of dataset */ int i; /* Loop index */ long num_prof_elmnts = 0; /* number of elements in profile */ long profile_datasize = 0; /* Size (in bytes) of Prof Field */ long begin_offset = 0; /* Used in storing to VL buffer */ long end_offset = 0; /* " " */ long length = 0; /* " " */ long idx = FAIL; /* Swath index */ herr_t status = FAIL; /* Status variable */ hid_t swathID = FAIL; /* HDF5-type swath ID */ hid_t groupID = FAIL; /* "Profile Fields" group ID */ hid_t gid = FAIL; /* "SWATHS" group ID */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t profID = FAIL; /* Profile dataset ID */ hid_t typeID = FAIL; /* Dataset type ID */ hid_t btypeID = FAIL; /* Base data type ID */ hssize_t *start = (hssize_t *)NULL;/* Start array (C order) */ hsize_t *stride = (hsize_t *)NULL; /* Stride array (C order) */ hsize_t *edge = (hsize_t *)NULL; /* Edge array (C order) */ hsize_t dims[HE5_DTSETRANKMAX]; /* Profile dimensions */ hsize_t maxdims[HE5_DTSETRANKMAX]; /* Profile max.dims */ size_t btype_size = 0; /* Size of base datatype */ size_t vltype_size = 0; /* Size of variable length */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ char *buffer_char=NULL; hvl_t *buffer; /* Buffer to read outt data from profile */ swathID = (hid_t)SwathID; /* Get HDF-EOS file ID, "HDFEOS" group ID and Swath index */ /* ------------------------------------------------------ */ status = HE5_SWchkswid(swathID, "HE5_PRinfo", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for swath ID failed. \n"); H5Epush(__FILE__, "HE5_PRreadF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get "Profile Fields" group ID */ /* ----------------------------- */ groupID = HE5_SWXSwath[idx].prof_id; /* Open specified profile dataset */ /* ------------------------------ */ profID = H5Dopen(groupID, profilename); if (profID == FAIL) { sprintf(errbuf,"Cannot open \"%s\" profile.\n", profilename); H5Epush(__FILE__, "HE5_PRreadF", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get data type ID */ /* ---------------- */ typeID = H5Dget_type(profID); if (typeID == FAIL) { sprintf(errbuf,"Cannot get data type ID.\n"); H5Epush(__FILE__, "HE5_PRreadF", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get size of variable length data type (Profile field) */ /* ----------------------------------------------------- */ vltype_size = H5Tget_size(typeID); if (vltype_size == FAIL) { sprintf(errbuf,"Cannot get size of variable length data type.\n"); H5Epush(__FILE__, "HE5_PRreadF", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get base data type ID */ /* --------------------- */ btypeID = H5Tget_super(typeID); if (btypeID == FAIL) { sprintf(errbuf,"Cannot get base data type ID.\n"); H5Epush(__FILE__, "HE5_PRreadF", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get size of base data type */ /* -------------------------- */ btype_size = H5Tget_size(btypeID); if (btype_size == FAIL) { sprintf(errbuf,"Cannot get size of base data type.\n"); H5Epush(__FILE__, "HE5_PRreadF", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Release data type ID */ /* -------------------- */ status = H5Tclose(typeID); if (status == FAIL) { sprintf(errbuf,"Cannot release data type ID.\n"); H5Epush(__FILE__, "HE5_PRreadF", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Release dataset ID */ /* ------------------ */ status = H5Dclose(profID); if (status == FAIL) { sprintf(errbuf,"Cannot release dataset ID.\n"); H5Epush(__FILE__, "HE5_PRreadF", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Initialize dims[]/maxdims[] arrays */ /* ---------------------------------- */ for ( i = 0; i < HE5_DTSETRANKMAX; i++) { dims[ i ] = 0; maxdims[ i ] = 0; } /* Get profile rank */ /* ----------------- */ status = HE5_PRinfo(swathID, profilename, &rank, dims, maxdims, NULL, NULL, NULL); if (status != FAIL) { start = (hssize_t *)calloc(rank, sizeof(hssize_t)); if(start == NULL) { sprintf(errbuf,"Cannot allocate memory for start.\n"); H5Epush(__FILE__, "HE5_PRreadF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } stride = (hsize_t *)calloc(rank, sizeof(hsize_t)); if(stride == NULL) { sprintf(errbuf,"Cannot allocate memory for stride.\n"); H5Epush(__FILE__, "HE5_PRreadF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); return(FAIL); } edge = (hsize_t *)calloc(rank, sizeof(hsize_t)); if(edge == NULL) { sprintf(errbuf,"Cannot allocate memory for edge.\n"); H5Epush(__FILE__, "HE5_PRreadF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(stride); return(FAIL); } /* Reverse order of dimensions (FORTRAN -> C) */ /* ------------------------------------------ */ for (i = 0; i < rank; i++) { start[i] = (hssize_t)fortstart[rank - 1 - i]; stride[i] = (hsize_t)fortstride[rank - 1 - i]; edge[i] = (hsize_t)fortedge[rank - 1 - i]; } /* Allocate space for buffer */ /* ------------------------- */ buffer = (hvl_t *) calloc(fortedge[0],sizeof(hvl_t)); if ( buffer == NULL ) { H5Epush(__FILE__, "HE5_PRreadF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for read buffer.\n"); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Read the data from profile dataset */ /* ----------------------------------- */ status = HE5_PRread(swathID, profilename, start, stride, edge, buffer); if ( status == FAIL ) { sprintf(errbuf, "Cannot read data from \"%s\" profile. \n", profilename); H5Epush(__FILE__, "HE5_PRreadF", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(buffer); return(FAIL); } free(start); free(stride); free(edge); } else { sprintf(errbuf, "Error calling HE5_PRinfo() from FORTRAN wrapper. \n") ; H5Epush(__FILE__, "HE5_PRreadF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); status = FAIL; } /* Calculate the number of elements in the profile field */ /* ----------------------------------------------------- */ for( i=0; i C) */ /* ------------------------------------------ */ for (i = 0; i < rank; i++) count[i] = (hsize_t)fortcount[rank - 1 - i]; swathID = (hid_t)SwathID; if ((numbertype == HE5T_CHARSTRING) || (numbertype == H5T_NATIVE_CHAR) || (numbertype == H5T_C_S1)) { if (strlen((char *)datbuf) < count[0]) { sprintf(errbuf,"Size of databuf is less than the number of group attribute elements.\n"); H5Epush(__FILE__, "HE5_PRwrgattrF", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); return(FAIL); } /* Allocate memory for temp buffer */ /* ------------------------------- */ tempbuf = (char * )calloc((count[0]+1), sizeof(char)); if(tempbuf == NULL) { sprintf(errbuf,"Cannot allocate memory for temp buffer.\n"); H5Epush(__FILE__, "HE5_PRwrgattrF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); return(FAIL); } strncpy(tempbuf, (char *)datbuf, count[0]); tempbuf[count[0]] = '\0'; status = HE5_PRwritegrpattr(swathID, attrname, numbertype, count, tempbuf); if(status == FAIL) { sprintf(errbuf,"Cannot write group attribute value.\n"); H5Epush(__FILE__, "HE5_PRwrgattrF", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); free(tempbuf); return(FAIL); } free(count); free(errbuf); free(tempbuf); } else { status = HE5_PRwritegrpattr(swathID, attrname, numbertype, count, datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot write group attribute value.\n"); H5Epush(__FILE__, "HE5_PRwrgattrF", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); return(FAIL); } free(count); free(errbuf); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PRrdgattrF (FORTRAN wrapper) | | | | DESCRIPTION: Reads attribute from the "Profile Fields" group in a swath. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int swath structure ID | | attrname char attribute name | | | | OUTPUTS: | | datbuf void I/O buffer | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Feb 04 S.Zhao Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_PRrdgattrF(int SwathID, char *attrname, void *datbuf) { int ret = FAIL; /* (int) return status */ herr_t status = FAIL; /* return status variable */ hid_t swathID = FAIL; /* HDF5 type Swath ID */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ swathID = (hid_t)SwathID; status = HE5_PRreadgrpattr(swathID,attrname,datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot read attribute \"%s\" from the \"Profile Fields\" group.\n", attrname); H5Epush(__FILE__, "HE5_PRrdgattrF", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PRgattrinfoF | | | | DESCRIPTION: FORTRAN wrapper for PRgrpattrinfo | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int swath structure ID | | attrname char* attribute name | | | | OUTPUTS: | | numbertype int attribute HDF numbertype | | fortcount long Number of attribute elements | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Feb 04 S.Zhao Original development | | | | END_PROLOG | | | -----------------------------------------------------------------------------*/ int HE5_PRgattrinfoF(int SwathID, char *attrname, int *numbertype, long *fortcount) { int ret = FAIL; /* (int) return status variable */ herr_t status = FAIL; /* routine return status variable */ hid_t *ntype = (hid_t *)NULL; /* Data type class ID */ hid_t swathID = FAIL; /* HDF5 type Swath ID */ hsize_t *count = (hsize_t *)NULL;/* Pointer to count (C order) */ char *errbuf = (char *)NULL; /* error message buffer */ /* Allocate memory for error message buffers */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_PRgattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } count = (hsize_t *)calloc(1, sizeof(hsize_t)); if( count == NULL) { sprintf(errbuf,"Cannot allocate memory for count.\n"); H5Epush(__FILE__, "HE5_PRgattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } ntype = (hid_t *)calloc(1, sizeof(hid_t)); if( ntype == (hid_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for ntype.\n"); H5Epush(__FILE__, "HE5_PRgattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); return(FAIL); } swathID = (hid_t)SwathID; status = HE5_PRgrpattrinfo(swathID, attrname, ntype, count); if(status == FAIL) { sprintf(errbuf,"Cannot get information about group attribute.\n"); H5Epush(__FILE__, "HE5_PRgattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); free(ntype); return(FAIL); } *fortcount = (long)(*count); *numbertype = (int)(*ntype); free(errbuf); free(count); free(ntype); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PRgattrinfoF2 | | | | DESCRIPTION: FORTRAN wrapper for PRgrpattrinfo2 | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int swath structure ID | | attrname char* attribute name | | | | OUTPUTS: | | numbertype int attribute HDF numbertype | | fortcount long Number of attribute elements | | fortsize long buf size of attribute elements | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Feb 04 S.Zhao Original development | | | | END_PROLOG | | | -----------------------------------------------------------------------------*/ int HE5_PRgattrinfoF2(int SwathID, char *attrname, int *numbertype, long *fortcount, long *fortsize) { int ret = FAIL; /* (int) return status variable */ herr_t status = FAIL; /* routine return status variable */ hid_t *ntype = (hid_t *)NULL; /* Data type class ID */ hid_t swathID = FAIL; /* HDF5 type Swath ID */ hsize_t *count = (hsize_t *)NULL;/* Pointer to count (C order) */ hsize_t *size = (hsize_t *)NULL;/* Pointer to size (C order) */ char *errbuf = (char *)NULL; /* error message buffer */ /* Allocate memory for error message buffers */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_PRgattrinfoF2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } count = (hsize_t *)calloc(1, sizeof(hsize_t)); if( count == NULL) { sprintf(errbuf,"Cannot allocate memory for count.\n"); H5Epush(__FILE__, "HE5_PRgattrinfoF2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } ntype = (hid_t *)calloc(1, sizeof(hid_t)); if( ntype == (hid_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for ntype.\n"); H5Epush(__FILE__, "HE5_PRgattrinfoF2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); return(FAIL); } size = (hsize_t *)calloc(1, sizeof(hsize_t)); if( size == NULL) { sprintf(errbuf,"Cannot allocate memory for size.\n"); H5Epush(__FILE__, "HE5_PRgattrinfoF2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } swathID = (hid_t)SwathID; status = HE5_PRgrpattrinfo2(swathID, attrname, ntype, count, size); if(status == FAIL) { sprintf(errbuf,"Cannot get information about group attribute.\n"); H5Epush(__FILE__, "HE5_PRgattrinfoF2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); free(ntype); return(FAIL); } *fortcount = (long)(*count); *fortsize = (long)(*size); *numbertype = (int)(*ntype); free(errbuf); free(count); free(size); free(ntype); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_PRinqgattrsF (FORTRAN wrapper) | | | | DESCRIPTION: Retrieves the number of attributes and string length of | | attribute list in "Profile Fields" group | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nattr long Number of attributes in "Profile Fields"| | group. | | | | INPUTS: | | SwathID int swath structure ID | | | | OUTPUTS: | | attrnames char Attribute names in "Profile Fields" | | group (Comma-separated list) | | strbufsize long Attributes name list string length | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Feb 04 S.Zhao Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_PRinqgattrsF(int SwathID, char *attrnames, long *strbufsize) { long nattr = FAIL; /* Number of attributes (return) */ hid_t swathID = FAIL; /* HDF5 type swath ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ swathID = (hid_t)SwathID; nattr = HE5_PRinqgrpattrs(swathID, attrnames, strbufsize); if ( nattr < 0 ) { sprintf(errbuf, "Cannot retrieve the attributes. \n"); H5Epush(__FILE__, "HE5_PRinqgattrsF", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return(nattr); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWsetaliasF (FORTRAN wrapper) | | | | DESCRIPTION: Defines alias for a specified field name | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | ret int Return status | | | | INPUTS: | | SwathID int swath ID | | fieldname char Original field name | | | | OUTPUTS: | | fortaliaslist char Comma separated list of aliases for| | the field name | | NOTES: | | None | | | | | | Date Programmer Description | | ======= ============ ================================================= | | Oct 00 A. Muslimov Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWsetaliasF(int SwathID, char *fieldname, char *fortaliaslist) { int ret = FAIL;/* (int)Return status variable */ herr_t status = FAIL;/* return status variable */ hid_t swathID = FAIL;/* HDF5 type swath ID */ char *aliaslist = NULL;/* C-order list of aliases */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ swathID = (hid_t)SwathID; /* Allocate space for C order alias list */ /* ------------------------------------- */ aliaslist = (char *)calloc(strlen(fortaliaslist) + 1, sizeof(char)); if(aliaslist == NULL) { sprintf(errbuf,"Cannot allocate memory for aliaslist.\n"); H5Epush(__FILE__, "HE5_SWsetaliasF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Reverse entries in alias list (FORTRAN -> C) */ /* -------------------------------------------- */ status = HE5_EHrevflds(fortaliaslist, aliaslist); if(status == FAIL) { sprintf(errbuf,"Cannot reverse entries in alias list.\n"); H5Epush(__FILE__, "HE5_SWsetaliasF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(aliaslist); return(FAIL); } /* Call SWsetalias() */ /* ----------------- */ status = HE5_SWsetalias(swathID, fieldname, aliaslist); if ( status == FAIL ) { sprintf(errbuf, "Error calling SWsetalias() from FORTRAN wrapper. \n"); H5Epush(__FILE__, "HE5_SWsetaliasF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(aliaslist); return(FAIL); } free(aliaslist); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWdropaliasF (FORTRAN wrapper) | | | | DESCRIPTION: Removes the alias for a specified field name | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | ret int Return status | | | | INPUTS: | | SwathID int swath ID | | aliasname char alias name to remove | | fldgroup int Field group flag | | | | OUTPUTS: | | | | NOTES: | | None | | | | | | Date Programmer Description | | ======= ============ ================================================= | | Oct 00 A. Muslimov Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWdropaliasF(int SwathID, int fldgroup, char *aliasname) { int ret = FAIL;/* (int)Return status variable */ herr_t status = FAIL;/* return status variable */ hid_t swathID = FAIL;/* HDF5 type Swath ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ swathID = (hid_t)SwathID; status = HE5_SWdropalias(swathID, fldgroup, aliasname); if(status == FAIL) { sprintf(errbuf,"Error calling SWdropalias() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_SWdropaliasF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWinqdfldaliasF (FORTRAN wrapper) | | | | DESCRIPTION: Retrieves the number of fields & aliases and string length of| | fields & aliases list in "Data Fields" group | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nfldalias long Number of fields & aliases in "Data | | Fields" group. | | | | INPUTS: | | SwathID int swath structure ID | | | | OUTPUTS: | | fldalias char* Fields & aliases names in "Data Fields" | | group (Comma-separated list) | | strbufsize long* Fields & aliases name list string length| | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Mar 03 S.Zhao Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_SWinqdfldaliasF(int SwathID, char *fldalias, long *strbufsize) { long nfldalias = FAIL; /* Number of fields & aliases (return) */ hid_t swathID = FAIL; /* HDF5 type swath ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ swathID = (hid_t)SwathID; nfldalias = HE5_SWinqdfldalias(swathID, fldalias, strbufsize); if ( nfldalias < 0 ) { sprintf(errbuf, "Cannot retrieve the fields & aliases. \n"); H5Epush(__FILE__, "HE5_SWinqdfldaliasF", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return(nfldalias); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWinqgfldaliasF (FORTRAN wrapper) | | | | DESCRIPTION: Retrieves the number of fields & aliases and string length of| | fields & aliases list in "Geolocation Fields" group | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nfldalias long Number of fields & aliases in "Geo- | | location Fields" group. | | | | INPUTS: | | SwathID int swath structure ID | | | | OUTPUTS: | | fldalias char* Fields & aliases names in "Geolocation | | Fields" group (Comma-separated list) | | strbufsize long* Fields & aliases name list string length| | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Apr 03 S.Zhao Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_SWinqgfldaliasF(int SwathID, char *fldalias, long *strbufsize) { long nfldalias = FAIL; /* Number of fields & aliases (return) */ hid_t swathID = FAIL; /* HDF5 type swath ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ swathID = (hid_t)SwathID; nfldalias = HE5_SWinqgfldalias(swathID, fldalias, strbufsize); if ( nfldalias < 0 ) { sprintf(errbuf, "Cannot retrieve the fields & aliases. \n"); H5Epush(__FILE__, "HE5_SWinqgfldaliasF", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return(nfldalias); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWaliasinfoF (FORTRAN wrapper) | | | | DESCRIPTION: Retrieves information about field aliases | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | ret int Return status | | | | INPUTS: | | SwathID int swath ID | | aliasname char alias name | | fldgroup int Field group flag | | | | OUTPUTS: | | length int Buffer size | | buffer char Buffer with original field name | | | | NOTES: | | None | | | | | | Date Programmer Description | | ======= ============ ================================================= | | Oct 00 A. Muslimov Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWaliasinfoF(int SwathID, int fldgroup, char *aliasname, int *length, char *buffer) { int ret = FAIL;/* (int) return status variable */ herr_t status = FAIL;/* return status variable */ hid_t swathID = FAIL;/* HDF5 type swath ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ swathID = (hid_t)SwathID; status = HE5_SWaliasinfo(swathID, fldgroup, aliasname, length, buffer); if(status == FAIL) { sprintf(errbuf,"Error calling SWaliasinfo() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_SWaliasinfoF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWfldrenameF (FORTRAN wrapper) | | | | DESCRIPTION: Changes the field name | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | ret int Return status | | | | INPUTS: | | SwathID int swath ID | | oldfieldname char Original field name | | | | OUTPUTS: | | newfieldname char New field name | | | | NOTES: | | None | | | | | | Date Programmer Description | | ======= ============ ================================================= | | Oct 00 A. Muslimov Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWfldrenameF(int SwathID, char *oldfieldname, char *newfieldname) { int ret = FAIL;/* (int)Return status variable */ herr_t status = FAIL;/* return status variable */ hid_t swathID = FAIL;/* HDF5 type swath ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ swathID = (hid_t)SwathID; status = HE5_SWfldrename(swathID, oldfieldname, newfieldname); if(status == FAIL) { sprintf(errbuf,"Error calling SWfldrename() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_SWfldrenameF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWdefcomchunkF (FORTRAN wrapper) | | | | DESCRIPTION: Defines compression type and parameters and sets chunking | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int Swath structure ID | | compcode int compression code | | compparm int compression parameters | | rank int rank of a dataset | | *dim long pointer to the array containing sizes | | of each dimension of a chunk | | | | OUTPUTS: | | None | | | | NOTES: | | | | | Date Programmer Description | | ====== ============ ================================================= | | Oct 00 A.Muslimov Original version. | | Jan 01 A.Muslimov Added proper FORTRAN to C dimension order conversion| | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWdefcomchunkF(int SwathID, int compcode, int *compparm, int rank, long *dim) { int ret = FAIL; /* return status */ int j = 0; /* Loop index */ herr_t status = FAIL; /* return status */ hsize_t *tempdims = (hsize_t *)NULL;/* Temporary variable */ hid_t swathID = FAIL; /* HDF5 type swath ID */ char *errbuf = (char *)NULL; /* error message buffer */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_SWdefcomchunkF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Allocate space for C order dimension list */ /* ----------------------------------------- */ tempdims = (hsize_t *)calloc(rank, sizeof(hsize_t)); if(tempdims == (hsize_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for tempdims.\n"); H5Epush(__FILE__, "HE5_SWdefcomchunkF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Change from FORTRAN to C dimension order */ /* ---------------------------------------- */ for (j = 0; j < rank; j++) tempdims[j] = (hsize_t)dim[ rank - 1 - j ]; swathID = (hid_t)SwathID; /* Call HE5_SWdefcomchunk() */ /* ------------------------ */ status = HE5_SWdefcomchunk(swathID, compcode, compparm, rank, tempdims); if (status == FAIL) { sprintf(errbuf, "Error calling HE5_SWdefcomchunk from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_SWdefcomchunkF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(tempdims); return(FAIL); } free(tempdims); free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWsetextdataF (FORTRAN wrapper) | | | | DESCRIPTION: Sets external data files. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int swath structure ID | | fortfilelist char* list of external files (FORTRAN order) | | offset long array of offsets (in bytes) from the | | beginning of the file to the location | | in the file where the data starts | | size long array of sizes (in bytes) reserved in | | the file for the data. | | | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Apr 01 A.Muslimov Original development. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWsetextdataF(int SwathID, char *fortfilelist, long offset[], long size[]) { int ret = FAIL; /* return status variable */ herr_t status = FAIL; /* Return status variable */ hid_t swathID = FAIL; /* Swath HDF5 type ID */ off_t *off = (off_t *)NULL; /* Array of data offsets */ long nentries = 0; /* Number of list entries */ long i; /* Loop index */ hsize_t *sz = (hsize_t *)NULL;/* Array of data sizes */ char *filelist = (char *)NULL; /* Files list (C order) */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ /* Allocate space for C order file list */ /* ------------------------------------ */ filelist = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char)); if(filelist == NULL) { sprintf(errbuf,"Cannot allocate memory for input list.\n"); H5Epush(__FILE__, "HE5_SWsetextdataF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Reverse entries in input list */ /* ----------------------------- */ status = HE5_EHrevflds(fortfilelist, filelist); if(status == FAIL) { sprintf(errbuf,"Cannot reverse entries in file list.\n"); H5Epush(__FILE__, "HE5_SWsetextdataF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(filelist); return(FAIL); } /* Parse the list of entries to get number of files */ /* ------------------------------------------------ */ nentries = HE5_EHparsestr(filelist, ',', NULL, NULL); if(nentries <= 0) { sprintf(errbuf,"Cannot parse the input list/input list is empty.\n"); H5Epush(__FILE__, "HE5_SWsetextdataF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(filelist); return(FAIL); } /* Allocate space for offset array */ /* ------------------------------- */ off = (off_t *)calloc(nentries, sizeof(off_t)); if(off == (off_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for input offset array.\n"); H5Epush(__FILE__, "HE5_SWsetextdataF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(filelist); return(FAIL); } /* Allocate space for size array */ /* ----------------------------- */ sz = (hsize_t *)calloc(nentries, sizeof(hsize_t)); if(sz == (hsize_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for input size array.\n"); H5Epush(__FILE__, "HE5_SWsetextdataF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(filelist); free(off); return(FAIL); } /* Copy the elements of input arrays */ /* --------------------------------- */ for (i = 0; i < nentries; i++) { off[ nentries - 1 - i ] = (off_t)offset[ i ]; sz[ nentries - 1 - i ] = (hsize_t)size[ i ]; } swathID = (hid_t)SwathID; /* Call the C function */ /* ------------------- */ status = HE5_SWsetextdata(swathID, filelist, off, sz); if (status == FAIL) { sprintf(errbuf, "Error calling HE5_SWsetextdata from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_SWsetextdataF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(filelist); free(off); free(sz); return(FAIL); } if (filelist != NULL) free(filelist); if (off != NULL) free(off); if (sz != NULL) free(sz); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWgetextdataF (FORTRAN wrapper) | | | | DESCRIPTION: Gets external data files information. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nfiles int number of external files SUCCEED, | | (-1) FAIL | | INPUTS: | | SwathID int swath structure ID | | fieldname char* External field name | | | | OUTPUTS: | | namelength long Length of each name entry | | fortfilelist char* List of file names (FORTRAN order) | | offset long array of offsets (in bytes) from the | | beginning of the file to the location | | in the file where the data starts | | size long array of sizes (in bytes) reserved in | | the file for the data. | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Apr 01 A.Muslimov Original development. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWgetextdataF(int SwathID, char *fieldname, long namelength, char *fortfilelist, long offset[], long size[]) { int nfiles = FAIL; /* number of files (return) */ int i; /* Loop index */ herr_t status = FAIL; /* Return status variable */ hid_t swathID = FAIL; /* Swath HDF5 type ID */ off_t *off = (off_t *)NULL; /* Array of data offsets */ hsize_t *sz = (hsize_t *)NULL;/* Array of sizes */ size_t nmlen = 0; /* Each entry string length */ char *filelist = (char *)NULL; /* Files list (C order) */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ /* Allocate space for C order output file list */ /* ------------------------------------------- */ filelist = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char)); if(filelist == NULL) { sprintf(errbuf,"Cannot allocate memory for output list.\n"); H5Epush(__FILE__, "HE5_SWgetextdataF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Allocate space for offset array */ /* ------------------------------- */ off = (off_t *)calloc(HE5_FLDNUMBERMAX , sizeof(off_t)); if(off == (off_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for input offset array.\n"); H5Epush(__FILE__, "HE5_SWgetextdataF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(filelist); return(FAIL); } /* Allocate space for size array */ /* ----------------------------- */ sz = (hsize_t *)calloc(HE5_FLDNUMBERMAX, sizeof(hsize_t)); if(sz == (hsize_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for input size array.\n"); H5Epush(__FILE__, "HE5_SWgetextdataF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(filelist); free(off); return(FAIL); } swathID = (hid_t)SwathID; nmlen = (size_t)namelength; /* Call the C function */ /* ------------------- */ nfiles = HE5_SWgetextdata(swathID, fieldname, nmlen, filelist, off, sz); if (nfiles == FAIL) { sprintf(errbuf, "Error calling HE5_SWgetextdata from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_SWgetextdataF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(filelist); free(off); free(sz); return(FAIL); } /* Reverse entries in output list */ /* ----------------------------- */ status = HE5_EHrevflds(filelist, fortfilelist); if(status == FAIL) { sprintf(errbuf,"Cannot reverse entries in output file list.\n"); H5Epush(__FILE__, "HE5_SWgetextdataF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(filelist); free(off); free(sz); return(FAIL); } /* Populate the output arrays */ /* -------------------------- */ for (i = 0; i < nfiles; i++) { offset[ nfiles - 1 - i ] = (long)off[ i ]; size[ nfiles - 1 - i ] = (long)sz[ i ]; } if (filelist != NULL) free(filelist); if (off != NULL) free(off); if (sz != NULL) free(sz); return(nfiles); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWindexinfoF | | | | DESCRIPTION: FORTRAN wrapper around SWindexinfo | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | RegionID int Region ID | | object char* field name | | | | OUTPUTS: | | rank int* field rank | | fortdimlist char* field dimension list | | fortindices long* indices of region for along track dim. | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | June 04 S.Zhao Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWindexinfoF(int RegionID, char *object, int *rank, char *fortdimlist, long *fortindices) { int ret = FAIL; /* (int) Return status variable */ int i, j; /* Loop index */ hid_t regionID = FAIL; /* HDF5 type region ID */ herr_t status = FAIL; /* routine return status variable */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ hsize_t *indices[HE5_DTSETRANKMAX]; hsize_t swap = 0; /* Temporary dimension size */ /* Dimension lists in C order */ /* -------------------------- */ char *dimlist = (char *)NULL; /* Allocate space for C order dimension list */ /* ----------------------------------------- */ dimlist = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char)); if(dimlist == NULL) { sprintf(errbuf,"Cannot allocate memory for input list.\n"); H5Epush(__FILE__, "HE5_SWindexinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } for (i = 0; i < HE5_DTSETRANKMAX; i++) { indices[i] = (hsize_t *)malloc(2*sizeof(hsize_t)); } regionID = (hid_t)RegionID; /* Call SWindexinfo */ /* ---------------- */ status = HE5_SWindexinfo(regionID, object, rank, dimlist, indices); if (status == FAIL) { sprintf(errbuf,"Cannot get information about indices.\n"); H5Epush(__FILE__, "HE5_SWindexinfoF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(dimlist); for (i = 0; i < HE5_DTSETRANKMAX; i++) { free(indices[i]); indices[i] = NULL; } return(FAIL); } /* Reverse order of dimensions entries in dimension list */ /* ----------------------------------------------------- */ if(fortdimlist != (char *)NULL) { status = HE5_EHrevflds(dimlist, fortdimlist); if(status == FAIL) { sprintf(errbuf,"Cannot reverse entries in dimension list.\n"); H5Epush(__FILE__, "HE5_SWindexinfoF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(dimlist); for (i = 0; i < HE5_DTSETRANKMAX; i++) { free(indices[i]); indices[i] = NULL; } return(FAIL); } } for (j = 0; j < *rank / 2; j++) { for (i = 0; i < 2; i++) { swap = indices[*rank - 1 - j][i]; indices[*rank - 1 - j][i] = indices[j][i]; indices[j][i] = swap; } } for (j = 0; j < *rank; j++) { for (i = 0; i < 2; i++) { fortindices[j*2+i] = (long)indices[j][i]; } } for (i = 0; i < HE5_DTSETRANKMAX; i++) { free(indices[i]); indices[i] = NULL; } free(dimlist); dimlist = NULL; ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWwrdmeta | | | | DESCRIPTION: Defines structural metadata for pre-existing data | | field within swath structure (FORTRAN) | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int swath structure ID | | fieldname char fieldname | | fortdimlist char Dimension list (comma-separated list) | | FORTRAN dimesion order | | mvalue int field type | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jun 05 S. Zhao Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWwrdmeta(int SwathID, char *fieldname, char *fortdimlist, int mvalue) { int ret = FAIL; /* (int) return status variable */ herr_t status = FAIL; /* routine return status variable */ hid_t swathID = FAIL; /* HDF5 type swath ID */ hid_t numbertype = FAIL; /* HDF5 type data type ID */ char *dimlist = (char *)NULL; /* Dimension list (C order) */ char *errbuf = (char *)NULL; /* error message buffer */ swathID = (hid_t)SwathID; numbertype = HE5_EHconvdatatype(mvalue); if(numbertype == FAIL) { H5Epush(__FILE__, "HE5_SWwrdmeta", __LINE__, H5E_DATATYPE, H5E_BADVALUE, "Cannot convert datatype for FORTRAN wrapper."); HE5_EHprint("Error: Cannot convert datatype for FORTRAN wrapper, occured", __FILE__, __LINE__); return(FAIL); } /* Allocate memory for error message buffers */ /* ----------------------------------------- */ errbuf = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_SWwrdmeta", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Allocate space for C order dimension list */ /* ----------------------------------------- */ dimlist = (char *) calloc(strlen(fortdimlist) + 1, sizeof(char)); if(dimlist == NULL) { sprintf(errbuf,"Cannot allocate memory for dimlist.\n"); H5Epush(__FILE__, "HE5_SWwrdmeta", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Reverse entries in dimension list (FORTRAN -> C) */ /* ------------------------------------------------ */ status = HE5_EHrevflds(fortdimlist, dimlist); if(status == FAIL) { sprintf(errbuf,"Cannot reverse entries in dimension list.\n"); H5Epush(__FILE__, "HE5_SWwrdmeta", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); return(FAIL); } /* Call Write Metadata routine */ /* --------------------------- */ status = HE5_SWwritedatameta(swathID, fieldname, dimlist, numbertype); if(status == FAIL) { sprintf(errbuf,"Cannot write \"%s\" field metadata.\n", fieldname); H5Epush(__FILE__, "HE5_SWwrdmeta", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); return(FAIL); } free(dimlist); free(errbuf); ret = (int)status; return (ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWwrgmeta | | | | DESCRIPTION: Defines structural metadata for pre-existing geolocation | | field within swath structure (FORTRAN) | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | SwathID int swath structure ID | | fieldname char fieldname | | fortdimlist char Dimension list (comma-separated list) | | FORTRAN dimesion order | | mvalue int field type | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jun 05 S. Zhao Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWwrgmeta(int SwathID, char *fieldname, char *fortdimlist, int mvalue) { int ret = FAIL; /* (int) return status variable */ herr_t status = FAIL; /* routine return status variable */ hid_t swathID = FAIL; /* HDF5 type swath ID */ hid_t numbertype = FAIL; /* HDF5 type data type ID */ char *dimlist = (char *)NULL; /* Dimension list (C order) */ char *errbuf = (char *)NULL; /* error message buffer */ swathID = (hid_t)SwathID; numbertype = HE5_EHconvdatatype(mvalue); if(numbertype == FAIL) { H5Epush(__FILE__, "HE5_SWwrgmeta", __LINE__, H5E_DATATYPE, H5E_BADVALUE, "Cannot convert datatype for FORTRAN wrapper."); HE5_EHprint("Error: Cannot convert datatype for FORTRAN wrapper, occured", __FILE__, __LINE__); return(FAIL); } /* Allocate memory for error message buffers */ /* ----------------------------------------- */ errbuf = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_SWwrgmeta", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Allocate space for C order dimension list */ /* ----------------------------------------- */ dimlist = (char *) calloc(strlen(fortdimlist) + 1, sizeof(char)); if(dimlist == NULL) { sprintf(errbuf,"Cannot allocate memory for dimlist.\n"); H5Epush(__FILE__, "HE5_SWwrgmeta", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Reverse entries in dimension list (FORTRAN -> C) */ /* ------------------------------------------------ */ status = HE5_EHrevflds(fortdimlist, dimlist); if(status == FAIL) { sprintf(errbuf,"Cannot reverse entries in dimension list.\n"); H5Epush(__FILE__, "HE5_SWwrgmeta", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); return(FAIL); } /* Call Write Metadata routine */ /* --------------------------- */ status = HE5_SWwritegeometa(swathID, fieldname, dimlist, numbertype); if(status == FAIL) { sprintf(errbuf,"Cannot write \"%s\" field metadata.\n", fieldname); H5Epush(__FILE__, "HE5_SWwrgmeta", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); return(FAIL); } free(dimlist); free(errbuf); ret = (int)status; return (ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWgetaliaslistF (FORTRAN wrapper) | | | | DESCRIPTION: Retrieves the number of aliases and aliases list in swath | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nalias long number of aliases | | | | INPUTS: | | SwathID int swath structure ID | | fldgroup int field group flag (geo or data) | | | | OUTPUTS: | | aliaslist char* list of aliases (comma-separated list) | | strbufsize long* length of aliases list | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 05 S.Zhao Original development | | Dec 05 T.Roegner NCR 44092 - Added CYGWIN capability | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_SWgetaliaslistF(int SwathID, int fldgroup, char *aliaslist, long *strbufsize) { long nalias = FAIL; /* Number of aliases (return) */ hid_t swathID = FAIL; /* HDF5 type swath ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ swathID = (hid_t)SwathID; nalias = HE5_SWgetaliaslist(swathID, fldgroup, aliaslist, strbufsize); if (nalias < 0) { sprintf(errbuf, "Cannot retrieve the aliases. \n"); H5Epush(__FILE__, "HE5_SWgetaliaslistF", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return(nalias); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWsetdimscale2F (FORTRAN wrapper for HE5_SWsetdimscale2) | | | | DESCRIPTION: Defines a dimension scale for a fields dimension in a SW | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swID int SW structure ID | | fieldname char field name | | dimname char dim name | | dimscalename char dim scale name | | dim long Dimemsion value | | numbertype_in int dim scale data type such as DFNT_INT32, | | DFNT_FLOAT64, DFNT_FLOAT32, etc. | | data void data buffer for write | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | March 17 Abe Taaheri Original Programmer | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWsetdimscale2F(int SwathID, char *fieldname, char *dimname, char *dimscalename, long dim, int numbertype_in, void * data) { herr_t status; hid_t swID; char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ swID = (hid_t)SwathID; status = HE5_SWsetdimscale2(swID, fieldname, dimname, dimscalename, (hsize_t) dim, (hid_t) numbertype_in, data); if (status < 0) { sprintf(errbuf, "Cannot set dimension scale %s for field %s. \n", dimname, fieldname); H5Epush(__FILE__, "HE5_SWsetdimscale2F", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return((int)status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWsetdimscaleF (FORTRAN wrapper) | | | | DESCRIPTION: Defines a dimension scale for a fields dimension in a SW | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swID int SW structure ID | | fieldname char field name | | dimname char dim name | | dim long Dimemsion value | | numbertype_in int dim scale data type such as DFNT_INT32, | | DFNT_FLOAT64, DFNT_FLOAT32, etc. | | data void data buffer for write | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | May 10 Abe Taaheri Original Programmer | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWsetdimscaleF(int SwathID, char *fieldname, char *dimname, long dim, int numbertype_in, void * data) { herr_t status; hid_t swID; char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ swID = (hid_t)SwathID; status = HE5_SWsetdimscale(swID, fieldname, dimname, (hsize_t) dim, (hid_t) numbertype_in, data); if (status < 0) { sprintf(errbuf, "Cannot set dimension scale %s for field %s. \n", dimname, fieldname); H5Epush(__FILE__, "HE5_SWsetdimscaleF", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return((int)status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWdefdimscale2F (FORTRAN wrapper forHE5_SWdefdimscale2 ) | | | | DESCRIPTION: Defines dimension scale for a dimension for all fields in a | | Swath | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swID int SW structure ID | | dimname char dim name | | dimscalename char dim scale name | | dim long Dimemsion value | | numbertype_in int dim scale data type such as DFNT_INT32, | | DFNT_FLOAT64, DFNT_FLOAT32, etc. | | data void data buffer for write | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | March 17 Abe Taaheri Original Programmer | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWdefdimscale2F(int SwathID, char *dimname, char *dimscalename, long dim, int numbertype_in, void * data) { herr_t status; hid_t swID; char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ swID = (hid_t)SwathID; status = HE5_SWdefdimscale2(swID, dimname, dimscalename, (hsize_t) dim, (hid_t) numbertype_in, data); if (status < 0) { sprintf(errbuf, "Cannot set dimension scale %s for all fields in swath. \n", dimname); H5Epush(__FILE__, "HE5_SWdefdimscale2F", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return((int)status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWdefdimscaleF (FORTRAN wrapper) | | | | DESCRIPTION: Defines dimension scale for a dimension for all fields in a | | Swath | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swID int SW structure ID | | dimname char dim name | | dim long Dimemsion value | | numbertype_in int dim scale data type such as DFNT_INT32, | | DFNT_FLOAT64, DFNT_FLOAT32, etc. | | data void data buffer for write | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jan 14 Abe Taaheri Original Programmer | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWdefdimscaleF(int SwathID, char *dimname, long dim, int numbertype_in, void * data) { herr_t status; hid_t swID; char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ swID = (hid_t)SwathID; status = HE5_SWdefdimscale(swID, dimname, (hsize_t) dim, (hid_t) numbertype_in, data); if (status < 0) { sprintf(errbuf, "Cannot set dimension scale %s for all fields in swath. \n", dimname); H5Epush(__FILE__, "HE5_SWdefdimscaleF", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return((int)status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWgetdimscaleF (FORTRAN wrapper) | | | | DESCRIPTION: Get dimension scale for a dimension of a field in a SW | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return databuffsize SUCCEED, (-1) FAIL | | | | INPUTS: | | swID int SWATH structure ID | | fieldname char field name | | dimname char dim name | | | | | | OUTPUTS: | | dimsize long dimension size | | ntype int number type | | databuff void data buffer for read | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | May 10 Abe Taaheri Original Programmer | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_SWgetdimscaleF(int SwathID, char *fieldname, char *dimname, long *dimsize, int *ntype, void * databuff) { hsize_t databuffsize =(hsize_t)FAIL; /* Size of buffer */ hid_t swID = FAIL; /* HDF5 type swath ID */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Buffer for error message */ hsize_t ds; hid_t numtype; swID = (hid_t)SwathID; databuffsize = HE5_SWgetdimscale(swID, fieldname, dimname, &ds, &numtype, databuff); *dimsize = (long) ds; *ntype = (int) numtype; if ( databuffsize < 0 ) { sprintf(errbuf,"Cannot get dimension scale %s for field %s. \n", dimname, fieldname); H5Epush(__FILE__, "HE5_SWgetdimscaleF", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return((long)databuffsize); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWreaddscaleattrF (FORTRAN wrapper) | | | | DESCRIPTION: Reads attribute associated with a dimension scale field | | from a SW. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swID int None HDF-EOS type SWATH ID | | fieldname char field name | | attrname char attribute name | | | | OUTPUTS: | | datbuf void I/O buffer | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jun 10 Abe Taaheri Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWreaddscaleattrF(int SwathID, char *fieldname, char *attrname, void *datbuf) { herr_t status = FAIL; /* return status */ hid_t swID = FAIL; /* HDF5 type swath ID */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Buffer for error message */ swID = (hid_t)SwathID; status = HE5_SWreaddscaleattr(swID, fieldname, attrname, datbuf); if ( status < 0 ) { sprintf(errbuf,"Cannot read attribute %s for dimension scale %s. \n", attrname, fieldname); H5Epush(__FILE__, "HE5_SWreaddscaleattrF", __LINE__, H5E_IO, H5E_SEEKERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return((int)status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWwritedscaleattrF (FORTRAN wrapper) | | | | DESCRIPTION: Writes/updates attribute associated with a dimension scale | | field in a SW. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swID int SWATH structure ID | | fieldname char* dimension scale SDS name | | attrname char* attribute name | | numtype int attribute datatype ID | | count[] long Number of attribute elements | | datbuf void I/O buffer | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | May 10 Abe Taaheri Original development. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWwritedscaleattrF(int SwathID, char *fieldname, char *attrname, int numtype, long count[], void *datbuf) { herr_t status = FAIL; /* return status */ hid_t swID = FAIL; /* HDF5 type swath ID */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Buffer for error message */ hsize_t fort_count[HE5_FLDNUMBERMAX]; swID = (hid_t)SwathID; fort_count[0] = (hsize_t)count[0]; status = HE5_SWwritedscaleattr(swID, fieldname, attrname, (hid_t)numtype, fort_count, datbuf); if ( status < 0 ) { sprintf(errbuf,"Cannot write attribute %s for dimension scale %s. \n", attrname, fieldname); H5Epush(__FILE__, "HE5_SWwritedscaleattrF", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return((int)status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWdscaleattrinfoF (FORTRAN wrapper) | | | | DESCRIPTION: Retrieves information about dimension scale attribute | | (attribute associated with a specified dimension scale field) | | in a SW. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swID int None HDF-EOS type SWATH ID | | fieldname char* field name | | attrname char* attribute name | | | | OUTPUTS: | | ntype int attribute data type ID | | fortcount long Number of attribute elements | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | May 10 Abe Taaheri Original Development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWdscaleattrinfoF(int SwathID, char *fieldname, char *attrname, int *ntype, long *fortcount) { herr_t status = FAIL; /* return status */ hid_t swID = FAIL; /* HDF5 type swath ID */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Buffer for error message */ hsize_t *count = (hsize_t *)NULL; /* C-order count array */ hid_t *dtype = (hid_t *)NULL; /* Data type class ID */ swID = (hid_t)SwathID; dtype = (hid_t *)calloc(1, sizeof(hid_t)); if(dtype == (hid_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for \"dtype\".\n"); H5Epush(__FILE__, "HE5_SWdscaleattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } count = (hsize_t *)calloc(1, sizeof(hsize_t)); if(count == NULL) { sprintf(errbuf,"Cannot allocate memory for \"count\".\n"); H5Epush(__FILE__, "HE5_SWdscaleattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(dtype); return(FAIL); } count[0] = 0; status = HE5_SWdscaleattrinfo(swID, fieldname, attrname, dtype, count); if ( status == FAIL) { sprintf(errbuf, "Cannot retrieve attribute info for the %s dimension scale. \n", fieldname); H5Epush(__FILE__, "HE5_SWdscaleattrinfoF", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(dtype); return(FAIL); } *fortcount = (long)(*count); *ntype = (int)(*dtype); free(count); free(dtype); return((int)status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWdscaleattrinfoF2 (FORTRAN wrapper) | | | | DESCRIPTION: Retrieves information about dimension scale attribute | | (attribute associated with a specified dimension scale field) | | in a SW. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swID int None HDF-EOS type SWATH ID | | fieldname char* field name | | attrname char* attribute name | | | | OUTPUTS: | | ntype int attribute data type ID | | fortcount long Number of attribute elements | | fortsize long buf size of attribute elements | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | May 10 Abe Taaheri Original Development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWdscaleattrinfoF2(int SwathID, char *fieldname, char *attrname, int *ntype, long *fortcount, long *fortsize) { herr_t status = FAIL; /* return status */ hid_t swID = FAIL; /* HDF5 type swath ID */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Buffer for error message */ hsize_t *count = (hsize_t *)NULL; /* C-order count array */ hsize_t *size = (hsize_t *)NULL; /* buf size of array element */ hid_t *dtype = (hid_t *)NULL; /* Data type class ID */ swID = (hid_t)SwathID; dtype = (hid_t *)calloc(1, sizeof(hid_t)); if(dtype == (hid_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for \"dtype\".\n"); H5Epush(__FILE__, "HE5_SWdscaleattrinfoF2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } count = (hsize_t *)calloc(1, sizeof(hsize_t)); if(count == NULL) { sprintf(errbuf,"Cannot allocate memory for \"count\".\n"); H5Epush(__FILE__, "HE5_SWdscaleattrinfoF2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(dtype); return(FAIL); } size = (hsize_t *)calloc(1, sizeof(hsize_t)); if(size == NULL) { sprintf(errbuf,"Cannot allocate memory for \"size\".\n"); H5Epush(__FILE__, "HE5_SWdscaleattrinfoF2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(dtype); return(FAIL); } count[0] = 0; status = HE5_SWdscaleattrinfo2(swID, fieldname, attrname, dtype, count, size); if ( status == FAIL) { sprintf(errbuf, "Cannot retrieve attribute info for the %s dimension scale. \n", fieldname); H5Epush(__FILE__, "HE5_SWdscaleattrinfoF2", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(dtype); return(FAIL); } *fortcount = (long)(*count); *fortsize = (long)(*size); *ntype = (int)(*dtype); free(count); free(size); free(dtype); return((int)status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWinqdscaleattrsF (FORTRAN wrapper) | | | | DESCRIPTION: Retrieves the number of attributes and string length of | | attribute list associated with a specified dimension scale | | in a SW. | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nattr long number of attributes (-1 if fails) | | | | INPUTS: | | swID int None HDF-EOS type SWATH ID | | fieldname char dimension scale name | | attrnames char attribute name(s) | | | | OUTPUTS: | | strbufsize long String length of attribute (in bytes) | | | | NOTES: | | | | None | | | | Date Programmer Description | | ====== ============ ================================================= | | June 10 Abe Taaheri Original development. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_SWinqdscaleattrsF(int SwathID, char *fieldname, char *attrnames, long *strbufsize) { long status = FAIL; /* return status */ hid_t swID = FAIL; /* HDF5 type swath ID */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Buffer for error message */ swID = (hid_t)SwathID; status = HE5_SWinqdscaleattrs(swID, fieldname, attrnames, strbufsize); if ( status == FAIL ) { sprintf(errbuf, "Cannot find the attribute %s for dimension scale %s. \n",attrnames,fieldname); H5Epush(__FILE__, "HE5_SWinqdscaleattrsF", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWflddiminfo | | | | DESCRIPTION: This functions returns dims and maxdims | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t None HDF-EOS type swath ID | | fieldname char* fieldname | | | | OUTPUTS: | | rank int field rank | | dims hsize_t dimensions of field | | maxdims hsize_t max dimensions of field | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Sep 11 Abe Taaheri Added support for unlimited dimension adjustment | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_SWflddiminfo(hid_t SwathID, char *fieldname, int *rank, hsize_t dims[], hsize_t maxdims[]) { herr_t status = FAIL; /* return status */ hid_t swID = FAIL; /* HDF5 type swath ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Buffer for error message */ hid_t ntype[1] = {FAIL}; /* Field numbertypes */ char *dimlist = (char *)NULL; /* Dimension list in C order */ char *maxdimlist = (char *)NULL; /* max Dimension list in C order */ char *dimbuf = (char *)NULL; /* Dimension buffer */ char *comma = (char *)NULL; /* Pointer to comma */ char *dimcheck = (char *)NULL; /* Dimension check buffer */ hsize_t dimsize = 0; /* Dimension size */ int maxrank = 0; /* max dim rank */ int i = 0; /* Loop index */ int foundAllDim = 1; /* found all dimensions flag */ int first = 1; /* first entry flag */ char utlbuf[HE5_HDFE_UTLBUFSIZE];/* Utility buffer */ swID = (hid_t)SwathID; /* Allocate space for C order dimension list */ /* ----------------------------------------- */ maxdimlist = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char)); dimlist = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char)); if(dimlist == NULL || maxdimlist == NULL) { sprintf(errbuf,"Cannot allocate memory for input list.\n"); H5Epush(__FILE__, "HE5_SWflddiminfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get field info */ /* --------------- */ status = HE5_SWfieldinfo(swID, fieldname, rank, dims, ntype, dimlist, maxdimlist); if ( status == FAIL ) { sprintf(errbuf, "Error calling HE5_SWfieldinfo. \n") ; H5Epush(__FILE__, "HE5_SWflddiminfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Allocate space for dimbuf, copy maxdimlist into it, & append comma */ /* ------------------------------------------------------------------ */ if(maxdimlist != NULL) { dimbuf = (char *) calloc(strlen(maxdimlist) + 64, sizeof(char)); if(dimbuf == NULL) { H5Epush(__FILE__, "HE5_SWflddiminfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory. \n"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); return(FAIL); } /* Copy "maxdimlist" to "dimbuf", & append comma */ /* --------------------------------------------- */ strcpy(dimbuf, maxdimlist); strcat(dimbuf, ","); /* Find comma */ /* ---------- */ comma = strchr(dimbuf, ','); /* * Loop through entries in dimension list to make sure they are * defined in swath */ while (comma != NULL) { /* Copy dimension list entry to dimcheck */ /* ------------------------------------- */ dimcheck = (char *) calloc(comma - dimbuf + 1, sizeof(char)); if(dimcheck == NULL) { H5Epush(__FILE__, "HE5_SWflddiminfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory. \n"); HE5_EHprint("Error: Can not allocate memory, occured", __FILE__, __LINE__); free(dimbuf); free(dimlist); free(maxdimlist); return(FAIL); } memmove(dimcheck, dimbuf, comma - dimbuf); /* Get dimension size */ /* ------------------ */ dimsize = HE5_SWdiminfo(swID, dimcheck); if ( (dimsize > 0) || (dimsize == H5S_UNLIMITED) ) { maxdims[maxrank] = dimsize; maxrank++; } else { /* * If dimension list entry not found - set error return * status, append name to utility buffer for error report */ status = FAIL; foundAllDim = 0; if (first == 1) strcpy(utlbuf, dimcheck); else { strcat(utlbuf, ","); strcat(utlbuf, dimcheck); } first = 0; } /* * Go to next dimension entry, find next comma, & free up * dimcheck buffer */ memmove(dimbuf, comma + 1, strlen(comma + 1) + 1); comma = strchr(dimbuf, ','); free(dimcheck); } free(dimbuf); free(dimlist); free(maxdimlist); /* If no dimensions found, report error */ /* ------------------------------------ */ if (foundAllDim == 0) { status = FAIL; sprintf(errbuf, "Dimension(s) \"%s\" not found for \"%s\" field. \n", utlbuf, fieldname); H5Epush(__FILE__, "HE5_SWflddiminfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return (status); } /* If maxrank !=rank then report error */ /* ------------------------------------ */ if ( maxrank != *rank ) { status = FAIL; sprintf(errbuf,"Dimension rank doesn't match Max dimension rank.\n"); H5Epush(__FILE__, "HE5_SWflddiminfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return (status); } } /* "maxlist == NULL" ==> maxdims[]= dims[] */ /* ---------------------------------------- */ else { for(i = 0; i < *rank; i++ ) maxdims[ i ] = dims[ i ]; } return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWsetflddimlabel | | | | DESCRIPTION: Sets label for a dimension in a field in a swath. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | swathID hid_t swath structure ID | | fieldname char field name | | dimname char Dimension name | | dimlabel char Dimemsion label | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | July 18 Abe Taaheri Original Programmer | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWsetflddimlabel(hid_t swathID, char *fieldname, char *dimname, char *dimlabel) { hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t did; /* Field dataset id */ long idx = FAIL; /* Swath index */ char olddimlabel[64]={""}; int olddimlabelexist = 0; unsigned int Dimindex; char tempdimlist[HE5_HDFE_DIMBUFSIZE];/* Dimension list */ int rank = FAIL; /* Rank of dataset */ hsize_t tempdims[HE5_DTSETRANKMAX]; /* Dimension sizes array */ int i, found; int labelsize; char *errbuf = (char *)NULL; /* buffer for error message*/ herr_t status; hid_t dtype = FAIL; /* data type ID */ HE5_LOCK; CHECKNAME(fieldname); CHECKNAME(dimname); CHECKNAME(dimlabel); /* Allocate memory for error buffer */ /* -------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_SWsetflddimlabel", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /************************************************************************ * Check for proper swath ID and return HDF-EOS file ID, SDinterface ID,* * and swath root Vgroup ID * ************************************************************************/ status = HE5_SWchkswid(swathID, " HE5_SWsetflddimlabel", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for swath ID failed.\n"); H5Epush(__FILE__, "HE5_SWsetdimscale", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } labelsize = (int)HE5_SWgetflddimlabel(swathID, fieldname, dimname, olddimlabel); if( labelsize == FAIL ) { sprintf(errbuf, "Getting dimlabel failed.\n"); H5Epush(__FILE__, "HE5_SWsetflddimlabel", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } else { if(strcmp(olddimlabel, "") !=0) { olddimlabelexist = 1; } } if(strcmp(dimlabel, olddimlabel)== 0) { /* no need for setting label. It is alread has vbeen set */ free(errbuf); return(SUCCEED); } /* Loop through all datasets in swath */ /* ------------------------------ */ for (i = 0; i < HE5_SWXSwath[idx].nDFLD; i++) { /* Get dataset name */ if( strcmp(fieldname, HE5_SWXSwath[ idx ].ddataset[ i ].name) == 0 ) { found = 1; did = HE5_SWXSwath[ idx ].ddataset[ i ].ID; break; } } if(found != 1) /* did not find fieldname */ { /* did not find Data-field name, lets look for Geo-fieldname */ for (i = 0; i < HE5_SWXSwath[idx].nGFLD; i++) { /* Get dataset name */ if(strcmp(fieldname,HE5_SWXSwath[idx].gdataset[i].name)==0) { found = 1; did = HE5_SWXSwath[ idx ].gdataset[ i ].ID; break; } } } if(found != 1) /* did not find fieldname */ { sprintf(errbuf, "Fieldname \"%s\" does not exist.\n", fieldname); H5Epush(__FILE__, "HE5_SWsetflddimlabel", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* if olddimlabel exist, replace it; Otherwise write the new dimlabel */ /* 1. get dim index .... */ /* for this field see if the dimlist contains dimname */ status = HE5_SWfieldinfo(swathID, fieldname, &rank, tempdims, &dtype, tempdimlist, NULL); if (status != SUCCEED) { sprintf(errbuf, "Field \"%s\" not found.\n", fieldname); H5Epush(__FILE__, "HE5_SWsetflddimlabel", __LINE__, H5E_ARGS, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } Dimindex = FAIL; Dimindex = HE5_EHstrwithin(dimname, tempdimlist, ','); if (Dimindex == FAIL) /* dimension not found */ { sprintf(errbuf, "Dimension dimname \"%s\" not found in Field \"%s\" .\n", dimname, fieldname); H5Epush(__FILE__, "HE5_SWsetflddimlabel", __LINE__, H5E_ARGS, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } status = (int)H5DSset_label(did, Dimindex, dimlabel); if(status <0) { sprintf(errbuf, "Setting label for dimension index %d failed.\n", Dimindex ); H5Epush(__FILE__, "HE5_SWsetflddimlabel", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_SWgetflddimlabel | | | | DESCRIPTION: Gets label for a dimension in a field in a swath. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | or the buffer size for label | | | | INPUTS: | | swathID hid_t swath structure ID | | fieldname char field name | | dimname char Dimension name | | dimlabel char Dimemsion label | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | July 18 Abe Taaheri Original Programmer | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_SWgetflddimlabel(hid_t swathID, char *fieldname, char *dimname, char *dimlabel) { hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t did; /* Field dataset id */ long idx = FAIL; /* Swath index */ char olddimlabel[64]; int olddimlabelexist = 0; unsigned int Dimindex; char tempdimlist[HE5_HDFE_DIMBUFSIZE];/* Dimension list */ int rank = FAIL; /* Rank of dataset */ hsize_t tempdims[HE5_DTSETRANKMAX]; /* Dimension sizes array */ int i, found; int labelsize; char *errbuf = (char *)NULL; /* buffer for error message*/ int status; hid_t dtype = FAIL; /* data type ID */ char tempdimlabel[128]; HE5_LOCK; CHECKNAME(fieldname); CHECKNAME(dimname); /* Allocate memory for error buffer */ /* -------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_SWsetflddimlabel", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /************************************************************************ * Check for proper swath ID and return HDF-EOS file ID, SDinterface ID,* * and swath root Vgroup ID * ************************************************************************/ status = (int)HE5_SWchkswid(swathID, " HE5_SWgetflddimlabel", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for swath ID failed.\n"); H5Epush(__FILE__, "HE5_SWgetdimscale", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Loop through all datasets in swath */ /* ------------------------------ */ for (i = 0; i < HE5_SWXSwath[idx].nDFLD; i++) { /* Get dataset name */ if( strcmp(fieldname, HE5_SWXSwath[ idx ].ddataset[ i ].name) == 0 ) { found = 1; did = HE5_SWXSwath[ idx ].ddataset[ i ].ID; break; } } if(found != 1) /* did not find fieldname */ { /* did not find Data-field name, lets look for Geo-fieldname */ for (i = 0; i < HE5_SWXSwath[idx].nGFLD; i++) { /* Get dataset name */ if(strcmp(fieldname,HE5_SWXSwath[idx].gdataset[i].name)==0) { found = 1; did = HE5_SWXSwath[ idx ].gdataset[ i ].ID; break; } } } if(found != 1) /* did not find fieldname */ { sprintf(errbuf, "Fieldname \"%s\" does not exist.\n", fieldname); H5Epush(__FILE__, "HE5_SWgetflddimlabel", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* if olddimlabel exist, replace it; Otherwise write the new dimlabel */ /* 1. get dim index .... */ /* for this field see if the dimlist contains dimname */ status = (int)HE5_SWfieldinfo(swathID, fieldname, &rank, tempdims, &dtype, tempdimlist, NULL); if (status != SUCCEED) { sprintf(errbuf, "Field \"%s\" not found.\n", fieldname); H5Epush(__FILE__, "HE5_SWgetflddimlabel", __LINE__, H5E_ARGS, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } Dimindex = FAIL; Dimindex = HE5_EHstrwithin(dimname, tempdimlist, ','); if (Dimindex == FAIL) /* dimension not found */ { sprintf(errbuf, "Dimension dimname \"%s\" not found in Field \"%s\" .\n", dimname, fieldname); H5Epush(__FILE__, "HE5_SWgetflddimlabel", __LINE__, H5E_ARGS, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } strcpy(tempdimlabel,""); status = (int)H5DSget_label(did, Dimindex, tempdimlabel, (size_t)MAX_NAME); if(status <0) { sprintf(errbuf, "Getting label for dimension index %d failed.\n", Dimindex ); H5Epush(__FILE__, "HE5_SWgetflddimlabel", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } if(dimlabel == NULL) { int len = 0; len = strlen(tempdimlabel); status = len; } else { strcpy(dimlabel, tempdimlabel); status = SUCCEED; } COMPLETION: HE5_UNLOCK; free(errbuf); return(status); } #ifndef _cplusplus /* HDF types used in FORTRAN bindings */ #define INT32 INT #define INT32V INTV #define PINT32 PINT /* File/Swath access routines */ FCALLSCFUN2(INT, HE5_SWopenF, HE5_SWOPEN, he5_swopen, STRING, INT) FCALLSCFUN2(INT, HE5_SWcreateF, HE5_SWCREATE, he5_swcreate, INT, STRING) FCALLSCFUN2(INT, HE5_SWattachF, HE5_SWATTACH, he5_swattach, INT, STRING) FCALLSCFUN1(INT, HE5_SWdetachF, HE5_SWDETACH, he5_swdetach, INT) FCALLSCFUN1(INT, HE5_SWcloseF, HE5_SWCLOSE, he5_swclose, INT) /* Definition routines */ FCALLSCFUN3(INT, HE5_SWdefdimF, HE5_SWDEFDIM, he5_swdefdim, INT, STRING, LONG) FCALLSCFUN5(INT, HE5_SWdefdimmapF, HE5_SWDEFMAP, he5_swdefmap, INT, STRING, STRING, LONG, LONG) FCALLSCFUN4(INT, HE5_SWdefidxmapF, HE5_SWDEFIMAP, he5_swdefimap, INT, STRING, STRING, LONGV) FCALLSCFUN6(INT, HE5_SWdefgfld, HE5_SWDEFGFLD, he5_swdefgfld, INT, STRING, STRING, STRING, INT, INT) FCALLSCFUN6(INT, HE5_SWdefdfld, HE5_SWDEFDFLD, he5_swdefdfld, INT, STRING, STRING, STRING, INT, INT) FCALLSCFUN3(INT, HE5_SWdefcompF, HE5_SWDEFCOMP, he5_swdefcomp, INT, INT, PINT) FCALLSCFUN3(INT, HE5_SWdefchunkF, HE5_SWDEFCHUNK, he5_swdefchunk, INT, INT, PLONG) FCALLSCFUN5(INT, HE5_SWdefcomchunkF, HE5_SWDEFCOMCH, he5_swdefcomch, INT, INT, PINT, INT, PLONG) FCALLSCFUN5(LONG, HE5_SWupimap, HE5_SWUPIMAP, he5_swupimap, INT, INT, LONGV, LONGV, LONGV) FCALLSCFUN3(INT, HE5_SWfldrenameF, HE5_SWFLDRNM, he5_swfldrnm, INT, STRING, STRING) /* I/O routines */ FCALLSCFUN6(INT, HE5_SWwrfld, HE5_SWWRFLD, he5_swwrfld, INT, STRING, LONGV, LONGV, LONGV, PVOID) FCALLSCFUN8(INT, HE5_SWwrcharfld, HE5_SWWRCHARFLD, he5_swwrcharfld, INT, STRING, INT, INT, LONGV, LONGV, LONGV, PVOID) FCALLSCFUN6(INT, HE5_SWrdfld, HE5_SWRDFLD, he5_swrdfld, INT, STRING, LONGV, LONGV, LONGV, PVOID) FCALLSCFUN8(INT, HE5_SWrdcharfld, HE5_SWRDCHARFLD, he5_swrdcharfld, INT, STRING, INT, INT, LONGV, LONGV, LONGV, PVOID) FCALLSCFUN5(INT, HE5_SWwrattr, HE5_SWWRATTR, he5_swwrattr,INT,STRING,INT,LONGV,PVOID) FCALLSCFUN5(INT, HE5_SWwrgattr, HE5_SWWRGATTR, he5_swwrgattr, INT, STRING, INT, LONGV,PVOID) FCALLSCFUN5(INT, HE5_SWwrgeogattr, HE5_SWWRGEOGATTR, he5_swwrgeogattr, INT, STRING, INT, LONGV,PVOID) FCALLSCFUN6(INT, HE5_SWwrlattr, HE5_SWWRLATTR, he5_swwrlattr, INT, STRING,STRING,INT,LONGV,PVOID) FCALLSCFUN3(INT, HE5_SWrdattr, HE5_SWRDATTR, he5_swrdattr, INT, STRING, PVOID) FCALLSCFUN3(INT, HE5_SWrdgattr, HE5_SWRDGATTR, he5_swrdgattr,INT,STRING,PVOID) FCALLSCFUN3(INT, HE5_SWrdgeogattr, HE5_SWRDGEOGATTR, he5_swrdgeogattr,INT,STRING,PVOID) FCALLSCFUN4(INT, HE5_SWrdlattr, HE5_SWRDLATTR, he5_swrdlattr,INT,STRING,STRING,PVOID) FCALLSCFUN4(INT, HE5_SWsetfill, HE5_SWSETFILL, he5_swsetfill, INT, STRING, INT, PVOID) FCALLSCFUN3(INT, HE5_SWgetfill, HE5_SWGETFILL, he5_swgetfill, INT, STRING, PVOID) FCALLSCFUN3(INT, HE5_SWsetaliasF, HE5_SWSETALIAS, he5_swsetalias, INT, STRING, STRING) FCALLSCFUN3(INT, HE5_SWdropaliasF, HE5_SWDRPALIAS, he5_swdrpalias, INT, INT, STRING) FCALLSCFUN4(INT, HE5_SWwrdmeta, HE5_SWWRDMETA, he5_swwrdmeta, INT, STRING, STRING, INT) FCALLSCFUN4(INT, HE5_SWwrgmeta, HE5_SWWRGMETA, he5_swwrgmeta, INT, STRING, STRING, INT) /* Inquiry routines */ FCALLSCFUN3(LONG, HE5_SWinqswathF, HE5_SWINQSWATH, he5_swinqswath, STRING, PSTRING,PLONG) FCALLSCFUN3(LONG, HE5_SWnentriesF, HE5_SWNENTRIES, he5_swnentries,INT,INT,PLONG) FCALLSCFUN2(LONG, HE5_SWdiminfoF, HE5_SWNDIMINFO, he5_swdiminfo, INT, STRING) FCALLSCFUN5(INT, HE5_SWmapinfoF, HE5_SWNMAPINFO, he5_swmapinfo,INT,STRING,STRING,PLONG,PLONG) FCALLSCFUN2(INT, HE5_SWgmapinfo, HE5_SWGMAPINFO, he5_swgmapinfo,INT,STRING) FCALLSCFUN7(INT, HE5_SWfldinfoF, HE5_SWFLDINFO, he5_swfldinfo,INT,STRING,PINT,LONGV,PINT,PSTRING,PSTRING) FCALLSCFUN4(LONG, HE5_SWidxmapinfoF, HE5_SWIMAPINFO, he5_swimapinfo,INT,STRING,STRING,LONGV) FCALLSCFUN4(LONG, HE5_SWinqmapsF, HE5_SWINQMAPS, he5_swinqmaps,INT,PSTRING,LONGV,LONGV) FCALLSCFUN3(LONG, HE5_SWinqimapsF, HE5_SWINQIMAPS, he5_swinqimaps,INT,PSTRING,LONGV) FCALLSCFUN3(LONG, HE5_SWinqdimsF, HE5_SWINQDIMS, he5_swinqdims,INT,PSTRING,LONGV) FCALLSCFUN4(LONG, HE5_SWinqgflds, HE5_SWINQGFLDS, he5_swinqgflds, INT,PSTRING, INTV, INTV) FCALLSCFUN4(LONG, HE5_SWinqdflds, HE5_SWINQDFLDS, he5_swinqdflds, INT,PSTRING, INTV, INTV) FCALLSCFUN4(INT, HE5_SWatinfo, HE5_SWATTRINFO, he5_swattrinfo, INT, STRING, PINT, PLONG) FCALLSCFUN4(INT, HE5_SWgatinfo, HE5_SWGATTRINFO, he5_swgattrinfo, INT, STRING, PINT, PLONG) FCALLSCFUN4(INT, HE5_SWgeogatinfo, HE5_SWGEOGATTRINFO, he5_swgeogattrinfo, INT, STRING, PINT, PLONG) FCALLSCFUN5(INT, HE5_SWlatinfo, HE5_SWLATTRINFO, he5_swlattrinfo, INT, STRING, STRING, PINT, PLONG) FCALLSCFUN5(INT, HE5_SWatinfo2, HE5_SWATTRINFO2, he5_swattrinfo2, INT, STRING, PINT, PLONG, PLONG) FCALLSCFUN5(INT, HE5_SWgatinfo2, HE5_SWGATTRINFO2, he5_swgattrinfo2, INT, STRING, PINT, PLONG, PLONG) FCALLSCFUN5(INT, HE5_SWgeogatinfo2, HE5_SWGEOGATTRINFO2, he5_swgeogattrinfo2, INT, STRING, PINT, PLONG, PLONG) FCALLSCFUN6(INT, HE5_SWlatinfo2, HE5_SWLATTRINFO2, he5_swlattrinfo2, INT, STRING, STRING, PINT, PLONG, PLONG) FCALLSCFUN4(INT, HE5_SWcompinfoF, HE5_SWCOMPINFO, he5_swcompinfo, INT, STRING,PINT, INTV) FCALLSCFUN3(LONG, HE5_SWinqattrsF, HE5_SWINQATTRS, he5_swinqattrs,INT,PSTRING,PLONG) FCALLSCFUN4(LONG, HE5_SWinqlattrs, HE5_SWINQLATTRS, he5_swinqlattrs,INT,STRING,PSTRING,PLONG) FCALLSCFUN3(LONG, HE5_SWinqgattrs, HE5_SWINQGATTRS, he5_swinqgattrs,INT,PSTRING,PLONG) FCALLSCFUN3(LONG, HE5_SWinqgeogattrs, HE5_SWINQGEOGATTRS, he5_swinqgeogattrs,INT,PSTRING,PLONG) FCALLSCFUN7(INT, HE5_SWreginfo, HE5_SWREGINFO, he5_swreginfo,INT,INT,STRING,PINT,PINT,LONGV,PLONG) FCALLSCFUN7(INT, HE5_SWperinfo, HE5_SWPERINFO, he5_swperinfo,INT,INT,STRING,PINT,PINT,LONGV,PLONG) FCALLSCFUN8(INT, HE5_SWidtype, HE5_SWIDTYPEF, he5_swidtype, INT,STRING,STRING,INT,PINT,PINT,PINT,PLONG) FCALLSCFUN5(INT, HE5_SWaliasinfoF, HE5_SWALIASINFO, he5_swaliasinfo, INT, INT, STRING, PINT, STRING) FCALLSCFUN3(LONG, HE5_SWinqdfldaliasF, HE5_SWINQDFLDALIAS, he5_swinqdfldalias,INT,PSTRING,PLONG) FCALLSCFUN3(LONG, HE5_SWinqgfldaliasF, HE5_SWINQGFLDALIAS, he5_swinqgfldalias,INT,PSTRING,PLONG) FCALLSCFUN4(INT, HE5_SWchunkinfoF, HE5_SWCHUNKINFO, he5_swchunkinfo,INT,STRING,PINT,LONGV) FCALLSCFUN4(LONG, HE5_SWgetaliaslistF, HE5_SWGETALIASLIST, he5_swgetaliaslist,INT,INT,PSTRING,PLONG) /* Subsetting routines */ FCALLSCFUN4(INT, HE5_SWdefboxreg, HE5_SWDEFBOXREG, he5_swdefboxreg, INT, DOUBLEV, DOUBLEV, INT) FCALLSCFUN4(INT, HE5_SWdefvrtreg, HE5_SWDEFVRTREG, he5_swdefvrtreg,INT,INT,STRING,DOUBLEV) FCALLSCFUN5(INT, HE5_SWextreg, HE5_SWEXTREG, he5_swextreg, INT, INT, STRING, INT, PVOID) FCALLSCFUN4(INT, HE5_SWdeftmeper, HE5_SWDEFTMEPER, he5_swdeftmeper,INT,DOUBLE,DOUBLE,INT) FCALLSCFUN1(INT, HE5_SWdupreg, HE5_SWDUPREG, he5_swdupreg, INT) FCALLSCFUN2(INT, HE5_SWupscene, HE5_SWUPSCENE, he5_swupscene,INT, INT) FCALLSCFUN6(INT, HE5_SWregidx, HE5_SWREGIDX, he5_swregidx,INT,DOUBLEV,DOUBLEV,INT,PSTRING,LONGV) FCALLSCFUN5(INT, HE5_SWextper, HE5_SWEXTPER, he5_swextper,INT,INT,STRING,INT,PVOID) FCALLSCFUN5(INT, HE5_SWindexinfoF, HE5_SWINDEXINFOF, he5_swindexinfof,INT,STRING,PINT,PSTRING,PLONG) /* PROFILE INTERFACE */ FCALLSCFUN5(INT, HE5_PRdefineF, HE5_PRDEFINE, he5_prdefine, INT, STRING, STRING, STRING, INT) FCALLSCFUN8(INT, HE5_PRwriteF, HE5_PRWRITE, he5_prwrite, INT, STRING, LONGV, LONGV, LONGV, LONG, LONGV, PVOID) FCALLSCFUN7(INT, HE5_PRreadF, HE5_PRREAD, he5_prread, INT, STRING, LONGV, LONGV, LONGV, LONGV, PVOID) FCALLSCFUN4(LONG, HE5_PRinquireF, HE5_PRINQIRE, he5_prinquire, INT, STRING, PINT, PINT) FCALLSCFUN8(INT, HE5_PRinfoF, HE5_PRINFO, he5_prinfo,INT,STRING,PINT,LONGV,LONGV,PINT,PSTRING,PSTRING) FCALLSCFUN5(INT, HE5_PRwrgattrF, HE5_PRWRGATTR, he5_prwrgattr, INT, STRING, INT, LONGV,PVOID) FCALLSCFUN3(INT, HE5_PRrdgattrF, HE5_PRRDGATTR, he5_prrdgattr,INT,STRING,PVOID) FCALLSCFUN4(INT, HE5_PRgattrinfoF, HE5_PRGATTRINFO, he5_prgattrinfo, INT, STRING, PINT, PLONG) FCALLSCFUN5(INT, HE5_PRgattrinfoF2, HE5_PRGATTRINFO2, he5_prgattrinfo2, INT, STRING, PINT, PLONG, PLONG) FCALLSCFUN3(LONG, HE5_PRinqgattrsF, HE5_PRINQGATTRS, he5_prinqgattrs,INT,PSTRING,PLONG) FCALLSCFUN5(INT, HE5_SWdefdimscaleF, HE5_SWDEFDIMSCALE, he5_swdefdimscale,INT,STRING,LONG,INT,PVOID) FCALLSCFUN6(INT, HE5_SWdefdimscale2F, HE5_SWDEFDIMSCALE2, he5_swdefdimscale2,INT,STRING,STRING,LONG,INT,PVOID) FCALLSCFUN6(INT, HE5_SWsetdimscaleF, HE5_SWSETDIMSCALE, he5_swsetdimscale,INT,STRING,STRING,LONG,INT,PVOID) FCALLSCFUN7(INT, HE5_SWsetdimscale2F, HE5_SWSETDIMSCALE2, he5_swsetdimscale2,INT,STRING,STRING,STRING,LONG,INT,PVOID) FCALLSCFUN6(LONG, HE5_SWgetdimscaleF, HE5_SWGETDIMSCALE, he5_swgetdimscale,INT,STRING,STRING,PLONG,PINT,PVOID) FCALLSCFUN4(INT, HE5_SWreaddscaleattrF,HE5_SWREADDSCALEATTR, he5_swreaddscaleattr,INT,STRING,STRING,PVOID) FCALLSCFUN6(INT, HE5_SWwritedscaleattrF, HE5_SWWRITEDSCALEATTR, he5_swwritedscaleattr,INT,STRING,STRING,INT,LONGV,PVOID) FCALLSCFUN5(INT, HE5_SWdscaleattrinfoF, HE5_SWDSCALEATTRINFO, he5_swdscaleattrinfo,INT,STRING,STRING,PINT,PLONG) FCALLSCFUN6(INT, HE5_SWdscaleattrinfoF2, HE5_SWDSCALEATTRINFO2, he5_swdscaleattrinfo2,INT,STRING,STRING,PINT,PLONG,PLONG) FCALLSCFUN4(INT, HE5_SWinqdscaleattrsF, HE5_SWINQDSCALATTRS, he5_swinqdscaleattrs,INT,STRING,STRING,PLONG) FCALLSCFUN4(INT, HE5_SWsetflddimlabel, HE5_SWSETFLDDIMLABEL, he5_swsetflddimlabel, INT, STRING, STRING, STRING); FCALLSCFUN4(INT, HE5_SWgetflddimlabel, HE5_SWGETFLDDIMLABEL, he5_swgetflddimlabel, INT, STRING, STRING, STRING); /* EXTERNAL DATA FILE INTERFACE */ FCALLSCFUN4(INT, HE5_SWsetextdataF, HE5_SWSETXDAT, he5_swsetxdat,INT,STRING,LONGV,LONGV) FCALLSCFUN6(INT, HE5_SWgetextdataF, HE5_SWGETXDAT, he5_swgetxdat,INT,STRING,LONG,PSTRING,LONGV,LONGV) #endif hdf-eos5-2.0/src/TSapi.c000077500000000000000000000320311507520047200147440ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 2001 Emergent IT Inc. and Raytheon Systems Company | | | | Permission to use, 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 and that both that | | copyright notice and this permission notice appear in supporting | | documentation. | ---------------------------------------------------------------------------- */ #include #include #ifdef _HDFEOS5_THREADSAFE /* Global Variable definition */ /* -------------------------- */ pthread_once_t HE5_HDFE_TS_FirstInit = PTHREAD_ONCE_INIT; #endif /*---------------------------------------------------------------------------- | BEGIN_PROLOG | | | | FUNCTION: HE5_TSinitfirst | | | | DESCRIPTION : This function initializes the mutex, once per run. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | | | INPUTS: None | | | | | | OUTPUTS: | | | | None | | | | NOTES: | | | | Date Programmer Description | | ======== ============ =============================================== | | 08/21/01 A.Muslimov Original development. | | 08/27/01 A.Muslimov Added appropriate error handlings. | | | | END_PROLOG | ----------------------------------------------------------------------------*/ void HE5_TSinitfirst(void) { #ifdef _HDFEOS5_THREADSAFE herr_t status = FAIL; char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Initialize Global Mutex Variable */ /* -------------------------------- */ GlobalMutex.MasterThread = (pthread_t *)NULL; /* Initialize mutex with default value */ /* ----------------------------------- */ status = pthread_mutex_init(&GlobalMutex.Lock, NULL); if (status != SUCCEED) { status = FAIL; sprintf(errbuf, "Failed to initialize the mutex.\n"); H5Epush(__FILE__, "HE5_TSinitfirst", __LINE__, H5E_FUNC, H5E_BADVALUE, errbuf); } /* Initialize condition variable with default attribute */ /* ---------------------------------------------------- */ status = pthread_cond_init(&GlobalMutex.CondVar, NULL); if (status != SUCCEED) { status = FAIL; sprintf(errbuf, "Failed to initialize the condition variable.\n"); H5Epush(__FILE__, "HE5_TSinitfirst", __LINE__, H5E_FUNC, H5E_BADVALUE, errbuf); } GlobalMutex.LockCount = 0; #endif } /*---------------------------------------------------------------------------- | BEGIN_PROLOG | | | | FUNCTION: HE5_TSmutexlock | | | | DESCRIPTION : This function locks the mutex. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t none Return status variable | | | | INPUTS: | | Mutex struct Input data structure | | | | | | OUTPUTS: | | | | None | | | | NOTES: | | | | Date Programmer Description | | ======== ============ =============================================== | | 08/21/01 A.Muslimov Original development. | | 08/27/01 A.Muslimov Added appropriate error handlings. | | | | END_PROLOG | ----------------------------------------------------------------------------*/ herr_t HE5_TSmutexlock(HE5_HDFE_MutexStruct *Mutex) { herr_t status = SUCCEED; #ifdef _HDFEOS5_THREADSAFE char errbuf[HE5_HDFE_ERRBUFSIZE]; #ifdef _HDFEOS5_THREADSAFE_DEBUG time_t lockTime; #endif status = FAIL; /* Initialize the mutex */ /* -------------------- */ HE5_FIRST_THREAD_INIT /* Check the initialization */ /* ------------------------ */ if (status != SUCCEED) { status = FAIL; sprintf(errbuf, "Failed to initialize the mutex.\n"); H5Epush(__FILE__, "HE5_TSmutexlock", __LINE__, H5E_FUNC, H5E_BADVALUE, errbuf); return(status); } #ifdef _HDFEOS5_THREADSAFE_DEBUG time(&lockTime); printf("Attempt to lock mutex ... Time = %lf \n", (double)lockTime); #endif /* Lock the mutex */ /* -------------- */ status = pthread_mutex_lock(&Mutex->Lock); if (status != SUCCEED) { status = FAIL; sprintf(errbuf, "Failed to lock the mutex.\n"); H5Epush(__FILE__, "HE5_TSmutexlock", __LINE__, H5E_FUNC, H5E_BADVALUE, errbuf); return(status); } /* Find out if the mutex is locked and who owns the lock */ /* ----------------------------------------------------- */ if (Mutex->MasterThread && pthread_equal(pthread_self(), *Mutex->MasterThread)){ /* already owned by self -- increment count */ /* ---------------------------------------- */ Mutex->LockCount++; } else if (!Mutex->MasterThread) { /* No one else has locked it -- set owner and get lock */ /* --------------------------------------------------- */ Mutex->MasterThread = (pthread_t *)malloc(sizeof(pthread_t)); if (Mutex->MasterThread == (pthread_t *)NULL) { status = FAIL; sprintf(errbuf, "Cannot allocate memory for master thread ID.\n"); H5Epush(__FILE__, "HE5_TSmutexlock", __LINE__, H5E_RESOURCE, H5E_BADRANGE, errbuf); return(status); } *Mutex->MasterThread = pthread_self(); Mutex->LockCount = 1; } else { /* if already locked by someone else */ /* --------------------------------- */ for (;;) { status = pthread_cond_wait(&Mutex->CondVar, &Mutex->Lock); if (status != SUCCEED) { status = FAIL; sprintf(errbuf, "Failed to block the thread on condition variable.\n"); H5Epush(__FILE__, "HE5_TSmutexlock", __LINE__, H5E_FUNC, H5E_BADVALUE, errbuf); return(status); } if (!Mutex->MasterThread) { Mutex->MasterThread = (pthread_t *)malloc(sizeof(pthread_t)); if (Mutex->MasterThread == (pthread_t *)NULL) { status = FAIL; sprintf(errbuf, "Cannot allocate memory for master thread ID.\n"); H5Epush(__FILE__, "HE5_TSmutexlock", __LINE__, H5E_RESOURCE, H5E_BADRANGE, errbuf); return(status); } #ifdef _HDFEOS5_THREADSAFE_DEBUG time(&lockTime); printf("Locking mutex ... Time = %lf \n", (double)lockTime); #endif *Mutex->MasterThread = pthread_self(); Mutex->LockCount = 1; break; } } } /* Unlock the mutex */ /* ---------------- */ status = pthread_mutex_unlock(&Mutex->Lock); if (status != SUCCEED) { status = FAIL; sprintf(errbuf, "Failed to unlock the mutex.\n"); H5Epush(__FILE__, "HE5_TSmutexlock", __LINE__, H5E_FUNC, H5E_BADVALUE, errbuf); } #ifdef _HDFEOS5_THREADSAFE_DEBUG time(&lockTime); printf("Locking mutex ... Time = %lf \n", (double)lockTime); #endif #endif return(status); } /*---------------------------------------------------------------------------- | BEGIN_PROLOG | | | | FUNCTION: HE5_TSmutexunlock | | | | DESCRIPTION : This function unlocks the mutex. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t Return status variable | | | | INPUTS: | | Mutex struct data structure | | | | | | OUTPUTS: | | | | None | | | | NOTES: | | | | Date Programmer Description | | ======== ============ =============================================== | | 08/21/01 A.Muslimov Original development. | | 08/27/01 A.Muslimov Added appropriate error handlings. | | | | END_PROLOG | ----------------------------------------------------------------------------*/ herr_t HE5_TSmutexunlock(HE5_HDFE_MutexStruct *Mutex) { herr_t status = SUCCEED; #ifdef _HDFEOS5_THREADSAFE char errbuf[HE5_HDFE_ERRBUFSIZE]; #ifdef _HDFEOS5_THREADSAFE_DEBUG time_t unlockTime; #endif status = FAIL; /* Lock the mutex */ /* -------------- */ status = pthread_mutex_lock(&Mutex->Lock); if (status != SUCCEED) { status = FAIL; sprintf(errbuf, "Failed to unlock the mutex.\n"); H5Epush(__FILE__, "HE5_TSmutexunlock", __LINE__, H5E_FUNC, H5E_BADVALUE, errbuf); return(status); } Mutex->LockCount--; if (Mutex->LockCount == 0) { free(Mutex->MasterThread); Mutex->MasterThread = NULL; status = pthread_cond_signal(&Mutex->CondVar); if (status != SUCCEED) { status = FAIL; sprintf(errbuf, "Failed to unblock the thread blocked on a condition variable.\n"); H5Epush(__FILE__, "HE5_TSmutexunlock", __LINE__, H5E_FUNC, H5E_BADVALUE, errbuf); return(status); } } /* Unlock the mutex */ /* ---------------- */ status = pthread_mutex_unlock(&Mutex->Lock); if (status != SUCCEED) { status = FAIL; sprintf(errbuf, "Failed to unlock the mutex.\n"); H5Epush(__FILE__, "HE5_TSmutexunlock", __LINE__, H5E_FUNC, H5E_BADVALUE, errbuf); } #ifdef _HDFEOS5_THREADSAFE_DEBUG time(&unlockTime); printf("Unlocking mutex ... Time = %lf \n", (double)unlockTime); #endif #endif return(status); } hdf-eos5-2.0/src/ZAapi.c000077500000000000000000030255571507520047200147520ustar00rootroot00000000000000/* ---------------------------------------------------------------------------- | Copyright (C) 2002 Emergent IT Inc. and Raytheon Systems Company | | | | Permission to use, 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 and that both that | | copyright notice and this permission notice appear in supporting | | documentation. | ---------------------------------------------------------------------------- */ #include #include #include #include #define HE5_ZAIDOFFSET 671088642 #define HE5_NZA 200 #ifndef MAX_NAME #define MAX_NAME 1024 #endif /* ZA Structure External Arrays */ struct HE5_zaStructure { hid_t fid; /* HDF-EOS file ID */ hid_t obj_id; /* "ZAS" group ID */ hid_t za_id; /* specified za group ID */ hid_t data_id; /* "Data Fields" group ID */ hid_t plist; /* current dataset creation property*/ int active; /* Flag: file active or not */ int compcode; /* compression mode */ int compparm[5]; /* compression level */ HE5_DTSinfo *ddataset; /* pointer to Data field info */ long nDFLD; /* number of data fields */ char zaname[HE5_OBJNAMELENMAX];/* za name */ }; struct HE5_zaStructure HE5_ZAXZa[HE5_NZA]; /* INTERNAL FUNCTION PROTOTYPES */ int HE5_szip_can_encode(void ); static herr_t HE5_ZAchkzaid(hid_t zaID, const char *routname, hid_t *fid, hid_t *gid, long *idx); static long HE5_ZAinqfield(hid_t zaID, char *datafield, char *fieldlist, int rank[], hid_t ntype[]); static size_t HE5_ZAfieldsizeID(hid_t zaID, char *fieldname, hid_t *fieldID); static herr_t HE5_ZAdefinefield(hid_t zaID, char *datafield, const char *fieldname, char *dimlist, char *maxdimlist, hid_t typeID); static herr_t HE5_ZAwrrdfield(hid_t zaID, char *fieldname, char *code, const hssize_t start[], const hsize_t stride[], const hsize_t count[], void * datbuf); static herr_t HE5_ZAfldinfo(hid_t zaID, char *datafield, char *fieldname, int *rank, hsize_t dims[], hid_t ntype[], char *dimlist, char *maxdimlist); static int HE5_ZAfldnameinfo(hid_t zaID, char *fieldname, char *fldactualname); /* FORTRAN WRAPPER PROTOTYPES */ /* File/ZA access routines */ int HE5_ZAopenF(char *filename, int flags); int HE5_ZAcreateF(int fileID, char *zaname); int HE5_ZAattachF(int fileID, char *zaname); int HE5_ZAdetachF(int zaID); int HE5_ZAcloseF(int fileID); /* Definition routines */ int HE5_ZAdefdimF(int zaID, char *dimname, long dim); int HE5_ZAdefineF(int zaID, char *fieldname, char *fortdimlist, char *fortmaxdimlist, int numtype); int HE5_ZAdefchunkF(int zaID, int ndims, long *dim); int HE5_ZAdefcompF(int zaID, int compcode, int *compparm); int HE5_ZAdefcomchunkF(int zaID, int compcode, int *compparm, int rank, long *dim); int HE5_ZAfldrenameF(int zaID, char *oldfieldname, char *newfieldname); int HE5_ZAsetflddimlabel(hid_t zaID, char *fieldname, char *dimname, char *label); int HE5_ZAgetflddimlabel(hid_t zaID, char *fieldname, char *dimname, char *label); herr_t HE5_ZAsetdimscale2(hid_t zaID, char *fieldname, char *dimname, char *dimscalename, const hsize_t dimsize, hid_t numbertype_in, void * data); /* I/O routines */ int HE5_ZAwriteF(int zaID, char *fieldname, long fortstart[], long fortstride[], long fortedge[], void *data); int HE5_ZAwritecharF(int zaID, char *fieldname, int elemlen, int numelem, long fortstart[], long fortstride[], long fortedge[], void *data); int HE5_ZAreadF(int zaID, char *fieldname, long fortstart[], long fortstride[], long fortedge[], void *buffer); int HE5_ZAreadcharF(int zaID, char *fieldname, int elemlen, int numelem, long fortstart[], long fortstride[], long fortedge[], void *buffer); int HE5_ZAsetfill(int zaID, char *fieldname, int ntype, void *fillval); int HE5_ZAgetfill(int zaID, char *fieldname, void *fillval); int HE5_ZAwrattr(int zaID, char *attrname, int ntype, long fortcount[], void * datbuf); int HE5_ZAwrgattr(int zaID, char *attrname, int ntype, long fortcount[], void *datbuf); int HE5_ZAwrlattr(int zaID, char *fieldname, char *attrname, int ntype, long fortcount[], void *datbuf); int HE5_ZArdattr(int zaID, char *attrname, void *datbuf); int HE5_ZArdgattr(int zaID, char *attrname, void *datbuf); int HE5_ZArdlattr(int zaID, char *fieldname, char *attrname, void *datbuf); int HE5_ZAsetaliasF(int zaID, char *fieldname, char *fortaliaslist); int HE5_ZAdropaliasF(int zaID, int fldgroup, char *aliasname); /* Inquiry routines */ long HE5_ZAinqzaF(char *filename, char *zalist, long *strbufsize); long HE5_ZAnentriesF(int zaID, int entrycode, long *strbufsize); long HE5_ZAdiminfoF(int zaID, char *dimname); int HE5_ZAinfoF(int zaID, char *fieldname, int *rank, long dims[], int *ntype, char *fortdimlist, char *fortmaxdimlist); long HE5_ZAinqdimsF(int zaID, char *dimlist, long dims[]); long HE5_ZAinquireF(int zaID, char *fieldlist, int rank[], int ntype[]); int HE5_ZAatinfo(int zaID, char *attrname, int *ntype, long *fortcount); int HE5_ZAgatinfo(int zaID, char *attrname, int *ntype, long *fortcount); int HE5_ZAlatinfo(int zaID, char *fieldname, char *attrname, int *ntype, long *fortcount); int HE5_ZAatinfo2(int zaID, char *attrname, int *ntype, long *fortcount, long *fortsize); int HE5_ZAgatinfo2(int zaID, char *attrname, int *ntype, long *fortcount, long *fortsize); int HE5_ZAlatinfo2(int zaID, char *fieldname, char *attrname, int *ntype, long *fortcount, long *fortsize); long HE5_ZAinqattrsF(int zaID, char *attrnames, long *strbufsize); long HE5_ZAinqgattrs(int zaID, char *attrnames, long *strbufsize); long HE5_ZAinqlattrs(int zaID, char *fieldname, char *attrnames, long *strbufsize); int HE5_ZAcompinfoF(int zaID, char *fieldname, int *compcode, int compparm[]); int HE5_ZAidtype(int zaID, char *fieldname, char *attrname, int fieldgroup, int *Type, int *Class, int *Order, long *size); int HE5_ZAaliasinfoF(int zaID, int fldgroup, char *aliasname, int *length, char *buffer); long HE5_ZAinqfldaliasF(int zaID, char *fldalias, long *strbufsize); int HE5_ZAchunkinfoF(int zaID, char *fieldname, int *ndims, long dims[]); long HE5_ZAgetaliaslistF(int zaID, int fldgroup, char *aliaslist, long *strbufsize); /* EXTERNAL DATA FILE INTERFACE */ int HE5_ZAsetextdataF(int zaID, char *fortfilelist, long offset[], long size[]); int HE5_ZAgetextdataF(int zaID, char *fieldname, long namelength, char *fortfilelist, long offset[], long size[]); /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAopen | | | | DESCRIPTION: Opens or creates HDF-EOS file in order to create, read, | | or write a ZA. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | fid hid_t None HDF-EOS file ID | | | | INPUTS: | | filename char* None File name string | | flags uintn None File access code | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ======== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ hid_t HE5_ZAopen(const char *filename, uintn flags) { hid_t fid = FAIL;/* hdf5 type file ID */ char *errbuf = NULL;/* Error message buffer */ /* Allocate memory for error buffer */ /* -------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_ZAopen", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory to error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Call HE5_EHopen to open file */ /* ---------------------------- */ fid = HE5_EHopen(filename,flags, H5P_DEFAULT ); if(fid == FAIL) { sprintf(errbuf, "Cannot open the file \"%s\". Check the file name. \n", filename); H5Epush(__FILE__, "HE5_ZAopen", __LINE__, H5E_FILE, H5E_CANTOPENFILE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } free(errbuf); return (fid); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAcreate | | | | DESCRIPTION: Creates a new ZA structure and returns ZA ID | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | zaID hid_t None ZA structure ID | | | | INPUTS: | | fid hid_t None HDF-EOS file ID | | zaname const char* None za name string | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ hid_t HE5_ZAcreate(hid_t fid, const char *zaname) { hid_t zaID = FAIL; /* return value of ZA ID */ hid_t HDFfid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t za_id = FAIL; /* HDF-EOS ZA ID */ hid_t data_id = FAIL; /* "Data Fields" group ID */ hid_t ZAS_ID = FAIL; /* "ZAS" group ID */ hid_t i; /* Loop index */ int nzaopen = 0; /* # of za structures open */ herr_t status = FAIL; /* routine return status variable */ uintn access = 0; /* Read/Write file access code */ long nza = FAIL; /* za counter */ char *errbuf =(char *)NULL; /* Buffer for error message */ char *utlbuf =(char *)NULL; /* Utility buffer */ char *utlbuf2=(char *)NULL; /* Utility buffer 2 */ HE5_LOCK; CHECKNAME(zaname); /* Allocate memory for error buffer */ /* -------------------------------- */ errbuf = (char *)calloc( HE5_HDFE_DIMBUFSIZE, sizeof(char ) ) ; if ( errbuf == NULL ) { H5Epush(__FILE__, "HE5_ZAcreate", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* * Check HDF-EOS file ID, get HDFEOS group ID and * access code */ status = HE5_EHchkfid(fid, "HE5_ZAcreate", &HDFfid, &gid, &access); /* Check file access */ /* -------------------------- */ if ( access == 0 ) { status = FAIL; sprintf(errbuf, "Cannot call HE5_ZAcreate on a file opened read-only.\n"); H5Epush(__FILE__, "HE5_ZAcreate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } if ( status == FAIL ) { sprintf(errbuf, "Checking for file ID failed.\n"); H5Epush(__FILE__, "HE5_ZAcreate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Check zaname for length */ /* ----------------------- */ if ( strlen(zaname) > HE5_OBJNAMELENMAX) { sprintf(errbuf, "za name \"%s\" must be less than %d characters.\n", zaname, HE5_OBJNAMELENMAX); H5Epush(__FILE__, "HE5_ZAcreate", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Determine number of zas currently opened */ /* ---------------------------------------- */ for (i = 0; i < HE5_NZA; i++) nzaopen += HE5_ZAXZa[i].active; if(nzaopen < HE5_NZA) { /* Probe , check if "ZAS" group exists */ /* ----------------------------------- */ H5E_BEGIN_TRY { ZAS_ID = H5Gopen(gid, "ZAS"); } H5E_END_TRY; if(ZAS_ID == FAIL ) { nza = 0; /* Create the "ZAS" group */ /* ---------------------- */ ZAS_ID = H5Gcreate(gid,"ZAS",0); if(ZAS_ID == FAIL) { sprintf(errbuf,"Cannot create the \"ZAS\" group.\n"); H5Epush(__FILE__, "HE5_ZAcreate", __LINE__, H5E_OHDR, H5E_CANTCREATE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } } else { /* Probe , check if zaname group exist */ /* ----------------------------------- */ H5E_BEGIN_TRY{ za_id = H5Gopen(ZAS_ID, zaname); } H5E_END_TRY; if( za_id == FAIL ) { /* Get the number of zas in "ZAS" group */ /* ------------------------------------ */ nza = HE5_EHdatasetcat(fid, "/HDFEOS/ZAS", NULL, NULL); if (nza == FAIL) { sprintf(errbuf,"Cannot retrieve the number of zas.\n"); H5Epush(__FILE__, "HE5_ZAcreate", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); status = H5Gclose(ZAS_ID); free(errbuf); return(FAIL); } } else { sprintf(errbuf, "za \"%s\" already exists.\n", zaname); H5Epush(__FILE__, "HE5_ZAcreate", __LINE__, H5E_OHDR, H5E_EXISTS, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); status = H5Gclose(ZAS_ID); free(errbuf); return(FAIL); } } /* za does not exist */ /* ----------------- */ /* Create zaname group */ /* ------------------- */ za_id = H5Gcreate( ZAS_ID, zaname, 0); if(za_id == FAIL) { sprintf(errbuf,"Cannot create the \"%s\" group.\n", zaname); H5Epush(__FILE__, "HE5_ZAcreate", __LINE__, H5E_OHDR, H5E_CANTCREATE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); status = H5Gclose(ZAS_ID); free(errbuf); return(FAIL); } /* Create /ZA/zaname/Data Fields group */ /* ----------------------------------- */ data_id = H5Gcreate( za_id, "Data Fields", 0); if(data_id == FAIL) { sprintf(errbuf,"Cannot create the \"Data Fields\" group.\n"); H5Epush(__FILE__, "HE5_ZAcreate", __LINE__, H5E_OHDR, H5E_CANTCREATE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); status = H5Gclose(ZAS_ID); free(errbuf); return(FAIL); } /* Allocate memory for utility buffers */ /* ----------------------------------- */ utlbuf = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char ) ) ; if ( utlbuf == NULL ) { H5Epush(__FILE__, "HE5_ZAcreate", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for utility buffer.\n"); HE5_EHprint("Error: Cannot allocate memory for utility buffer, occured", __FILE__, __LINE__); status = H5Gclose(ZAS_ID); free(errbuf); return(FAIL); } utlbuf2 = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char ) ) ; if ( utlbuf2 == NULL ) { H5Epush(__FILE__, "HE5_ZAcreate", __LINE__, H5E_RESOURCE, H5E_NOSPACE,"Cannot allocate memory for utility buffer2.\n"); HE5_EHprint("Error: Cannot allocate memory for utility buffer2, occured", __FILE__, __LINE__); status = H5Gclose(ZAS_ID); free(errbuf); free(utlbuf); return(FAIL); } /* Establish za in "Structural MetaData" Block */ /* ------------------------------------------- */ sprintf(utlbuf, "%s%li%s%s%s", "\tGROUP=ZA_", nza + 1, "\n\t\tZaName=\"", zaname, "\"\n"); strcat(utlbuf, "\t\tGROUP=Dimension\n"); strcat(utlbuf, "\t\tEND_GROUP=Dimension\n"); strcat(utlbuf, "\t\tGROUP=DimensionMap\n"); strcat(utlbuf, "\t\tEND_GROUP=DimensionMap\n"); strcat(utlbuf, "\t\tGROUP=IndexDimensionMap\n"); strcat(utlbuf, "\t\tEND_GROUP=IndexDimensionMap\n"); strcat(utlbuf, "\t\tGROUP=DataField\n"); strcat(utlbuf, "\t\tEND_GROUP=DataField\n"); sprintf(utlbuf2, "%s%li%s","\tEND_GROUP=ZA_", nza + 1, "\n"); strcat(utlbuf, utlbuf2); /* Insert metadata buffer to the "StructMetadata" */ /* ---------------------------------------------- */ status = HE5_EHinsertmeta(fid, (char*)zaname, "z", 1004L, utlbuf, NULL); if (status == FAIL ) { sprintf(errbuf,"Cannot insert metadata buffer to \"StructMetadata\".\n"); H5Epush(__FILE__, "HE5_ZAcreate", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); status = H5Gclose(ZAS_ID); free(errbuf); free(utlbuf); free(utlbuf2); return(FAIL); } /* Release "ZAS" group ID */ /* ---------------------- */ status = H5Gclose(ZAS_ID); if(status == FAIL ) { sprintf(errbuf,"Cannot release the \"ZAS\" group ID.\n"); H5Epush(__FILE__, "HE5_ZAcreate", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); status = H5Gclose(ZAS_ID); free(utlbuf); free(utlbuf2); free(errbuf); return(FAIL); } /* Assign zaID & Load za and ZAXZa table entries */ /* --------------------------------------------- */ for (i = 0; i < HE5_NZA; i++) { if (HE5_ZAXZa[i].active == 0) { /* * Set za_id, Set za entry active, Store root group * ID, Store sub group IDs, Store HDF-EOS file ID */ HE5_ZAXZa[i].active = 1; HE5_ZAXZa[i].za_id = za_id; HE5_ZAXZa[i].data_id = data_id; HE5_ZAXZa[i].fid = fid; HE5_ZAXZa[i].obj_id = ZAS_ID; HE5_ZAXZa[i].plist = FAIL; strcpy(HE5_ZAXZa[i].zaname, zaname); HE5_ZAXZa[i].compcode = HE5_HDFE_COMP_NONE; zaID = i + HE5_ZAIDOFFSET; break; } } } else { /* Too many files opened */ /* --------------------- */ zaID = FAIL; sprintf(errbuf,"\n Illegal attempt to open more than %d zas simultaneously.\n", HE5_NZA); H5Epush(__FILE__, "HE5_ZAcreate", __LINE__, H5E_OHDR, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } /* Release allocated memory */ /* ------------------------ */ free(errbuf); free(utlbuf); free(utlbuf2); COMPLETION: HE5_UNLOCK; return (zaID); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAattach | | | | DESCRIPTION: Attaches to an existing za within the file. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | zaID hid_t ZA structure ID | | | | INPUTS: | | fid hid_t HDF-EOS file ID | | zaname const char* ZA structure name | | | | OUTPUTS: | | None | | | | NOTES: | | The iteration over the "Data Fields" group has the followings | | side effect: it counts as an object (which is supposed to be | | a dataset) the group "Ragged Arrays". So the external structure | | "ddataset" gets filled with a fake member and nDFLD gets | | incremented by one. This shouldn't affect the other interfacing | | routines unless someone tries to access the datasets in "Data | | Fields" group directly through their IDs retrieved from external| | "ddataset" structure, or use "nDFLD" data member of to retrieve | | the actual number of data sets (fields). To avoid potential | | problems, the dataset counter is decremented by one and the | | corresponding error checking are inserted to handle this case. | | | | | | Date Programmer Description | | ========= ============ ============================================== | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ hid_t HE5_ZAattach(hid_t fid, const char *zaname) { hid_t zaID = FAIL;/* ZA ID (return value) */ hid_t i; /* Loop index */ hid_t emptyslot = 0; /* Spare za index */ herr_t status = FAIL;/* Return status variable */ int nzaopen = 0; /* # of za structures open */ int idx = FAIL;/* return value from an operator */ uintn acs = 0; /* Read/Write file access code */ hid_t HDFfid = FAIL;/* HDF-EOS file ID */ hid_t datid = FAIL;/* Dataset ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t data_id = FAIL;/* "Data Fields" Group ID */ hid_t za_id = FAIL;/* za ID */ HE5_OBJINFO inout; /* IN/OUT operator data */ char *grpname =NULL;/* Ptr to a group name string */ char *tmpname =NULL;/* ..... temporary name ... */ char *namebuf =NULL;/* ..... temporary buffer name ... */ char *fldname =NULL;/* ..... temporary field name ... */ char *comma =NULL; char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer*/ HE5_LOCK; CHECKPOINTER(zaname); /* Check HDF-EOS file ID, get back HDF file ID and access code */ /* ----------------------------------------------------------- */ status = HE5_EHchkfid(fid, "HE5_ZAattach", &HDFfid, &gid, &acs); if ( status == FAIL ) { H5Epush(__FILE__, "HE5_ZAattach", __LINE__, H5E_ARGS, H5E_BADRANGE, "Checking for file ID failed.\n"); HE5_EHprint("Error: Checking for file ID failed, occured", __FILE__, __LINE__); return(FAIL); } /* Determine number of zas currently opened */ /* ---------------------------------------- */ for (i = 0; i < HE5_NZA; i++) nzaopen += HE5_ZAXZa[i].active; /* Check there is a room for more */ /* ------------------------------ */ if (nzaopen < HE5_NZA) { /* Search for group "/ZAS/zaname" */ /* ============================== */ grpname = (char *) calloc( (strlen(zaname)+40), sizeof(char) ); if (grpname == NULL) { sprintf(errbuf, "Cannot allocate memory for grpname.\n") ; H5Epush(__FILE__, "HE5_ZAattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } strcpy( grpname, "/HDFEOS/ZAS/"); strcat( grpname, zaname); /* * If group with zaname found, open the group, load tables */ H5E_BEGIN_TRY{ za_id = H5Gopen(HDFfid, grpname); } H5E_END_TRY; if( za_id == FAIL ) { sprintf(errbuf, "za \"%s\" does not exist within HDF-EOS file.\n",zaname) ; H5Epush(__FILE__, "HE5_ZAattach", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } /* Attach to "Data Fields" */ /* ======================= */ data_id = H5Gopen( za_id, "Data Fields"); if (data_id == FAIL) { sprintf(errbuf, "Cannot open the \"Data Fields\" group. \n") ; H5Epush(__FILE__, "HE5_ZAattach", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } /* Setup External Arrays */ /* --------------------- */ for (i = 0; i < HE5_NZA; i++) { /* Find empty entry in array */ /* ------------------------- */ if (HE5_ZAXZa[i].active == 0) { /* Set IDs, codes., etc */ /* ==================== */ HE5_ZAXZa[i].active = 1; HE5_ZAXZa[i].data_id = data_id; HE5_ZAXZa[i].fid = fid; HE5_ZAXZa[i].za_id = za_id; HE5_ZAXZa[i].plist = FAIL; HE5_ZAXZa[i].compcode = HE5_HDFE_COMP_NONE; zaID = i + HE5_ZAIDOFFSET; strcpy(HE5_ZAXZa[i].zaname, zaname); break; } } emptyslot = i; /* Access za "Data Fields" datasets */ /* ----------------------------------- */ tmpname = (char *) calloc( (strlen(grpname)+ 20), sizeof(char)); if (tmpname == NULL) { sprintf(errbuf, "Cannot allocate memory for tmpname. \n") ; H5Epush(__FILE__, "HE5_ZAattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } strcpy(tmpname,grpname); strcat(tmpname,"/Data Fields"); /* Get the number of OBJECTS in "Data Fields" group */ /* ================================================ */ inout.count = 0; inout.name = NULL; inout.strsize = 0; idx = H5Giterate(data_id, tmpname , NULL, HE5_EHobj_info, &inout); if ( idx == FAIL ) { sprintf(errbuf, "Iteration of \"HE5_EHobj_info()\" operation failed. \n") ; H5Epush(__FILE__, "HE5_ZAattach", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); free(tmpname); return(FAIL); } free(tmpname); /* Set the data members of external structure */ /* ========================================== */ HE5_ZAXZa[emptyslot].nDFLD = inout.count; /*------------------------------------------------------*/ /* Loop through all data field datasets and open it */ /* Allocate space for namebuf, copy inout.name into it, */ /* and append comma */ /*------------------------------------------------------*/ if( inout.name != NULL && inout.count > 0 ) { /* Allocate memory to ddataset struct */ /* ---------------------------------- */ HE5_ZAXZa[emptyslot].ddataset = (HE5_DTSinfo *)realloc((void *)HE5_ZAXZa[emptyslot].ddataset,(HE5_ZAXZa[emptyslot].nDFLD) * sizeof(HE5_DTSinfo)); /* Allocate memory to the list of dataset names */ /* -------------------------------------------- */ namebuf = (char *) calloc(strlen(inout.name) + 2, sizeof(char)); if (namebuf == NULL) { sprintf(errbuf, "Cannot allocate memory for namebuf. \n") ; H5Epush(__FILE__, "HE5_ZAattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } strcpy(namebuf, inout.name); strcat(namebuf, ","); /* Find comma */ /* ---------- */ comma = strchr(namebuf, ','); i = 0; /* Parse the list of dataset names */ /* ------------------------------- */ while (comma != NULL) { /* Allocate memory for fldname buffer */ /* ---------------------------------- */ fldname = (char *) calloc(comma - namebuf + 1, sizeof(char)); if (fldname == NULL) { sprintf(errbuf, "Cannot allocate memory for fldname. \n") ; H5Epush(__FILE__, "HE5_ZAattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); free(namebuf); return(FAIL); } /* Copy field list entry to fldname */ /* -------------------------------- */ memmove(fldname, namebuf, comma - namebuf); fldname[comma-namebuf]=0; /* open dataset fldname */ /* -------------------- */ H5E_BEGIN_TRY{ datid = H5Dopen(data_id, fldname); }H5E_END_TRY; if ( datid == FAIL ) { sprintf(errbuf, "Cannot open the dataset \"%s\". \n",fldname ); H5Epush(__FILE__, "HE5_ZAattach", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); free(namebuf); free(fldname); return(FAIL); } /* allocate memory to the dataset name */ /* ----------------------------------- */ HE5_ZAXZa[emptyslot].ddataset[i].name = (char *)calloc((strlen(fldname)+1), sizeof(char)); if (HE5_ZAXZa[emptyslot].ddataset[i].name == NULL) { sprintf(errbuf, "Cannot allocate memory for the dataset name. \n") ; H5Epush(__FILE__, "HE5_ZAattach", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); free(namebuf); free(fldname); return(FAIL); } /* Set the data members of external structure */ /* ========================================== */ HE5_ZAXZa[emptyslot].ddataset[i].ID = datid; strcpy(HE5_ZAXZa[emptyslot].ddataset[i].name, fldname); /* Go to next field entry, find next comma, ... */ /* ============================================ */ memmove(namebuf, comma + 1, strlen(comma + 1) + 1); comma = strchr(namebuf, ','); if (fldname != NULL) free(fldname); i++; } if (namebuf != NULL) free(namebuf); if(inout.name != NULL ) free( inout.name); } /* end if(inout.name!=NULL) */ } else { /* Too many zas opened */ /* ------------------- */ zaID = FAIL; sprintf(errbuf,"\n Illegal attempt to open more than %d zas simultaneously. \n", HE5_NZA); H5Epush(__FILE__, "HE5_ZAattach", __LINE__, H5E_OHDR, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } COMPLETION: HE5_UNLOCK; free (grpname); return(zaID); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAchkzaid | | | | DESCRIPTION: Checks for valid zaID and returns file ID and | | "HDFEOS" group ID | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t ZA structure ID | | routname const char* Routine name | | | | OUTPUTS: | | fid hid_t* HDF-EOS file ID | | gid hid_t* "HDFEOS" Group ID | | idx long* za index | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ static herr_t HE5_ZAchkzaid(hid_t zaID, const char *routname, hid_t *fid, hid_t *gid, long *idx ) { herr_t status = FAIL;/* routine return status variable */ uintn access = 0; /* Read/Write access code */ hid_t HDFfid = FAIL;/* HDF-EOS file ID */ hid_t idOffset = HE5_ZAIDOFFSET; char message1[] = "Invalid za id: %d in routine \"%s\". ID must be >= %d and < %d.\n"; char message2[] = "za id %d in routine \"%s\" not active.\n"; char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ /* Check for valid za ID */ /* --------------------- */ if (zaID < idOffset || zaID >= HE5_NZA + idOffset) { status = FAIL; sprintf(errbuf, message1, zaID, routname, idOffset, HE5_NZA + idOffset); H5Epush(__FILE__, "HE5_ZAchkzaid", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } else { /* Check for active za ID */ /* ---------------------- */ if (HE5_ZAXZa[zaID % idOffset].active == 0) { status = FAIL; sprintf(errbuf, message2, zaID, routname); H5Epush(__FILE__, "HE5_ZAchkzaid", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } else { *idx = HE5_EHhid2long(zaID % idOffset); if (*idx == FAIL) { status = FAIL; sprintf(errbuf,"Cannot set up the za index.\n"); H5Epush(__FILE__, "HE5_ZAchkzaid", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } /* Get HDF file ID & "HDFEOS" group ID */ /* ------------------------------------ */ *fid = HE5_ZAXZa[*idx].fid; status = HE5_EHchkfid(*fid,"", &HDFfid, gid, &access); if (status == FAIL) { sprintf(errbuf,"Checking for file ID failed.\n"); H5Epush(__FILE__, "HE5_ZAchkzaid", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } } return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAdefdim | | | | DESCRIPTION: Defines numerical value of dimension | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None Return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t ZA structure ID | | dimname char* dimension name | | dim hsize_t dimension size | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAdefdim(hid_t zaID, char *dimname, hsize_t dim) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ long idx = FAIL;/* za index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKNAME(dimname); /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAdefdim", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for za ID failed.\n"); H5Epush(__FILE__, "HE5_ZAdefdim", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Make certain that dim != 0 */ /* -------------------------- */ if ( dim == 0 ) { status = FAIL; sprintf(errbuf, "Invalid (zero) dimension size.\n"); H5Epush(__FILE__, "HE5_ZAdefdim", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Write dimension to the dataset "StructMetadata.0" */ /* ------------------------------------------------- */ status = HE5_EHinsertmeta(fid, HE5_ZAXZa[idx].zaname,"z", 0L, dimname, &dim); if ( status == FAIL ) { sprintf(errbuf, "Cannot insert the value for \"%s\" dimension into Metadata.\n", dimname); H5Epush(__FILE__, "HE5_ZAdefdim", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAdefdimscale | | | | DESCRIPTION: Defines dimension scale for all fields that use the given | | dimesion | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t ZA structure ID | | dimname char dim name | | dimsize hsize_t Dimemsion size value | | numbertype_in hid_t dim scale data type such as DFNT_INT32, | | DFNT_FLOAT64, DFNT_FLOAT32, etc. | | data void data buffer for write | | | | | | OUTPUTS: | | | | NOTES: This function finds out which field in a ZA has the dimension | | and sets dimension scale for that field calling HE5_ZAsetdimscale() | | User must detach ZA after creating fields and attach again before | | calling the routine. | | | | | | Date Programmer Description | | ======== ============ =============================================== | | Dec 2013 Abe Taaheri Original Programmer | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAdefdimscale(hid_t zaID, char *dimname, const hsize_t dimsize, hid_t numbertype_in, void * data) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ long idx = FAIL;/* Za index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ char *fieldlist = NULL; long strbufsize; long nflds = FAIL; HE5_LOCK; CHECKNAME(dimname); /* Get HDF-EOS file ID, "HDFEOS" group ID and Za index */ /* ------------------------------------------------------ */ status = HE5_ZAchkzaid(zaID, "HE5_ZAdefdimscale", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for Za ID failed.\n"); H5Epush(__FILE__, "HE5_ZAdefdimscale", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Make certain that dimsize != 0 */ /* ------------------------------ */ if ( dimsize == 0 ) { status = FAIL; sprintf(errbuf, "Invalid (zero) dimension size.\n"); H5Epush(__FILE__, "HE5_ZAdefdimscale", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Loop over all fields in the ZA and find out if field's dimension list has the dimension name. If true then set the dimension scale for the dim in that field */ /* Inquire Data Fields first*/ /* ------------------------ */ nflds = HE5_ZAnentries(zaID, HE5_HDFE_NENTDFLD, &strbufsize); if (nflds == FAIL) { sprintf(errbuf, "Cannot get the number of fields in \"Data Fields\" group. \n"); H5Epush(__FILE__, "HE5_ZAdefdimscale", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } else { fieldlist = (char *) calloc(strbufsize + 1, sizeof(char)); if(fieldlist == NULL) { sprintf(errbuf,"Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_ZAdefdimscale", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } nflds = HE5_ZAinqfield(zaID, "Data Fields", fieldlist, NULL, NULL); if (nflds == FAIL) { sprintf(errbuf, "Cannot get the list of fields in \"Data Fields\" group. \n"); H5Epush(__FILE__, "HE5_ZAdefdimscale", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(fieldlist); return(FAIL); } if(nflds > 0) { size_t fldnmlen[HE5_FLDNUMBERMAX]; /* Array of namelengths */ char *fldnm[HE5_FLDNUMBERMAX]; /* Array of names */ char tempdimlist[HE5_HDFE_DIMBUFSIZE];/* Dimension list */ int rank = FAIL; /* Rank of dataset */ hsize_t tempdims[HE5_DTSETRANKMAX]; /* Dimension sizes array*/ hid_t dtype[1] = {FAIL}; /* Data type */ long ntflds = 0; /* field counter */ int i; char *tempfield = NULL; unsigned int Dimindex; ntflds = HE5_EHparsestr(fieldlist, ',', fldnm,fldnmlen); if(ntflds != FAIL) { for(i = 0; i < ntflds; i++) { tempfield = (char *)calloc(fldnmlen[i] + 1, sizeof(char)); memmove(tempfield,fldnm[i],fldnmlen[i]); tempfield[fldnmlen[i]]='\0'; /* for this field see if the dimlist contains dimname */ status = HE5_ZAfldinfo(zaID, "Data Fields", tempfield, &rank, tempdims, dtype, tempdimlist, NULL); if (status != SUCCEED) { sprintf(errbuf, "Field \"%s\" not found.\n", tempfield); H5Epush(__FILE__, "HE5_ZAdefdimscale", __LINE__, H5E_ARGS, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(tempfield); free(fieldlist); return(FAIL); } Dimindex = FAIL; Dimindex = HE5_EHstrwithin(dimname, tempdimlist, ','); if (Dimindex == FAIL) /* dimension not found */ { continue; /*dimlist does not contain dim name */ } else { /* call HE5_ZAsetdimscle */ status = HE5_ZAsetdimscale(zaID, (char *)tempfield, dimname, dimsize, numbertype_in, data); if ( status == FAIL ) { sprintf(errbuf,"Cannot set dimension scale %s for the field %s. \n", dimname, tempfield); H5Epush(__FILE__, "HE5_ZAdefdimscale", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(tempfield); free(fieldlist); return(status); } } } free(tempfield); tempfield = NULL; } } free(fieldlist); fieldlist = NULL; } COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAdefdimscale2 | | | | DESCRIPTION: Defines dimension scale for all fields that use the given | | dimesion (user defined dimension scale name) | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t ZA structure ID | | dimname char dim name | | dimscalename char dim scale name | | dimsize hsize_t Dimemsion size value | | numbertype_in hid_t dim scale data type such as DFNT_INT32, | | DFNT_FLOAT64, DFNT_FLOAT32, etc. | | data void data buffer for write | | | | | | OUTPUTS: | | | | NOTES: This function finds out which field in a ZA has the dimension | | and sets dimension scale for that field calling HE5_ZAsetdimscale2()| | User must detach ZA after creating fields and attach again before | | calling the routine. | | | | | | Date Programmer Description | | ======== ============ =============================================== | | Dec 2013 Abe Taaheri Original Programmer | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAdefdimscale2(hid_t zaID, char *dimname, char *dimscalename, const hsize_t dimsize, hid_t numbertype_in, void * data) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ long idx = FAIL;/* Za index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ char *fieldlist = NULL; long strbufsize; long nflds = FAIL; HE5_LOCK; CHECKNAME(dimname); /* Get HDF-EOS file ID, "HDFEOS" group ID and Za index */ /* ------------------------------------------------------ */ status = HE5_ZAchkzaid(zaID, "HE5_ZAdefdimscale2", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for Za ID failed.\n"); H5Epush(__FILE__, "HE5_ZAdefdimscale2", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Make certain that dimsize != 0 */ /* ------------------------------ */ if ( dimsize == 0 ) { status = FAIL; sprintf(errbuf, "Invalid (zero) dimension size.\n"); H5Epush(__FILE__, "HE5_ZAdefdimscale2", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Loop over all fields in the ZA and find out if field's dimension list has the dimension name. If true then set the dimension scale for the dim in that field */ /* Inquire Data Fields first*/ /* ------------------------ */ nflds = HE5_ZAnentries(zaID, HE5_HDFE_NENTDFLD, &strbufsize); if (nflds == FAIL) { sprintf(errbuf, "Cannot get the number of fields in \"Data Fields\" group. \n"); H5Epush(__FILE__, "HE5_ZAdefdimscale2", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } else { fieldlist = (char *) calloc(strbufsize + 1, sizeof(char)); if(fieldlist == NULL) { sprintf(errbuf,"Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_ZAdefdimscale2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } nflds = HE5_ZAinqfield(zaID, "Data Fields", fieldlist, NULL, NULL); if (nflds == FAIL) { sprintf(errbuf, "Cannot get the list of fields in \"Data Fields\" group. \n"); H5Epush(__FILE__, "HE5_ZAdefdimscale2", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(fieldlist); return(FAIL); } if(nflds > 0) { size_t fldnmlen[HE5_FLDNUMBERMAX]; /* Array of namelengths */ char *fldnm[HE5_FLDNUMBERMAX]; /* Array of names */ char tempdimlist[HE5_HDFE_DIMBUFSIZE];/* Dimension list */ int rank = FAIL; /* Rank of dataset */ hsize_t tempdims[HE5_DTSETRANKMAX]; /* Dimension sizes array*/ hid_t dtype[1] = {FAIL}; /* Data type */ long ntflds = 0; /* field counter */ int i; char *tempfield = NULL; unsigned int Dimindex; ntflds = HE5_EHparsestr(fieldlist, ',', fldnm,fldnmlen); if(ntflds != FAIL) { for(i = 0; i < ntflds; i++) { tempfield = (char *)calloc(fldnmlen[i] + 1, sizeof(char)); memmove(tempfield,fldnm[i],fldnmlen[i]); tempfield[fldnmlen[i]]='\0'; /* for this field see if the dimlist contains dimname */ status = HE5_ZAfldinfo(zaID, "Data Fields", tempfield, &rank, tempdims, dtype, tempdimlist, NULL); if (status != SUCCEED) { sprintf(errbuf, "Field \"%s\" not found.\n", tempfield); H5Epush(__FILE__, "HE5_ZAdefdimscale2", __LINE__, H5E_ARGS, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(tempfield); free(fieldlist); return(FAIL); } Dimindex = FAIL; Dimindex = HE5_EHstrwithin(dimname, tempdimlist, ','); if (Dimindex == FAIL) /* dimension not found */ { continue; /*dimlist does not contain dim name */ } else { /* call HE5_ZAsetdimscle */ status = HE5_ZAsetdimscale2(zaID, (char *)tempfield, dimname, dimscalename, dimsize, numbertype_in, data); if ( status == FAIL ) { sprintf(errbuf,"Cannot set dimension scale %s for the field %s. \n", dimscalename, tempfield); H5Epush(__FILE__, "HE5_ZAdefdimscale2", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(tempfield); free(fieldlist); return(status); } } } free(tempfield); tempfield = NULL; } } free(fieldlist); fieldlist = NULL; } COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAsetdimscale | | | | DESCRIPTION: Defines a dimension scale for a fields dimension in a ZA | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t ZA structure ID | | fieldname char field name | | dimname char Dimension name | | dimsize hsize_t Dimemsion size value | | numbertype_in hid_t dim scale data type such as DFNT_INT32, | | DFNT_FLOAT64, DFNT_FLOAT32, etc. | | data void data buffer for write | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | May 10 Abe Taaheri Original Programmer | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAsetdimscale(hid_t zaID, char *fieldname, char *dimname, const hsize_t dimsize, hid_t numbertype_in, void * data) { herr_t status; hid_t ntype; hsize_t dims[HE5_DTSETRANKMAX]; int rankSDS; hid_t field_ntype[1] = {FAIL}; /* number types */ char dimlist[HE5_HDFE_DIMBUFSIZE]; char maxdimlist[HE5_HDFE_DIMBUFSIZE]; hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t did; hid_t dsid; hid_t fspace = FAIL; /* File dataspace ID */ unsigned int Dimindex; hid_t dsplist = FAIL; /* Property list ID */ H5D_layout_t layout = H5D_LAYOUT_ERROR; /* Type of storage */ hid_t data_space = FAIL; /* dataspace ID */ long idx = FAIL; /* Za index */ char *errbuf = (char *)NULL; /* buffer for error message*/ void *data_buff; int i, found; int rankds; hsize_t dimsds[1]; char *dimscalename = NULL; HE5_LOCK; CHECKNAME(fieldname); CHECKNAME(dimname); /* Allocate memory for error buffer */ /* -------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_ZAsetdimscale", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer ", __FILE__, __LINE__); return(FAIL); } /* Convert HDF-EOS5 datatype to HDF5 datatype */ if ( H5Tequal(numbertype_in, H5T_NATIVE_CHAR) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_SCHAR) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_UCHAR) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_SHORT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_USHORT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_INT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_UINT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_LONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_ULONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_LLONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_ULLONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_FLOAT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_DOUBLE) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_LDOUBLE)== TRUE || H5Tequal(numbertype_in, H5T_C_S1) == TRUE) { ntype = numbertype_in; } else { ntype = HE5_EHconvdatatype((int) numbertype_in); } if(ntype == FAIL) { sprintf(errbuf,"Cannot convert to HDF5 type data type ID for dimscale\n"); H5Epush(__FILE__, "HE5_ZAsetdimscale", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* ********************************************************** * Check for proper ZA ID and return HDF-EOS file ID, * * "HDFEOS" group ID and ZA index * ********************************************************** */ status = HE5_ZAchkzaid(zaID, "HE5_ZAsetdimscale", &fid, &gid, &idx); if(status == FAIL) { sprintf(errbuf,"Checking for ZA ID failed.\n"); H5Epush(__FILE__, "HE5_ZAsetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } if (status == 0) { /* Check that field exists */ /* ----------------------- */ status = HE5_ZAinfo(zaID, fieldname, &rankSDS, dims, field_ntype, dimlist, maxdimlist); if (status != 0) { sprintf(errbuf, "Fieldname \"%s\" does not exist.\n", fieldname); H5Epush(__FILE__, "HE5_ZAsetdimscale", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } data_buff = data; /* Loop through all datasets in ZA */ /* ------------------------------ */ for (i = 0; i < HE5_ZAXZa[idx].nDFLD; i++) { /* Get dataset name */ if( strcmp(fieldname, HE5_ZAXZa[ idx ].ddataset[ i ].name) == 0 ) { found = 1; did = HE5_ZAXZa[ idx ].ddataset[ i ].ID; break; } } if(found != 1) /* did not find fieldname */ { sprintf(errbuf, "Fieldname \"%s\" does not exist.\n", fieldname); H5Epush(__FILE__, "HE5_ZAsetdimscale", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Dimension index */ Dimindex = FAIL; Dimindex = HE5_EHstrwithin(dimname, dimlist, ','); if (Dimindex == FAIL) /* dimension not found */ { status = FAIL; sprintf( errbuf, "Dimname \"%s\" does not exist for field \"%s\".\n", dimname, fieldname ); H5Epush(__FILE__, "HE5_ZAsetdimscale", __LINE__, H5E_IO, H5E_SEEKERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } /* If dimension found ... */ /* Found the dimname; Use its dimid to set Dimension Scale*/ /* See if dimscale dataset already exist */ dsid = H5Dopen(HE5_ZAXZa[idx].za_id, dimname); if(dsid < 0) { /* create Dim Scale dataset */ /* Try to open the " group */ /* =================================== */ dsplist = H5Pcreate(H5P_DATASET_CREATE); if(dsplist == FAIL) { sprintf(errbuf,"Cannot create a new property list.\n"); H5Epush(__FILE__, "HE5_ZAsetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Get layout information */ /* ---------------------- */ layout = H5Pget_layout(dsplist); if(layout == H5D_LAYOUT_ERROR) { sprintf(errbuf,"Cannot get layout information for the dataset.\n"); H5Epush(__FILE__, "HE5_ZAsetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } rankds = 1; dimsds[0] = dims[Dimindex]; data_space = H5Screate_simple(rankds, dimsds, NULL); if(data_space == FAIL) { sprintf(errbuf,"Cannot create dataspace for the dimension scale dataset.\n"); H5Epush(__FILE__, "HE5_ZAsetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } dsid = H5Dcreate(HE5_ZAXZa[idx].za_id,dimname,ntype, data_space, dsplist); if( dsid == FAIL ) { sprintf(errbuf, "Cannot create dataset for Dimension Scale \"%s\" field. \n", dimname); H5Epush(__FILE__, "HE5_ZAsetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* write data_buff to it */ /* Get the field space ID */ /* --------------------- */ fspace = H5Dget_space(dsid); if ( fspace == FAIL) { sprintf(errbuf, "Cannot get the file data space ID.\n"); H5Epush(__FILE__, "HE5_ZAsetdimscale", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } status = H5Dwrite(dsid, ntype, data_space, fspace, H5P_DEFAULT, data_buff); if( status == FAIL ) { sprintf(errbuf,"Cannot write data to the dataset.\n"); H5Epush(__FILE__, "HE5_ZAsetdimscale", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } } /* Dataset exist. See if it is Dimension Scale already. If not make it */ if ((H5DSis_scale(dsid)) <= 0 ) { status = H5DSset_scale(dsid, dimname); if( status < 0) { status = -1; free(errbuf); goto COMPLETION; } if(H5DSattach_scale(did, dsid, Dimindex) < 0) { status = -1; free(errbuf); goto COMPLETION; } /* set dimscale name as dimlabel in DIMENSION_LABELS attribute for this field */ if(dimscalename == NULL) { dimscalename = (char *)malloc(strlen(dimname) + 1); strcpy(dimscalename, dimname); } if(HE5_ZAsetflddimlabel(zaID, fieldname, dimname, dimscalename) < 0) { status = 0; sprintf(errbuf,"Cannot write dimscale label to the dataset.\n"); H5Epush(__FILE__, "HE5_ZAsetdimscale", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if(dimscalename != NULL) { free(dimscalename); dimscalename = NULL; } free(errbuf); goto COMPLETION; } else { if(dimscalename != NULL) { free(dimscalename); dimscalename = NULL; } } } else { if(H5DSattach_scale(did, dsid, Dimindex) < 0) { status = -1; free(errbuf); goto COMPLETION; } /* set dimscale name as dimlabel in DIMENSION_LABELS attribute for this field */ if(dimscalename == NULL) { dimscalename = (char *)malloc(strlen(dimname) + 1); strcpy(dimscalename, dimname); } if(HE5_ZAsetflddimlabel(zaID, fieldname, dimname, dimscalename) < 0) { status = 0; sprintf(errbuf,"Cannot write dimscale label to the dataset.\n"); H5Epush(__FILE__, "HE5_ZAsetdimscale", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if(dimscalename != NULL) { free(dimscalename); dimscalename = NULL; } free(errbuf); goto COMPLETION; } else { if(dimscalename != NULL) { free(dimscalename); dimscalename = NULL; } } } if( H5Dclose(dsid) < 0) { status = -1; sprintf(errbuf, "Cannot closee dataset for Dimension Scale \"%s\" field. \n", dimname); H5Epush(__FILE__, "HE5_ZAsetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); goto COMPLETION; } } if(errbuf != NULL) { free(errbuf); errbuf = NULL; } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAsetdimscale2 | | | | DESCRIPTION: Defines a dimension scale for a fields dimension in a ZA | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t ZA structure ID | | fieldname char field name | | dimname char Dimension name | | dimsize hsize_t Dimemsion size value | | numbertype_in hid_t dim scale data type such as DFNT_INT32, | | DFNT_FLOAT64, DFNT_FLOAT32, etc. | | data void data buffer for write | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | May 10 Abe Taaheri Original Programmer | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAsetdimscale2(hid_t zaID, char *fieldname, char *dimname, char *dimscalename, const hsize_t dimsize, hid_t numbertype_in, void * data) { herr_t status; hid_t ntype; hsize_t dims[HE5_DTSETRANKMAX]; int rankSDS; hid_t field_ntype[1] = {FAIL}; /* number types */ char dimlist[HE5_HDFE_DIMBUFSIZE]; char maxdimlist[HE5_HDFE_DIMBUFSIZE]; hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t did; /* Field dataset id */ hid_t dsid; /* Dimscale dataset id */ hid_t fspace = FAIL; /* File dataspace ID */ unsigned int Dimindex; hid_t dsplist = FAIL; /* Property list ID */ H5D_layout_t layout = H5D_LAYOUT_ERROR; /* Type of storage */ hid_t data_space = FAIL; /* dataspace ID */ long idx = FAIL; /* Za index */ char *errbuf = (char *)NULL; /* buffer for error message*/ void *data_buff; int i, found; int rankds; hsize_t dimsds[1]; HE5_LOCK; CHECKNAME(fieldname); CHECKNAME(dimname); /* Allocate memory for error buffer */ /* -------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_ZAsetdimscale2", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer ", __FILE__, __LINE__); return(FAIL); } /* Convert HDF-EOS5 datatype to HDF5 datatype */ if ( H5Tequal(numbertype_in, H5T_NATIVE_CHAR) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_SCHAR) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_UCHAR) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_SHORT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_USHORT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_INT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_UINT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_LONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_ULONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_LLONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_ULLONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_FLOAT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_DOUBLE) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_LDOUBLE)== TRUE || H5Tequal(numbertype_in, H5T_C_S1) == TRUE) { ntype = numbertype_in; } else { ntype = HE5_EHconvdatatype((int) numbertype_in); } if(ntype == FAIL) { sprintf(errbuf,"Cannot convert to HDF5 type data type ID for dimscale\n"); H5Epush(__FILE__, "HE5_ZAsetdimscale2", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* ********************************************************** * Check for proper ZA ID and return HDF-EOS file ID, * * "HDFEOS" group ID and ZA index * ********************************************************** */ status = HE5_ZAchkzaid(zaID, "HE5_ZAsetdimscale2", &fid, &gid, &idx); if(status == FAIL) { sprintf(errbuf,"Checking for ZA ID failed.\n"); H5Epush(__FILE__, "HE5_ZAsetdimscale2", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } if (status == 0) { /* Check that field exists */ /* ----------------------- */ status = HE5_ZAinfo(zaID, fieldname, &rankSDS, dims, field_ntype, dimlist, maxdimlist); if (status != 0) { sprintf(errbuf, "Fieldname \"%s\" does not exist.\n", fieldname); H5Epush(__FILE__, "HE5_ZAsetdimscale2", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } data_buff = data; /* Loop through all datasets in ZA */ /* ------------------------------ */ for (i = 0; i < HE5_ZAXZa[idx].nDFLD; i++) { /* Get dataset name */ if( strcmp(fieldname, HE5_ZAXZa[ idx ].ddataset[ i ].name) == 0 ) { found = 1; did = HE5_ZAXZa[ idx ].ddataset[ i ].ID; break; } } if(found != 1) /* did not find fieldname */ { sprintf(errbuf, "Fieldname \"%s\" does not exist.\n", fieldname); H5Epush(__FILE__, "HE5_ZAsetdimscale2", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Dimension index */ Dimindex = FAIL; Dimindex = HE5_EHstrwithin(dimname, dimlist, ','); if (Dimindex == FAIL) /* dimension not found */ { status = FAIL; sprintf( errbuf, "Dimname \"%s\" does not exist for field \"%s\".\n", dimname, fieldname ); H5Epush(__FILE__, "HE5_ZAsetdimscale2", __LINE__, H5E_IO, H5E_SEEKERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } /* If dimension found ... */ /* Found the dimname; Use its dimid to set Dimension Scale*/ /* See if dimscale dataset already exist */ dsid = H5Dopen(HE5_ZAXZa[idx].za_id, dimscalename); if(dsid < 0) { /* create Dim Scale dataset */ /* Try to open the " group */ /* =================================== */ dsplist = H5Pcreate(H5P_DATASET_CREATE); if(dsplist == FAIL) { sprintf(errbuf,"Cannot create a new property list.\n"); H5Epush(__FILE__, "HE5_ZAsetdimscale2", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Get layout information */ /* ---------------------- */ layout = H5Pget_layout(dsplist); if(layout == H5D_LAYOUT_ERROR) { sprintf(errbuf,"Cannot get layout information for the dataset.\n"); H5Epush(__FILE__, "HE5_ZAsetdimscale2", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } rankds = 1; /*dimsds[0] = dims[Dimindex];*/ dimsds[0] = dimsize; data_space = H5Screate_simple(rankds, dimsds, NULL); if(data_space == FAIL) { sprintf(errbuf,"Cannot create dataspace for the dimension scale dataset.\n"); H5Epush(__FILE__, "HE5_ZAsetdimscale2", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } dsid = H5Dcreate(HE5_ZAXZa[idx].za_id,dimscalename,ntype, data_space, dsplist); if( dsid == FAIL ) { sprintf(errbuf, "Cannot create dataset for Dimension Scale \"%s\" field. \n", dimscalename); H5Epush(__FILE__, "HE5_ZAsetdimscale2", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* write data_buff to it */ /* Get the field space ID */ /* --------------------- */ fspace = H5Dget_space(dsid); if ( fspace == FAIL) { sprintf(errbuf, "Cannot get the file data space ID.\n"); H5Epush(__FILE__, "HE5_ZAsetdimscale2", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } status = H5Dwrite(dsid, ntype, data_space, fspace, H5P_DEFAULT, data_buff); if( status == FAIL ) { sprintf(errbuf,"Cannot write data to the dataset.\n"); H5Epush(__FILE__, "HE5_ZAsetdimscale2", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } } /* Dataset exist. See if it is Dimension Scale already. If not make it */ if ((H5DSis_scale(dsid)) <= 0 ) { status = H5DSset_scale(dsid, dimscalename); if( status < 0) { status = -1; free(errbuf); goto COMPLETION; } if(H5DSattach_scale(did, dsid, Dimindex) < 0) { status = -1; free(errbuf); goto COMPLETION; } } else { if(H5DSattach_scale(did, dsid, Dimindex) < 0) { status = -1; free(errbuf); goto COMPLETION; } } /* set dimscale name as dimlabel in DIMENSION_LABELS attribute for this field */ if(HE5_ZAsetflddimlabel(zaID, fieldname, dimname, dimscalename) < 0) { status = -1; free(errbuf); goto COMPLETION; } if( H5Dclose(dsid) < 0) { status = -1; free(errbuf); goto COMPLETION; } } free(errbuf); COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAgetdimscale | | | | DESCRIPTION: Get dimension scale for a dimension of a field in a ZA | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status long return databuffsize SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t ZA structure ID | | fieldname char field name | | dimname char dim name | | | | | | OUTPUTS: | | dimsize hsize_t dimension size | | ntype hid_t dtata type of dimension scale | | databuff void data buffer for read | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | May 10 Abe Taaheri Original Programmer | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_ZAgetdimscale(hid_t zaID, char *fieldname, char *dimname, hsize_t *dimsize,hid_t *ntype, void * databuff) { int i,j; /* Loop index */ long status; /* routine return status */ long idx = FAIL; /* ZA index */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t did = FAIL; /* dataset ID */ hid_t dsid = FAIL; /* dimscale dataset ID */ hid_t dspace = FAIL; /* data space ID */ hid_t mspace = FAIL; /* memory data space ID */ hid_t dtype = FAIL; /* data type ID */ hid_t mtype = FAIL; /* memory data type ID */ H5T_class_t classid = H5T_NO_CLASS; /* Data type class ID */ hsize_t dimsds[HE5_DTSETRANKMAX]; /* Field dimensions */ char *errbuf = (char *)NULL; /* buff for error message */ long size = 0; /* data buffer size(bytes)*/ int rankds; size_t sd_type_size = 0; /* Size of a data type */ unsigned int Dimindex; int rankSDS; hid_t *field_ntype = (hid_t *)NULL; /* number types */ char dimlist[HE5_HDFE_DIMBUFSIZE]; char maxdimlist[HE5_HDFE_DIMBUFSIZE]; hsize_t dims[HE5_DTSETRANKMAX]; int found = 0; htri_t str_is_variable; /* boolean: TRUE if string is variable lengeth FALSE if string is fixed length -1 if error in H5Tis_variavle_str() */ HE5_LOCK; CHECKNAME(fieldname); CHECKNAME(dimname); /* Allocate memory for error buffer */ /* -------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* ********************************************************** * Check for proper ZA ID and return HDF-EOS file ID, * * "HDFEOS" group ID and ZA index * ********************************************************** */ status = HE5_ZAchkzaid(zaID, "HE5_ZAgetdimscale", &fid, &gid, &idx); if(status == FAIL) { sprintf(errbuf,"Checking for ZA ID failed.\n"); H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* See if dimscale dataset exist */ dsid = H5Dopen(HE5_ZAXZa[idx].za_id, dimname); if(dsid < 0) { status = FAIL; sprintf( errbuf, "Dimension scale dataset \"%s\" does not exist.\n", dimname); H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_IO, H5E_SEEKERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } /* Loop through all datasets in ZA */ /* ------------------------------ */ for (i = 0; i < HE5_ZAXZa[idx].nDFLD; i++) { /* Get dataset name */ if( strcmp(fieldname, HE5_ZAXZa[ idx ].ddataset[ i ].name) == 0 ) { found = 1; did = HE5_ZAXZa[ idx ].ddataset[ i ].ID; break; } } if(found != 1) /* did not find fieldname */ { sprintf(errbuf, "Fieldname \"%s\" does not exist.\n", fieldname); H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Check that field exists */ /* ----------------------- */ status = HE5_ZAinfo(zaID, fieldname, &rankSDS, dims, field_ntype, dimlist, maxdimlist); if (status != 0) { sprintf(errbuf, "Fieldname \"%s\" does not exist.\n", fieldname); H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* find the index of the dimension in the field */ Dimindex = FAIL; Dimindex = HE5_EHstrwithin(dimname, dimlist, ','); if (Dimindex == FAIL) /* dimension not found */ { status = FAIL; sprintf( errbuf, "Dimname \"%s\" does not exist for field \"%s\".\n", dimname, fieldname ); H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_IO, H5E_SEEKERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } /* check that dimname is dimension scale name for the field dimname */ status = H5DSis_attached(did, dsid, Dimindex); if( status < 0) { status = FAIL; sprintf( errbuf, "Dimname \"%s\" is not dimension scale for a dimension in the field \"%s\".\n", dimname, fieldname ); H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_IO, H5E_SEEKERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } /* OK. dsid is a dimension scale for did. It is time to read Dimension Scale dataset for output */ /* get size first ... */ /* ------------------ */ dtype = H5Dget_type(dsid); if ( dtype == FAIL ) { size = 0; sprintf(errbuf, "Cannot get data type ID.\n"); H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Get data type size (bytes) */ /* -------------------------- */ sd_type_size = H5Tget_size(dtype); if ( sd_type_size == 0 ) { sprintf(errbuf, "Cannot retrieve data type size.\n"); H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Get data space ID */ /* ----------------- */ dspace = H5Dget_space( dsid ); if (dspace == FAIL) { sprintf(errbuf, "Cannot get the dataspace ID for the \"%s\" dataset.\n", dimname); H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Get dataset rank */ /* ---------------- */ rankds = H5Sget_simple_extent_ndims(dspace); if ( rankds == FAIL ) { sprintf(errbuf, "Cannot get the dataset rank for the \"%s\" dataset.\n", dimname); H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Get dataset dimension sizes */ /* --------------------------- */ status = H5Sget_simple_extent_dims(dspace,dimsds, NULL); if ( status == FAIL ) { sprintf(errbuf, "Cannot get the dataset dimension sizes for the \"%s\" dataset.\n", dimname); H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } /*----------------------------------------------------------------------*/ /* Get data class ID */ /* ----------------- */ classid = H5Tget_class(dtype); if (classid == H5T_NO_CLASS) { sprintf(errbuf, "Cannot get the data type class ID for \"%s\" dataset.", dimname); H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (errbuf != NULL) free(errbuf); return(FAIL); } if (classid == H5T_STRING) { /* HE5T_CHARSTRING has variable length for data fields */ str_is_variable = H5Tis_variable_str(dtype); if(str_is_variable == TRUE) { *ntype = HE5T_CHARSTRING; } else if(str_is_variable == FALSE) { *ntype = HE5T_NATIVE_CHAR; } else { sprintf(errbuf, "Failed to see if string field is varaible or fixed length for the \"%s\" field.\n",dimname); H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (errbuf != NULL) free(errbuf); return(FAIL); } } else { *ntype = HE5_EHdtype2numtype(dtype); if (*ntype == FAIL) { sprintf(errbuf, "Cannot get the number type for \"%s\" dataset.", dimname); H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (errbuf != NULL) free(errbuf); return(FAIL); } } /*----------------------------------------------------------------------*/ status = H5Tclose(dtype); if ( status == FAIL ) { sprintf(errbuf,"Cannot release the datatype ID.\n"); H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Release the dataspace ID */ /* ------------------------ */ status = H5Sclose(dspace); if ( status == FAIL) { sprintf(errbuf, "Cannot release the dataset ID for the \"%s\" dataset.\n", dimname); H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(status); } size = (long)dimsds[ 0 ]; *dimsize = (hsize_t)size; for (j = 1; j < rankds; j++) size *= (long)dimsds[j]; size *= (long)sd_type_size; /* If data values are requested ... */ /* -------------------------------- */ if (databuff != NULL) { /* Create a data space in memory */ /* ----------------------------- */ mspace = H5Screate_simple(rankds, (const hsize_t *)dimsds, NULL); if ( mspace == FAIL ) { sprintf(errbuf,"Cannot create the data space.\n"); H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_DATASPACE, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } dspace = H5Dget_space(dsid ); if (dspace == FAIL) { sprintf(errbuf, "Cannot get the dataspace ID for the \"%s\" dataset.\n", dimname); H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } dtype = H5Dget_type(dsid); if ( dtype == FAIL ) { sprintf(errbuf,"Cannot get the datatype ID.\n"); H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Get the memory data type ID */ /* --------------------------- */ mtype = HE5_EHdtype2mtype(dtype); if ( mtype == FAIL ) { sprintf(errbuf,"Cannot get the memory data type.\n"); H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Read the selected points into the buffer */ /* --------------------------------------- */ status = H5Dread(dsid, mtype, mspace, dspace, H5P_DEFAULT, databuff); if ( status == FAIL ) { sprintf(errbuf,"Cannot read out the data from the dataset.\n"); H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } status = H5Tclose(dtype); if ( status == FAIL ) { sprintf(errbuf,"Cannot release the datatype ID.\n"); H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } status = H5Sclose(mspace); if ( status == FAIL ) { sprintf(errbuf,"Cannot release the memory data space ID.\n"); H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } status = H5Sclose(dspace); if ( status == FAIL ) { sprintf(errbuf,"Cannot release the file data space ID.\n"); H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } } free(errbuf); COMPLETION: HE5_UNLOCK; return (size); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAreaddscaleattr | | | | DESCRIPTION: Reads attribute associated with a dimension scale field | | from a ZA. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t None HDF-EOS type ZA ID | | fieldname char field name | | attrname char attribute name | | | | OUTPUTS: | | datbuf void I/O buffer | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jun 10 Abe Taaheri Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAreaddscaleattr(hid_t zaID, const char *fieldname, const char *attrname, void *datbuf) { herr_t status = FAIL;/* routine return status variable */ hid_t ntype = FAIL;/* hdf5 type data type ID */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t fieldID = FAIL;/* Field-related dataset ID */ long idx = FAIL;/* ZA index */ hsize_t count[]={0}; /* array with the number of elements */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ HE5_LOCK; CHECKPOINTER(fieldname); CHECKPOINTER(attrname); /* ********************************************************** * Check for proper ZA ID and return HDF-EOS file ID, * * "HDFEOS" group ID and ZA index * ********************************************************** */ status = HE5_ZAchkzaid(zaID, "HE5_ZAreaddscaleattr", &fid, &gid, &idx); if (status == SUCCEED) { /* Get field ID */ /* ------------ */ fieldID = H5Dopen(HE5_ZAXZa[idx].za_id, fieldname); if(fieldID == FAIL) { sprintf(errbuf,"Cannot open the \"%s\" field dataset ID.\n", fieldname); H5Epush(__FILE__, "HE5_ZAreaddscaleattr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Call EHattr to perform I/O */ /* -------------------------- */ status = HE5_EHattr(fieldID, attrname, ntype, count, "r", datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot read Attribute \"%s\" associated wth the \"%s\" field.\n", attrname,fieldname); H5Epush(__FILE__, "HE5_ZAreaddscaleattr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release dataset ID */ /* ------------------ */ status = H5Dclose(fieldID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"%s\" field dataset ID.\n", fieldname); H5Epush(__FILE__, "HE5_ZAreaddscaleattr", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAwritedscaleattr | | | | DESCRIPTION: Writes/updates attribute associated with a dimension scale | | field in a ZA. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t ZA structure ID | | fieldname char* dimension scale SDS name | | attrname char* attribute name | | numtype hid_t attribute datatype ID | | count[] hsize_t Number of attribute elements | | datbuf void I/O buffer | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | May 10 Abe Taaheri Original development. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAwritedscaleattr(hid_t zaID, const char *fieldname, const char *attrname, hid_t numtype, hsize_t count[], void *datbuf) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t fieldID = FAIL;/* Field-related dataset ID */ long idx = FAIL;/* ZA index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ hid_t ntype; HE5_LOCK; CHECKPOINTER(fieldname); CHECKNAME(attrname); CHECKPOINTER(count); CHECKPOINTER(datbuf); /* if numtype is HE5 numbertype, rather than H5 numbertype, then convert it, otherwise use ntype itself */ ntype = HE5_EHconvdatatype(numtype); if(ntype == FAIL) { ntype = numtype; } /* ********************************************************** * Check for proper ZA ID and return HDF-EOS file ID, * * "HDFEOS" group ID and ZA index * ********************************************************** */ status = HE5_ZAchkzaid(zaID, "HE5_ZAwritedscaleattr", &fid, &gid, &idx); if (status == SUCCEED) { /* Get field ID */ /* ------------ */ fieldID = H5Dopen(HE5_ZAXZa[idx].za_id, fieldname); if(fieldID == FAIL) { sprintf(errbuf,"Cannot open the \"%s\" field dataset ID.\n", fieldname); H5Epush(__FILE__, "HE5_ZAwritedscaleattr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Call EHattr to perform I/O */ /* -------------------------- */ status = HE5_EHattr(fieldID, attrname, ntype, count,"w", datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot write Attribute \"%s\" for the \"%s\" field.\n", attrname, fieldname); H5Epush(__FILE__, "HE5_ZAwritedscaleattr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Dclose(fieldID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"%s\" field dataset ID.\n", fieldname); H5Epush(__FILE__, "HE5_ZAwritedscaleattr", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAdscaleattrinfo | | | | DESCRIPTION: Retrieves information about dimension scale attribute | | (attribute associated with a specified dimension scale field) | | in a ZA. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t None HDF-EOS type ZA ID | | fieldname char* field name | | attrname char* attribute name | | | | OUTPUTS: | | ntype hid_t attribute data type ID | | count hsize_t Number of attribute elements | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | May 10 Abe Taaheri Original Development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAdscaleattrinfo(hid_t zaID, const char *fieldname, const char *attrname, hid_t *ntype, hsize_t *count) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t fieldID = FAIL;/* Field-related dataset ID */ long idx = FAIL;/* ZA index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ CHECKPOINTER(fieldname); CHECKPOINTER(attrname); /* ********************************************************** * Check for proper ZA ID and return HDF-EOS file ID, * * "HDFEOS" group ID and ZA index * ********************************************************** */ status = HE5_ZAchkzaid(zaID, "HE5_ZAdscaleattrinfo", &fid, &gid, &idx); if (status == SUCCEED) { /* Get field ID */ /* ------------ */ fieldID = H5Dopen(HE5_ZAXZa[idx].za_id, fieldname); if(fieldID == FAIL) { sprintf(errbuf,"Cannot open the \"%s\" field dataset ID.\n", fieldname); H5Epush(__FILE__, "HE5_ZAdscaleattrinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Call EHattrinfo */ /* --------------- */ if(strcmp(attrname,"REFERENCE_LIST") !=0)/* do not need ntype for internal dimension scale attribute */ { status = HE5_EHattrinfo(fieldID, attrname, ntype, count); if(status == FAIL) { sprintf(errbuf,"Cannot retrieve information about Attribute \"%s\" associated with the \"%s\" field.\n", attrname, fieldname); H5Epush(__FILE__, "HE5_ZAdscaleattrinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { status = -1; *ntype = -1; *count = 0; sprintf(errbuf,"Will not retrieve information about internal Attribute \"%s\" associated with the dimension scale \"%s\" .\n", attrname, fieldname); H5Epush(__FILE__, "HE5_ZAdscaleattrinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Dclose(fieldID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"%s\" field dataset ID.\n", fieldname); H5Epush(__FILE__, "HE5_ZAdscaleattrinfo", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAdscaleattrinfo2 | | | | DESCRIPTION: Retrieves information about dimension scale attribute | | (attribute associated with a specified dimension scale field) | | in a ZA. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t None HDF-EOS type ZA ID | | fieldname char* field name | | attrname char* attribute name | | | | OUTPUTS: | | ntype hid_t attribute data type ID | | count hsize_t Number of attribute elements | | size hsize_t buf size of attribute elements | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | May 10 Abe Taaheri Original Development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAdscaleattrinfo2(hid_t zaID, const char *fieldname, const char *attrname, hid_t *ntype, hsize_t *count, hsize_t *size) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t fieldID = FAIL;/* Field-related dataset ID */ long idx = FAIL;/* ZA index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ CHECKPOINTER(fieldname); CHECKPOINTER(attrname); /* ********************************************************** * Check for proper ZA ID and return HDF-EOS file ID, * * "HDFEOS" group ID and ZA index * ********************************************************** */ status = HE5_ZAchkzaid(zaID, "HE5_ZAdscaleattrinfo", &fid, &gid, &idx); if (status == SUCCEED) { /* Get field ID */ /* ------------ */ fieldID = H5Dopen(HE5_ZAXZa[idx].za_id, fieldname); if(fieldID == FAIL) { sprintf(errbuf,"Cannot open the \"%s\" field dataset ID.\n", fieldname); H5Epush(__FILE__, "HE5_ZAdscaleattrinfo2", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Call EHattrinfo */ /* --------------- */ if(strcmp(attrname,"REFERENCE_LIST") !=0)/* do not need ntype for internal dimension scale attribute */ { status = HE5_EHattrinfo2(fieldID, attrname, ntype, count, size); if(status == FAIL) { sprintf(errbuf,"Cannot retrieve information about Attribute \"%s\" associated with the \"%s\" field.\n", attrname, fieldname); H5Epush(__FILE__, "HE5_ZAdscaleattrinfo2", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { status = -1; *ntype = -1; *count = 0; sprintf(errbuf,"Will not retrieve information about internal Attribute \"%s\" associated with the dimension scale \"%s\" .\n", attrname, fieldname); H5Epush(__FILE__, "HE5_ZAdscaleattrinfo2", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Dclose(fieldID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"%s\" field dataset ID.\n", fieldname); H5Epush(__FILE__, "HE5_ZAdscaleattrinfo2", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAinqdscaleattrs | | | | DESCRIPTION: Retrieves the number of attributes and string length of | | attribute list associated with a specified dimension scale | | in a ZA. | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nattr long number of attributes (-1 if fails) | | | | INPUTS: | | zaID hid_t None HDF-EOS type ZA ID | | fieldname char dimension scale name | | attrnames char attribute name(s) | | | | OUTPUTS: | | strbufsize long String length of attribute (in bytes) | | | | NOTES: | | | | None | | | | Date Programmer Description | | ====== ============ ================================================= | | June 10 Abe Taaheri Original development. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_ZAinqdscaleattrs(hid_t zaID, const char *fieldname, char *attrnames, long *strbufsize) { long nattr = 0; /* Number of attributes (return) */ long idx = FAIL;/* Za index */ herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ char *dtsname = NULL;/* Buffer for dataset name */ char errbuf[HE5_HDFE_ERRBUFSIZE]; CHECKPOINTER(fieldname); /* ********************************************************** * Check for proper ZA ID and return HDF-EOS file ID, * * "HDFEOS" group ID and Za index * ********************************************************** */ status = HE5_ZAchkzaid(zaID, "HE5_ZAinqdscaleattrs", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf,"Checking for ZA ID failed.\n" ); H5Epush(__FILE__, "HE5_ZAinqdscaleattrs", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } dtsname = (char *) calloc(HE5_HDFE_NAMBUFSIZE, 1); if( dtsname == NULL) { sprintf(errbuf, "Can not allocate memory.\n"); H5Epush(__FILE__, "HE5_ZAinqdscaleattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } strcpy(dtsname,"/HDFEOS/ZAS/"); strcat(dtsname, HE5_ZAXZa[idx].zaname); strcat(dtsname,"/"); strcat(dtsname,fieldname); nattr = HE5_EHattrcat(fid, dtsname, attrnames, strbufsize); if (dtsname != NULL) free(dtsname); COMPLETION: return(nattr); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAdiminfo | | | | DESCRIPTION: Returns size in bytes of named dimension | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | size hsize_t size of dimension | | | | INPUTS: | | zaID hid_t ZA structure ID | | dimname char* dimension name | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ hsize_t HE5_ZAdiminfo(hid_t zaID, char *dimname) { hsize_t size = 0; /* Dimension size (return value) */ herr_t status = FAIL;/* status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ long idx = FAIL;/* za index */ char *metabuf=(char *)NULL; /* Ptr to StrucMetadata (SM) */ char *metaptrs[2]={NULL,NULL}; /* Ptrs to the start/end of SM */ char utlstr[HE5_HDFE_UTLBUFSIZE];/* Utility string buffer */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAdiminfo", &fid, &gid, &idx); if (status == SUCCEED) { /* Get pointers to "Dimension" section within SM */ /* --------------------------------------------- */ metabuf = (char *)HE5_EHmetagroup(fid, HE5_ZAXZa[idx].zaname, "z", "Dimension", metaptrs); /* Search for dimension name (surrounded by quotes) */ /* ------------------------------------------------ */ sprintf(utlstr, "%s%s%s", "\"", dimname, "\"\n"); metaptrs[0] = strstr(metaptrs[0], utlstr); /* * If dimension found within za structure then get dimension value */ if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL) { /* Set "end" ptr at the end of dimension definition entry */ /* ------------------------------------------------------ */ metaptrs[1] = strstr(metaptrs[0], "\t\t\tEND_OBJECT"); /* Get the value of "Size" entry */ /* ----------------------------- */ status = HE5_EHgetmetavalue(metaptrs, "Size", utlstr); if (status == SUCCEED) { size = atol(utlstr); if (size == 0) { sprintf(errbuf, "Returning zero \"Size\" value from Metadata.\n"); H5Epush(__FILE__, "HE5_ZAdiminfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } else { sprintf(errbuf, "The \"Size\" string not found in metadata. \n"); H5Epush(__FILE__, "HE5_ZAdiminfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } else { sprintf(errbuf, "The Dimension \"%s\" not found in metadata. \n", dimname); H5Epush(__FILE__, "HE5_ZAdiminfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } if (metabuf != NULL) free(metabuf); } return(size); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAcompinfo | | | | DESCRIPTION: Retrieves compression information about a field | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None Return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t ZA structure ID | | fldname char* field name | | compcode int* compression code | | compparm int compression parameters | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAcompinfo(hid_t zaID, char *fldname, int *compcode, int compparm[]) { herr_t status = FAIL; /* Return status variable */ herr_t statmeta = FAIL; /* Status variable */ int i; /* Loop Index */ int nameflag = FAIL; /* Name flag (0-alias,1-actual)*/ int fldgroup = FAIL; /* Field group flag */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ long idx = FAIL; /* za index */ char fieldname[HE5_HDFE_NAMBUFSIZE]; /* Field name buffer */ char fldactualname[HE5_HDFE_NAMBUFSIZE];/* Actual name of a field */ char *metabuf = (char *)NULL; /* Pntr to StrucMetadata (SM) */ char *metaptrs[2]={NULL,NULL}; /* Ptrs to the start/end of SM */ char *utlstr = (char *)NULL; /* Utility string buffer */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ char *HDFcomp[18] = {"HE5_HDFE_COMP_NONE", "HE5_HDFE_COMP_RLE", "HE5_HDFE_COMP_NBIT", "HE5_HDFE_COMP_SKPHUFF", "HE5_HDFE_COMP_DEFLATE", "HE5_HDFE_COMP_SZIP_CHIP", "HE5_HDFE_COMP_SZIP_K13", "HE5_HDFE_COMP_SZIP_EC", "HE5_HDFE_COMP_SZIP_NN", "HE5_HDFE_COMP_SZIP_K13orEC", "HE5_HDFE_COMP_SZIP_K13orNN", "HE5_HDFE_COMP_SHUF_DEFLATE", "HE5_HDFE_COMP_SHUF_SZIP_CHIP", "HE5_HDFE_COMP_SHUF_SZIP_K13", "HE5_HDFE_COMP_SHUF_SZIP_EC", "HE5_HDFE_COMP_SHUF_SZIP_NN", "HE5_HDFE_COMP_SHUF_SZIP_K13orEC", "HE5_HDFE_COMP_SHUF_SZIP_K13orNN"}; /* Compression method Codes */ CHECKPOINTER(fldname); /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAcompinfo", &fid, &gid, &idx); if (status == SUCCEED) { /* Allocate space for utility string */ /* --------------------------------- */ utlstr = (char *)calloc(HE5_HDFE_DIMBUFSIZE, sizeof(char)); if ( utlstr == NULL ) { sprintf( errbuf,"Cannot allocate memory for utility string.\n"); H5Epush(__FILE__, "HE5_ZAcompinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Call HE5_ZAfldnameinfo() to get actual field name */ /* ------------------------------------------------- */ nameflag = HE5_ZAfldnameinfo(zaID, fldname, fldactualname); if ( nameflag == FAIL ) { sprintf(errbuf, "Cannot get the actual name of the field.\n"); H5Epush(__FILE__, "HE5_ZAcompinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (utlstr != NULL) free(utlstr); return(FAIL); } /* If fieldname is alias, then change it to the actual name */ /* -------------------------------------------------------- */ if (nameflag == FALSE) { strcpy(fieldname,""); strcpy(fieldname,fldactualname); } if (nameflag == TRUE) { strcpy(fieldname,""); strcpy(fieldname,fldname); } /* Get the field group code */ /* ------------------------ */ fldgroup = HE5_ZAfldsrch(zaID,fieldname,NULL,NULL,NULL,NULL); if (fldgroup == HE5_HDFE_DATAGROUP) { /* Get pointers to "DataField" section within SM */ /* --------------------------------------------- */ metabuf = (char *)HE5_EHmetagroup(fid, HE5_ZAXZa[idx].zaname, "z", "DataField", metaptrs); /* Search for field */ /* ---------------- */ sprintf(utlstr, "%s%s%s", "\"", fieldname, "\"\n"); metaptrs[0] = strstr(metaptrs[0], utlstr); } else { sprintf(errbuf , "Cannot get the field group code.\n"); H5Epush(__FILE__, "HE5_ZAcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (metabuf != NULL) free(metabuf); if (utlstr != NULL) free(utlstr); return(FAIL); } /* If field found and user wants compression code ... */ /* -------------------------------------------------- */ if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL) { if (compcode != NULL) { /* Set endptr at end of field's definition entry */ /* --------------------------------------------- */ metaptrs[1] = strstr(metaptrs[0], "\t\t\tEND_OBJECT"); /* Get compression type */ /* -------------------- */ statmeta = HE5_EHgetmetavalue(metaptrs, "CompressionType", utlstr); /* * Default is no compression if "CompressionType" string not * in metadata */ *compcode = HE5_HDFE_COMP_NONE; /* If compression code is found ... */ /* -------------------------------- */ if (statmeta == SUCCEED) { /* Loop through compression types until match */ /* ------------------------------------------ */ for (i = 0; i < 11; i++) { if (strcmp(utlstr, HDFcomp[i]) == 0) { *compcode = i; break; } } } } /* If user wants compression parameters ... */ /* ---------------------------------------- */ if (compparm != NULL && compcode != NULL) { /* Initialize to zero */ /* ------------------ */ for (i = 0; i < 5; i++) compparm[i] = 0; /* Get compression parameters */ /* -------------------------- */ if (*compcode == HE5_HDFE_COMP_NBIT) { statmeta = HE5_EHgetmetavalue(metaptrs, "CompressionParams", utlstr); if (statmeta == SUCCEED) { sscanf(utlstr, "(%d,%d,%d,%d)", &compparm[0], &compparm[1], &compparm[2], &compparm[3]); } else { status = FAIL; sprintf( errbuf,"\"CompressionParams\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_ZAcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } else if (*compcode == HE5_HDFE_COMP_DEFLATE) { statmeta = HE5_EHgetmetavalue(metaptrs, "DeflateLevel", utlstr); if (statmeta == SUCCEED) { sscanf(utlstr, "%d", &compparm[0]); } else { status = FAIL; sprintf( errbuf,"The \"DeflateLevel\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_ZAcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } else if (*compcode == HE5_HDFE_COMP_SZIP_CHIP) { statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr); if (statmeta == SUCCEED) { sscanf(utlstr, "%d", &compparm[0]); } else { status = FAIL; sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_ZAcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } else if (*compcode == HE5_HDFE_COMP_SZIP_K13) { statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr); if (statmeta == SUCCEED) { sscanf(utlstr, "%d", &compparm[0]); } else { status = FAIL; sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_ZAcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } else if (*compcode == HE5_HDFE_COMP_SZIP_EC) { statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr); if (statmeta == SUCCEED) { sscanf(utlstr, "%d", &compparm[0]); } else { status = FAIL; sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_ZAcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } else if (*compcode == HE5_HDFE_COMP_SZIP_NN) { statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr); if (statmeta == SUCCEED) { sscanf(utlstr, "%d", &compparm[0]); } else { status = FAIL; sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_ZAcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } else if (*compcode == HE5_HDFE_COMP_SZIP_K13orEC) { statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr); if (statmeta == SUCCEED) { sscanf(utlstr, "%d", &compparm[0]); } else { status = FAIL; sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_ZAcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } else if (*compcode == HE5_HDFE_COMP_SZIP_K13orNN) { statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr); if (statmeta == SUCCEED) { sscanf(utlstr, "%d", &compparm[0]); } else { status = FAIL; sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n" ); H5Epush(__FILE__, "HE5_ZAcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } else if (*compcode == HE5_HDFE_COMP_SHUF_DEFLATE) { statmeta = HE5_EHgetmetavalue(metaptrs, "DeflateLevel", utlstr); if (statmeta == SUCCEED) { sscanf(utlstr, "%d", &compparm[0]); } else { status = FAIL; sprintf( errbuf,"The \"DeflateLevel\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_ZAcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } else if (*compcode == HE5_HDFE_COMP_SHUF_SZIP_CHIP) { statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr); if (statmeta == SUCCEED) { sscanf(utlstr, "%d", &compparm[0]); } else { status = FAIL; sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_ZAcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } else if (*compcode == HE5_HDFE_COMP_SHUF_SZIP_K13) { statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr); if (statmeta == SUCCEED) { sscanf(utlstr, "%d", &compparm[0]); } else { status = FAIL; sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_ZAcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } else if (*compcode == HE5_HDFE_COMP_SHUF_SZIP_EC) { statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr); if (statmeta == SUCCEED) { sscanf(utlstr, "%d", &compparm[0]); } else { status = FAIL; sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_ZAcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } else if (*compcode == HE5_HDFE_COMP_SHUF_SZIP_NN) { statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr); if (statmeta == SUCCEED) { sscanf(utlstr, "%d", &compparm[0]); } else { status = FAIL; sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_ZAcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } else if (*compcode == HE5_HDFE_COMP_SHUF_SZIP_K13orEC) { statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr); if (statmeta == SUCCEED) { sscanf(utlstr, "%d", &compparm[0]); } else { status = FAIL; sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_ZAcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } else if (*compcode == HE5_HDFE_COMP_SHUF_SZIP_K13orNN) { statmeta = HE5_EHgetmetavalue(metaptrs, "BlockSize", utlstr); if (statmeta == SUCCEED) { sscanf(utlstr, "%d", &compparm[0]); } else { status = FAIL; sprintf( errbuf,"The \"BlockSize\" string not found in metadata.\n"); H5Epush(__FILE__, "HE5_ZAcompinfo", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } } } if (metabuf != NULL) free(metabuf); if (utlstr != NULL) free(utlstr); } COMPLETION: return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAfldnameinfo | | | | DESCRIPTION: Retrieves actual name of the field | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nameFlag int None return (1) actual name, (0) alias, | | (-1) FAIL | | INPUTS: | | zaID hid_t ZA structure ID | | fieldname char* name of field | | | | OUTPUTS: | | actualname char* field actual name | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ static int HE5_ZAfldnameinfo(hid_t zaID, char *fieldname, char *actualname) { int nameFlag = FAIL;/* Return value of flag */ int length = 0; /* String length */ int fldgroup = FAIL;/* Field group code */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t groupID = FAIL;/* data field group ID */ long idx = FAIL;/* za index */ H5G_stat_t *statbuf = (H5G_stat_t *)NULL;/* buffer for link info */ herr_t status = FAIL;/* routine return status variable */ char *namebuf = NULL;/* Buffer for an actual field name */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ CHECKPOINTER(fieldname); /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAfldnameinfo", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for za ID failed.\n"); H5Epush(__FILE__, "HE5_ZAfldnameinfo", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } statbuf = (H5G_stat_t *)calloc(1, sizeof(H5G_stat_t )); /* Try to get information about specified field */ /* -------------------------------------------- */ H5E_BEGIN_TRY { groupID = HE5_ZAXZa[idx].data_id; fldgroup = HE5_HDFE_DATAGROUP; status = H5Gget_objinfo(groupID, fieldname, 0, statbuf); } H5E_END_TRY; if (status == FAIL) { nameFlag = FAIL; sprintf(errbuf, "Cannot find \"%s\" field.\n", fieldname); H5Epush(__FILE__, "HE5_ZAfldnameinfo", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(statbuf); return(nameFlag); } /* If the field name is an alias */ /* ----------------------------- */ if (statbuf->type == H5G_LINK) nameFlag = FALSE; else nameFlag = TRUE; if (nameFlag == FALSE) { if (actualname != NULL) { status = HE5_ZAaliasinfo(zaID, fldgroup, fieldname, &length, NULL); if ( status == FAIL ) { sprintf(errbuf, "Cannot get information about alias \"%s\".\n", fieldname); H5Epush(__FILE__, "HE5_ZAfldnameinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } namebuf = (char *)calloc(length, sizeof(char)); if ( namebuf == NULL ) { sprintf(errbuf, "Cannot allocate memory for namebuf.\n"); H5Epush(__FILE__, "HE5_ZAfldnameinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Retrieve information about alias */ /* -------------------------------- */ status = HE5_ZAaliasinfo(zaID, fldgroup, fieldname, &length, namebuf); if ( status == FAIL ) { sprintf(errbuf, "Cannot get information about alias \"%s\".\n", fieldname); H5Epush(__FILE__, "HE5_ZAfldnameinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(namebuf); return(FAIL); } strcpy(actualname,""); strcpy(actualname,namebuf); free(namebuf); } } if (nameFlag == TRUE) { if (actualname != NULL) { strcpy(actualname,""); strcpy(actualname, fieldname); } } free(statbuf); COMPLETION: return(nameFlag); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAfldinfo | | | | DESCRIPTION: Retrieves information about specified ZA structure | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t ZA structure ID | | datafield char* data field | | za_name char* name of a specific ZA data set | | | | OUTPUTS: | | rank int* rank of ZA data set | | dims hsize_t array of dimension sizes | | numbertype hid_t number type | | dimlist char* dimension list | | maxdimlist char* maximum dimension list | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | Oct 03 S.ZHAO Added the H5Tclose(datatype) call. | | Jan 04 S.Zhao Modified to enable a character string dataset. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ static herr_t HE5_ZAfldinfo(hid_t zaID, char *datafield, char *za_name, int *rank, hsize_t dims[], hid_t numbertype[], char *dimlist, char *maxdimlist) { herr_t status = FAIL;/* routine return status variable */ herr_t statmeta = FAIL;/* EHgetmetavalue return status */ herr_t Dstatus = FAIL;/* Status for H5Dclose */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t dspace = FAIL;/* "fieldname" Dataspace ID */ hid_t fieldID = FAIL;/* "fieldname" Dataset ID */ hid_t groupid = FAIL;/* group ID */ hid_t datasetid = FAIL;/* dataset ID */ hid_t datatype = FAIL;/* data type ID */ H5T_class_t classid = H5T_NO_CLASS;/* data type class ID */ long ndims = 0; /* Number of dimensions */ long idx = FAIL;/* Index of a za */ long i = 0; /* Loop index */ size_t slen[HE5_DTSETRANKMAX]; /* Length of each entry in parsed string */ char *metabuf = (char *)NULL; /* Ptr to structural metadata (SM) */ char *metaptrs[2] = {NULL, NULL}; /* Ptrs to the begining and end of SM */ char utlstr[HE5_HDFE_UTLBUFSIZE]; /* Utility string */ char *ptr[HE5_DTSETRANKMAX]; /* String pointers for parsed string */ char dimstr[HE5_HDFE_DIMBUFSIZE]; /* Individual dimension entry string */ char maxdimstr[HE5_HDFE_DIMBUFSIZE]; /* Individual max. dimension entry string */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ htri_t str_is_variable; /* boolean: TRUE if string is variable lengeth FALSE if string is fixed length -1 if error in H5Tis_variavle_str() */ CHECKPOINTER(datafield); CHECKPOINTER(za_name); /* Initialize rank to FAIL (error) */ /* ------------------------------- */ *rank = FAIL; /* Initialize slen[] array */ /* ----------------------- */ for ( i = 0; i < HE5_DTSETRANKMAX; i++) slen[i] = 0; /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAfldinfo", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for za ID failed.\n"); H5Epush(__FILE__, "HE5_ZAfldinfo", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Reset status to FAIL */ /* -------------------- */ status = FAIL; /* Get pointers to appropriate "Field" section within SM */ /* ----------------------------------------------------- */ metabuf = (char *)HE5_EHmetagroup(fid, HE5_ZAXZa[idx].zaname, "z", "DataField", metaptrs); if ( metabuf == NULL ) { status = FAIL; sprintf(errbuf, "Cannot get pointer to metabuf.\n"); H5Epush(__FILE__, "HE5_ZAfldinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } sprintf(utlstr, "%s%s%s", "\"", za_name, "\"\n"); metaptrs[0] = strstr(metaptrs[0], utlstr); /* If field is found in "Data Fields" group */ /* ---------------------------------------- */ if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL) { /* Get DataType string */ /* ------------------- */ statmeta = HE5_EHgetmetavalue(metaptrs, "DataType", utlstr); /* Convert to data type class ID */ /* ----------------------------- */ if (statmeta == SUCCEED) { groupid = HE5_ZAXZa[idx].data_id; /* Open the field dataset */ /* ---------------------- */ datasetid = H5Dopen(groupid, za_name); if (datasetid == FAIL) { status = FAIL; sprintf(errbuf, "Cannot open the dataset for the \"%s\" field.\n",za_name); H5Epush(__FILE__, "HE5_ZAfldinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); if (metabuf != NULL) free(metabuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get the data type ID */ /* -------------------- */ datatype = H5Dget_type(datasetid); if (datatype == FAIL) { status = FAIL; sprintf(errbuf, "Cannot get the data type for the \"%s\" field.\n",za_name); H5Epush(__FILE__, "HE5_ZAfldinfo", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); if (metabuf != NULL) free(metabuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get the data type class ID */ /* -------------------------- */ classid = H5Tget_class(datatype); if (classid == H5T_NO_CLASS) { status = FAIL; sprintf(errbuf, "Cannot get the data type class ID for the \"%s\" field.\n",za_name); H5Epush(__FILE__, "HE5_ZAfldinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); if (metabuf != NULL) free(metabuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } if (classid == H5T_STRING) { /* HE5T_CHARSTRING has variable length for data fields */ str_is_variable = H5Tis_variable_str(datatype); if(str_is_variable == TRUE) { numbertype[0] = HE5T_CHARSTRING; } else if(str_is_variable == FALSE) { numbertype[0] = HE5T_NATIVE_CHAR; } else { status = FAIL; sprintf(errbuf, "Failed to see if string field is varaible or fixed length for the \"%s\" field.\n",za_name); H5Epush(__FILE__, "HE5_ZAfldinfo", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (metabuf != NULL) free(metabuf); return(status); } /*HE5_ZAgetstringtype(zaID, fieldname,classid);*/ /*numbertype[0] = HE5T_CHARSTRING;*/ } else { numbertype[0] = HE5_EHdtype2numtype(datatype); if (numbertype[0] == FAIL) { status = FAIL; sprintf(errbuf, "Cannot get the number type for the \"%s\" field.\n",za_name); H5Epush(__FILE__, "HE5_ZAfldinfo", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); if (metabuf != NULL) free(metabuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } /* Release the datatype ID */ /* ----------------------- */ status = H5Tclose(datatype); if (status == FAIL) { sprintf(errbuf, "Cannot release the datatype ID for the \"%s\" field.\n",za_name); H5Epush(__FILE__, "HE5_ZAfldinfo", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); if (metabuf != NULL) free(metabuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release the dataset ID */ /* ---------------------- */ Dstatus = H5Dclose(datasetid); if (Dstatus == FAIL) { status = FAIL; sprintf(errbuf, "Cannot release the dataset ID for the \"%s\" field.\n",za_name); H5Epush(__FILE__, "HE5_ZAfldinfo", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); if (metabuf != NULL) free(metabuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { status = FAIL; sprintf(errbuf, "The \"DataType\" string not found in metadata. \n"); H5Epush(__FILE__, "HE5_ZAfldinfo", __LINE__, H5E_DATASET, H5E_SEEKERROR, errbuf); if (metabuf != NULL) free(metabuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get "DimList" string, trim off "(" and ")" */ /* ------------------------------------------ */ statmeta = HE5_EHgetmetavalue(metaptrs, "DimList", utlstr); if (statmeta == SUCCEED) { memmove(utlstr, utlstr + 1, strlen(utlstr) - 2); utlstr[strlen(utlstr) - 2] = 0; /* Parse trimmed "DimList" string and get rank */ /* ------------------------------------------- */ ndims = HE5_EHparsestr(utlstr, ',', ptr, slen); *rank = HE5_EHlong2int(ndims); if (*rank == FAIL) { sprintf(errbuf, "Cannot convert from \"long\" to \"int\" data type. \n"); H5Epush(__FILE__, "HE5_ZAfldinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); if (metabuf != NULL) free(metabuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } else { status = FAIL; sprintf(errbuf, "The \"DimList\" string not found in metadata. \n"); H5Epush(__FILE__, "HE5_ZAfldinfo", __LINE__, H5E_DATASET, H5E_SEEKERROR, errbuf); if (metabuf != NULL) free(metabuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* If "DimList" IS REQUESTED ... */ /* ----------------------------- */ if (dimlist != NULL) { strcpy(dimstr,""); strcpy(dimlist,""); /* * Copy each entry in DimList and remove leading and trailing quotes. * Get dimension sizes and concatenate dimension names to dimension list. */ for (i = 0; i < ndims; i++) { memmove(dimstr, ptr[i] + 1, slen[i] - 2); dimstr[slen[i] - 2] = 0; if (i > 0) { strcat(dimlist,","); } strcat(dimlist, dimstr); } } /* If "MaxdimList" IS REQUESTED ... */ /* -------------------------------------- */ if(maxdimlist != NULL) { strcpy(utlstr,""); statmeta = HE5_EHgetmetavalue(metaptrs,"MaxdimList", utlstr); if (statmeta == SUCCEED) { memmove(utlstr, utlstr + 1, strlen(utlstr) - 2); utlstr[strlen(utlstr) - 2] = 0; ndims = HE5_EHparsestr(utlstr,',', ptr, slen); } else { status = FAIL; sprintf(errbuf, "The \"MaxdimList\" string not found in metadata. \n"); H5Epush(__FILE__, "HE5_ZAfldinfo", __LINE__, H5E_DATASET, H5E_SEEKERROR, errbuf); if (metabuf != NULL) free(metabuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } strcpy(maxdimstr,""); strcpy(maxdimlist,""); for (i = 0; i < ndims; i++) { memmove(maxdimstr, ptr[i] + 1, slen[i] - 2); maxdimstr[slen[i] - 2] = 0; if (maxdimlist != NULL) { if (i > 0) { strcat(maxdimlist,","); } strcat(maxdimlist, maxdimstr); } } } /* Get field ID */ /* ------------ */ HE5_ZAfieldsizeID( zaID, za_name, &fieldID); /* Get the data space ID */ /* --------------------- */ dspace = H5Dget_space( fieldID ); if(dspace == FAIL) { status = FAIL; sprintf(errbuf, "Cannot get the data space ID.\n"); H5Epush(__FILE__, "HE5_ZAfldinfo", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf); if (metabuf != NULL) free(metabuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get the dataset rank */ /* -------------------- */ *rank = H5Sget_simple_extent_ndims(dspace); if( *rank == FAIL) { status = FAIL; sprintf(errbuf, "Cannot get the rank of the dataset.\n"); H5Epush(__FILE__, "HE5_ZAfldinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); if (metabuf != NULL) free(metabuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get the dataset dimension sizes */ /* ------------------------------- */ status = H5Sget_simple_extent_dims(dspace, dims, NULL); if( status == FAIL) { sprintf(errbuf, "Cannot get the dimension array of the dataset.\n"); H5Epush(__FILE__, "HE5_ZAfldinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); if (metabuf != NULL) free(metabuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release the data space ID */ /* ------------------------- */ status = H5Sclose(dspace); if( status == FAIL) { sprintf(errbuf, "Cannot release the data space ID.\n"); H5Epush(__FILE__, "HE5_ZAfldinfo", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); if (metabuf != NULL) free(metabuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } if (metabuf != NULL) free(metabuf); COMPLETION: return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAinfo | | | | DESCRIPTION: Wrapper around HE5_ZAfldinfo | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t ZA structure ID | | za_name char* za name | | | | | | OUTPUTS: | | rank int* rank of field (# of dims) | | dims hsize_t field dimensions | | dtype hid_t data type ID | | dimlist char* field dimension list | | maxdimlist char* field maximum dimension list | | | | | | NOTES: | | | | | | Date Programmer Description | | ========= ============ ================================================ | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAinfo(hid_t zaID, char *za_name, int *rank, hsize_t dims[], hid_t dtype[], char *dimlist, char *maxdimlist) { herr_t status = FAIL;/* routine return status variable */ int nameflag = FAIL;/* Actual(1)/Alias(0) field name */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ long idx = FAIL;/* za index */ char fieldname[HE5_HDFE_NAMBUFSIZE]; /* field name buffer */ char fldactualname[HE5_HDFE_NAMBUFSIZE];/* Actual field name */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ CHECKPOINTER(za_name); /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAinfo", &fid, &gid, &idx); if (status == SUCCEED) { /* Call HE5_ZAfldnameinfo() to get actual field name */ /* ------------------------------------------------- */ nameflag = HE5_ZAfldnameinfo(zaID, za_name, fldactualname); if ( nameflag == FAIL ) { sprintf(errbuf, "Cannot get actual name of the field.\n"); H5Epush(__FILE__, "HE5_ZAinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Name is not alias */ /* ----------------- */ if (nameflag == TRUE) { strcpy(fieldname,""); strcpy(fieldname,za_name); } /* Name is alias */ /* ------------- */ if (nameflag == FALSE) { strcpy(fieldname,""); strcpy(fieldname,fldactualname); } /* Check for field within Data Fields */ /* ---------------------------------- */ status = HE5_ZAfldinfo(zaID, "Data Fields", fieldname, rank, dims, dtype, dimlist, maxdimlist); /* If not there either then can't be found */ /* --------------------------------------- */ if (status == FAIL) { sprintf(errbuf,"Field \"%s\" not found. Check out the field name. \n", fieldname); H5Epush(__FILE__, "HE5_ZAinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAdefchunk | | | | DESCRIPTION: Defines size of chunk used to store a chunked layout dataset | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t ZA structure ID | | rank int rank of a dataset | | dim const hsize_t* pointer to the array containing sizes | | of each dimension of a chunk | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ========= ============ ============================================== | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAdefchunk(hid_t zaID, int rank, const hsize_t *dim) { herr_t status = FAIL;/* Return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ long idx = FAIL;/* za index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKPOINTER(dim); /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAdefchunk", &fid, &gid, &idx); if (status == SUCCEED) { /* get the current dataset creation property ID from external array */ /* if current property instance has not been created, then create it */ if( HE5_ZAXZa[idx].plist == FAIL){ HE5_ZAXZa[idx].plist = H5Pcreate(H5P_DATASET_CREATE); if (HE5_ZAXZa[idx].plist == FAIL){ sprintf(errbuf, "Cannot create the property list. \n"); H5Epush(__FILE__, "HE5_ZAdefchunk", __LINE__, H5E_PLIST, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } /* Set layout */ /* ---------- */ status = H5Pset_layout( HE5_ZAXZa[idx].plist, H5D_CHUNKED); if (status == FAIL) { sprintf(errbuf, "Cannot set the \"CHUNKED\" type of storage. \n"); H5Epush(__FILE__, "HE5_ZAdefchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Set chunking */ /* ------------ */ status = H5Pset_chunk( HE5_ZAXZa[idx].plist, rank, dim); if (status == FAIL) { sprintf(errbuf, "Cannot set the sizes of chunks. \n"); H5Epush(__FILE__, "HE5_ZAdefchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAdefcomp | | | | DESCRIPTION: Defines compression type and parameters | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t ZA structure ID | | compcode int compression code | | compparm int* compression parameters | | | | OUTPUTS: | | None | | | | NOTES: Before calling this function, storage must be CHUNKED | | Values of compression code | | HDFE_COMP_NONE 0 | | HDFE_COMP_RLE 1 | | HDFE_COMP_NBIT 2 | | HDFE_COMP_SKPHUFF 3 | | HDFE_COMP_DEFLATE 4 | | HDFE_COMP_SZIP_EC 5 | | HDFE_COMP_SZIP_NN 6 | | HDFE_COMP_SZIP_K13 7 | | HDFE_COMP_SZIP_CHIP 8 | | HDFE_COMP_SZIP_K13orEC 9 | | HDFE_COMP_SZIP_K13orNN 10 | | HDFE_COMP_SHUF_DEFLATE 11 | | HDFE_COMP_SHUF_SZIP_CHIP 12 | | HDFE_COMP_SHUF_SZIP_K13 13 | | HDFE_COMP_SHUF_SZIP_EC 14 | | HDFE_COMP_SHUF_SZIP_NN 15 | | HDFE_COMP_SHUF_SZIP_K13orEC 16 | | HDFE_COMP_SHUF_SZIP_K13orNN 17 | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | Aug 03 S.Zhao Added Szip compression methods. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAdefcomp(hid_t zaID, int compcode, int *compparm) { herr_t status = FAIL; /* routine return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ long idx = FAIL; /* za index */ H5D_layout_t layout = H5D_LAYOUT_ERROR; /* Storage layout type */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ int can_encode = 0; /* szip encoder presence flag */ HE5_LOCK; CHECKPOINTER(compparm); /* Check if compression code is valid */ /* ---------------------------------- */ if( compcode != HE5_HDFE_COMP_DEFLATE && compcode != HE5_HDFE_COMP_NONE && compcode != HE5_HDFE_COMP_SZIP_CHIP && compcode != HE5_HDFE_COMP_SZIP_K13 && compcode != HE5_HDFE_COMP_SZIP_EC && compcode != HE5_HDFE_COMP_SZIP_NN && compcode != HE5_HDFE_COMP_SZIP_K13orEC && compcode != HE5_HDFE_COMP_SZIP_K13orNN && compcode != HE5_HDFE_COMP_SHUF_DEFLATE && compcode != HE5_HDFE_COMP_SHUF_SZIP_CHIP && compcode != HE5_HDFE_COMP_SHUF_SZIP_K13 && compcode != HE5_HDFE_COMP_SHUF_SZIP_EC && compcode != HE5_HDFE_COMP_SHUF_SZIP_NN && compcode != HE5_HDFE_COMP_SHUF_SZIP_K13orEC && compcode != HE5_HDFE_COMP_SHUF_SZIP_K13orNN ) { status = FAIL; sprintf(errbuf,"Invalid/unsupported compression code. \n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } if( compcode == HE5_HDFE_COMP_DEFLATE || compcode == HE5_HDFE_COMP_NONE || compcode == HE5_HDFE_COMP_SHUF_DEFLATE) { /* Check GZIP compression level */ /* ---------------------------- */ if( compparm[0] < 0 || compparm[0] > 9) { status = FAIL; sprintf(errbuf,"Invalid GZIP compression level. \n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { /* Check SZIP compression block size */ /* --------------------------------- */ if( compparm[0] != 2 && compparm[0] != 4 && compparm[0] != 6 && compparm[0] != 8 && compparm[0] != 10 && compparm[0] != 12 && compparm[0] != 14 && compparm[0] != 16 && compparm[0] != 18 && compparm[0] != 20 && compparm[0] != 22 && compparm[0] != 24 && compparm[0] != 26 && compparm[0] != 28 && compparm[0] != 30 && compparm[0] != 32) { status = FAIL; sprintf(errbuf,"Invalid SZIP compression block size. \n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } #ifdef H5_HAVE_FILTER_SZIP can_encode = HE5_szip_can_encode(); #endif /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAdefcomp", &fid, &gid, &idx); if (status == SUCCEED) { /* If the current property list is not set up */ /* ------------------------------------------ */ if( HE5_ZAXZa[idx].plist == FAIL) { status = FAIL; sprintf(errbuf,"Unable to compress, dataset storage layout has not been set to CHUNKED. \n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_PLIST, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } else { layout = H5Pget_layout(HE5_ZAXZa[idx].plist); if (layout == H5D_LAYOUT_ERROR) { status = FAIL; sprintf(errbuf, "Cannot get the layout of the raw data. \n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_PLIST, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } if( layout != H5D_CHUNKED ) status = H5Pset_layout(HE5_ZAXZa[idx].plist, H5D_CHUNKED); if (status == FAIL) { sprintf(errbuf, "Cannot set the \"CHUNKED\" type of storage of the raw data. \n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } switch (compcode) { /* Set NBIT compression parameters in compression external array */ /* ------------------------------------------------------------- */ case HE5_HDFE_COMP_NBIT: HE5_ZAXZa[idx].compparm[0] = compparm[0]; HE5_ZAXZa[idx].compparm[1] = compparm[1]; HE5_ZAXZa[idx].compparm[2] = compparm[2]; HE5_ZAXZa[idx].compparm[3] = compparm[3]; break; case HE5_HDFE_COMP_DEFLATE: /* ------------------------------------------------- */ /* Set compression method to H5D_COMPRESS_DEFLATE */ /* and compression level to "compparm[0]" */ /* ------------------------------------------------- */ status = H5Pset_deflate(HE5_ZAXZa[idx].plist, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set GZIP compresssion method and level. \n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* ------------------------------------------------- */ /* Set GZIP compression method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_ZAXZa[idx].compcode = compcode; HE5_ZAXZa[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SZIP_CHIP: #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_CHIP_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_CHIP compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set SZIP_CHIP compression method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_ZAXZa[idx].compcode = compcode; HE5_ZAXZa[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SZIP_K13: #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_K13 compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set SZIP_K13 compression method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_ZAXZa[idx].compcode = compcode; HE5_ZAXZa[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SZIP_EC: #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_EC_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_EC compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set SZIP_EC compression method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_ZAXZa[idx].compcode = compcode; HE5_ZAXZa[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SZIP_NN: #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_NN_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_NN compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set SZIP_NN compression method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_ZAXZa[idx].compcode = compcode; HE5_ZAXZa[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SZIP_K13orEC: #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_EC_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_K13orEC compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set SZIP_K13orEC compression method and */ /* compression parameters in external array */ /* ------------------------------------------------- */ HE5_ZAXZa[idx].compcode = compcode; HE5_ZAXZa[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SZIP_K13orNN: #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_K13orNN compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set SZIP_K13orNN compression method and */ /* compression parameters in external array */ /* ------------------------------------------------- */ HE5_ZAXZa[idx].compcode = compcode; HE5_ZAXZa[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SHUF_DEFLATE: status = H5Pset_shuffle(HE5_ZAXZa[idx].plist); if (status == FAIL) { sprintf(errbuf, "Cannot set the shuffling method. \n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Pset_deflate(HE5_ZAXZa[idx].plist, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set GZIP compresssion method and level. \n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* ------------------------------------------------- */ /* Set shuffling+GZIP method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_ZAXZa[idx].compcode = compcode; HE5_ZAXZa[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SHUF_SZIP_CHIP: status = H5Pset_shuffle(HE5_ZAXZa[idx].plist); if (status == FAIL) { sprintf(errbuf, "Cannot set the shuffling method. \n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_CHIP_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_CHIP compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set shuffling+SZIP_CHIP method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_ZAXZa[idx].compcode = compcode; HE5_ZAXZa[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SHUF_SZIP_K13: status = H5Pset_shuffle(HE5_ZAXZa[idx].plist); if (status == FAIL) { sprintf(errbuf, "Cannot set the shuffling method. \n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_K13 compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set shuffling+SZIP_K13 method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_ZAXZa[idx].compcode = compcode; HE5_ZAXZa[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SHUF_SZIP_EC: status = H5Pset_shuffle(HE5_ZAXZa[idx].plist); if (status == FAIL) { sprintf(errbuf, "Cannot set the shuffling method. \n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_EC_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_EC compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set shuffling+SZIP_EC method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_ZAXZa[idx].compcode = compcode; HE5_ZAXZa[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SHUF_SZIP_NN: status = H5Pset_shuffle(HE5_ZAXZa[idx].plist); if (status == FAIL) { sprintf(errbuf, "Cannot set the shuffling method. \n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_NN_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_NN compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set shuffling+SZIP_NN method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_ZAXZa[idx].compcode = compcode; HE5_ZAXZa[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SHUF_SZIP_K13orEC: status = H5Pset_shuffle(HE5_ZAXZa[idx].plist); if (status == FAIL) { sprintf(errbuf, "Cannot set the shuffling method. \n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_EC_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_K13orEC compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set shuffling+SZIP_K13orEC method and */ /* compression parameters in external array */ /* ------------------------------------------------- */ HE5_ZAXZa[idx].compcode = compcode; HE5_ZAXZa[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SHUF_SZIP_K13orNN: status = H5Pset_shuffle(HE5_ZAXZa[idx].plist); if (status == FAIL) { sprintf(errbuf, "Cannot set the shuffling method. \n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_K13orNN compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set shuffling+SZIP_K13orNN method and */ /* compression parameters in external array */ /* ------------------------------------------------- */ HE5_ZAXZa[idx].compcode = compcode; HE5_ZAXZa[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_NONE: HE5_ZAXZa[idx].compparm[0] = compparm[0]; break; default: { status = FAIL; sprintf(errbuf, "Invalid compression method \"%d\" . \n", compcode); H5Epush(__FILE__, "HE5_ZAdefcomp", __LINE__, H5E_ARGS, H5E_UNSUPPORTED, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } break; } } } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAdefcomchunk | | | | DESCRIPTION: Defines compression type and parameters and sets chunking | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t ZA structure ID | | compcode int compression code | | compparm int* compression parameters | | rank int rank of a dataset | | dim const hsize_t* pointer to the array containing sizes | | of each dimension of a chunk | | OUTPUTS: | | None | | | | NOTES: Before calling this function, storage must be CHUNKED | | Values of compression code | | HDFE_COMP_NONE 0 | | HDFE_COMP_RLE 1 | | HDFE_COMP_NBIT 2 | | HDFE_COMP_SKPHUFF 3 | | HDFE_COMP_DEFLATE 4 | | HDFE_COMP_SZIP_EC 5 | | HDFE_COMP_SZIP_NN 6 | | HDFE_COMP_SZIP_K13 7 | | HDFE_COMP_SZIP_CHIP 8 | | HDFE_COMP_SZIP_K13orEC 9 | | HDFE_COMP_SZIP_K13orNN 10 | | HDFE_COMP_SHUF_DEFLATE 11 | | HDFE_COMP_SHUF_SZIP_CHIP 12 | | HDFE_COMP_SHUF_SZIP_K13 13 | | HDFE_COMP_SHUF_SZIP_EC 14 | | HDFE_COMP_SHUF_SZIP_NN 15 | | HDFE_COMP_SHUF_SZIP_K13orEC 16 | | HDFE_COMP_SHUF_SZIP_K13orNN 17 | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | Aug 03 S.Zhao Added Szip compression methods. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAdefcomchunk(hid_t zaID, int compcode, int *compparm, int rank, const hsize_t *dim) { herr_t status = FAIL; /* Return status variable */ int i = 0; /* Loop index */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hsize_t dims[HE5_DTSETRANKMAX]; /* Default dim. sizes */ long idx = FAIL; /* za index */ H5D_layout_t layout = H5D_LAYOUT_ERROR; /* Storage layout type */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ int can_encode; /* szip encoder presence flag */ HE5_LOCK; CHECKPOINTER(compparm); CHECKPOINTER(dim); /* Check if compression code is valid */ /* ---------------------------------- */ if( compcode != HE5_HDFE_COMP_DEFLATE && compcode != HE5_HDFE_COMP_NONE && compcode != HE5_HDFE_COMP_SZIP_CHIP && compcode != HE5_HDFE_COMP_SZIP_K13 && compcode != HE5_HDFE_COMP_SZIP_EC && compcode != HE5_HDFE_COMP_SZIP_NN && compcode != HE5_HDFE_COMP_SZIP_K13orEC && compcode != HE5_HDFE_COMP_SZIP_K13orNN && compcode != HE5_HDFE_COMP_SHUF_DEFLATE && compcode != HE5_HDFE_COMP_SHUF_SZIP_CHIP && compcode != HE5_HDFE_COMP_SHUF_SZIP_K13 && compcode != HE5_HDFE_COMP_SHUF_SZIP_EC && compcode != HE5_HDFE_COMP_SHUF_SZIP_NN && compcode != HE5_HDFE_COMP_SHUF_SZIP_K13orEC && compcode != HE5_HDFE_COMP_SHUF_SZIP_K13orNN) { status = FAIL; sprintf(errbuf, "Invalid/unsupported compression code. \n"); H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } if( compcode == HE5_HDFE_COMP_DEFLATE || compcode == HE5_HDFE_COMP_NONE || compcode == HE5_HDFE_COMP_SHUF_DEFLATE) { /* Check GZIP compression level */ /* ---------------------------- */ if( compparm[0] < 0 || compparm[0] > 9) { status = FAIL; sprintf(errbuf,"Invalid GZIP compression level. \n"); H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { /* Check SZIP compression block size */ /* --------------------------------- */ if( compparm[0] != 2 && compparm[0] != 4 && compparm[0] != 6 && compparm[0] != 8 && compparm[0] != 10 && compparm[0] != 12 && compparm[0] != 14 && compparm[0] != 16 && compparm[0] != 18 && compparm[0] != 20 && compparm[0] != 22 && compparm[0] != 24 && compparm[0] != 26 && compparm[0] != 28 && compparm[0] != 30 && compparm[0] != 32) { status = FAIL; sprintf(errbuf,"Invalid SZIP compression block size. \n"); H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } #ifdef H5_HAVE_FILTER_SZIP can_encode = HE5_szip_can_encode(); #endif /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAdefcomchunk", &fid, &gid, &idx); if (status == SUCCEED) { /* Initialize dims[] array */ /* ----------------------- */ for (i = 0; i < HE5_DTSETRANKMAX; i++) dims[i] = 0; /* get the current dataset creation property ID from external array */ /* ----------------------------------------------------------------- */ if(HE5_ZAXZa[idx].plist == FAIL) { /* create property list */ /* -------------------- */ HE5_ZAXZa[idx].plist = H5Pcreate(H5P_DATASET_CREATE); /* set layout to "H5D_CHUNKED" */ /* --------------------------- */ status = H5Pset_layout(HE5_ZAXZa[idx].plist, H5D_CHUNKED); if (status == FAIL) { sprintf(errbuf, "Cannot set the \"CHUNKED\" type of storage. \n"); H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_STORAGE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { /* Get layout of the raw data */ /* -------------------------- */ layout = H5Pget_layout(HE5_ZAXZa[idx].plist); if (layout == H5D_LAYOUT_ERROR) { status = FAIL; sprintf(errbuf, "Cannot get the layout of the raw data. \n"); H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_STORAGE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } if( layout != H5D_CHUNKED ) { /* set layout to "H5D_CHUNKED" */ /* --------------------------- */ status = H5Pset_layout( HE5_ZAXZa[idx].plist, H5D_CHUNKED); if (status == FAIL) { sprintf(errbuf, "Cannot set the \"CHUNKED\" type of storage. \n"); H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_STORAGE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } } /* set chunking */ /* ------------ */ if ( rank > 0 && dim != (hsize_t *)NULL) { status = H5Pset_chunk(HE5_ZAXZa[idx].plist, rank, dim); if (status == FAIL) { sprintf(errbuf, "Cannot set the sizes of chunks. \n"); H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else if ( rank > 0 && dim == (hsize_t *)NULL) { /* Set default chunk sizes */ /* ----------------------- */ for (i = 0; i < rank; i++) dims[ i ] = HE5_CHUNKSIZE; status = H5Pset_chunk(HE5_ZAXZa[idx].plist, rank, dims); if (status == FAIL) { sprintf(errbuf, "Cannot set the sizes of chunks. \n"); H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Invalid dataset rank,\"%d\" . \n", rank); H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } switch (compcode) { /* Set NBIT compression parameters in compression external array */ /* ------------------------------------------------------------- */ case HE5_HDFE_COMP_NBIT: HE5_ZAXZa[idx].compparm[0] = compparm[0]; HE5_ZAXZa[idx].compparm[1] = compparm[1]; HE5_ZAXZa[idx].compparm[2] = compparm[2]; HE5_ZAXZa[idx].compparm[3] = compparm[3]; break; case HE5_HDFE_COMP_DEFLATE: /* ------------------------------------------------- */ /* Set compression method to H5D_COMPRESS_DEFLATE */ /* and compression level to "compparm[0]" */ /* ------------------------------------------------- */ status = H5Pset_deflate(HE5_ZAXZa[idx].plist, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set GZIP compresssion method and level. \n"); H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* ------------------------------------------------- */ /* Set GZIP compression method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_ZAXZa[idx].compcode = compcode; HE5_ZAXZa[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SZIP_CHIP: #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_CHIP_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_CHIP compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_ZAdefcompchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set SZIP_CHIP compression method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_ZAXZa[idx].compcode = compcode; HE5_ZAXZa[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SZIP_K13: #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_K13 compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_ZAdefcompchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set SZIP_K13 compression method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_ZAXZa[idx].compcode = compcode; HE5_ZAXZa[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SZIP_EC: #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_EC_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_EC compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_ZAdefcompchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set SZIP_EC compression method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_ZAXZa[idx].compcode = compcode; HE5_ZAXZa[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SZIP_NN: #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_NN_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_NN compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_ZAdefcompchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set SZIP_NN compression method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_ZAXZa[idx].compcode = compcode; HE5_ZAXZa[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SZIP_K13orEC: #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_EC_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_K13orEC compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_ZAdefcompchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set SZIP_K13orEC compression method and */ /* compression parameters in external array */ /* ------------------------------------------------- */ HE5_ZAXZa[idx].compcode = compcode; HE5_ZAXZa[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SZIP_K13orNN: #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_K13orNN compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_ZAdefcompchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set SZIP_K13orNN compression method and */ /* compression parameters in external array */ /* ------------------------------------------------- */ HE5_ZAXZa[idx].compcode = compcode; HE5_ZAXZa[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SHUF_DEFLATE: status = H5Pset_shuffle(HE5_ZAXZa[idx].plist); if (status == FAIL) { sprintf(errbuf, "Cannot set the shuffling method. \n"); H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Pset_deflate(HE5_ZAXZa[idx].plist, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set GZIP compresssion method and level. \n"); H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* ------------------------------------------------- */ /* Set shuffling+GZIP method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_ZAXZa[idx].compcode = compcode; HE5_ZAXZa[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SHUF_SZIP_CHIP: status = H5Pset_shuffle(HE5_ZAXZa[idx].plist); if (status == FAIL) { sprintf(errbuf, "Cannot set the shuffling method. \n"); H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_CHIP_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_CHIP compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_ZAdefcompchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set shuffling+SZIP_CHIP method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_ZAXZa[idx].compcode = compcode; HE5_ZAXZa[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SHUF_SZIP_K13: status = H5Pset_shuffle(HE5_ZAXZa[idx].plist); if (status == FAIL) { sprintf(errbuf, "Cannot set the shuffling method. \n"); H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_K13 compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_ZAdefcompchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set shuffling+SZIP_K13 method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_ZAXZa[idx].compcode = compcode; HE5_ZAXZa[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SHUF_SZIP_EC: status = H5Pset_shuffle(HE5_ZAXZa[idx].plist); if (status == FAIL) { sprintf(errbuf, "Cannot set the shuffling method. \n"); H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_EC_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_EC compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_ZAdefcompchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set shuffling+SZIP_EC method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_ZAXZa[idx].compcode = compcode; HE5_ZAXZa[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SHUF_SZIP_NN: status = H5Pset_shuffle(HE5_ZAXZa[idx].plist); if (status == FAIL) { sprintf(errbuf, "Cannot set the shuffling method. \n"); H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_NN_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_NN compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_ZAdefcompchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set shuffling+SZIP_NN method and compression */ /* parameters in external array */ /* ------------------------------------------------- */ HE5_ZAXZa[idx].compcode = compcode; HE5_ZAXZa[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SHUF_SZIP_K13orEC: status = H5Pset_shuffle(HE5_ZAXZa[idx].plist); if (status == FAIL) { sprintf(errbuf, "Cannot set the shuffling method. \n"); H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_EC_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_K13orEC compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_ZAdefcompchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set shuffling+SZIP_K13orEC method and */ /* compression parameters in external array */ /* ------------------------------------------------- */ HE5_ZAXZa[idx].compcode = compcode; HE5_ZAXZa[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_SHUF_SZIP_K13orNN: status = H5Pset_shuffle(HE5_ZAXZa[idx].plist); if (status == FAIL) { sprintf(errbuf, "Cannot set the shuffling method. \n"); H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } #ifdef H5_HAVE_FILTER_SZIP if(can_encode == 1) { status = H5Pset_szip(HE5_ZAXZa[idx].plist, H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK, compparm[0]); if (status == FAIL) { sprintf(errbuf, "Cannot set SZIP_K13orNN compresssion method and block size. \n"); H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { sprintf(errbuf, "Szip does not have encoder; szip compression won't apply to datafields.\n"); H5Epush(__FILE__, "HE5_ZAdefcompchunk", __LINE__, H5E_RESOURCE, H5E_CANTENCODE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } #endif /* ------------------------------------------------- */ /* Set shuffling+SZIP_K13orNN method and */ /* compression parameters in external array */ /* ------------------------------------------------- */ HE5_ZAXZa[idx].compcode = compcode; HE5_ZAXZa[idx].compparm[0] = compparm[0]; break; case HE5_HDFE_COMP_NONE: status = H5Pset_shuffle(HE5_ZAXZa[idx].plist); if (status == FAIL) { sprintf(errbuf, "Cannot set the shuffling method. \n"); H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } HE5_ZAXZa[idx].compparm[0] = compparm[0]; break; default: { status = FAIL; sprintf(errbuf, "Invalid (unsupported) compression method \"%d\". \n", compcode); H5Epush(__FILE__, "HE5_ZAdefcomchunk", __LINE__, H5E_ARGS, H5E_UNSUPPORTED, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } break; } } COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAdefinefield | | | | DESCRIPTION: Defines data field within ZA structure | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t ZA structure ID | | datafield char* data field | | za_name const char* za name | | dimlist char* Dimension (comma-separated)list | | maxdimlist char* Maximum Dimension (comma-separated) list| | numbertype hid_t field data type ID | | | | OUTPUTS: | | None | | | | NOTES: H5S_UNLIMITED is -1, not 0 => unlimited extendiable dimention | | size = -1. | | If maxdimlist = NULL, then dimlist string is copied to the | | maxdimlist string, and corresponding information is written to | | the metadata section. | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | Jan 04 S.Zhao Added to create a character string dataset. | | Mar 04 S.Zhao Modified for a character string dataset. | | Apr 04 S.Zhao Modified for a character string dataset. | | May 05 S.Zhao Added HE5_EHdtype2numtype() function call. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ static herr_t HE5_ZAdefinefield(hid_t zaID, char *datafield, const char *za_name, char *dimlist, char *maxdimlist, hid_t numbertype_in) { herr_t status = FAIL; /* Return status variable */ int i = 0; /* Loop index */ int foundAllDim = 1; /* found all dimensions flag */ int append = FALSE;/* "Is field appendable?" flag */ int first = 1; /* first entry flag */ int compcode = FAIL; /* Compression code */ int rank = 0; /* Field rank */ int maxrank = 0; /* max dim rank */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t data_space = FAIL;/* dataspace ID */ hid_t dataset = FAIL;/* dataset ID */ hid_t heos_gid = FAIL;/* "ZAS" group ID */ hid_t ntype = FAIL;/* Number type ID */ hid_t numtype = FAIL; hid_t numbertype; hsize_t metavalue = 0; /* Metavalue to insert */ hsize_t dims[HE5_DTSETRANKMAX]; /* Dimension size array */ hsize_t maxdims[HE5_DTSETRANKMAX];/* Dimension size array */ hsize_t dimsize = 0; /* Dimension size */ hsize_t count[] = { 1 }; /* number of elements to insert */ long idx = FAIL; /* za index */ H5D_layout_t layout = H5D_LAYOUT_ERROR; /* Storage layout for raw data */ void *value; size_t tsize = 0; /* Size of a datatype in bytes */ int attr = 0; /* attribute value */ char *dimbuf = (char *)NULL; /* Dimension buffer */ char *comma = (char *)NULL; /* Pointer to comma */ char *dimcheck = (char *)NULL; /* Dimension check buffer */ char utlbuf[HE5_HDFE_UTLBUFSIZE]; /* Utility buffer */ char utlbuf2[HE5_HDFE_UTLBUFSIZE]; /* Utility buffer 2 */ char errbuf1[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer 1 */ char errbuf2[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer 2 */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ char maxdimlstbuf[HE5_HDFE_DIMBUFSIZE]; char dimlstbuf[HE5_HDFE_DIMBUFSIZE]; char compparmbuf[HE5_HDFE_DIMBUFSIZE];/* Compression parmeter */ char *HDFcomp[18] = {"HE5_HDFE_COMP_NONE", "HE5_HDFE_COMP_RLE", "HE5_HDFE_COMP_NBIT", "HE5_HDFE_COMP_SKPHUFF", "HE5_HDFE_COMP_DEFLATE", "HE5_HDFE_COMP_SZIP_CHIP", "HE5_HDFE_COMP_SZIP_K13", "HE5_HDFE_COMP_SZIP_EC", "HE5_HDFE_COMP_SZIP_NN", "HE5_HDFE_COMP_SZIP_K13orEC", "HE5_HDFE_COMP_SZIP_K13orNN", "HE5_HDFE_COMP_SHUF_DEFLATE", "HE5_HDFE_COMP_SHUF_SZIP_CHIP", "HE5_HDFE_COMP_SHUF_SZIP_K13", "HE5_HDFE_COMP_SHUF_SZIP_EC", "HE5_HDFE_COMP_SHUF_SZIP_NN", "HE5_HDFE_COMP_SHUF_SZIP_K13orEC", "HE5_HDFE_COMP_SHUF_SZIP_K13orNN"}; /* Compression code names */ CHECKNAME(za_name); CHECKPOINTER(datafield); CHECKPOINTER(dimlist); /* Convert HDF-EOS5 datatype to HDF5 datatype */ if ( H5Tequal(numbertype_in, H5T_NATIVE_CHAR) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_SCHAR) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_UCHAR) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_SHORT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_USHORT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_INT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_UINT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_LONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_ULONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_LLONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_ULLONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_FLOAT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_DOUBLE) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_LDOUBLE)== TRUE || H5Tequal(numbertype_in, H5T_C_S1) == TRUE) { numbertype = numbertype_in; } else { numbertype = HE5_EHconvdatatype((int) numbertype_in); } if(numbertype == FAIL) { sprintf(errbuf,"Cannot convert to HDF5 type data type ID for defining field.\n"); H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Setup error message strings */ /* --------------------------- */ strcpy(errbuf1, "HE5_ZAXZDname array too small.\nPlease increase "); strcat(errbuf1, "size of HE5_HDFE_NAMBUFSIZE in \"HE5_HdfEosDef.h\".\n"); strcpy(errbuf2, "HE5_ZAXZDdims array too small.\nPlease increase "); strcat(errbuf2, "size of HE5_HDFE_DIMBUFSIZE in \"HE5_HdfEosDef.h\".\n"); /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAdefinefield", &fid, &heos_gid, &idx); if(status == FAIL ) return(status); /* initialize dims and maxdims array */ /* --------------------------------- */ for(i = 0; i < HE5_DTSETRANKMAX; i++) { dims[i] = 0; maxdims[i] = 0; } /* Allocate space for dimbuf, copy dimlist into it, & append comma */ /* --------------------------------------------------------------- */ dimbuf = (char *) calloc(strlen(dimlist) + 64, sizeof(char)); if(dimbuf == NULL) { H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory"); HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__); return(FAIL); } /* ******************************************************************** * C H E C K T H E C O N T E N T O F dimlist S T R I N G * ******************************************************************** */ strcpy(dimbuf, dimlist); strcat(dimbuf, ","); /* Find comma */ /* ---------- */ comma = strchr(dimbuf, ','); /* * Loop through entries in dimension list to make sure they are * defined in za */ while (comma != NULL) { /* Copy dimension list entry to dimcheck */ /* ------------------------------------- */ dimcheck = (char *) calloc(comma - dimbuf + 1, sizeof(char)); if(dimcheck == NULL) { H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory. \n"); HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__); free(dimbuf); return(FAIL); } memmove(dimcheck, dimbuf, comma - dimbuf); /* Get dimension size */ /* ------------------ */ dimsize = HE5_ZAdiminfo(zaID, dimcheck); if (dimsize > 0) { dims[rank] = dimsize; rank++; } else { /* * If dimension list entry not found - set error return * status, append name to utility buffer for error report */ status = FAIL; foundAllDim = 0; if (first == 1) strcpy(utlbuf, dimcheck); else { strcat(utlbuf, ","); strcat(utlbuf, dimcheck); } first = 0; } /* * Go to next dimension entry, find next comma, & free up * dimcheck buffer */ memmove(dimbuf, comma + 1, strlen(comma + 1) + 1); comma = strchr(dimbuf, ','); free(dimcheck); } free(dimbuf); /* If no dimensions found, report error */ /* ------------------------------------ */ if (foundAllDim == 0) { status = FAIL; sprintf(errbuf, "Dimension(s) \"%s\" not found for \"%s\" field. \n", utlbuf, za_name); H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return (status); } /* ************************************************************************ * C H E C K T H E C O N T E N T O F maxdimlist S T R I N G * ************************************************************************ */ /* Allocate space for dimbuf, copy maxdimlist into it, & append comma */ /* ------------------------------------------------------------------ */ if(maxdimlist != NULL) { dimbuf = (char *) calloc(strlen(maxdimlist) + 64, sizeof(char)); if(dimbuf == NULL) { H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory. \n"); HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__); return(FAIL); } /* Copy "maxdimlist" to "dimbuf", & append comma */ /* --------------------------------------------- */ strcpy(dimbuf, maxdimlist); strcat(dimbuf, ","); /* Find comma */ /* ---------- */ comma = strchr(dimbuf, ','); /* * Loop through entries in dimension list to make sure they are * defined in za */ while (comma != NULL) { /* Copy dimension list entry to dimcheck */ /* ------------------------------------- */ dimcheck = (char *) calloc(comma - dimbuf + 1, sizeof(char)); if(dimcheck == NULL) { H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory. \n"); HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__); free(dimbuf); return(FAIL); } memmove(dimcheck, dimbuf, comma - dimbuf); /* Get dimension size */ /* ------------------ */ dimsize = HE5_ZAdiminfo(zaID, dimcheck); if ( (dimsize > 0 && strcmp(dimcheck,"Unlim") != 0 ) || (dimsize == H5S_UNLIMITED && strcmp(dimcheck, "Unlim") == 0 ) ) { maxdims[maxrank] = dimsize; maxrank++; } else { /* * If dimension list entry not found - set error return * status, append name to utility buffer for error report */ status = FAIL; foundAllDim = 0; if (first == 1) strcpy(utlbuf, dimcheck); else { strcat(utlbuf, ","); strcat(utlbuf, dimcheck); } first = 0; } /* * Go to next dimension entry, find next comma, & free up * dimcheck buffer */ memmove(dimbuf, comma + 1, strlen(comma + 1) + 1); comma = strchr(dimbuf, ','); free(dimcheck); } free(dimbuf); /* If no dimensions found, report error */ /* ------------------------------------ */ if (foundAllDim == 0) { status = FAIL; sprintf(errbuf, "Dimension(s) \"%s\" not found for \"%s\" field. \n", utlbuf, za_name); H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return (status); } /* If maxrank !=rank then report error */ /* ------------------------------------ */ if ( maxrank != rank ) { status = FAIL; sprintf(errbuf,"Dimension rank doesn't match Maximum dimension rank. \n"); H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return (status); } } /* "maxlist == NULL" ==> maxdims[]= dims[] */ /* ---------------------------------------- */ else { for(i = 0; i < rank; i++ ) maxdims[ i ] = dims[ i ]; } /* Find out if the dataset dimension is appendable */ /* ----------------------------------------------- */ for(i = 0; i < rank; i++) { if( dims[i] == maxdims[i] ) append = FALSE; else if ( (dims[i] < maxdims[i]) || (maxdims[i] == H5S_UNLIMITED)) { append = TRUE; break; } else { status = FAIL; H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_ARGS, H5E_BADRANGE, "Maximum dimension size is smaller than Dimension size. \n"); HE5_EHprint("Error: Maximum dimension size is smaller than Dimension size, occured", __FILE__, __LINE__); return(status); } } /* Check for valid data type ID ("numbertype") */ /* ------------------------------------------- */ if (numbertype != HE5T_CHARSTRING) { if (H5Tequal(numbertype, H5T_NATIVE_CHAR) == FALSE && H5Tequal(numbertype, H5T_NATIVE_SCHAR) == FALSE && H5Tequal(numbertype, H5T_NATIVE_UCHAR) == FALSE && H5Tequal(numbertype, H5T_NATIVE_SHORT) == FALSE && H5Tequal(numbertype, H5T_NATIVE_USHORT) == FALSE && H5Tequal(numbertype, H5T_NATIVE_INT) == FALSE && H5Tequal(numbertype, H5T_NATIVE_UINT) == FALSE && H5Tequal(numbertype, H5T_NATIVE_LONG) == FALSE && H5Tequal(numbertype, H5T_NATIVE_ULONG) == FALSE && H5Tequal(numbertype, H5T_NATIVE_LLONG) == FALSE && H5Tequal(numbertype, H5T_NATIVE_ULLONG) == FALSE && H5Tequal(numbertype, H5T_NATIVE_FLOAT) == FALSE && H5Tequal(numbertype, H5T_NATIVE_DOUBLE) == FALSE && H5Tequal(numbertype, H5T_NATIVE_LDOUBLE)== FALSE && H5Tequal(numbertype, H5T_C_S1) == FALSE ) { H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, "Invalid (unsupported) data type. \n"); HE5_EHprint("Error: Invalid (unsupported) data type, occured", __FILE__, __LINE__); return(FAIL); } } /* Get the field group ID */ /*----------------------- */ if (strcmp(datafield, "Data Fields") == 0) { gid = HE5_ZAXZa[idx].data_id; } else { sprintf(errbuf,"Invalid (unsupported) field group. \n"); H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return (FAIL); } /* Create dataspace then create dataset */ /* ------------------------------------ */ if( HE5_ZAXZa[idx].plist == FAIL ) { HE5_ZAXZa[idx].plist = H5Pcreate(H5P_DATASET_CREATE); } /* Get dataset layout */ /* ------------------ */ layout = H5Pget_layout(HE5_ZAXZa[idx].plist); if( layout == H5D_LAYOUT_ERROR) { H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_ARGS, H5E_BADVALUE, "Cannot get dataset layout.\n"); HE5_EHprint("Error: Cannot get dataset layout, occured", __FILE__, __LINE__); return(FAIL); } if(append == FALSE) data_space = H5Screate_simple(rank, dims, NULL); else { if( layout == H5D_CHUNKED) data_space = H5Screate_simple(rank, dims, maxdims); else { status = FAIL; H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_ARGS, H5E_BADVALUE, "Appendable dataset MUST BE CHUNKED first.\n"); HE5_EHprint("Error: Appendable dataset MUST BE CHUNKED first, occured", __FILE__, __LINE__); return(status); } } /* Get current compression code */ /* ---------------------------- */ compcode = HE5_ZAXZa[idx].compcode; /* Note: in inquiry routines HE5T_CHARSTRING is distinguished from HE5T_NATIVE_CHAR for the field data (not attributes) based on whether string has variable or fixed length as set below. The field data of type HE5T_NATIVE_CHAR has fixed length of 1, and the field is array of characters, not strings. However, HE5T_CHARSTRING sets array of vaiable length strings for the field data. Currently HE5_EHattr treats HE5T_NATIVE_CHAR, HE5T_CHARSTRING, and H5T_C_S1 as fixed (any size) for attributes. */ ntype = numbertype; if ((numbertype == HE5T_CHARSTRING) || (numbertype == H5T_C_S1)) { ntype = H5Tcopy(H5T_C_S1); status = H5Tset_size(ntype, H5T_VARIABLE); if( status == FAIL) { sprintf(errbuf, "Cannot set the total size for \"%s\" field. \n", za_name); H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Create dataset */ /* -------------- */ dataset = H5Dcreate(gid, za_name, ntype, data_space, HE5_ZAXZa[idx].plist); if (dataset == FAIL) { status = FAIL; sprintf(errbuf, "Cannot create dataset for \"%s\" field. \n", za_name); H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else if (numbertype == H5T_NATIVE_CHAR) { ntype = H5Tcopy(H5T_C_S1); status = H5Tset_size(ntype, 1); if( status == FAIL) { sprintf(errbuf, "Cannot set the total size for \"%s\" field. \n", za_name); H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Create dataset */ /* -------------- */ dataset = H5Dcreate(gid, za_name, ntype, data_space, HE5_ZAXZa[idx].plist); if (dataset == FAIL) { status = FAIL; sprintf(errbuf, "Cannot create dataset for \"%s\" field. \n", za_name); H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } else { /* Create dataset */ /* -------------- */ dataset = H5Dcreate(gid, za_name, numbertype, data_space, HE5_ZAXZa[idx].plist); if (dataset == FAIL) { status = FAIL; sprintf(errbuf, "Cannot create dataset for \"%s\" field. \n", za_name); H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } /* Extend the dataset. assure that dataset is at least dims */ /* -------------------------------------------------------- */ if( append == TRUE) { status = H5Dextend(dataset,dims); if (status == FAIL) { sprintf(errbuf, "Cannot extend the dataset for \"%s\" field.\n", za_name); H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } /* load external array */ /* ------------------- */ /* store dataset IDs and dataset name */ /* ---------------------------------- */ if (HE5_ZAXZa[idx].nDFLD > 0) { /* Allocate memory to ddataset struct */ /* ---------------------------------- */ HE5_ZAXZa[idx].ddataset = (HE5_DTSinfo *)realloc((void *)HE5_ZAXZa[idx].ddataset,(HE5_ZAXZa[idx].nDFLD + 1) * sizeof(HE5_DTSinfo)); } else { HE5_ZAXZa[idx].ddataset = (HE5_DTSinfo *)calloc(1, sizeof(HE5_DTSinfo)); if (HE5_ZAXZa[idx].ddataset == NULL ) { status = FAIL; H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory. \n"); HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__); return(status); } } /* Allocate memory to name */ /* ----------------------- */ HE5_ZAXZa[idx].ddataset[HE5_ZAXZa[idx].nDFLD].name = (char *)calloc( (strlen(za_name)+1), sizeof(char) ); if (HE5_ZAXZa[idx].ddataset[HE5_ZAXZa[idx].nDFLD].name == NULL) { status = FAIL; H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory.\n"); HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__); return(status); } /* load table */ /* ---------- */ HE5_ZAXZa[idx].ddataset[HE5_ZAXZa[idx].nDFLD].ID = dataset; strcpy(HE5_ZAXZa[idx].ddataset[HE5_ZAXZa[idx].nDFLD].name, za_name); HE5_ZAXZa[idx].nDFLD++; if ((numbertype != HE5T_CHARSTRING) && (numbertype != H5T_NATIVE_CHAR) && (numbertype != H5T_C_S1)) { /* Get the size of a datatype in bytes */ /* ----------------------------------- */ tsize = H5Tget_size( numbertype); if( tsize == 0) { sprintf(errbuf, "Cannot get the size of a datatype. \n"); H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return (FAIL); } /* allocate memory for "fill" value */ /* -------------------------------- */ value = (void *)calloc(1, tsize); if( value == (void *)NULL) { sprintf(errbuf, "Cannot allocate memory for fill value.\n"); H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return (FAIL); } /* Try to retrieve the fill value (in case it's already defined) */ /* ------------------------------------------------------------- */ H5E_BEGIN_TRY { status = H5Pget_fill_value(HE5_ZAXZa[idx].plist, numbertype, value); } H5E_END_TRY; /* Store fill value in the dataset attribute "_FillValue" */ /* ----------------------------------------------------- */ if( status != FAIL) { status = HE5_EHattr( dataset, "_FillValue", numbertype, count, "w", value); if( status == FAIL ) { sprintf(errbuf, "Cannot store fill value in the attribute \"_FillValue\"."); H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(value); return (status); } } free( value); } /* ****************************************************************** * SET UP METADATA STRINGS * ****************************************************************** */ /* set up "DimList" string content */ /* ------------------------------- */ strcpy(utlbuf,""); sprintf(utlbuf, "%s%s%s", za_name,":",dimlist); /* set up "MaxdimList" string content */ /* ----------------------------------- */ if ( maxdimlist != NULL) { status = HE5_EHmetalist(maxdimlist,maxdimlstbuf); if (status == FAIL) { sprintf(errbuf, "Cannot convert the input \"%s\" list to the metadata list. \n", maxdimlist); H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return (status); } sprintf(utlbuf2,"%s%s",":\n\t\t\t\tMaxdimList=", maxdimlstbuf); strcat(utlbuf,utlbuf2); } if (maxdimlist == NULL) { status = HE5_EHmetalist(dimlist,dimlstbuf); if (status == FAIL) { sprintf(errbuf, "Cannot convert the input \"%s\" list to the metadata list.\n", dimlist); H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return (status); } sprintf(utlbuf2,"%s%s",":\n\t\t\t\tMaxdimList=", dimlstbuf); strcat(utlbuf,utlbuf2); } /* setup "CompressionType" & "CompressionParams" strings content */ /* ------------------------------------------------------------- */ if (compcode != HE5_HDFE_COMP_NONE) { sprintf(utlbuf2,"%s%s","\n\t\t\t\tCompressionType=", HDFcomp[compcode]); switch (compcode) { case HE5_HDFE_COMP_NBIT: sprintf(compparmbuf, "%s%d,%d,%d,%d%s", "\n\t\t\t\tCompressionParams=(", HE5_ZAXZa[idx].compparm[0], HE5_ZAXZa[idx].compparm[1], HE5_ZAXZa[idx].compparm[2], HE5_ZAXZa[idx].compparm[3], ")"); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_DEFLATE: sprintf(compparmbuf,"%s%d","\n\t\t\t\tDeflateLevel=", HE5_ZAXZa[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SZIP_CHIP: sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_ZAXZa[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SZIP_K13: sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_ZAXZa[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SZIP_EC: sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_ZAXZa[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SZIP_NN: sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_ZAXZa[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SZIP_K13orEC: sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_ZAXZa[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SZIP_K13orNN: sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_ZAXZa[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SHUF_DEFLATE: sprintf(compparmbuf,"%s%d","\n\t\t\t\tDeflateLevel=", HE5_ZAXZa[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SHUF_SZIP_CHIP: sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_ZAXZa[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SHUF_SZIP_K13: sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_ZAXZa[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SHUF_SZIP_EC: sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_ZAXZa[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SHUF_SZIP_NN: sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_ZAXZa[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SHUF_SZIP_K13orEC: sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_ZAXZa[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; case HE5_HDFE_COMP_SHUF_SZIP_K13orNN: sprintf(compparmbuf,"%s%d","\n\t\t\t\tBlockSize=", HE5_ZAXZa[idx].compparm[0]); strcat(utlbuf2, compparmbuf); break; default: { sprintf(errbuf,"Compression code \"%d\" is not supported. \n", compcode); H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_ARGS, H5E_UNSUPPORTED, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } break; } /* Concatanate compression parameters with compression code */ /* -------------------------------------------------------- */ strcat(utlbuf, utlbuf2); } /* ****************************************************************** * Insert metadata information to Structural Metadata section * ****************************************************************** */ numtype = HE5_EHdtype2numtype(numbertype); if (numtype == FAIL) { sprintf(errbuf, "Cannot get the number type ID. \n"); H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } else if (numtype == 0) { metavalue = 0; } else { metavalue = HE5_EHhid2hsize(numtype); if (metavalue == 0) { sprintf(errbuf, "Cannot convert \"hid_t\" to \"hsize_t\" data type. \n"); H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } status = HE5_EHinsertmeta(fid, HE5_ZAXZa[idx].zaname, "z", 4L, utlbuf, &metavalue); if (status == FAIL) { sprintf(errbuf, "Cannot insert metadata for \"%s\" field.\n", za_name); H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release data space ID */ /* --------------------- */ status = H5Sclose(data_space); if (status == FAIL) { H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, "Cannot release the data space ID.\n"); HE5_EHprint("Error: Cannot release the data space ID, occured", __FILE__, __LINE__); return(status); } /* Release property list ID */ /* ------------------------ */ status = H5Pclose(HE5_ZAXZa[idx].plist); if (status == FAIL) { H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_PLIST, H5E_CLOSEERROR, "Cannot release the property list ID.\n"); HE5_EHprint("Error: Cannot release the property list ID, occured", __FILE__, __LINE__); return(status); } /* Reset external array entry for next dataset creation */ /* ==================================================== */ HE5_ZAXZa[idx].plist = FAIL; HE5_ZAXZa[idx].compcode = HE5_HDFE_COMP_NONE; if ((numbertype == HE5T_CHARSTRING) || (numbertype == H5T_C_S1)) { attr = HE5T_CHARSTRING; status = HE5_ZAwritelocattr(zaID, za_name, "ARRAYOFSTRINGS", H5T_NATIVE_INT, count, &attr); if (status == FAIL) { sprintf(errbuf, "Cannot write attribute to the field \"%s\".",za_name) ; H5Epush(__FILE__, "HE5_ZAdefinefield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAdefine | | | | DESCRIPTION: Defines data field within ZA structure (wrapper) | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t ZA structure ID | | za_name const char* za name | | dimlist char* Dimension (comma-separated)list | | maxdimlist char* Maximum Dimension (comma-separated) list| | dtype hid_t field data type ID | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAdefine(hid_t zaID, const char *za_name, char *dimlist, char *maxdimlist, hid_t dtype) { herr_t status = FAIL; /* routine return status variable */ HE5_LOCK; CHECKNAME(za_name); CHECKPOINTER(dimlist); /* Call HE5_ZAdefinefield routine */ /* ============================== */ status = HE5_ZAdefinefield(zaID, "Data Fields", za_name, dimlist,maxdimlist,dtype); COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAwritedatameta | | | | DESCRIPTION: Defines structural metadata for pre-existing data | | field within za structure | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t ZA structure ID | | fieldname const char* fieldname | | dimlist char* Dimension list (comma-separated list) | | mvalue hid_t metavalue to insert | | | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | May 05 S.Zhao Added HE5_EHdtype2numtype() function call. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAwritedatameta(hid_t zaID, const char *fieldname, char *dimlist, hid_t mvalue) { herr_t status = FAIL; /* Return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hsize_t metavalue = 0; /* Metavalue to insert */ long idx = FAIL; /* za index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ char utlbuf[HE5_HDFE_DIMBUFSIZE];/* Utility buffer */ hid_t numtype = FAIL; /* Number type ID */ HE5_LOCK; CHECKNAME(fieldname); CHECKPOINTER(dimlist); numtype = HE5_EHdtype2numtype(mvalue); if (numtype == FAIL) { sprintf(errbuf, "Cannot get the number type ID. \n"); H5Epush(__FILE__, "HE5_ZAwritedatameta", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } else if (numtype == 0) { metavalue = 0; } else { /* Convert 'numtype' to 'metavalue' */ /* -------------------------------- */ metavalue = HE5_EHhid2hsize(numtype); if ( metavalue == 0 ) { sprintf(errbuf, "Cannot convert metadata value. \n"); H5Epush(__FILE__, "HE5_ZAwritedatameta", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAwritedatameta", &fid, &gid, &idx); if (status == SUCCEED) { /* Setup and write field metadata */ /* ------------------------------ */ sprintf(utlbuf, "%s%s%s", fieldname, ":", dimlist); status = HE5_EHinsertmeta(gid, HE5_ZAXZa[idx].zaname, "z", 4L, utlbuf, &metavalue); if ( status == FAIL ) { sprintf(errbuf, "Cannot insert metadata value. \n"); H5Epush(__FILE__, "HE5_ZAwritedatameta", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAwriteattr | | | | DESCRIPTION: Writes/updates attribute in a za. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t ZA structure ID | | attrname const char* attribute name | | numbertype hid_t attribute dataset datatype ID | | count[] hsize_t Number of attribute elements | | datbuf void* I/O buffer | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAwriteattr(hid_t zaID, const char *attrname, hid_t numtype, hsize_t count[], void *datbuf) { herr_t status = FAIL; /* Return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ long idx = FAIL; /* za index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ hid_t numbertype; HE5_LOCK; CHECKNAME(attrname); CHECKPOINTER(count); CHECKPOINTER(datbuf); /* if numtype is HE5 numbertype, rather than H5 numbertype, then convert it, otherwise use numtype itself */ numbertype = HE5_EHconvdatatype(numtype); if(numbertype == FAIL) { numbertype = numtype; } /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAwriteattr", &fid, &gid, &idx); if (status == SUCCEED) { /* Call HE5_EHattr to perform I/O */ /* ------------------------------ */ status = HE5_EHattr(HE5_ZAXZa[idx].za_id, attrname, numbertype, count,"w", datbuf); if ( status == FAIL ) { sprintf(errbuf, "Cannot write the attribute value. \n"); H5Epush(__FILE__, "HE5_ZAwriteattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAreadattr | | | | DESCRIPTION: Reads attribute from a za. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t ZA structure ID | | attrname const char* attribute name | | | | OUTPUTS: | | datbuf void* I/O buffer | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAreadattr(hid_t zaID, const char *attrname, void *datbuf) { herr_t status = FAIL; /* Return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t ntype = FAIL; /* Data type ID */ long idx = FAIL; /* za index */ hsize_t count[] ={0}; /* Number of elements */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKPOINTER(attrname); /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAreadattr", &fid, &gid, &idx); if (status == SUCCEED) { /* Call HE5_EHattr to perform I/O */ /* ------------------------------ */ status = HE5_EHattr(HE5_ZAXZa[idx].za_id, attrname, ntype, count,"r", datbuf); if ( status == FAIL ) { sprintf(errbuf, "Cannot read the attribute value. \n"); H5Epush(__FILE__, "HE5_ZAreadattr", __LINE__, H5E_ATTR, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAattrinfo | | | | DESCRIPTION: Returns information about a za attribute | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t ZA structure ID | | attrname const char* attribute name | | | | OUTPUTS: | | ntype hid_t* Data type ID | | count hsize_t* Number of attribute elements | | | | NOTES: | | | | | | Date Programmer Description | | ======== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAattrinfo(hid_t zaID, const char *attrname, hid_t *ntype, hsize_t *count) { herr_t status = FAIL; /* Return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ long idx = FAIL; /* za index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ CHECKPOINTER(attrname); /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAattrinfo", &fid, &gid, &idx); if (status == SUCCEED) { /* Get attribute group ID and call HE5_EHattrinfo */ /* ---------------------------------------------- */ status = HE5_EHattrinfo(HE5_ZAXZa[idx].za_id, attrname, ntype, count); if ( status == FAIL ) { sprintf(errbuf, "Cannot retrieve information about attribute. \n"); H5Epush(__FILE__, "HE5_ZAattrinfo", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAattrinfo2 | | | | DESCRIPTION: Returns information about a za attribute | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t ZA structure ID | | attrname const char* attribute name | | | | OUTPUTS: | | ntype hid_t* Data type ID | | count hsize_t* Number of attribute elements | | size hsize_t* buf size of attribute elements | | | | NOTES: | | | | | | Date Programmer Description | | ======== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAattrinfo2(hid_t zaID, const char *attrname, hid_t *ntype, hsize_t *count, hsize_t *size) { herr_t status = FAIL; /* Return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ long idx = FAIL; /* za index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ CHECKPOINTER(attrname); /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAattrinfo2", &fid, &gid, &idx); if (status == SUCCEED) { /* Get attribute group ID and call HE5_EHattrinfo */ /* ---------------------------------------------- */ status = HE5_EHattrinfo2(HE5_ZAXZa[idx].za_id, attrname, ntype, count, size); if ( status == FAIL ) { sprintf(errbuf, "Cannot retrieve information about attribute. \n"); H5Epush(__FILE__, "HE5_ZAattrinfo2", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } } COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAinqattrs | | | | DESCRIPTION: Retrieves information about attributes defined in ZA | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nattr long Number of attributes in za struct | | | | INPUTS: | | zaID hid_t ZA structure ID | | | | OUTPUTS: | | attrnames char* Attribute names in za struct | | (Comma-separated list) | | strbufsize long* Attributes name list string length | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_ZAinqattrs(hid_t zaID, char *attrnames, long *strbufsize) { long nattr = FAIL;/* Number of attributes (return) */ long idx = FAIL;/* za index */ herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* za group ID */ char *grpname = (char *)NULL;/* Group name string */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAinqattrs", &fid, &gid, &idx); if(status == SUCCEED ) { grpname = (char *)calloc( HE5_HDFE_NAMBUFSIZE, sizeof(char) ); if( grpname == NULL) { H5Epush(__FILE__, "HE5_ZAinqattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory"); HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__); return(FAIL); } strcpy(grpname,"/HDFEOS/ZAS/"); strcat(grpname, HE5_ZAXZa[idx].zaname); nattr = HE5_EHattrcat(fid, grpname, attrnames, strbufsize); if ( nattr == FAIL ) { sprintf(errbuf, "Cannot find the attributes. \n"); H5Epush(__FILE__, "HE5_ZAinqattrs", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); } if (grpname != NULL) free(grpname); } return (nattr); } #define REMQUOTE \ \ memmove(utlstr, utlstr + 1, strlen(utlstr) - 2); \ utlstr[strlen(utlstr) - 2] = 0; /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAinqdims | | | | DESCRIPTION: Returns dimension names and values defined in ZA structure | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nDim long Number of defined dimensions | | | | INPUTS: | | zaID hid_t ZA structure ID | | | | OUTPUTS: | | dimlist char* Dimension names (comma-separated) | | dims hsize_t Dimension values | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_ZAinqdims(hid_t zaID, char *dimlist, hsize_t dims[]) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ long idx = FAIL;/* ZA index */ long nDim = 0; /* Number of dimensions */ hsize_t size = 0; /* Dimension size */ char *metabuf = (char *)NULL; /* Pointer to SM */ char *metaptrs[2]={NULL,NULL}; /* Ptrs to start/end of SM */ char utlstr[HE5_HDFE_UTLBUFSIZE]; /* Utility string */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ /* Get HDF-EOS file ID, "HDFEOS" group ID and ZA index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAinqdims", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for ZA ID failed.\n"); H5Epush(__FILE__, "HE5_ZAinqdims", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* If dimension names or sizes are desired ... */ /* ------------------------------------------- */ if (dimlist != NULL || dims != NULL) { /* Get pointers to "Dimension" section within SM */ /* --------------------------------------------- */ metabuf = (char *)HE5_EHmetagroup(fid, HE5_ZAXZa[idx].zaname, "z", "Dimension", metaptrs); /* If dimension names are desired then "clear" name buffer */ /* ------------------------------------------------------- */ if (dimlist != NULL) dimlist[0] = 0; /* Begin loop through dimension entries in metadata */ /* ------------------------------------------------ */ while (1) { /* Search for OBJECT string */ /* ------------------------ */ metaptrs[0] = strstr(metaptrs[0], "\t\tOBJECT="); /* If found within "Dimension" metadata section ... */ /* ------------------------------------------------ */ if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL) { /* Get Dimension Name (if desired) */ /* ------------------------------- */ if (dimlist != NULL) { /* Check 1st for old meta data then new */ /* ------------------------------------ */ HE5_EHgetmetavalue(metaptrs, "OBJECT", utlstr); /* * If OBJECT value begins with double quote then old * metadata, dimension name is OBJECT value. * Otherwise search for "DimensionName" string */ if (utlstr[0] != '"') { metaptrs[0] = strstr(metaptrs[0], "\t\t\t\tDimensionName="); HE5_EHgetmetavalue(metaptrs, "DimensionName", utlstr); } /* Strip off double quotes */ /* ----------------------- */ REMQUOTE /* If not first name then add comma delimitor */ /* ------------------------------------------ */ if (nDim > 0) { strcat(dimlist, ","); } /* Add dimension name to dimension list */ /* ------------------------------------ */ strcat(dimlist, utlstr); } /* Get Dimension Size (if desired) */ /* ------------------------------- */ if (dims != NULL) { HE5_EHgetmetavalue(metaptrs, "Size", utlstr); size = (hsize_t)atol(utlstr); dims[ nDim ] = size; } /* Increment dimension counter */ /* --------------------------- */ nDim++; } else /* No more dimensions found */ /* ------------------------ */ break; } free(metabuf); } return(nDim); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAinqfield | | | | DESCRIPTION: Returns fieldnames, ranks and numbertypes defined in ZA. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nFld long Number of data fields in ZA | | | | INPUTS: | | zaID hid_t ZA structure ID | | datafield char* data field | | | | OUTPUTS: | | fieldlist char* Field names (comma-separated) | | rank int Array of ranks | | numbertype hid_t Array of HDF number types | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | Oct 03 S.ZHAO Added the H5Tclose(datatype) call. | | Jan 04 S.Zhao Modified to enable a character string dataset. | | Mar 04 S.Zhao Modified for a character string dataset. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ static long HE5_ZAinqfield(hid_t zaID, char *datafield, char *fieldlist, int rank[], hid_t numbertype[]) { long nFld = 0; /* Return number of mappings */ long i = 0; /* Loop index */ long idx = FAIL; /* za index */ long ntflds = 0; /* field counter */ herr_t status = FAIL;/* routine return status variable */ herr_t Dstatus = FAIL;/* Status for H5Dclose */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t datasetid = FAIL;/* Dataset ID */ hid_t datatype = FAIL;/* Data type ID */ hid_t groupid = FAIL;/* Group ID */ H5T_class_t classid = H5T_NO_CLASS; /* Data type class ID */ size_t slen[HE5_DTSETRANKMAX]; /* String length array */ size_t fldnmlen[HE5_FLDNUMBERMAX]; /* Array of namelengths */ char *fldnm[HE5_FLDNUMBERMAX]; /* Array of names */ char *metabuf = (char *)NULL; /* Pntr to SM */ char *metaptrs[2]={NULL,NULL}; /* Start/end of SM */ char utlstr[HE5_HDFE_UTLBUFSIZE]; /* Utility string */ char utlstr2[HE5_HDFE_UTLBUFSIZE];/* Utility string 2 */ char *ptr[HE5_DTSETRANKMAX]; /* String pointer array */ char *tempfield = (char *)NULL; char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ htri_t str_is_variable; /* boolean: TRUE if string is variable lengeth FALSE if string is fixed length -1 if error in H5Tis_variavle_str() */ CHECKPOINTER(datafield); /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAinqfield", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for za ID failed.\n"); H5Epush(__FILE__, "HE5_ZAinqfield", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Initialize slen[] array */ /* ----------------------- */ for (i = 0; i < HE5_DTSETRANKMAX; i++) slen[i] = 0; /* Initialize fldnmlen[] array */ /* --------------------------- */ for (i = 0; i < HE5_FLDNUMBERMAX; i++) fldnmlen[i] = 0; /* If field names, ranks, or number types desired ... */ /* --------------------------------------------------- */ if (fieldlist != NULL || rank != NULL || numbertype != NULL) { /* Get pointers to "DataField" section within SM */ /* --------------------------------------------- */ metabuf = (char *)HE5_EHmetagroup( fid, HE5_ZAXZa[idx].zaname, "z", "DataField", metaptrs); strcpy(utlstr2, "DataFieldName"); /* If field names are desired then "clear" name buffer */ /* --------------------------------------------------- */ if (fieldlist != NULL) fieldlist[0] = 0; /* Begin loop through mapping entries in metadata */ /* ---------------------------------------------- */ while (1) { /* Search for OBJECT string */ /* ------------------------ */ metaptrs[0] = strstr(metaptrs[0], "\t\tOBJECT="); /* If found within "Data" Field metadata section ... */ /* ------------------------------------------------- */ if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL) { /* Get field names (if desired) */ /* ---------------------------- */ if (fieldlist != NULL) { /* Check 1st for old meta data then new */ /* ------------------------------------ */ HE5_EHgetmetavalue(metaptrs, "OBJECT", utlstr); /* * If OBJECT value begins with double quote then old * metadata, field name is OBJECT value. Otherwise * search for "DataFieldName" string */ if (utlstr[0] != '"') { strcpy(utlstr, "\t\t\t\t"); strcat(utlstr, utlstr2); strcat(utlstr, "="); metaptrs[0] = strstr(metaptrs[0], utlstr); HE5_EHgetmetavalue(metaptrs, utlstr2, utlstr); } /* Strip off double quotes */ /* ----------------------- */ REMQUOTE /* Add to fieldlist */ /* ---------------- */ if (nFld > 0) strcat(fieldlist, ","); strcat(fieldlist, utlstr); } /* If numbertype are desired then "clear" name buffer */ /* --------------------------------------------------- */ if (numbertype != NULL) { ntflds = HE5_EHparsestr(fieldlist, ',', fldnm,fldnmlen); if(ntflds != FAIL) { groupid = HE5_ZAXZa[idx].data_id; for(i = 0; i < ntflds; i++) { tempfield = (char *)calloc(fldnmlen[i] + 1, sizeof(char)); memmove(tempfield,fldnm[i],fldnmlen[i]); /* Open the dataset */ /* ---------------- */ datasetid = H5Dopen(groupid, tempfield); if ( datasetid == FAIL ) { sprintf(errbuf, "Cannot open the dataset \"%s\". \n", tempfield); H5Epush(__FILE__, "HE5_ZAinqfield", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (metabuf != NULL) free(metabuf); free(tempfield); return(FAIL); } /* Get the data type */ /* ----------------- */ datatype = H5Dget_type(datasetid); if ( datatype == FAIL ) { sprintf(errbuf, "Cannot get the data type ID. \n"); H5Epush(__FILE__, "HE5_ZAinqfield", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (metabuf != NULL) free(metabuf); free(tempfield); return(FAIL); } /* Get the data type class ID */ /* -------------------------- */ classid = H5Tget_class(datatype); if ( classid == H5T_NO_CLASS ) { sprintf(errbuf, "Cannot get the data type class ID. \n"); H5Epush(__FILE__, "HE5_ZAinqfield", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (metabuf != NULL) free(metabuf); free(tempfield); return(FAIL); } if (classid == H5T_STRING) { /* HE5T_CHARSTRING has variable length for data fields */ str_is_variable = H5Tis_variable_str(datatype); if(str_is_variable == TRUE) { numbertype[i] = HE5T_CHARSTRING; } else if(str_is_variable == FALSE) { numbertype[i] = HE5T_NATIVE_CHAR; } else { status = FAIL; sprintf(errbuf, "Failed to see if string field is varaible or fixed length.\n"); H5Epush(__FILE__, "HE5_ZAinqfield", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (metabuf != NULL) free(metabuf); free(tempfield); return(status); } /*HE5_ZAgetstringtype(zaID, fieldname,classid);*/ /*numbertype[i] = HE5T_CHARSTRING;*/ } else { numbertype[i] = HE5_EHdtype2numtype(datatype); if ( numbertype[i] == FAIL ) { sprintf(errbuf, "Cannot get the number type ID. \n"); H5Epush(__FILE__, "HE5_ZAinqfield", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (metabuf != NULL) free(metabuf); free(tempfield); return(FAIL); } } /* Release the datatype ID */ /* ----------------------- */ status = H5Tclose(datatype); if ( status == FAIL ) { sprintf(errbuf, "Cannot close the datatype \"%s\". \n", tempfield); H5Epush(__FILE__, "HE5_ZAinqfield", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (metabuf != NULL) free(metabuf); free(tempfield); return(FAIL); } /* Release the dataset ID */ /* ---------------------- */ Dstatus = H5Dclose(datasetid); if ( Dstatus == FAIL ) { sprintf(errbuf, "Cannot close the dataset \"%s\". \n", tempfield); H5Epush(__FILE__, "HE5_ZAinqfield", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (metabuf != NULL) free(metabuf); free(tempfield); return(FAIL); } free(tempfield); } } } /* * Get Rank (if desired) by counting # of dimensions in * "DimList" string */ if (rank != NULL) { HE5_EHgetmetavalue(metaptrs, "DimList", utlstr); rank[nFld] = HE5_EHlong2int(HE5_EHparsestr(utlstr, ',', ptr, slen) ); if (rank[nFld] == FAIL ) { sprintf(errbuf, "Cannot convert data type. \n"); H5Epush(__FILE__, "HE5_ZAinqfield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if(metabuf != NULL) free(metabuf); return(FAIL); } } /* Increment field counter */ /* ----------------------- */ nFld++; } else /* No more fields found */ /* -------------------- */ break; } if (metabuf != NULL) free(metabuf); } COMPLETION: return(nFld); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAinquire | | | | DESCRIPTION: Inquires about data fields in za | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nflds long Number of data fields in za | | | | INPUTS: | | zaID hid_t ZA structure ID | | | | OUTPUTS: | | za_name_list char* Field names (comma-separated) | | rank int Array of ranks | | dtype hid_t data type ID | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_ZAinquire(hid_t zaID, char *za_name_list, int rank[], hid_t dtype[]) { long nflds = FAIL; /* Number of Data fields */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ /* Call "HE5_ZAinqfield" routine to get number of fields */ /* ----------------------------------------------------- */ nflds = HE5_ZAinqfield(zaID, "Data Fields", za_name_list, NULL, NULL); if (nflds == FAIL) { sprintf(errbuf, "Cannot get the number of fields in \"Data Fields\" group. \n"); H5Epush(__FILE__, "HE5_ZAinquire", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Call "HE5_ZAinqfield" routine to get other parameters */ /* ----------------------------------------------------- */ nflds = HE5_ZAinqfield(zaID, "Data Fields", za_name_list, rank, dtype); if (nflds == FAIL) { sprintf(errbuf, "Inquiry about fields in \"Data Fields\" group fails. \n"); H5Epush(__FILE__, "HE5_ZAinquire", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } return(nflds); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAinqdatatype | | | | DESCRIPTION: Inquires about data field in za | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t | | fieldname const char* | | attrname const char* | | group int Group flag: | | ...DATAGROUP - for the field | | ...ATTRGROUP, ...GRPATTRGROUP, | | ...LOCATTRGROUP - for the attribute | | OUTPUTS: | | datatype hid_t* | | classid H5T_class_t* | | order H5T_order_t* | | size size_t* | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAinqdatatype(hid_t zaID, const char *fieldname, const char *attrname, int group, hid_t *datatype, H5T_class_t *classid, H5T_order_t *order, size_t *size) { herr_t status = FAIL; /* routine return status */ int fldgroup = FAIL; /* Field group flag */ hid_t datasetid = FAIL; /* Dataset ID */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t attr = FAIL; /* attribute dataset ID */ hid_t fldgroupID = FAIL; /* Field group ID */ hid_t fieldID = FAIL; /* Field dataset ID */ long idx = FAIL; /* za index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAinqdatatype", &fid, &gid, &idx); if(status == SUCCEED) { if(group == HE5_HDFE_DATAGROUP) fldgroupID = HE5_ZAXZa[idx].data_id; else if(group == HE5_HDFE_ATTRGROUP) fldgroupID = HE5_ZAXZa[idx].za_id; else if(group == HE5_HDFE_GRPATTRGROUP) fldgroupID = HE5_ZAXZa[idx].data_id; else if(group == HE5_HDFE_LOCATTRGROUP) { /* Get the field group flag */ /* ------------------------ */ fldgroup = HE5_ZAfldsrch(zaID,(char *)fieldname,NULL,NULL,NULL,NULL); if(fldgroup == FAIL) { sprintf(errbuf,"Cannot get the group flag for \"%s\" field.\n",fieldname); H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } if (fldgroup == HE5_HDFE_DATAGROUP) fldgroupID = HE5_ZAXZa[idx].data_id; } else { sprintf(errbuf, "Invalid group flag (\"%d\"). \n", group); H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_FUNC, H5E_BADVALUE , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get data type information for the field */ /* --------------------------------------- */ if( group == HE5_HDFE_DATAGROUP ) { datasetid = H5Dopen(fldgroupID, fieldname); if (datasetid == FAIL) { sprintf(errbuf, "Cannot open the dataset for the \"%s\" field.\n", fieldname); H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_DATASET, H5E_NOTFOUND , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } *datatype = H5Dget_type(datasetid); if (*datatype == FAIL) { sprintf(errbuf, "Cannot get the datatype for the \"%s\" field.\n", fieldname); H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_DATATYPE, H5E_NOTFOUND , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } *classid = H5Tget_class(*datatype); if (*classid == H5T_NO_CLASS) { sprintf(errbuf, "Cannot get the data type class ID for the \"%s\" field.\n", fieldname); H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } *order = H5Tget_order(*datatype); if (*order == H5T_ORDER_ERROR) { sprintf(errbuf, "Cannot get the data type order for the \"%s\" field.\n", fieldname); H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } if (*classid == H5T_STRING) { *size = H5Tget_size(*datatype); } else { *size = H5Tget_size(*datatype); if (*size == 0) { sprintf(errbuf, "Cannot get the data type size for the \"%s\" field.\n", fieldname); H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } status = H5Dclose(datasetid); if (status == FAIL) { sprintf(errbuf, "Cannot release the dataset ID for the \"%s\" field.\n", fieldname); H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_DATASET, H5E_CLOSEERROR , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } /* Get data type information about global/group attribute */ /* ------------------------------------------------------ */ else if(group == HE5_HDFE_ATTRGROUP || group == HE5_HDFE_GRPATTRGROUP) { attr = H5Aopen_name(fldgroupID, attrname); if (attr == FAIL) { sprintf(errbuf, "Cannot open the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } *datatype = H5Aget_type(attr); if (*datatype == FAIL) { sprintf(errbuf, "Cannot get the data type for the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } *classid = H5Tget_class(*datatype); if (*classid == H5T_NO_CLASS) { sprintf(errbuf, "Cannot get the data type class ID for the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } *order = H5Tget_order(*datatype); if (*order == H5T_ORDER_ERROR) { sprintf(errbuf, "Cannot get the data type order for the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } if (*classid == H5T_STRING) { *size = H5Tget_size(*datatype); } else { *size = H5Tget_size(*datatype); if (*size == 0) { sprintf(errbuf, "Cannot get the data type size for the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } status = H5Aclose(attr); if (status == FAIL) { sprintf(errbuf, "Cannot release the dataset ID for the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_DATASET, H5E_CLOSEERROR , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } /* Get data type information for local attribute */ /* --------------------------------------------- */ else if(group == HE5_HDFE_LOCATTRGROUP) { fieldID = H5Dopen(fldgroupID, fieldname); if(fieldID == FAIL) { sprintf(errbuf,"Cannot open the \"%s\" field dataset.\n", fieldname); H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } attr = H5Aopen_name(fieldID, attrname); if (attr == FAIL) { sprintf(errbuf, "Cannot open the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } *datatype = H5Aget_type(attr); if (*datatype == FAIL) { sprintf(errbuf, "Cannot get the data type for the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } *classid = H5Tget_class(*datatype); if (*classid == H5T_NO_CLASS) { sprintf(errbuf, "Cannot get the data type class ID for the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } *order = H5Tget_order(*datatype); if (*order == H5T_ORDER_ERROR) { sprintf(errbuf, "Cannot get the data type order for the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } if (*classid == H5T_STRING) { *size = H5Tget_size(*datatype); } else { *size = H5Tget_size(*datatype); if (*size == 0) { sprintf(errbuf, "Cannot get the data type size for the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_FUNC, H5E_CANTINIT , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } status = H5Aclose(attr); if (status == FAIL) { sprintf(errbuf, "Cannot release the dataset ID for the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_DATASET, H5E_CLOSEERROR , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } status = H5Dclose(fieldID); if (status == FAIL) { sprintf(errbuf, "Cannot release the dataset ID for the \"%s\" attribute.\n", attrname); H5Epush(__FILE__, "HE5_ZAinqdatatype", __LINE__, H5E_DATASET, H5E_CLOSEERROR , errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } } return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAchunkinfo | | | | DESCRIPTION: Retrieves chunking information | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t ZA structure ID | | fldname char* name of field | | | | OUTPUTS: | | chunk_rank int* rank of a dataset | | chunk_dims hsize_t the array containing sizes | | of each dimension of a chunk | | | | NOTES: | | | | | | Date Programmer Description | | ========= ============ ============================================== | | Dec 03 S.Zhao Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAchunkinfo(hid_t zaID, char *fldname, int *chunk_rank, hsize_t chunk_dims[]) { herr_t status = FAIL;/* Return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ long idx = FAIL;/* ZA index */ hid_t fieldID = FAIL;/* field dataset ID */ hid_t plist = FAIL;/* field dataset property list ID */ hid_t dspace = FAIL;/* "fieldname" Dataspace ID */ int ndims = 0; /* Number of dimensions */ H5D_layout_t layout = H5D_LAYOUT_ERROR; /* Storage layout type */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKPOINTER(fldname); /* Initialize chunk_rank to FAIL (error) */ /* ------------------------------------- */ *chunk_rank = FAIL; /* Get HDF-EOS file ID, "HDFEOS" group ID and ZA index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAchunkinfo", &fid, &gid, &idx); if (status == FAIL) { sprintf(errbuf,"Checking for valid ZA ID failed.\n"); H5Epush(__FILE__, "HE5_ZAchunkinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Check out the field group and get field ID */ /* ------------------------------------------ */ HE5_ZAfldsrch(zaID,fldname,&fieldID,NULL,NULL,NULL); if(fieldID == FAIL) { sprintf(errbuf, "Cannot get the field ID for the \"%s\" field.\n", fldname); H5Epush(__FILE__, "HE5_ZAchunkinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the property list ID */ /* ------------------------ */ plist = H5Dget_create_plist(fieldID); if (plist == FAIL) { sprintf(errbuf, "Cannot get the property list ID for the \"%s\" data field.\n", fldname); H5Epush(__FILE__, "HE5_ZAchunkinfo", __LINE__, H5E_PLIST, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the data space ID */ /* --------------------- */ dspace = H5Dget_space(fieldID); if(dspace == FAIL) { sprintf(errbuf, "Cannot get the data space ID for the \"%s\" data field.\n", fldname); H5Epush(__FILE__, "HE5_ZAchunkinfo", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the dataset rank */ /* -------------------- */ ndims = H5Sget_simple_extent_ndims(dspace); if(ndims == FAIL) { sprintf(errbuf, "Cannot get the rank of the dataset.\n"); H5Epush(__FILE__, "HE5_ZAchunkinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get Layout */ /* ---------- */ layout = H5Pget_layout(plist); if (layout == H5D_LAYOUT_ERROR) { sprintf(errbuf, "Cannot get the layout of the raw data. \n"); H5Epush(__FILE__, "HE5_ZAchunkinfo", __LINE__, H5E_PLIST, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } else if (layout == H5D_CHUNKED) { /* Get chunking */ /* ------------ */ *chunk_rank = H5Pget_chunk(plist, ndims, chunk_dims); if (*chunk_rank == FAIL) { sprintf(errbuf, "Cannot get the sizes of chunks. \n"); H5Epush(__FILE__, "HE5_ZAchunkinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } else { *chunk_rank = 0; } /* Release property list ID */ /* ------------------------ */ status = H5Pclose(plist); if (status == FAIL ) { sprintf(errbuf, "Cannot release property list ID. \n"); H5Epush(__FILE__, "HE5_ZAchunkinfo", __LINE__, H5E_PLIST, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Release the data space ID */ /* ------------------------- */ status = H5Sclose(dspace); if( status == FAIL) { sprintf(errbuf, "Cannot release the data space ID.\n"); H5Epush(__FILE__, "HE5_ZAchunkinfo", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAnentries | | | | DESCRIPTION: Returns number of entries and string buffer size | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nEntries long Number of entries | | | | INPUTS: | | zaID hid_t ZA structure ID | | entrycode int Entry code: | | | | HE5_HDFE_NENTDIM (0) | | HE5_HDFE_NENTMAP (1) | | HE5_HDFE_NENTIMAP (2) | | HE5_HDFE_NENTDFLD (4) | | | | OUTPUTS: | | strbufsize long* Length of comma-separated list | | (Does not include null-terminator) | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_ZAnentries(hid_t zaID, int entrycode, long *strbufsize) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ long idx = FAIL;/* za index */ long nEntries = 0; /* Number of entries */ long metaflag = FAIL;/* Old (0), New (1) metadata flag) */ long nVal = 0; /* Number of strings to search for */ long i; /* Loop index */ char *metabuf = (char *)NULL; /* Ptr to SM */ char *metaptrs[2]={NULL,NULL}; /* Start/end of SM */ char utlstr[HE5_HDFE_UTLBUFSIZE];/* Utility string */ char valName[2][32]; /* Strings to search for */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAnentries", &fid, &gid, &idx); if (status == SUCCEED) { /* Zero out string buffer size */ /* --------------------------- */ *strbufsize = 0; /* * Get pointer to relevant section within SM and Get names of * metadata strings to inquire about */ switch (entrycode) { case HE5_HDFE_NENTDIM: /* Dimensions */ /* ---------- */ { metabuf = (char *)HE5_EHmetagroup(fid, HE5_ZAXZa[idx].zaname, "z", "Dimension", metaptrs); nVal = 1; strcpy(&valName[0][0], "DimensionName"); } break; case HE5_HDFE_NENTMAP: /* Dimension Maps */ /* -------------- */ { metabuf = (char *)HE5_EHmetagroup(fid, HE5_ZAXZa[idx].zaname, "z", "DimensionMap", metaptrs); nVal = 1; strcpy(&valName[0][0], "DataDimension"); } break; case HE5_HDFE_NENTIMAP: /* Indexed Dimension Maps */ /* ---------------------- */ { metabuf = (char *)HE5_EHmetagroup(fid, HE5_ZAXZa[idx].zaname, "z","IndexDimensionMap", metaptrs); nVal = 1; strcpy(&valName[0][0], "DataDimension"); } break; case HE5_HDFE_NENTDFLD: /* Data Fields */ /* ----------- */ { metabuf = (char *)HE5_EHmetagroup(fid, HE5_ZAXZa[idx].zaname, "z", "DataField", metaptrs); nVal = 1; strcpy(&valName[0][0], "DataFieldName"); } break; default: { sprintf(errbuf,"Invalid (unsupported) entry code \"%d\". \n", entrycode); H5Epush(__FILE__, "HE5_ZAnentries", __LINE__, H5E_ARGS, H5E_UNSUPPORTED, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } break; } if ( metabuf == NULL ) { nEntries = FAIL; sprintf(errbuf,"Cannot get the number of entries. \n"); H5Epush(__FILE__, "HE5_ZAnentries", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(nEntries); } /* * Check for presence of 'GROUP="' string If found then old metadata, * search on OBJECT string */ metaflag = (strstr(metabuf, "GROUP=\"") == NULL) ? 1 : 0; if (metaflag == 0) { nVal = 1; strcpy(&valName[0][0], "\t\tOBJECT"); } /* Begin loop through entries in metadata */ /* -------------------------------------- */ while (1) { /* Search for first string */ /* ----------------------- */ strcpy(utlstr, &valName[0][0]); strcat(utlstr, "="); metaptrs[0] = strstr(metaptrs[0], utlstr); /* If found within relevant metadata section ... */ /* --------------------------------------------- */ if (metaptrs[0] < metaptrs[1] && metaptrs[0] != NULL) { for (i = 0; i < nVal; i++) { /* * Get all string values Don't count quotes */ status = HE5_EHgetmetavalue(metaptrs, &valName[i][0], utlstr); if ( status == FAIL ) { nEntries = FAIL; sprintf(errbuf,"Cannot get metavalue. \n"); H5Epush(__FILE__, "HE5_ZAnentries", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(metabuf); return(nEntries); } *strbufsize += strlen(utlstr) - 2; } /* Increment number of entries */ /* --------------------------- */ nEntries++; /* Go to end of OBJECT */ /* ------------------- */ metaptrs[0] = strstr(metaptrs[0], "END_OBJECT"); } else /* No more entries found */ /* --------------------- */ { break; } } if (metabuf != NULL) free(metabuf); /* Count comma separators & slashes (if mappings) */ /* ---------------------------------------------- */ if (nEntries > 0) { *strbufsize += nEntries - 1; *strbufsize += (nVal - 1) * nEntries; } } return(nEntries); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAinqza | | | | DESCRIPTION: Returns number and names of ZA structures in file | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nZA long Number of ZA structures in file | | | | INPUTS: | | filename const char* HDF-EOS filename | | | | OUTPUTS: | | zalist char* List of za names (comma-separated) | | strbufsize long* Length of zalist | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_ZAinqza(const char *filename, char *zalist, long *strbufsize) { long nZA = FAIL; /* Number of zas in file */ herr_t status = FAIL; /* Return status variable */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ CHECKPOINTER(filename); /* Call "HE5_EHinquire" routine */ /* ---------------------------- */ nZA = HE5_EHinquire(filename, "/HDFEOS/ZAS", zalist, strbufsize); if ( nZA == FAIL ) { sprintf(errbuf,"Cannot get information about ZA. \n"); H5Epush(__FILE__, "HE5_ZAinqza", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } COMPLETION: return(nZA); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAwrrdfield | | | | DESCRIPTION: Writes/Reads fields | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t ZA structure ID | | fldname char* field name | | code char* Write/Read code (w/r) | | start hssize_t start array | | stride hsize_t stride array | | count hsize_t count array | | datbuf void data buffer for read | | | | OUTPUTS: | | datbuf void data buffer for write | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | Jan 04 S.Zhao Added to write/read a character string dataset. | | Apr 04 S.Zhao Modified for a character string dataset. | | Feb 05 S.Zhao Replaced the "count" array by the "dims" array if | | it was declared larger than the dimension size. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ static herr_t HE5_ZAwrrdfield(hid_t zaID, char *fldname, char *code, const hssize_t start[], const hsize_t stride[], const hsize_t count[], void *datbuf) { herr_t status = FAIL; /* routine return status variable */ int i; /* Loop index */ int startf = 0; /* flag (if start is NULL) */ int countf = 0; /* flag (if counf is NULL) */ int bothf = 0; /* flag (if start and count are NULL) */ int append = FALSE;/* FLAG (if field is appendable) */ int rank = FAIL; /* Rank of dataset */ int maxrank = 0; /* Rank dummy variable */ int nameflag = FAIL; /* Actual (1)/Alias (0) field name */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t fieldID = FAIL;/* fieldname Dataset ID */ hid_t fspace = FAIL;/* file data space ID */ hid_t mid = FAIL;/* memory data space ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t tid = FAIL;/* datatype ID */ hid_t mtype = FAIL;/* Memory data type ID */ long idx = FAIL;/* za index */ hsize_t dims[HE5_DTSETRANKMAX]; /* Field dimensions */ hsize_t maxdims[HE5_DTSETRANKMAX];/* Field maximum dimensions */ hssize_t *tstart =(hssize_t *)NULL;/* Not NULL "start" value */ hsize_t *tcount = (hsize_t *)NULL;/* Not NULL "count" value */ hsize_t *lcount = (hsize_t *)NULL; hsize_t dimsize = 0; /* Field dimension size */ hsize_t size[HE5_DTSETRANKMAX]; /* Extended dimension size */ hid_t ntype[1] = {FAIL}; /* Datatype ID */ char *dimbuf = (char *)NULL; char *comma = (char *)NULL; char *dimcheck = (char *)NULL; char fieldname[HE5_HDFE_NAMBUFSIZE]; /* Field name buffer */ char fldactualname[HE5_HDFE_NAMBUFSIZE];/* Actual field name */ char maxdimlist[HE5_HDFE_DIMBUFSIZE]; /* Maximum dimension list */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ H5T_class_t classid = H5T_NO_CLASS; /* data type class ID */ int ibuf; /* Loop index */ char **chardatbuf = NULL; /* string data buffer */ int maxlen = 0; /* max length in array of string */ int strsize = 0; /* each str length in array of str */ hsize_t numattr[1]; /* number of attribute elements */ int mycount = 0; /* flag */ long strbufsize1; /* string buffer size */ long strbufsize2; /* string buffer size */ long nattr = 0; /* number of attributes */ char *attrlist1 = (char *)NULL;/* attribute list */ char *attrlist2 = (char *)NULL;/* attribute list */ char *attptr = (char *)NULL; /* attribute pointer */ CHECKNAME(fldname); /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAwrrdfield", &fid, &gid, &idx); if (status == FAIL) return(status); /* Call HE5_ZAfldnameinfo() to get actual field name */ /* ------------------------------------------------- */ nameflag = HE5_ZAfldnameinfo(zaID, fldname, fldactualname); if ( nameflag == FAIL ) { sprintf(errbuf, "Cannot get actual name of the field.\n"); H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__,H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Name is not alias */ /* ----------------- */ if (nameflag == TRUE) { strcpy(fieldname,""); strcpy(fieldname,fldname); } /* Name is an alias */ /* ---------------- */ if (nameflag == FALSE) { strcpy(fieldname,""); strcpy(fieldname,fldactualname); } /* Initialize dims[]/maxdims[]/size[] arrays */ /* ----------------------------------------- */ for (i = 0; i < HE5_DTSETRANKMAX; i++) { dims[i] = 0; maxdims[i] = 0; size[i] = 0; } /* Check whether fieldname is in dataset (multi-dim field) */ /* ------------------------------------------------------- */ status = HE5_ZAinfo(zaID, fieldname, &rank, dims, ntype, NULL, maxdimlist); if( status == FAIL ) { sprintf(errbuf,"Cannot get information about \"%s\" field. \n", fieldname); H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Find out if the field is appendable */ /* ----------------------------------- */ dimbuf = (char *) calloc(strlen(maxdimlist) + 64, sizeof(char)); if(dimbuf == NULL) { sprintf(errbuf,"Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } strcpy(dimbuf,maxdimlist); strcat(dimbuf,","); comma = strchr(dimbuf,','); while(comma != NULL) { dimcheck = (char *) calloc(comma - dimbuf + 1, sizeof(char)); if(dimcheck == NULL) { sprintf(errbuf,"Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(dimbuf); return(FAIL); } memmove(dimcheck,dimbuf,comma-dimbuf); /* Get dimension size */ /* ------------------ */ dimsize = HE5_ZAdiminfo(zaID, dimcheck); if ( (dimsize > 0 && strcmp(dimcheck,"Unlim") != 0 ) || (dimsize == H5S_UNLIMITED && strcmp(dimcheck,"Unlim") == 0 ) ) { maxdims[maxrank] = dimsize; maxrank++; } memmove(dimbuf,comma+1,strlen(comma+1)+1); comma = strchr(dimbuf,','); free(dimcheck); } free(dimbuf); for(i = 0; i < rank; i++) { if( dims[i] == maxdims[i] ) append = FALSE; else if ( (dims[i] < maxdims[i]) || (maxdims[i] == H5S_UNLIMITED)) { append = TRUE; break; } else { sprintf(errbuf,"Maximum dimension size is smaller than dimension size.\n"); H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } if(start == NULL) { tstart = (hssize_t *)calloc(rank, sizeof(hssize_t)); for(i = 0; i < rank; i++) tstart[ i ] = 0; startf = 1; } if(count == NULL) { tcount = (hsize_t *)calloc(rank, sizeof(hsize_t)); for(i = 0; i < rank; i++) tcount[ i ] = dims[ i ]; if(startf == 1) bothf = 1; else countf = 1; } else { lcount = (hsize_t *)calloc(rank, sizeof(hsize_t)); for(i = 0; i < rank; i++) { if(count[ i ] > dims[ i ]) lcount[ i ] = dims[ i ]; else lcount[ i ] = count[ i ]; } } if (append == TRUE) { /* Get the field-related dataset ID */ /* -------------------------------- */ HE5_ZAfieldsizeID(zaID, fieldname, &fieldID); if(bothf == 1) status = H5Dextend(fieldID, tcount); else if(startf == 1) status = H5Dextend(fieldID, lcount); else if(countf == 1) status = H5Dextend(fieldID, tcount); else { for(i = 0; i < rank; i++) size[ i ] = start[ i ] + lcount[ i ]; /* Extend the dataset size */ /* ----------------------- */ status = H5Dextend(fieldID, size); } if( status == FAIL) { sprintf(errbuf,"Cannot extend the dataset. \n"); H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } } if (append == FALSE) { /* Get the field-related dataset ID */ /* -------------------------------- */ HE5_ZAfieldsizeID(zaID, fieldname, &fieldID); } /* Get the file space ID */ /* --------------------- */ fspace = H5Dget_space(fieldID ); if( fspace == FAIL) { sprintf(errbuf,"Cannot get data space ID. \n"); H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } /* Select the hyperslab */ /* -------------------- */ if(bothf == 1) status = H5Sselect_hyperslab( fspace, H5S_SELECT_SET, (const hsize_t *)tstart,stride,tcount,NULL); else if(startf == 1) status = H5Sselect_hyperslab( fspace, H5S_SELECT_SET, (const hsize_t *)tstart,stride,lcount,NULL); else if(countf == 1) status = H5Sselect_hyperslab( fspace, H5S_SELECT_SET, (const hsize_t *)start,stride,tcount,NULL); else status = H5Sselect_hyperslab( fspace, H5S_SELECT_SET, (const hsize_t *)start,stride,lcount,NULL) ; if( status == FAIL ) { sprintf(errbuf,"Cannot select a hyperslab. \n"); H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } /* Define memory space */ /* =================== */ if(countf == 1 || bothf == 1) mid = H5Screate_simple(rank, tcount, NULL); else mid = H5Screate_simple(rank, lcount, NULL); if( mid == FAIL) { sprintf(errbuf,"Cannot create the data space.\n"); H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_DATASPACE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } /* Get the data type ID */ /* -------------------- */ tid = H5Dget_type(fieldID ); if( tid == FAIL ) { sprintf(errbuf,"Cannot get the data type ID.\n"); H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } /* Get the data type class ID */ /* -------------------------- */ classid = H5Tget_class(tid); if (classid == H5T_NO_CLASS) { sprintf(errbuf,"Cannot get the data type class ID.\n"); H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } /* Write/read whole data to/from the dataset */ /* ========================================= */ if( strcmp(code,"w") == 0) { strbufsize1 = 0; nattr = HE5_ZAinqlocattrs(zaID, fieldname, NULL, &strbufsize1); if ( nattr < 0 ) { sprintf(errbuf, "Cannot retrieve the attributes. \n"); H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } attrlist1 = (char *) calloc(strbufsize1 + 2, sizeof(char)); if (attrlist1 == NULL) { sprintf(errbuf, "Cannot allocate memory for attrlist1.\n") ; H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } nattr = HE5_ZAinqlocattrs(zaID, fieldname, attrlist1, &strbufsize1); if ( nattr < 0 ) { sprintf(errbuf, "Cannot retrieve the attributes. \n"); H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (attrlist1 != NULL) { free(attrlist1); attrlist1 = NULL; } if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } attptr = strstr(attrlist1,"ARRAYOFSTRINGS"); if ( (classid == H5T_STRING) && (attptr == NULL) ) { status = H5Dwrite(fieldID, tid, mid, fspace, H5P_DEFAULT, datbuf); if( status == FAIL ) { sprintf(errbuf,"Cannot write data to the dataset.\n"); H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (attrlist1 != NULL) { free(attrlist1); attrlist1 = NULL; } if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(status); } } else if ( (classid == H5T_STRING) && (attptr != NULL) ) { strbufsize2 = 0; nattr = HE5_ZAinqlocattrs(zaID, fieldname, NULL, &strbufsize2); if ( nattr < 0 ) { sprintf(errbuf, "Cannot retrieve the attributes. \n"); H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (attrlist1 != NULL) { free(attrlist1); attrlist1 = NULL; } if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } attrlist2 = (char *) calloc(strbufsize2 + 2, sizeof(char)); if (attrlist2 == NULL) { sprintf(errbuf, "Cannot allocate memory for attrlist2.\n") ; H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (attrlist1 != NULL) { free(attrlist1); attrlist1 = NULL; } if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } nattr = HE5_ZAinqlocattrs(zaID, fieldname, attrlist2, &strbufsize2); if ( nattr < 0 ) { sprintf(errbuf, "Cannot retrieve the attributes. \n"); H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (attrlist1 != NULL) { free(attrlist1); attrlist1 = NULL; } if (attrlist2 != NULL) { free(attrlist2); attrlist2 = NULL; } if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(FAIL); } if ( (nattr == 0) || ((attptr = strstr(attrlist2,"StringLengthAttribute")) == NULL) ) { chardatbuf = (char **)datbuf; if (count == NULL) mycount = tcount[0]; if (count != NULL) mycount = *lcount; for (ibuf = 0; ibuf < mycount; ibuf++) { if (chardatbuf[ibuf] == NULL) strsize = 0; else strsize = strlen(chardatbuf[ibuf]); if (strsize > maxlen) maxlen = strsize; } numattr[0] = 1; status = HE5_ZAwritelocattr(zaID, fieldname, "StringLengthAttribute", H5T_NATIVE_INT, numattr, &maxlen); if (status == FAIL) { sprintf(errbuf, "Cannot write attribute to the field \"%s\".",fieldname) ; H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (attrlist1 != NULL) { free(attrlist1); attrlist1 = NULL; } if (attrlist2 != NULL) { free(attrlist2); attrlist2 = NULL; } if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(status); } } status = H5Dwrite(fieldID, tid, mid, fspace, H5P_DEFAULT, datbuf); if( status == FAIL ) { sprintf(errbuf,"Cannot write data to the dataset.\n"); H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (attrlist1 != NULL) { free(attrlist1); attrlist1 = NULL; } if (attrlist2 != NULL) { free(attrlist2); attrlist2 = NULL; } if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(status); } } else { /* Get memory data type ID */ /* ----------------------- */ mtype = HE5_EHdtype2mtype(tid); if( mtype == FAIL ) { sprintf(errbuf,"Cannot convert to memory data type.\n"); status = FAIL; H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (attrlist1 != NULL) { free(attrlist1); attrlist1 = NULL; } if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(status); } status = H5Dwrite(fieldID, mtype, mid, fspace, H5P_DEFAULT, datbuf); if( status == FAIL ) { sprintf(errbuf,"Cannot write data to the dataset.\n"); H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (attrlist1 != NULL) { free(attrlist1); attrlist1 = NULL; } if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(status); } } if (attrlist1 != NULL) { free(attrlist1); attrlist1 = NULL; } if (attrlist2 != NULL) { free(attrlist2); attrlist2 = NULL; } } else { if (classid == H5T_STRING) { /* Read the data buffer */ /* -------------------- */ status = H5Dread(fieldID, tid, mid, fspace , H5P_DEFAULT, datbuf); if( status == FAIL ) { sprintf(errbuf,"Cannot read data from the dataset.\n"); H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(status); } } else { /* Get memory data type ID */ /* ----------------------- */ mtype = HE5_EHdtype2mtype(tid); if( mtype == FAIL ) { sprintf(errbuf,"Cannot convert to memory data type.\n"); status = FAIL; H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(status); } /* Read the data buffer */ /* -------------------- */ status = H5Dread(fieldID, mtype, mid, fspace , H5P_DEFAULT, datbuf); if( status == FAIL ) { sprintf(errbuf,"Cannot read data from the dataset.\n"); H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (start == NULL) { if (tstart != NULL) free(tstart); } if (count == NULL) { if (tcount != NULL) free(tcount); } if (lcount != NULL) free(lcount); return(status); } } } if ( count == NULL) { if(tcount != NULL) free(tcount); } if( start == NULL) { if(tstart != NULL) free(tstart); } if (lcount != NULL) free(lcount); /* Release data space ID */ /* --------------------- */ status = H5Sclose(mid); if( status == FAIL ) { sprintf(errbuf,"Cannot release memory data space ID.\n"); H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release data space ID */ /* --------------------- */ status = H5Sclose(fspace); if( status == FAIL ) { sprintf(errbuf,"Cannot release the file data space ID.\n"); H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release data type ID */ /* -------------------- */ status = H5Tclose(tid); if( status == FAIL ) { sprintf(errbuf,"Cannot release the data type ID.\n"); H5Epush(__FILE__, "HE5_ZAwrrdfield", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } COMPLETION: return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAwrite | | | | DESCRIPTION: Writes data to field | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t ZA structure ID | | za_name char* za name | | start hssize_t start array | | stride hsize_t stride array | | count hsize_t count array | | | | OUTPUTS: | | datbuf void* data buffer for write | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAwrite(hid_t zaID, char *za_name, const hssize_t start[], const hsize_t stride[], const hsize_t count[], void *datbuf) { herr_t status = FAIL;/* routine return status variable */ HE5_LOCK; CHECKNAME(za_name); CHECKPOINTER(datbuf); status = HE5_ZAwrrdfield(zaID, za_name, "w", start, stride, count, datbuf); COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAread | | | | DESCRIPTION: Reads data from field | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t ZA structure ID | | za_name char* za name | | start hssize_t start array | | stride hsize_t stride array | | count hsize_t count array | | datbuf void* data buffer for read | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAread(hid_t zaID, char *za_name, const hssize_t start[], const hsize_t stride[], const hsize_t count[], void *datbuf) { herr_t status = FAIL;/* routine return status variable */ HE5_LOCK; CHECKPOINTER(za_name); status = HE5_ZAwrrdfield(zaID, za_name, "r", start, stride, count, datbuf); COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAfldsrch | | | | DESCRIPTION: Retrieves information about field DATASET | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | fldgroup int Flag representing the group: | | "Data Fields". (-1) FAILS. | | INPUTS: | | zaID hid_t ZA structure ID | | fldname char field name | | | | OUTPUTS: | | fieldID hid_t Field dataset ID | | rank int dataset Rank | | dims hsize_t Dimensions of field | | typeID hid_t Data type ID | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAfldsrch(hid_t zaID, char *fldname, hid_t *fieldID, int *rank, hsize_t dims[], hid_t *typeID) { int fldgroup = FAIL; /* Field group flag (return value) */ int i; /* Loop index */ int nameflag = FAIL; /* Alias (0) /actual (1) name flag */ herr_t status = FAIL; /* routine return status variable */ hid_t idx = FAIL; /* za index */ hid_t idOffset = HE5_ZAIDOFFSET;/* za ID offset */ hid_t spaceID = FAIL; /* File data space ID */ char fieldname[HE5_HDFE_NAMBUFSIZE]; /* Buffer for name of a field */ char fldactualname[HE5_HDFE_NAMBUFSIZE];/* Actual name of a field */ char fldtype ='n'; /* Internal group discriminating flag */ char name[HE5_HDFE_NAMBUFSIZE]; /* Field Name buffer */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Buffer for error message */ CHECKPOINTER(fldname); /* Compute "reduced" za ID */ /* ----------------------- */ idx = zaID % idOffset; /* Call HE5_ZAfldnameinfo() to get actual field name */ /* ------------------------------------------------- */ nameflag = HE5_ZAfldnameinfo(zaID, fldname, fldactualname); if (nameflag == FAIL) { sprintf(errbuf, "Cannot get actual name of the field.\n"); H5Epush(__FILE__, "HE5_ZAfldsrch", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } if (nameflag == FALSE) { strcpy(fieldname,""); strcpy(fieldname,fldactualname); } if (nameflag == TRUE) { strcpy(fieldname,""); strcpy(fieldname,fldname); } /* Loop through all data datasets in za */ /* ------------------------------------ */ for (i = 0; i < HE5_ZAXZa[idx].nDFLD; i++) { /* get dataset name */ /* ---------------- */ strcpy(name, HE5_ZAXZa[idx].ddataset[i].name); if( strcmp(fieldname, name) == 0 ) { fldtype ='d'; fldgroup = HE5_HDFE_DATAGROUP; break; } } if (fieldID != NULL) { /* Get dataset ID */ /* ============== */ if( fldtype =='d') *fieldID = HE5_ZAXZa[idx].ddataset[i].ID; else { sprintf(errbuf,"Cannot find \"%s\" field in za. Check the spelling.\n", fieldname); H5Epush(__FILE__, "HE5_ZAfldsrch", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get data space ID */ /* ----------------- */ spaceID = H5Dget_space(*fieldID); if (spaceID == FAIL) { sprintf(errbuf,"Cannot get the data space ID.\n"); H5Epush(__FILE__, "HE5_ZAfldsrch", __LINE__, H5E_DATASPACE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } if (rank != NULL) { /* Get dataset rank */ /* ---------------- */ *rank = H5Sget_simple_extent_ndims(spaceID); if (*rank == FAIL) { sprintf(errbuf,"Cannot get the dataset rank.\n"); H5Epush(__FILE__, "HE5_ZAfldsrch", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } if (typeID != NULL || dims != NULL) { /* Get data type ID */ /* ---------------- */ *typeID = H5Dget_type(*fieldID); if (*typeID == FAIL) { sprintf(errbuf,"Cannot get the data type ID.\n"); H5Epush(__FILE__, "HE5_ZAfldsrch", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get dimension sizes */ /* ------------------- */ status = H5Sget_simple_extent_dims(spaceID, dims, NULL); if (status == FAIL) { sprintf(errbuf,"Cannot get the data space dimension sizes.\n"); H5Epush(__FILE__, "HE5_ZAfldsrch", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Release data type ID */ /* -------------------- */ status = H5Tclose(*typeID); if (status == FAIL) { sprintf(errbuf,"Cannot release the data type ID.\n"); H5Epush(__FILE__, "HE5_ZAfldsrch", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Release data space ID */ /* --------------------- */ status = H5Sclose(spaceID); if (status == FAIL) { sprintf(errbuf,"Cannot release the data space ID.\n"); H5Epush(__FILE__, "HE5_ZAfldsrch", __LINE__, H5E_DATASPACE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } } COMPLETION: return(fldgroup); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAdetach | | | | DESCRIPTION: Detachs za structure and performs housekeeping | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t ZA structure ID | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAdetach(hid_t zaID) { herr_t status = FAIL; /* Return status variable */ long idx = FAIL; /* za index */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ int k; /* Loop indices */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAdetach", &fid, &gid, &idx); if (status == SUCCEED) { /* "Detach" from previously attached "Data Fields" datasets */ /* -------------------------------------------------------- */ if( HE5_ZAXZa[idx].nDFLD > 0 ) { for (k = 0; k < HE5_ZAXZa[idx].nDFLD; k++) { if ( HE5_ZAXZa[idx].ddataset[k].ID > 0 ) { status = H5Dclose(HE5_ZAXZa[idx].ddataset[k].ID); if (status == FAIL) { sprintf(errbuf, "Cannot release the data dataset ID. \n") ; H5Epush(__FILE__, "HE5_ZAdetach", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } if(HE5_ZAXZa[idx].ddataset[k].name != NULL) free(HE5_ZAXZa[idx].ddataset[k].name); } if (HE5_ZAXZa[idx].ddataset != NULL) free(HE5_ZAXZa[idx].ddataset); } /* Detach from the za groups */ /* ------------------------- */ if ( HE5_ZAXZa[idx].data_id > 0 ) { status = H5Gclose(HE5_ZAXZa[idx].data_id); if (status == FAIL) { sprintf(errbuf, "Cannot release the \"Data Fields\" group ID. \n") ; H5Epush(__FILE__, "HE5_ZAdetach", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } if ( HE5_ZAXZa[idx].za_id > 0 ) { status = H5Gclose(HE5_ZAXZa[idx].za_id); if (status == FAIL) { sprintf(errbuf, "Cannot release the za group ID. \n") ; H5Epush(__FILE__, "HE5_ZAdetach", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } /* Delete entries from External Arrays */ /* ----------------------------------- */ HE5_ZAXZa[idx].active = 0; HE5_ZAXZa[idx].data_id = 0; HE5_ZAXZa[idx].ddataset = NULL; HE5_ZAXZa[idx].fid = 0; HE5_ZAXZa[idx].za_id = 0; HE5_ZAXZa[idx].obj_id = 0; HE5_ZAXZa[idx].nDFLD = 0; } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAsetfillvalue | | | | DESCRIPTION: Sets fill value for the specified field. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t ZA structure ID | | fieldname char* field name | | numbertype hid_t number type | | fillval void* fill value | | | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | Mar 04 S.Zhao Modified for a character string dataset. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAsetfillvalue(hid_t zaID, char *fieldname, hid_t numbertype_in, void *fillval) { herr_t status = FAIL;/* return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ long idx = FAIL;/* za index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ hid_t numbertype; HE5_LOCK; CHECKPOINTER(fillval); /* Convert HDF-EOS5 datatype to HDF5 datatype */ if ( H5Tequal(numbertype_in, H5T_NATIVE_CHAR) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_SCHAR) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_UCHAR) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_SHORT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_USHORT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_INT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_UINT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_LONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_ULONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_LLONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_ULLONG) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_FLOAT) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_DOUBLE) == TRUE || H5Tequal(numbertype_in, H5T_NATIVE_LDOUBLE)== TRUE || H5Tequal(numbertype_in, H5T_C_S1) == TRUE) { numbertype = numbertype_in; } else { numbertype = HE5_EHconvdatatype((int) numbertype_in); } if(numbertype == FAIL) { sprintf(errbuf,"Cannot convert to HDF5 type data type ID for fillvalue.\n"); H5Epush(__FILE__, "HE5_ZAsetfillvalue", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAsetfillvalue", &fid, &gid, &idx); if(status == FAIL) { sprintf(errbuf,"Checking for valid za ID failed.\n"); H5Epush(__FILE__, "HE5_ZAsetfillvalue", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get current dataset creation property list */ /* ------------------------------------------ */ if( HE5_ZAXZa[idx].plist == FAIL) { HE5_ZAXZa[idx].plist = H5Pcreate(H5P_DATASET_CREATE); if (HE5_ZAXZa[idx].plist == FAIL) { sprintf(errbuf,"Cannot create the dataset property list.\n"); H5Epush(__FILE__, "HE5_ZAsetfillvalue", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } /* Set fill value */ /* -------------- */ if ((numbertype != HE5T_CHARSTRING) && (numbertype != H5T_NATIVE_CHAR) && (numbertype != H5T_C_S1)) { status = H5Pset_fill_value(HE5_ZAXZa[idx].plist, numbertype, fillval); if(status == FAIL) { sprintf(errbuf,"Cannot set fill value for \"%s\" field.\n", fieldname); H5Epush(__FILE__, "HE5_ZAsetfillvalue", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAgetfillvalue | | | | DESCRIPTION: Retrieves fill value for a specified field. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t ZA structure ID | | fieldname char* field name | | | | OUTPUTS: | | fillval void* fill value | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAgetfillvalue(hid_t zaID, char *fieldname, void *fillval) { herr_t status = FAIL;/* routine return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "HDFEOS" group ID */ hid_t fieldID = FAIL;/* field dataset ID */ hid_t tid = FAIL;/* field dataset data type ID */ hid_t plist = FAIL;/* field dataset property list ID */ long idx = FAIL;/* za index */ hsize_t count[1] = { 1 };/* number of attribute elements */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAgetfillvalue", &fid, &gid, &idx); if(status == FAIL) { sprintf(errbuf,"Checking for valid za ID failed.\n"); H5Epush(__FILE__, "HE5_ZAgetfillvalue", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Check out the field group and get field ID */ /* ------------------------------------------ */ HE5_ZAfldsrch(zaID,fieldname,&fieldID,NULL,NULL,NULL); if( fieldID == FAIL ) { sprintf(errbuf, "Cannot get the field ID for the \"%s\" field.\n", fieldname); H5Epush(__FILE__, "HE5_ZAgetfillvalue", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the property list ID */ /* ------------------------ */ plist = H5Dget_create_plist(fieldID); if ( plist == FAIL ) { sprintf(errbuf, "Cannot get the property list ID for the \"%s\" data field.\n", fieldname); H5Epush(__FILE__, "HE5_ZAgetfillvalue", __LINE__, H5E_PLIST, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the datatype ID */ /* ------------------- */ tid = H5Dget_type(fieldID); if ( tid == FAIL ) { sprintf(errbuf, "Cannot get the data type ID for the \"%s\" data field.\n", fieldname); H5Epush(__FILE__, "HE5_ZAgetfillvalue", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Read out a fill value from the attribute */ /* ---------------------------------------- */ status = HE5_EHattr(fieldID, "_FillValue", tid, count, "r", fillval); if (status == FAIL ) { sprintf(errbuf, "Cannot get fill value for the \"%s\" field.\n", fieldname); H5Epush(__FILE__, "HE5_ZAgetfillvalue", __LINE__, H5E_ATTR, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release data type ID */ /* -------------------- */ status = H5Tclose(tid); if (status == FAIL ) { sprintf(errbuf, "Cannot release data type ID for the \"%s\" dataset.\n", fieldname); H5Epush(__FILE__, "HE5_ZAgetfillvalue", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Release property list ID */ /* ------------------------ */ status = H5Pclose(plist); if (status == FAIL ) { sprintf(errbuf, "Cannot release property list ID for the \"%s\" dataset.\n", fieldname); H5Epush(__FILE__, "HE5_ZAgetfillvalue", __LINE__, H5E_PLIST, H5E_CLOSEERROR,errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAclose | | | | DESCRIPTION: Closes HDF-EOS file | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | fid hid_t File ID | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAclose(hid_t fid) { herr_t status = FAIL;/* routine return status variable */ /* Call HE5_EHclose to perform file close */ /* -------------------------------------- */ status = HE5_EHclose(fid); return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAfieldsizeID | | | | DESCRIPTION: Returns the size (in bytes) of field-related data type, | | otherwise returns 0. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | size size_t Size of field data type | | | | INPUTS: | | zaID hid_t ZA structure ID | | fieldname char fieldname | | | | OUTPUTS: | | fieldID hid_t field-related dataset ID | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ static size_t HE5_ZAfieldsizeID( hid_t zaID, char *fieldname, hid_t *fieldID) { size_t size = 0; /* Size of field data type */ herr_t status = FAIL; /* Return status variable */ int i; /* Loop index */ int found = 0; /* Flag */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t dtype = FAIL; /* datatype ID */ long idx = FAIL; /* ZA index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Buffer for error message */ CHECKPOINTER(fieldname); /* Get HDF-EOS file ID, "HDFEOS" group ID and ZA index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAfieldsizeID", &fid, &gid, &idx); /* Loop through all data fields in ZA */ /* ---------------------------------- */ for (i = 0; i < HE5_ZAXZa[idx].nDFLD; i++) { if( strcmp(fieldname, HE5_ZAXZa[idx].ddataset[i].name) == 0 ) { /* get dataset ID */ /* -------------- */ *fieldID = HE5_ZAXZa[idx].ddataset[i].ID; dtype = H5Dget_type(*fieldID); if (dtype == FAIL) { sprintf(errbuf, "Cannot get the dataset data type. \n"); H5Epush(__FILE__, "HE5_ZAfieldsizeID", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(0); } size = H5Tget_size(dtype); if (size == 0) { sprintf(errbuf, "Cannot get the data type size. \n"); H5Epush(__FILE__, "HE5_ZAfieldsizeID", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(0); } status = H5Tclose(dtype); if (status == FAIL) { sprintf(errbuf, "Cannot release the data type ID. \n"); H5Epush(__FILE__, "HE5_ZAfieldsizeID", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(0); } found = 1; break; } } if( found == 0 ) { sprintf(errbuf, "field \"%s\" is not in ZA. \n", fieldname); H5Epush(__FILE__, "HE5_ZAfieldsizeID", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } COMPLETION: return(size); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAwritegrpattr | | | | DESCRIPTION: Writes/updates attribute associated with the "Data Fields" | | group in a za. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t ZA structure ID | | attrname char attribute name | | numbertype hid_t attribute dataset datatype ID | | count[] hsize_t Number of attribute elements | | datbuf void I/O buffer | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAwritegrpattr(hid_t zaID, const char *attrname, hid_t numtype, hsize_t count[], void *datbuf) { herr_t status = FAIL; /* Return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t DataFieldsGrpID = FAIL; /* "Data Fields" group ID */ long idx = FAIL; /* za index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ hid_t numbertype; HE5_LOCK; CHECKNAME(attrname); CHECKPOINTER(count); CHECKPOINTER(datbuf); /* if ntype is HE5 numbertype, rather than H5 numbertype, then convert it, otherwise use ntype itself */ numbertype = HE5_EHconvdatatype(numtype); if(numbertype == FAIL) { numbertype = numtype; } /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAwritegrpattr", &fid, &gid, &idx); if (status == SUCCEED) { /* Get "Data Fields" group ID and call HE5_EHattr to perform I/O */ /* ------------------------------------------------------------- */ DataFieldsGrpID = H5Gopen(HE5_ZAXZa[idx].za_id, "Data Fields"); if(DataFieldsGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"Data Fields\" group ID. \n"); H5Epush(__FILE__, "HE5_ZAwritegrpattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } status = HE5_EHattr(DataFieldsGrpID, attrname, numbertype, count,"w", datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot write Attribute \"%s\"to the \"Data Fields\" group.\n", attrname); H5Epush(__FILE__, "HE5_ZAwritegrpattr", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Gclose(DataFieldsGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"Data Fields\" group ID. \n"); H5Epush(__FILE__, "HE5_ZAwritegrpattr", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAreadgrpattr | | | | DESCRIPTION: Reads attribute from the "Data Fields" group in a za. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t ZA structure ID | | attrname char attribute name | | | | OUTPUTS: | | datbuf void I/O buffer | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAreadgrpattr(hid_t zaID, const char *attrname, void * datbuf) { herr_t status = FAIL; /* return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t ntype = FAIL; /* Data type ID */ hid_t DataFieldsGrpID = FAIL; /* "Data Fields" group ID */ long idx = FAIL; /* za index */ hsize_t count[] = { 0 }; /* # of attribute elements */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKPOINTER(attrname); /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAreadgrpattr", &fid, &gid, &idx); if (status == SUCCEED) { /* Get "Data Fields" group ID and call HE5_EHattr to perform I/O */ /* -------------------------------------------------------------- */ DataFieldsGrpID = H5Gopen(HE5_ZAXZa[idx].za_id, "Data Fields"); if(DataFieldsGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"Data Fields\" group ID.\n"); H5Epush(__FILE__, "HE5_ZAreadgrpattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } status = HE5_EHattr(DataFieldsGrpID,attrname,ntype,count,"r", datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot read Attribute \"%s\" from the \"Data Fields\" group.\n", attrname); H5Epush(__FILE__, "HE5_ZAreadgrpattr", __LINE__, H5E_ATTR, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Gclose(DataFieldsGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"Data Fields\" group ID.\n"); H5Epush(__FILE__, "HE5_ZAreadgrpattr", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAgrpattrinfo | | | | DESCRIPTION: Retrieves information about attributes in "Data Fields" group.| | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t ZA structure ID | | attrname const char* attribute name | | | | OUTPUTS: | | ntype hid_t data type ID | | count hsize_t Number of attribute elements | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAgrpattrinfo(hid_t zaID, const char *attrname, hid_t *ntype, hsize_t *count) { herr_t status = FAIL; /* routine return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t DataFieldsGrpID = FAIL; /* "Data Fields" group ID */ long idx = FAIL; /* za index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ CHECKPOINTER(attrname); /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAgrpattrinfo", &fid, &gid, &idx); if (status == SUCCEED) { /* Get "Data Fields" group ID and call HE5_EHattrinfo */ /* --------------------------------------------------- */ DataFieldsGrpID = H5Gopen(HE5_ZAXZa[idx].za_id, "Data Fields"); if(DataFieldsGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"Data Fields\" group ID.\n"); H5Epush(__FILE__, "HE5_ZAgrpattrinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } status = HE5_EHattrinfo(DataFieldsGrpID,attrname,ntype,count); if(status == FAIL) { sprintf(errbuf,"Cannot retrieve information about Attribute \"%s\" in the \"Data Fields\" group.\n", attrname); H5Epush(__FILE__, "HE5_ZAgrpattrinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Gclose(DataFieldsGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"Data Fields\" group ID.\n"); H5Epush(__FILE__, "HE5_ZAgrpattrinfo", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAgrpattrinfo2 | | | | DESCRIPTION: Retrieves information about attributes in "Data Fields" group.| | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t ZA structure ID | | attrname const char* attribute name | | | | OUTPUTS: | | ntype hid_t data type ID | | count hsize_t Number of attribute elements | | size hsize_t buf size of attribute elements | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAgrpattrinfo2(hid_t zaID, const char *attrname, hid_t *ntype, hsize_t *count, hsize_t *size) { herr_t status = FAIL; /* routine return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t DataFieldsGrpID = FAIL; /* "Data Fields" group ID */ long idx = FAIL; /* za index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ CHECKPOINTER(attrname); /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAgrpattrinfo2", &fid, &gid, &idx); if (status == SUCCEED) { /* Get "Data Fields" group ID and call HE5_EHattrinfo */ /* --------------------------------------------------- */ DataFieldsGrpID = H5Gopen(HE5_ZAXZa[idx].za_id, "Data Fields"); if(DataFieldsGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"Data Fields\" group ID.\n"); H5Epush(__FILE__, "HE5_ZAgrpattrinfo2", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } status = HE5_EHattrinfo2(DataFieldsGrpID,attrname,ntype,count, size); if(status == FAIL) { sprintf(errbuf,"Cannot retrieve information about Attribute \"%s\" in the \"Data Fields\" group.\n", attrname); H5Epush(__FILE__, "HE5_ZAgrpattrinfo2", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } status = H5Gclose(DataFieldsGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"Data Fields\" group ID.\n"); H5Epush(__FILE__, "HE5_ZAgrpattrinfo2", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } } COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAinqgrpattrs | | | | DESCRIPTION: Retrieves the number of attributes and string length of | | attribute list in "Data Fields" group | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nattr long Number of attributes in "Data Fields" | | group. | | INPUTS: | | zaID hid_t ZA structure ID | | | | OUTPUTS: | | attrnames char Attribute names in "Data Fields" group | | (Comma-separated list) | | strbufsize long Attributes name list string length | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_ZAinqgrpattrs(hid_t zaID, char *attrnames, long *strbufsize) { long nattr = FAIL; /* Number of attributes (return) */ long idx = FAIL; /* za index */ herr_t status = FAIL; /* Return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "ZAS" group ID */ char *grpname = (char *)NULL; /* Group name string */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAinqgrpattrs", &fid, &gid, &idx); if(status == SUCCEED ) { grpname = (char *)calloc(HE5_HDFE_NAMBUFSIZE, sizeof(char) ); if( grpname == NULL) { H5Epush(__FILE__, "HE5_ZAinqgrpattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Can not allocate memory"); HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__); return(FAIL); } strcpy(grpname,"/HDFEOS/ZAS/"); strcat(grpname, HE5_ZAXZa[idx].zaname); strcat(grpname,"/Data Fields"); /* search group with grpname for the number of attributes */ /* ------------------------------------------------------ */ nattr = HE5_EHattrcat(fid, grpname, attrnames, strbufsize); if ( nattr < 0 ) { sprintf(errbuf, "Cannot find the attributes. \n"); H5Epush(__FILE__, "HE5_ZAinqgrpattrs", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); } if (grpname != NULL) free(grpname); } return (nattr); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAwritelocattr | | | | DESCRIPTION: Writes/updates attribute associated with a specified field | | in a za. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t ZA structure ID | | fieldname char field name | | attrname char attribute name | | numbertype hid_t attribute dataset datatype ID | | count[] hsize_t Number of attribute elements | | datbuf void I/O buffer | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAwritelocattr(hid_t zaID, const char *fieldname, const char *attrname, hid_t numtype, hsize_t count[], void *datbuf) { herr_t status = FAIL; /* Return status variable */ int fldgroup = FAIL; /* Field group flag */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t FieldGrpID = FAIL; /* Field group ID */ hid_t fieldID = FAIL; /* Field dataset ID */ long idx = FAIL; /* za index */ char *grpname = (char *)NULL; /* Group name buffer */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ hid_t numbertype; HE5_LOCK; CHECKPOINTER(fieldname); CHECKNAME(attrname); CHECKPOINTER(count); CHECKPOINTER(datbuf); /* if ntype is HE5 numbertype, rather than H5 numbertype, then convert it, otherwise use ntype itself */ numbertype = HE5_EHconvdatatype(numtype); if(numbertype == FAIL) { numbertype = numtype; } /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAwritelocattr", &fid, &gid, &idx); if (status == SUCCEED) { /* Allocate memory for the group name buffer */ /* ----------------------------------------- */ grpname = (char *)calloc(64, sizeof(char) ); if( grpname == NULL) { sprintf(errbuf,"Cannot allocate memory for the group name buffer.\n"); H5Epush(__FILE__, "HE5_ZAwritelocattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the field group flag */ /* ------------------------ */ fldgroup = HE5_ZAfldsrch(zaID,(char *)fieldname,NULL,NULL,NULL,NULL); if(fldgroup == FAIL) { sprintf(errbuf,"Cannot get the group flag for \"%s\" field.\n",fieldname); H5Epush(__FILE__, "HE5_ZAwritelocattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } if (fldgroup == HE5_HDFE_DATAGROUP) strcpy(grpname,"Data Fields"); /* Get the Field group ID */ /* ---------------------- */ FieldGrpID = H5Gopen(HE5_ZAXZa[idx].za_id, grpname); if(FieldGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"%s\" group.\n", grpname); H5Epush(__FILE__, "HE5_ZAwritelocattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } /* Get field ID and call HE5_EHattr to perform I/O */ /* ----------------------------------------------- */ fieldID = H5Dopen(FieldGrpID, fieldname); if(fieldID == FAIL) { sprintf(errbuf,"Cannot open the \"%s\" field dataset.\n", fieldname); H5Epush(__FILE__, "HE5_ZAwritelocattr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } /* Call EHattr() to perform I/O */ /* ---------------------------- */ status = HE5_EHattr(fieldID, attrname, numbertype, count,"w", datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot write Attribute \"%s\" for the \"%s\" field.\n", attrname, fieldname); H5Epush(__FILE__, "HE5_ZAwritelocattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(status); } /* Release dataset ID */ /* ------------------ */ status = H5Dclose(fieldID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"%s\" field dataset ID.\n", fieldname); H5Epush(__FILE__, "HE5_ZAwritelocattr", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(status); } /* Release group ID */ /* ---------------- */ status = H5Gclose(FieldGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"%s\" group ID.\n",grpname); H5Epush(__FILE__, "HE5_ZAwritelocattr", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(status); } free(grpname); } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAreadlocattr | | | | DESCRIPTION: Reads attribute associated with a specified field in a za. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t ZA structure ID | | fieldname char fieldname | | attrname char attribute name | | | | OUTPUTS: | | datbuf void I/O buffer | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAreadlocattr(hid_t zaID, const char *fieldname, const char *attrname, void * datbuf) { herr_t status = FAIL; /* return status variable */ int fldgroup = FAIL; /* Field group flag */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t ntype = FAIL; /* Data type ID */ hid_t FieldGrpID = FAIL; /* Field group ID */ hid_t fieldID = FAIL; /* Field dataset ID */ long idx = FAIL; /* za index */ hsize_t count[] = { 0 }; /* number of elements */ char *grpname = (char *)NULL; /* Group name buffer */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKPOINTER(fieldname); CHECKPOINTER(attrname); /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAreadlocattr", &fid, &gid, &idx); if (status == SUCCEED) { /* Allocate memory for the group name buffer */ /* ----------------------------------------- */ grpname = (char *)calloc(64, sizeof(char) ); if( grpname == NULL) { sprintf(errbuf,"Cannot allocate memory for the group name buffer.\n"); H5Epush(__FILE__, "HE5_ZAreadlocattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the field group flag */ /* ------------------------ */ fldgroup = HE5_ZAfldsrch(zaID,(char *)fieldname,NULL,NULL,NULL,NULL); if(fldgroup == FAIL) { sprintf(errbuf,"Cannot get the group flag for \"%s\" field. \n",fieldname); H5Epush(__FILE__, "HE5_ZAreadlocattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } if (fldgroup == HE5_HDFE_DATAGROUP) strcpy(grpname,"Data Fields"); /* Get Field group ID */ /* -------------------- */ FieldGrpID = H5Gopen(HE5_ZAXZa[idx].za_id, grpname); if(FieldGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"%s\" group.\n", grpname); H5Epush(__FILE__, "HE5_ZAreadlocattr", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } /* Get field ID and call HE5_EHattr to perform I/O */ /* ----------------------------------------------- */ fieldID = H5Dopen(FieldGrpID, fieldname); if(fieldID == FAIL) { sprintf(errbuf,"Cannot open the \"%s\" field dataset.\n", fieldname); H5Epush(__FILE__, "HE5_ZAreadlocattr", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } /* Call EHattr() to perform I/O */ /* ---------------------------- */ status = HE5_EHattr(fieldID,attrname,ntype,count,"r", datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot read Attribute \"%s\" associated wth the \"%s\" field.\n", attrname,fieldname); H5Epush(__FILE__, "HE5_ZAreadlocattr", __LINE__, H5E_ATTR, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(status); } /* Release the dataset ID */ /* ---------------------- */ status = H5Dclose(fieldID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"%s\" field dataset ID.\n", fieldname); H5Epush(__FILE__, "HE5_ZAreadlocattr", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(status); } /* Release the group ID */ /* -------------------- */ status = H5Gclose(FieldGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"%s\" group ID.\n", grpname); H5Epush(__FILE__, "HE5_ZAreadlocattr", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(status); } free(grpname); } COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAlocattrinfo | | | | DESCRIPTION: Retrievs information about attribute associated with a | | specified field in the "Data Fields" group. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t ZA structure ID | | fieldname char* field name | | attrname const char* attribute name | | | | OUTPUTS: | | ntype hid_t data type ID | | count hsize_t Number of attribute elements | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAlocattrinfo(hid_t zaID, const char *fieldname, const char *attrname, hid_t *ntype, hsize_t *count) { herr_t status = FAIL; /* Return status variable */ int fldgroup = FAIL; /* Field group flag */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t FieldGrpID = FAIL; /* Field group ID */ hid_t fieldID = FAIL; /* Field dataset ID */ long idx = FAIL; /* za index */ char *grpname = (char *)NULL; /* Group name buffer */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ CHECKPOINTER(fieldname); CHECKPOINTER(attrname); /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAlocattrinfo", &fid, &gid, &idx); if (status == SUCCEED) { /* Allocate memory for the group name buffer */ /* ----------------------------------------- */ grpname = (char *)calloc(64, sizeof(char) ); if( grpname == NULL) { sprintf(errbuf,"Cannot allocate memory for the group name buffer.\n"); H5Epush(__FILE__, "HE5_ZAlocattrinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the field group flag */ /* ------------------------ */ fldgroup = HE5_ZAfldsrch(zaID,(char *)fieldname,NULL,NULL,NULL,NULL); if(fldgroup == FAIL) { sprintf(errbuf,"Cannot get the group flag for \"%s\" field. \n",fieldname); H5Epush(__FILE__, "HE5_ZAlocattrinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } if (fldgroup == HE5_HDFE_DATAGROUP) strcpy(grpname,"Data Fields"); /* Get Field group ID */ /* ------------------- */ FieldGrpID = H5Gopen(HE5_ZAXZa[idx].za_id, grpname); if(FieldGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"%s\" group.\n", grpname); H5Epush(__FILE__, "HE5_ZAlocattrinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } /* Get field ID */ /* ------------ */ fieldID = H5Dopen(FieldGrpID, fieldname); if(fieldID == FAIL) { sprintf(errbuf,"Cannot open the \"%s\" field dataset.\n", fieldname); H5Epush(__FILE__, "HE5_ZAlocattrinfo", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } /* Call EHattrinfo() to perform I/O */ /* -------------------------------- */ status = HE5_EHattrinfo(fieldID,attrname,ntype,count); if(status == FAIL) { sprintf(errbuf,"Cannot retrieve information about Attribute \"%s\" in the \"%s\" group.\n", attrname, grpname); H5Epush(__FILE__, "HE5_ZAlocattrinfo", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(status); } /* Release dataset ID */ /* ------------------ */ status = H5Dclose(fieldID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"%s\" field dataset ID.\n", fieldname); H5Epush(__FILE__, "HE5_ZAlocattrinfo", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(status); } /* Release group ID */ /* ---------------- */ status = H5Gclose(FieldGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the field group ID.\n"); H5Epush(__FILE__, "HE5_ZAlocattrinfo", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(status); } free(grpname); } COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAlocattrinfo2 | | | | DESCRIPTION: Retrievs information about attribute associated with a | | specified field in the "Data Fields" group. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t ZA structure ID | | fieldname char* field name | | attrname const char* attribute name | | | | OUTPUTS: | | ntype hid_t data type ID | | count hsize_t Number of attribute elements | | size hsize_t buf size of attribute elements | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAlocattrinfo2(hid_t zaID, const char *fieldname, const char *attrname, hid_t *ntype, hsize_t *count, hsize_t *size) { herr_t status = FAIL; /* Return status variable */ int fldgroup = FAIL; /* Field group flag */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t FieldGrpID = FAIL; /* Field group ID */ hid_t fieldID = FAIL; /* Field dataset ID */ long idx = FAIL; /* za index */ char *grpname = (char *)NULL; /* Group name buffer */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ CHECKPOINTER(fieldname); CHECKPOINTER(attrname); /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAlocattrinfo2", &fid, &gid, &idx); if (status == SUCCEED) { /* Allocate memory for the group name buffer */ /* ----------------------------------------- */ grpname = (char *)calloc(64, sizeof(char) ); if( grpname == NULL) { sprintf(errbuf,"Cannot allocate memory for the group name buffer.\n"); H5Epush(__FILE__, "HE5_ZAlocattrinfo2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the field group flag */ /* ------------------------ */ fldgroup = HE5_ZAfldsrch(zaID,(char *)fieldname,NULL,NULL,NULL,NULL); if(fldgroup == FAIL) { sprintf(errbuf,"Cannot get the group flag for \"%s\" field. \n",fieldname); H5Epush(__FILE__, "HE5_ZAlocattrinfo2", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } if (fldgroup == HE5_HDFE_DATAGROUP) strcpy(grpname,"Data Fields"); /* Get Field group ID */ /* ------------------- */ FieldGrpID = H5Gopen(HE5_ZAXZa[idx].za_id, grpname); if(FieldGrpID == FAIL) { sprintf(errbuf,"Cannot open the \"%s\" group.\n", grpname); H5Epush(__FILE__, "HE5_ZAlocattrinfo2", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } /* Get field ID */ /* ------------ */ fieldID = H5Dopen(FieldGrpID, fieldname); if(fieldID == FAIL) { sprintf(errbuf,"Cannot open the \"%s\" field dataset.\n", fieldname); H5Epush(__FILE__, "HE5_ZAlocattrinfo2", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(FAIL); } /* Call EHattrinfo() to perform I/O */ /* -------------------------------- */ status = HE5_EHattrinfo2(fieldID,attrname,ntype,count, size); if(status == FAIL) { sprintf(errbuf,"Cannot retrieve information about Attribute \"%s\" in the \"%s\" group.\n", attrname, grpname); H5Epush(__FILE__, "HE5_ZAlocattrinfo2", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(status); } /* Release dataset ID */ /* ------------------ */ status = H5Dclose(fieldID); if(status == FAIL) { sprintf(errbuf,"Cannot release the \"%s\" field dataset ID.\n", fieldname); H5Epush(__FILE__, "HE5_ZAlocattrinfo2", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(status); } /* Release group ID */ /* ---------------- */ status = H5Gclose(FieldGrpID); if(status == FAIL) { sprintf(errbuf,"Cannot release the field group ID.\n"); H5Epush(__FILE__, "HE5_ZAlocattrinfo2", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); return(status); } free(grpname); } COMPLETION: return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAinqlocattrs | | | | DESCRIPTION: Retrieves the number of attributes and string length of | | attribute list associated with a specified field in the | | "Data Fields" group. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nattr long Number of attributes in "Data Fields" | | group. | | INPUTS: | | zaID hid_t ZA structure ID | | fieldname char field name | | | | OUTPUTS: | | attrnames char Attribute names in "Data Fields" group | | (Comma-separated list) | | strbufsize long Attributes name list string length | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_ZAinqlocattrs(hid_t zaID, const char *fieldname, char *attrnames, long *strbufsize) { long nattr = FAIL; /* Number of attributes */ long idx = FAIL; /* za index */ herr_t status = FAIL; /* Return status variable */ int fldgroup = FAIL; /* Field group flag */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "ZAS" group ID */ char *dtsname = (char *)NULL; /* Dataset name string */ char *grpname = (char *)NULL; /* Group name buffer */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ CHECKPOINTER(fieldname); /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAinqlocattrs", &fid, &gid, &idx); if(status == SUCCEED ) { /* Allocate memory for the dataset name buffer */ /* ------------------------------------------- */ dtsname = (char *)calloc(HE5_HDFE_NAMBUFSIZE, sizeof(char) ); if( dtsname == NULL) { sprintf(errbuf, "Cannot allocate memory for the dataset name buffer. \n"); H5Epush(__FILE__, "HE5_ZAinqlocattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Allocate memory for the group name buffer */ /* ----------------------------------------- */ grpname = (char *)calloc(64, sizeof(char) ); if( grpname == NULL) { sprintf(errbuf,"Cannot allocate memory for the group name buffer.\n"); H5Epush(__FILE__, "HE5_ZAinqlocattrs", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(dtsname); return(FAIL); } /* Get the field group flag */ /* ------------------------ */ fldgroup = HE5_ZAfldsrch(zaID,(char *)fieldname,NULL,NULL,NULL,NULL); if(fldgroup == FAIL) { sprintf(errbuf,"Cannot get the group flag for \"%s\" field.\n",fieldname); H5Epush(__FILE__, "HE5_ZAinqlocattrs", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); free(dtsname); return(FAIL); } if (fldgroup == HE5_HDFE_DATAGROUP) strcpy(grpname,"/Data Fields/"); strcpy(dtsname,"/HDFEOS/ZAS/"); strcat(dtsname, HE5_ZAXZa[idx].zaname); strcat(dtsname, grpname); strcat(dtsname, fieldname); /* search group with grpname for the number of attributes */ /* ------------------------------------------------------ */ nattr = HE5_EHattrcat(fid, dtsname, attrnames, strbufsize); if ( nattr < 0 ) { sprintf(errbuf, "Cannot find the attributes. \n"); H5Epush(__FILE__, "HE5_ZAinqlocattrs", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } if (dtsname != NULL) free(dtsname); if (grpname != NULL) free(grpname); } COMPLETION: return(nattr); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAsetalias | | | | DESCRIPTION: Defines alias for a specified field name | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | status herr_t Return status | | | | INPUTS: | | zaID hid_t ZA structure ID | | fieldname char Original field name | | | | OUTPUTS: | | aliaslist char List of aliases for the field name | | | | NOTES: | | None | | | | | | Date Programmer Description | | ======= ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAsetalias(hid_t zaID, char *fieldname, const char *aliaslist) { herr_t status = FAIL; /* return status variable */ int fldgroup = FAIL; /* Field group flag */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "ZAS" group ID */ hid_t groupID = FAIL; /* Field group ID */ long idx = FAIL; /* za index */ char *buf = NULL; /* Pointer to temporary buffer */ char *comma = NULL; /* Pointer to comma */ char *aliasname = NULL; /* Pointer to the alias name */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKPOINTER(fieldname); CHECKPOINTER(aliaslist); /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAsetalias", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for za ID failed. \n"); H5Epush(__FILE__, "HE5_ZAsetalias", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Find out the field group */ /* ------------------------ */ fldgroup = HE5_ZAfldsrch(zaID,fieldname,NULL,NULL,NULL,NULL); if (fldgroup == HE5_HDFE_DATAGROUP) groupID = HE5_ZAXZa[idx].data_id; else { sprintf(errbuf, "Cannot find \"%s\" field in za. \n", fieldname); H5Epush(__FILE__, "HE5_ZAsetalias", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Allocate memory for temporary buffer */ /* ------------------------------------ */ buf = (char *)calloc(strlen(aliaslist)+64, sizeof(char)); if (buf == NULL) { sprintf(errbuf, "Cannot allocate memory for \"buf\". \n"); H5Epush(__FILE__, "HE5_ZAsetalias", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Make a list like "name1,name2,name3," */ /* ------------------------------------- */ strcpy(buf,aliaslist); strcat(buf,","); /* Find first comma and make pointer pointing to it */ /* ------------------------------------------------ */ comma = strchr(buf, ','); while(comma != NULL) { /* Allocate memory for individual entry */ /* ------------------------------------ */ aliasname = (char *)calloc(comma-buf+1, sizeof(char)); if (aliasname == NULL) { sprintf(errbuf, "Cannot allocate memory for \"aliasname\". \n"); H5Epush(__FILE__, "HE5_ZAsetalias", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (buf != NULL) free(buf); return(FAIL); } /* Pick up an individual entry and put it to the "aliasname" */ /* --------------------------------------------------------- */ memmove(aliasname,buf,comma-buf); /* Create a symbolic link for a specified object */ /* --------------------------------------------- */ status = H5Glink(groupID, H5G_LINK_SOFT, fieldname, aliasname); if (status == FAIL) { sprintf(errbuf, "Cannot create an alias \"%s\" for \"%s\" field. \n", aliasname, fieldname); H5Epush(__FILE__, "HE5_ZAsetalias", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if (aliasname != NULL) free(aliasname); if (buf != NULL) free(buf); return(FAIL); } /* Go to the next name entry */ /* ------------------------- */ memmove(buf,comma+1,strlen(comma+1)+1); comma = strchr(buf, ','); if (aliasname != NULL) free(aliasname); } if (buf != NULL) free(buf); COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAdropalias | | | | DESCRIPTION: Removes the alias for a specified field name | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | status herr_t Return status | | | | INPUTS: | | zaID hid_t ZA structure ID | | aliasname char Alias name to remove | | fldgroup int Field group flag | | | | OUTPUTS: | | | | NOTES: | | None | | | | | | Date Programmer Description | | ======= ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAdropalias(hid_t zaID, int fldgroup, const char *aliasname) { herr_t status = FAIL; /* return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "ZAS" group ID */ hid_t groupID = FAIL; /* Field group ID */ long idx = FAIL; /* za index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKPOINTER(aliasname); /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAdropalias", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for za ID failed. \n"); H5Epush(__FILE__, "HE5_ZAdropalias", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get Group ID */ /* ------------ */ if (fldgroup == HE5_HDFE_DATAGROUP) groupID = HE5_ZAXZa[idx].data_id; else { sprintf(errbuf, "Invalid input group flag. \n"); H5Epush(__FILE__, "HE5_ZAdropalias", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Destroy a symbolic link */ /* ----------------------- */ status = H5Gunlink(groupID, aliasname); if (status == FAIL) { sprintf(errbuf, "Cannot remove alias named \"%s\". \n", aliasname); H5Epush(__FILE__, "HE5_ZAdropalias", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAinqfldalias | | | | DESCRIPTION: Retrieves the number of fields & aliases and string length of| | fields & aliases list in "Data Fields" group | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nfldalias long Number of fields & aliases in "Data | | Fields" group. | | | | INPUTS: | | zaID hid_t za structure ID | | | | OUTPUTS: | | fldalias char* Fields & aliases names in "Data Fields" | | group (Comma-separated list) | | strbufsize long* Fields & aliases name list string length| | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Apr 03 S.Zhao Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_ZAinqfldalias(hid_t zaID, char *fldalias, long *strbufsize) { long nfldalias = FAIL;/* Number of fields & aliases (return) */ long idx = FAIL; /* za index */ herr_t status = FAIL; /* Return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "ZA" group ID */ char *grpname = (char *)NULL; /* Group name string */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAinqfldalias", &fid, &gid, &idx); if(status == SUCCEED ) { grpname = (char *)calloc(HE5_HDFE_NAMBUFSIZE, sizeof(char) ); if( grpname == NULL) { H5Epush(__FILE__, "HE5_ZAinqfldalias", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Can not allocate memory"); HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__); return(FAIL); } strcpy(grpname,"/HDFEOS/ZAS/"); strcat(grpname, HE5_ZAXZa[idx].zaname); strcat(grpname,"/Data Fields"); /* search group with grpname for the number of fields & aliases */ /* ------------------------------------------------------------ */ nfldalias = HE5_EHdatasetcat(fid, grpname, fldalias, strbufsize); if ( nfldalias < 0 ) { sprintf(errbuf, "Cannot find the fields & aliases. \n"); H5Epush(__FILE__, "HE5_ZAinqfldalias", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(grpname); } if (grpname != NULL) free(grpname); } else { sprintf(errbuf, "Checking for za ID failed. \n"); H5Epush(__FILE__, "HE5_ZAinqfldalias", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } return (nfldalias); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAaliasinfo | | | | DESCRIPTION: Retrieves information about field aliases | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | status herr_t Return status | | | | INPUTS: | | zaID hid_t ZA structure ID | | aliasname char alias name | | fldgroup int Field group flag | | | | OUTPUTS: | | length int Buffer size | | buffer char Buffer with original field name | | | | NOTES: | | None | | | | | | Date Programmer Description | | ======= ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAaliasinfo(hid_t zaID, int fldgroup, const char *aliasname, int *length, char *buffer) { herr_t status = FAIL; /* return status variable */ int type = FAIL; /* type-value of an object */ size_t size = 0; /* Size of the name buffer */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "ZAS" group ID */ hid_t groupID = FAIL; /* Field group ID */ long idx = FAIL; /* za index */ H5G_stat_t *statbuf = (H5G_stat_t *)NULL; /* pointer to a structure */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ CHECKPOINTER(aliasname); /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAaliasinfo", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for za ID failed. \n"); H5Epush(__FILE__, "HE5_ZAaliasinfo", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the group ID */ /* ---------------- */ if (fldgroup == HE5_HDFE_DATAGROUP) groupID = HE5_ZAXZa[idx].data_id; else { sprintf(errbuf, "Invalid input group flag. \n"); H5Epush(__FILE__, "HE5_ZAaliasinfo", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } if (buffer == NULL) { /* Get the string length of a "real" name */ /* -------------------------------------- */ statbuf = (H5G_stat_t *)calloc(1, sizeof(H5G_stat_t)); if (statbuf == NULL) { sprintf(errbuf, "Cannot allocate memory for \"statbuf\". \n"); H5Epush(__FILE__, "HE5_ZAaliasinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the Object Info */ /* ------------------- */ status = H5Gget_objinfo(groupID, aliasname, 0, statbuf); if (status == FAIL) { sprintf(errbuf, "Cannot get information about \"%s\" alias. \n", aliasname); H5Epush(__FILE__, "HE5_ZAaliasinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* LINK name length with a null terminator */ /* --------------------------------------- */ size = statbuf->linklen; /* Object type (dataset, link, etc) */ /* -------------------------------- */ type = statbuf->type; /* Make sure that the object is a LINK */ /* ----------------------------------- */ if (type != H5G_LINK) { sprintf(errbuf,"The object named \"%s\" is not a symbolic link.\n", aliasname); H5Epush(__FILE__, "HE5_ZAaliasinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } *length = (int)size; if ( statbuf != (H5G_stat_t *)NULL ) free(statbuf); } if (buffer != NULL) { size = (size_t)*length; /* Get the "real" name by an "alias" */ /* --------------------------------- */ status = H5Gget_linkval(groupID, aliasname, size, buffer); if (status == FAIL) { sprintf(errbuf,"Cannot get the real name for the alias named \"%s\".\n", aliasname); H5Epush(__FILE__, "HE5_ZAaliasinfo", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } COMPLETION: return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAgetaliaslist | | | | DESCRIPTION: Retrieves the number of aliases and the list of aliases in | | "Data Fields" group | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nalias long number of aliases in "Data Fields" | | group | | | | INPUTS: | | zaID hid_t za structure ID | | fldgroup int field group flag | | | | OUTPUTS: | | aliaslist char* list of aliases in "Data Fields" group | | (comma-separated list) | | strbufsize long* length of aliases list | | | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 05 S.Zhao Original development | | Mar 06 Abe Taaheri Added code to get alias strbufsize only when user | | passes aliaslist as NULL pointer | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_ZAgetaliaslist(hid_t zaID, int fldgroup, char *aliaslist, long *strbufsize) { long nalias = FAIL; /* Number of aliases (return) */ long idx = FAIL; /* za index */ herr_t status = FAIL; /* Return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "ZAS" group ID */ char *fieldlist = (char *)NULL; /* List of Data fields */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ long fldstrbuf = FAIL; /* Buffer size for Data fields */ long nflds = FAIL; /* Number of Data fields */ long nfldalias = FAIL; /* Number of fields & aliases */ char *fldalias = (char *)NULL; /* List of fields & aliases */ long fldaliasbuf = FAIL; /* Buffer size for fields & aliases */ char *buff = (char *)NULL; /* Pointer to temporary buffer */ char *comma = (char *)NULL; /* Pointer to comma */ char *comma1 = (char *)NULL; /* Pointer to comma */ char *nameptr = (char *)NULL; /* Pointer to each name */ char *tmpbuf = (char *)NULL; /* Pointer to temp buffer */ long nameflag = FAIL; /* Name flag */ /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAgetaliaslist", &fid, &gid, &idx); if(status == SUCCEED ) { /* If aliaslist and strbufsize desired */ /* ----------------------------------- */ if (fldgroup == HE5_HDFE_DATAGROUP) { /* Call "HE5_ZAnentries" routine to get number of fields */ /* ----------------------------------------------------- */ nflds = HE5_ZAnentries(zaID, HE5_HDFE_NENTDFLD, &fldstrbuf); if (nflds == FAIL) { sprintf(errbuf, "Cannot get the number of fields in \"Data Fields\" group. \n"); H5Epush(__FILE__, "HE5_ZAgetaliaslist", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Allocate memory for fields list buffer */ /* -------------------------------------- */ fieldlist = (char *) calloc(fldstrbuf+6, sizeof(char)); if(fieldlist == NULL) { sprintf(errbuf,"Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_ZAgetaliaslist", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Call "HE5_ZAinquire" routine to get the list of Data fields */ /* ----------------------------------------------------------- */ nflds = HE5_ZAinquire(zaID, fieldlist, NULL, NULL); if (nflds == FAIL) { sprintf(errbuf, "Cannot get the list of fields in \"Data Fields\" group. \n"); H5Epush(__FILE__, "HE5_ZAgetaliaslist", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(fieldlist); return(FAIL); } /* Call "HE5_ZAinqfldalias" routine to get number of fields & aliases */ /* -------------------------------------------------------- */ nfldalias = HE5_ZAinqfldalias(zaID, NULL, &fldaliasbuf); if (nfldalias == FAIL) { sprintf(errbuf, "Cannot get the number of fields & aliases in \"Data Fields\" group. \n"); H5Epush(__FILE__, "HE5_ZAgetaliaslist", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(fieldlist); return(FAIL); } /* Allocate memory for fields & aliases list buffer */ /* ------------------------------------------------ */ fldalias = (char *) calloc(fldaliasbuf+6, sizeof(char)); if(fldalias == NULL) { sprintf(errbuf,"Cannot allocate memory.\n"); H5Epush(__FILE__, "HE5_ZAgetaliaslist", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(fieldlist); return(FAIL); } /* Call "HE5_ZAinqfldalias" routine to get the list of fields & aliases */ /* ---------------------------------------------------------- */ nfldalias = HE5_ZAinqfldalias(zaID, fldalias, &fldaliasbuf); if (nfldalias == FAIL) { sprintf(errbuf, "Cannot get the list of fields & aliases in \"Data Fields\" group. \n"); H5Epush(__FILE__, "HE5_ZAgetaliaslist", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(fieldlist); free(fldalias); return(FAIL); } *strbufsize = strlen(fldalias) - strlen(fieldlist); if (*strbufsize <= 0) { sprintf(errbuf, "Cannot find the aliases.\n"); H5Epush(__FILE__, "HE5_ZAgetaliaslist", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(fieldlist); free(fldalias); return(FAIL); } else { nalias = 0; /* Allocate memory for temporary buffer */ /* ------------------------------------ */ buff = (char *)calloc(strlen(fldalias)+6, sizeof(char)); if (buff == NULL) { sprintf(errbuf, "Cannot allocate memory for \"buff\". \n"); H5Epush(__FILE__, "HE5_ZAgetaliaslist", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(fieldlist); free(fldalias); return(FAIL); } /* Allocate memory for aliases */ /* --------------------------- */ tmpbuf = (char *)calloc(*strbufsize+6, sizeof(char)); if (tmpbuf == NULL) { sprintf(errbuf, "Cannot allocate memory for \"tmpbuf\". \n"); H5Epush(__FILE__, "HE5_ZAgetaliaslist", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(fieldlist); free(fldalias); free(buff); return(FAIL); } strcpy(buff, fldalias); strcat(buff, ","); strcat(fieldlist, ","); /* Find first comma and make pointer pointing to it */ /* ------------------------------------------------ */ comma = strchr(buff, ','); while(comma != NULL) { /* Allocate memory for individual entry */ /* ------------------------------------ */ nameptr = (char *)calloc(comma-buff+6, sizeof(char)); if (nameptr == NULL) { sprintf(errbuf, "Cannot allocate memory for \"nameptr\". \n"); H5Epush(__FILE__, "HE5_ZAgetaliaslist", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(fieldlist); free(fldalias); free(buff); free(tmpbuf); return(FAIL); } /* Pick up an individual entry and put it to the "nameptr" */ /* ------------------------------------------------------- */ memmove(nameptr,buff,comma-buff); strcat(nameptr, ","); nameflag = (strstr(fieldlist,nameptr) == NULL) ? 1 : 0; if (nameflag == 1) { comma1 = strchr(tmpbuf, ','); if(comma1 == NULL) strcpy(tmpbuf, nameptr); else strcat(tmpbuf, nameptr); nalias++; } memmove(buff,comma+1,strlen(comma+1)+1); comma = strchr(buff, ','); if (nameptr != NULL) free(nameptr); } } if(aliaslist == NULL)/* just return buffersize and number of aliases */ { if(nalias > 0 ) { if (fieldlist != NULL) free(fieldlist); if (fldalias != NULL) free(fldalias); if (buff != NULL) free(buff); if (tmpbuf != NULL) free(tmpbuf); return (nalias); } else { sprintf(errbuf, "Cannot find the aliases.\n"); H5Epush(__FILE__, "HE5_ZAgetaliaslist", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if(fieldlist != NULL) free(fieldlist); if(fldalias != NULL) free(fldalias); if (buff != NULL) free(buff); if (tmpbuf != NULL) free(tmpbuf); return(FAIL); } } else { if(nalias > 0 ) { strncpy(aliaslist, tmpbuf, *strbufsize-1); aliaslist[*strbufsize-1] = '\0'; } else { sprintf(errbuf, "Cannot find the aliases.\n"); H5Epush(__FILE__, "HE5_ZAgetaliaslist", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); if(fieldlist != NULL) free(fieldlist); if(fldalias != NULL) free(fldalias); if (buff != NULL) free(buff); if (tmpbuf != NULL) free(tmpbuf); return(FAIL); } } } else { sprintf(errbuf, "Invalid input field group flag. \n"); H5Epush(__FILE__, "HE5_ZAgetaliaslist", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } } else { sprintf(errbuf, "Checking for za ID failed. \n"); H5Epush(__FILE__, "HE5_ZAgetaliaslist", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } if (fieldlist != NULL) free(fieldlist); if (fldalias != NULL) free(fldalias); if (buff != NULL) free(buff); if (tmpbuf != NULL) free(tmpbuf); return (nalias); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAfldrename | | | | DESCRIPTION: Changes the field name | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | status herr_t Return status | | | | INPUTS: | | zaID hid_t ZA structure ID | | oldfieldname char Original field name | | | | OUTPUTS: | | newfieldname char New field name | | | | NOTES: | | None | | | | | | Date Programmer Description | | ======= ============ ================================================= | | Aug 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAfldrename(hid_t zaID, char *oldfieldname, const char *newfieldname) { herr_t status = FAIL; /* Return status variable */ int fldgroup = FAIL; /* Field group flag */ int k; /* Loop index */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "ZAS" group ID */ hid_t groupID = FAIL; /* Field group ID */ long idx = FAIL; /* za index */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKPOINTER(oldfieldname); CHECKNAME(newfieldname); /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAfldrename", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for za ID failed. \n"); H5Epush(__FILE__, "HE5_ZAfldrename", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Find out the field group */ /* ------------------------ */ fldgroup = HE5_ZAfldsrch(zaID,oldfieldname,NULL,NULL,NULL,NULL); if (fldgroup == HE5_HDFE_DATAGROUP) groupID = HE5_ZAXZa[idx].data_id; else { sprintf(errbuf, "Error returning field group flag. \n"); H5Epush(__FILE__, "HE5_ZAfldrename", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Rename the field */ /* ---------------- */ status = H5Gmove(groupID, oldfieldname, newfieldname); if (status == FAIL) { sprintf(errbuf, "Cannot change the field name from \"%s\" to \"%s\". \n", oldfieldname, newfieldname); H5Epush(__FILE__, "HE5_ZAfldrename", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Update Table */ /* ------------ */ if (fldgroup == HE5_HDFE_DATAGROUP) { for (k = 0; k < HE5_ZAXZa[idx].nDFLD; k++) { if (strcmp(HE5_ZAXZa[idx].ddataset[k].name, oldfieldname) == 0 ) strcpy(HE5_ZAXZa[idx].ddataset[k].name, newfieldname); } } COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAmountexternal | | | | DESCRIPTION: Mounts external data file onto "Data Fields" | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | extfID hid_t External file ID | | | | INPUTS: | | zaID hid_t ZA structure ID | | fldgroup int Group flag | | extfilename char External File Name | | | | OUTPUTS: | | | | NOTES: | | None | | | | | | Date Programmer Description | | ======= ============ ================================================= | | Aug 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ hid_t HE5_ZAmountexternal(hid_t zaID, int fldgroup, const char *extfilename) { hid_t extfID = FAIL; /* External file ID (return) */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "ZAS" group ID */ herr_t status = FAIL; /* Return status variable */ long idx = FAIL; /* za index */ char grpname[HE5_HDFE_NAMBUFSIZE];/* Group name buffer */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ HE5_LOCK; CHECKNAME(extfilename); /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAmountexternal", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for za ID failed. \n"); H5Epush(__FILE__, "HE5_ZAmountexternal", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } strcpy(grpname,"/HDFEOS/ZAS/"); strcat(grpname, HE5_ZAXZa[idx].zaname); if (fldgroup == HE5_HDFE_DATAGROUP) strcat(grpname,"/Data Fields"); /* Open external data file */ /* ----------------------- */ extfID = H5Fopen(extfilename, H5F_ACC_RDONLY, H5P_DEFAULT); if ( extfID == FAIL ) { sprintf(errbuf, "Cannot open external file named \"%s\". \n", extfilename); H5Epush(__FILE__, "HE5_ZAmountexternal", __LINE__, H5E_FILE, H5E_CANTOPENFILE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Mount external file */ /* ------------------- */ status = H5Fmount(fid, grpname, extfID, H5P_DEFAULT); if ( status == FAIL ) { sprintf(errbuf, "Cannot mount external file onto \"%s\" group. \n", grpname); H5Epush(__FILE__, "HE5_ZAmountexternal", __LINE__, H5E_FILE, H5E_MOUNT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } COMPLETION: HE5_UNLOCK; return(extfID); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: ZAunmount | | | | DESCRIPTION: Unmounts external data file from "Data Fields" | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | status herr_t Return status | | | | INPUTS: | | zaID hid_t ZA structure ID | | fldgroup int Group flag | | fileID hid_t ID of file to be unmounted | | | | OUTPUTS: | | | | NOTES: | | None | | | | | | Date Programmer Description | | ======= ============ ================================================= | | Aug 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAunmount(hid_t zaID, int fldgroup, hid_t fileID) { herr_t status = FAIL; /* Return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "ZAS" group ID */ long idx = FAIL; /* za index */ char grpname[HE5_HDFE_NAMBUFSIZE];/* Group name buffer */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ HE5_LOCK; /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAunmount", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for za ID failed. \n"); H5Epush(__FILE__, "HE5_ZAunmount", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } strcpy(grpname,"/HDFEOS/ZAS/"); strcat(grpname, HE5_ZAXZa[idx].zaname); if (fldgroup == HE5_HDFE_DATAGROUP) strcat(grpname,"/Data Fields"); status = H5Funmount(fid, grpname); if ( status == FAIL ) { sprintf(errbuf, "Cannot unmount external file from \"%s\" group. \n", grpname); H5Epush(__FILE__, "HE5_ZAunmount", __LINE__, H5E_FILE, H5E_MOUNT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } status = H5Fclose(fileID); if ( status == FAIL ) { sprintf(errbuf, "Cannot close external file. \n"); H5Epush(__FILE__, "HE5_ZAunmount", __LINE__, H5E_FILE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAreadexternal | | | | DESCRIPTION: Reads external dataset | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | status herr_t Return status | | | | INPUTS: | | zaID hid_t ZA structure ID | | fldgroup int Group flag | | fieldname const char* Field name to read | | | | OUTPUTS: | | buffer void* Output data bufer | | | | NOTES: | | None | | | | | | Date Programmer Description | | ======= ============ ================================================= | | Aug 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAreadexternal(hid_t zaID, int fldgroup, const char *fieldname, void *buffer) { herr_t status = FAIL;/* return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ hid_t gid = FAIL;/* "ZAS" group ID */ hid_t groupID = FAIL;/* Group ID */ hid_t datasetID = FAIL;/* Dataset ID */ hid_t typeID = FAIL;/* File data type ID */ hid_t mtypeID = FAIL;/* Memory datatype ID */ long idx = FAIL;/* za index */ char grpname[HE5_HDFE_NAMBUFSIZE];/* Group name buffer */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKPOINTER(fieldname); /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAreadexternal", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for za ID failed. \n"); H5Epush(__FILE__, "HE5_ZAreadexternal", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } strcpy(grpname,"/HDFEOS/ZAS/"); strcat(grpname, HE5_ZAXZa[idx].zaname); if (fldgroup == HE5_HDFE_DATAGROUP) strcat(grpname,"/Data Fields"); /* Open the group containing mounted file */ /* -------------------------------------- */ groupID = H5Gopen(fid, grpname); if ( groupID == FAIL ) { sprintf(errbuf, "Cannot open group containing mounted file. \n"); H5Epush(__FILE__, "HE5_ZAreadexternal", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Open the dataset */ /* ---------------- */ datasetID = H5Dopen(groupID, fieldname); if ( datasetID == FAIL ) { sprintf(errbuf, "Cannot open mounted dataset. \n"); H5Epush(__FILE__, "HE5_ZAreadexternal", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the data type ID */ /* -------------------- */ typeID = H5Dget_type(datasetID); if ( typeID == FAIL ) { sprintf(errbuf, "Cannot get the data type ID of mounted dataset. \n"); H5Epush(__FILE__, "HE5_ZAreadexternal", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get memory data type ID */ /* ----------------------- */ mtypeID = HE5_EHdtype2mtype(typeID); if (mtypeID == FAIL) { sprintf(errbuf, "Cannot convert to memory data type.") ; H5Epush(__FILE__, "HE5_ZAreadexternal", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Read the mounted dataset */ /* ------------------------ */ status = H5Dread(datasetID, mtypeID, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer); if ( status == FAIL ) { sprintf(errbuf, "Cannot read mounted data.") ; H5Epush(__FILE__, "HE5_ZAreadexternal", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Release data type ID */ /* -------------------- */ status = H5Tclose(typeID); if ( status == FAIL ) { sprintf(errbuf, "Cannot release data type ID.") ; H5Epush(__FILE__, "HE5_ZAreadexternal", __LINE__, H5E_DATATYPE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Release dataset ID */ /* ------------------ */ status = H5Dclose(datasetID); if ( status == FAIL ) { sprintf(errbuf, "Cannot release dataset ID.") ; H5Epush(__FILE__, "HE5_ZAreadexternal", __LINE__, H5E_DATASET, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Release the group ID */ /* -------------------- */ status = H5Gclose(groupID); if ( status == FAIL ) { sprintf(errbuf, "Cannot release group ID.") ; H5Epush(__FILE__, "HE5_ZAreadexternal", __LINE__, H5E_OHDR, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAsetextdata | | | | DESCRIPTION: Sets external data files. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t ZA structure ID | | filelist const char* list of external files | | offset off_t array of offsets (in bytes) from the | | beginning of the file to the location | | in the file where the data starts | | size hsize_t array of sizes (in bytes) reserved in | | the file for the data. | | | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ herr_t HE5_ZAsetextdata(hid_t zaID, const char *filelist, off_t offset[], hsize_t size[]) { herr_t status = FAIL; /* return status variable */ int i; /* Loop index */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ long idx = FAIL; /* za index */ char *namebuf = (char *)NULL;/* File list buffer */ char *filename = (char *)NULL;/* File name buffer */ char *comma = (char *)NULL;/* Pointer to comma */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKPOINTER(filelist); CHECKPOINTER(offset); CHECKPOINTER(size); /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAsetextdata", &fid, &gid, &idx); if(status == FAIL) { sprintf(errbuf,"Checking for valid za ID failed.\n"); H5Epush(__FILE__, "HE5_ZAsetextdata", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Get current dataset creation property list */ /* ------------------------------------------ */ if( HE5_ZAXZa[idx].plist == FAIL) HE5_ZAXZa[idx].plist = H5Pcreate(H5P_DATASET_CREATE); /* Allocate space for namebuf, copy dimlist into it, & append comma */ /* ---------------------------------------------------------------- */ namebuf = (char *)calloc(strlen(filelist) + 64, sizeof(char)); if(namebuf == NULL) { H5Epush(__FILE__, "HE5_ZAsetextdata", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory."); HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__); return(FAIL); } /* ******************************************************************** * C H E C K T H E C O N T E N T O F filelist S T R I N G * ******************************************************************** */ strcpy(namebuf, filelist); strcat(namebuf, ","); /* Find comma */ /* ---------- */ comma = strchr(namebuf, ','); i = 0; /* Parse the list of file names */ /* ---------------------------- */ while (comma != NULL) { /* Allocate memory for filename buffer */ /* ----------------------------------- */ filename = (char *) calloc(comma - namebuf + 1, sizeof(char)); if (filename == NULL) { sprintf(errbuf, "Cannot allocate memory for filename. \n") ; H5Epush(__FILE__, "HE5_ZAsetextdata", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(namebuf); return(FAIL); } /* Copy file list entry to filename */ /* -------------------------------- */ memmove(filename, namebuf, comma - namebuf); filename[comma-namebuf] = 0; /* Set the property list */ /* --------------------- */ status = H5Pset_external(HE5_ZAXZa[idx].plist, filename, offset[i], size[i]); if(status == FAIL) { sprintf(errbuf,"Cannot set external dataset property list.\n"); H5Epush(__FILE__, "HE5_ZAsetextdata", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(namebuf); free(filename); return(status); } /* Go to next file entry, find next comma, ... */ /* ============================================ */ memmove(namebuf, comma + 1, strlen(comma + 1) + 1); comma = strchr(namebuf, ','); if (filename != NULL) free(filename); i++; } if (namebuf != NULL) free(namebuf); COMPLETION: HE5_UNLOCK; return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAgetextdata | | | | DESCRIPTION: Gets external data files information. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nfiles int number of external files SUCCEED, | | (-1) FAIL | | INPUTS: | | zaID hid_t za structure ID | | fieldname char* External field name | | | | OUTPUTS: | | namelength size_t Length of each name entry | | filelist char* List of file names | | offset off_t array of offsets (in bytes) from the | | beginning of the file to the location | | in the file where the data starts | | size hsize_t array of sizes (in bytes) reserved in | | the file for the data. | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAgetextdata(hid_t zaID, char *fieldname, size_t namelength, char *filelist, off_t offset[], hsize_t size[]) { int nfiles = FAIL; /* Number of ext. files */ int i; /* Loop index */ size_t slen = 0; /* String length */ herr_t status = FAIL; /* return status variable */ hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t fieldID = FAIL; /* Data field ID */ hid_t plist = FAIL; /* Property list ID */ off_t off = 0; /* Offset of data segment */ hsize_t sz = 0; /* Size of data segment */ long idx = FAIL; /* za index */ char *filename = (char *)NULL;/* File name buffer */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ HE5_LOCK; CHECKPOINTER(fieldname); /* Get HDF-EOS file ID, "HDFEOS" group ID and za index */ /* --------------------------------------------------- */ status = HE5_ZAchkzaid(zaID, "HE5_ZAgetextdata", &fid, &gid, &idx); if(status == FAIL) { sprintf(errbuf,"Checking for valid za ID failed.\n"); H5Epush(__FILE__, "HE5_ZAgetextdata", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(status); } /* Check out the field group and get field ID */ /* ------------------------------------------ */ HE5_ZAfldsrch(zaID,fieldname,&fieldID,NULL,NULL,NULL); if( fieldID == FAIL ) { sprintf(errbuf, "Cannot get the field ID for the \"%s\" field.\n", fieldname); H5Epush(__FILE__, "HE5_ZAgetextdata", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the property list ID */ /* ------------------------ */ plist = H5Dget_create_plist(fieldID); if ( plist == FAIL ) { sprintf(errbuf, "Cannot get the property list ID for the \"%s\" data field.\n", fieldname); H5Epush(__FILE__, "HE5_ZAgetextdata", __LINE__, H5E_PLIST, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get the number of external files */ /* -------------------------------- */ nfiles = H5Pget_external_count(plist); if ( nfiles < 0 ) { sprintf(errbuf, "Cannot get the number of external files.\n"); H5Epush(__FILE__, "HE5_ZAgetextdata", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Allocate memory for file name */ /* ----------------------------- */ filename = (char *)calloc(HE5_HDFE_NAMBUFSIZE, sizeof(char)); if(filename == NULL) { H5Epush(__FILE__, "HE5_ZAgetextdata", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory."); HE5_EHprint("Error: Cannot allocate memory, occured", __FILE__, __LINE__); return(FAIL); } strcpy(filelist,""); /* Loop through all external files */ /* ------------------------------- */ for (i = 0; i < nfiles; i++) { strcpy(filename,""); /* Get the file name, offset, and size */ /* ----------------------------------- */ status = H5Pget_external(plist, i, namelength, filename, &off, &sz); if( status == FAIL) { sprintf(errbuf,"Cannot get information about external file.\n"); H5Epush(__FILE__, "HE5_ZAgetextdata", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(filename); return(FAIL); } offset[i] = off; size[i] = sz; strcat(filelist, filename); /* Append comma */ /* ------------ */ if (nfiles > 1 && i < nfiles - 1) strcat(filelist,","); } slen = strlen(filelist); filelist[slen] = 0; if (filename != NULL) free(filename); /* Release property list ID */ /* ------------------------ */ status = H5Pclose(plist); if (status == FAIL ) { sprintf(errbuf, "Cannot release property list ID.\n"); H5Epush(__FILE__, "HE5_ZAgetextdata", __LINE__, H5E_PLIST, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } COMPLETION: HE5_UNLOCK; return (nfiles); } /* ****************************************************************************** | | | F O R T R A N 7 7 W R A P P E R S | | | ****************************************************************************** */ /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAopenF (FORTRAN wrapper) | | | | DESCRIPTION: Opens or creates HDF-EOS file in order to create, read, or | | write a ZA. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | FileID int None HDF-EOS file ID | | | | INPUTS: | | filename char* None File name string | | Flags int None File access code | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ======== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAopenF(char *filename, int Flags) { hid_t fid = FAIL;/* HDF5 file ID */ int FileID = FAIL;/* hdf-eos file ID */ uintn flags = 9999;/* HDF5 file access code */ char *errbuf = NULL;/* Error message buffer */ /* Allocate memory for error buffer */ /* -------------------------------- */ errbuf = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_ZAopenF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory to error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Set up the file access flag */ /* --------------------------- */ if (Flags == HE5F_ACC_RDWR || Flags == HDF5_ACC_RDWR) flags = H5F_ACC_RDWR; else if (Flags == HE5F_ACC_RDONLY || Flags == HDF5_ACC_RDONLY) flags = H5F_ACC_RDONLY; else if (Flags == HE5F_ACC_TRUNC || Flags == HDF5_ACC_CREATE) flags = H5F_ACC_TRUNC; else { sprintf(errbuf, "File access flag is not supported. \n"); H5Epush(__FILE__, "HE5_ZAopenF", __LINE__, H5E_ARGS, H5E_UNSUPPORTED, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Call HE5_EHopen to open file */ /* ---------------------------- */ fid = HE5_EHopen(filename, flags, H5P_DEFAULT); if(fid == FAIL) { sprintf(errbuf, "Cannot open the file \"%s\". Check the file name. \n", filename); H5Epush(__FILE__, "HE5_ZAopenF", __LINE__, H5E_FILE, H5E_CANTOPENFILE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } free(errbuf); FileID = (int)fid; return(FileID); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAcreateF (FORTRAN wrapper) | | | | DESCRIPTION: Creates a new za structure and returns za ID | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | zaID int None ZA structure ID | | | | INPUTS: | | FileID int None HDF-EOS file ID | | zaname char* None za name string | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAcreateF(int FileID, char *zaname) { hid_t zaID = FAIL;/* return value of za ID */ hid_t fid = FAIL;/* HDF-EOS file ID */ int ZaID = FAIL;/* int Za ID */ char *errbuf =(char *)NULL;/* Buffer for error message */ /* Allocate memory for error buffer */ /* -------------------------------- */ errbuf = (char *)calloc(HE5_HDFE_DIMBUFSIZE, sizeof(char ) ) ; if ( errbuf == NULL ) { H5Epush(__FILE__, "HE5_ZAcreateF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } fid = (hid_t)FileID; zaID = HE5_ZAcreate(fid, zaname); if (zaID == FAIL) { sprintf(errbuf,"Cannot create za. \n"); H5Epush(__FILE__, "HE5_ZAcreateF", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } ZaID = (int)zaID; /* Deallocate memory */ /* ----------------- */ free(errbuf); return(ZaID); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAattachF (FORTRAN wrapper) | | | | DESCRIPTION: Attaches to an existing za within the file. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ZaID int ZA structure ID | | | | INPUTS: | | FileID int HDF-EOS file ID | | zaname char ZA structure name | | | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ========= ============ ============================================== | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAattachF(int FileID, char *zaname) { int ZaID = FAIL;/* int za ID (return) */ hid_t zaID = FAIL;/* za ID (return value) */ hid_t fid = FAIL;/* HDF-EOS file ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer*/ fid = (hid_t)FileID; zaID = HE5_ZAattach(fid, zaname); if (zaID == FAIL) { sprintf(errbuf,"Cannot attach to the za \"%s\". \n", zaname); H5Epush(__FILE__, "HE5_ZAattachF", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } ZaID = (int)zaID; return (ZaID); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAdetachF (FORTRAN wrapper) | | | | DESCRIPTION: Detachs za structure and performs housekeeping | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | ZaID int ZA structure ID | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAdetachF(int ZaID) { int ret = FAIL;/* int return status */ hid_t zaID = FAIL;/* HDF-EOS za ID */ herr_t status = FAIL;/* routine return status variable */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ zaID = (hid_t)ZaID; status = HE5_ZAdetach(zaID); if (status == FAIL) { sprintf(errbuf,"Cannot detach from the za. \n"); H5Epush(__FILE__, "HE5_ZAdetachF", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAcloseF (FORTRAN wrapper) | | | | DESCRIPTION: Closes HDF-EOS file | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | FileID int File ID | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAcloseF(int FileID) { int ret = FAIL;/* int return status variable */ hid_t fid = FAIL;/* HDF-EOS file ID */ herr_t status = FAIL;/* routine return status variable */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ fid = (hid_t)FileID; status = HE5_ZAclose(fid); if (status == FAIL) { sprintf(errbuf,"Cannot close the file. \n"); H5Epush(__FILE__, "HE5_ZAcloseF", __LINE__, H5E_FILE, H5E_CLOSEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAdefdimF | | | | DESCRIPTION: Defines numerical value of dimension (FORTRAN wrapper) | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | ZaID int ZA structure ID | | dimname char dimension name | | dim long dimension size | | | | OUTPUTS: | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAdefdimF(int ZaID, char *dimname, long dim) { int ret = SUCCEED;/* (int) return status variable */ hid_t zaID = FAIL; /* HDF5 type za ID */ herr_t status = SUCCEED;/* HDF5 type return status */ hsize_t tdim = 0; /* temporary(dimension) variable */ char *errbuf = (char *)NULL;/* Error message buffer */ errbuf = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); tdim = (hsize_t)dim; zaID = (hid_t)ZaID; status = HE5_ZAdefdim(zaID, dimname, tdim); if ( status == FAIL ) { sprintf(errbuf, "Error calling HE5_ZAdefdim from FORTRAN wrapper. \n"); H5Epush(__FILE__, "HE5_ZAdefdimF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAdefineF | | | | | | DESCRIPTION: Defines data field within ZA structure (FORTRAN) | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status herr_t return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID int ZA structure ID | | fieldname char fieldname | | fortdimlist char Dimension list (comma-separated list) | | FORTRAN dimesion order | | fortmaxdimlist char Max Dimension list (FORTRAN order) | | numtype int field type | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAdefineF(int zaID, char *fieldname, char *fortdimlist, char *fortmaxdimlist, int numtype) { int ret = SUCCEED;/* (int) return status variable */ herr_t status = SUCCEED;/* routine return status variable */ hid_t ZaID = FAIL; /* HDF5 type za ID */ hid_t numbertype = FAIL; /* HDF5 type data type ID */ char *dimlist = (char *)NULL;/* Dimension list (C order) */ char *maxdimlist= (char *)NULL;/* Max. dimension list (C) */ char *errbuf = (char *)NULL;/* error message buffer */ ZaID = (hid_t)zaID; numbertype = HE5_EHconvdatatype(numtype); if(numbertype == FAIL) { H5Epush(__FILE__, "HE5_ZAdefineF", __LINE__, H5E_DATATYPE, H5E_NOTFOUND, "Cannot convert datatype for FORTRAN wrapper."); HE5_EHprint("Error: Cannot convert datatype for FORTRAN wrapper, occured", __FILE__, __LINE__); return(FAIL); } if(strcmp(fortmaxdimlist,"") == 0) fortmaxdimlist = NULL; /* Allocate memory for error message buffers */ /* ----------------------------------------- */ errbuf = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_ZAdefineF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Allocate space for C order dimension list */ /* ----------------------------------------- */ dimlist = (char *)calloc(strlen(fortdimlist) + 1, sizeof(char)); if(dimlist == NULL) { sprintf(errbuf,"Cannot allocate memory for dimlist.\n"); H5Epush(__FILE__, "HE5_ZAdefineF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Reverse entries in dimension list (FORTRAN -> C) */ /* ------------------------------------------------ */ status = HE5_EHrevflds(fortdimlist, dimlist); if(status == FAIL) { sprintf(errbuf,"Cannot reverse entries in dimension list.\n"); H5Epush(__FILE__, "HE5_ZAdefineF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); return(FAIL); } if (fortmaxdimlist != NULL) { /* Allocate space for C order max. dim. list */ /* ----------------------------------------- */ maxdimlist = (char *)calloc(strlen(fortmaxdimlist) + 1, sizeof(char)); if(maxdimlist == NULL) { sprintf(errbuf,"Cannot allocate memory for maxdimlist.\n"); H5Epush(__FILE__, "HE5_ZAdefineF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(dimlist); free(errbuf); return(FAIL); } /* Reverse entries in dimension list (FORTRAN -> C) */ /* ------------------------------------------------ */ status = HE5_EHrevflds(fortmaxdimlist, maxdimlist); if(status == FAIL) { sprintf(errbuf,"Cannot reverse entries in maximum dimension list.\n"); H5Epush(__FILE__, "HE5_ZAdefineF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(maxdimlist); return(FAIL); } } else { maxdimlist = NULL; } /* Call Define Field routine */ /* ------------------------- */ status = HE5_ZAdefinefield(ZaID, "Data Fields", fieldname, dimlist, maxdimlist, numbertype); if(status == FAIL) { sprintf(errbuf,"Cannot define \"%s\" field.\n", fieldname); H5Epush(__FILE__, "HE5_ZAdefineF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); if (maxdimlist!=NULL) free(maxdimlist); return(FAIL); } free(dimlist); if (maxdimlist != NULL) free(maxdimlist); free(errbuf); ret = (int)status; return (ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAdefcompF (FORTRAN wrapper) | | | | DESCRIPTION: Defines compression type and parameters | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | ZaID int ZA structure ID | | compcode int compression code | | compparm int compression parameters | | | | OUTPUTS: | | None | | | | NOTES: Before calling this function, storage must be CHUNKED | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAdefcompF(int ZaID, int compcode, int *compparm) { int ret = FAIL; /* routine return status variable */ herr_t status = FAIL; /* routine return status variable */ hid_t zaID = FAIL; /* HDF5 type za ID */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ zaID = (hid_t)ZaID; status = HE5_ZAdefcomp(zaID, compcode, compparm); if(status == FAIL) { sprintf(errbuf,"Error calling ZAdefcomp() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_ZAdefcompF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAdefchunkF | | | | DESCRIPTION: FORTRAN wrapper for ZAdefchunk | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | ZaID int ZA structure ID | | ndims int rank of a dataset | | *dim long pointer to the array containing sizes | | of each dimension of a chunk | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ========= ============ ============================================== | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAdefchunkF(int ZaID, int ndims, long *dim) { int ret = FAIL; /* return status */ int j = 0; /* Loop index */ herr_t status = FAIL; /* return status */ hid_t zaID = FAIL; /* HDF5 type za ID */ hsize_t *tempdims = (hsize_t *)NULL;/* Temporary variable */ char *errbuf = (char *)NULL; /* error message buffer */ /* Allocate memory for error message buffer */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_ZAdefchunkF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Allocate space for C order dimension list */ /* ----------------------------------------- */ tempdims = (hsize_t *)calloc(ndims, sizeof(hsize_t)); if(tempdims == NULL) { sprintf(errbuf,"Cannot allocate memory for tempdims.\n"); H5Epush(__FILE__, "HE5_ZAdefchunkF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Change from FORTRAN to C dimension order */ /* ---------------------------------------- */ for (j = 0; j < ndims; j++) tempdims[j] = (hsize_t)dim[ndims - 1 - j]; zaID = (hid_t)ZaID; status = HE5_ZAdefchunk(zaID, ndims, tempdims); if(status == FAIL) { sprintf(errbuf,"Error calling ZAdefchunk() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_ZAdefchunkF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(tempdims); return(FAIL); } free(tempdims); free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAcompinfoF (FORTRAN wrapper) | | | | DESCRIPTION: Retrieves compression information about a field | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int None Return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | ZaID int ZA structure ID | | fieldname const char* Field name | | compcode int* Compression code | | compparm int Compression parameters | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAcompinfoF(int ZaID, char *fieldname, int *compcode, int compparm[]) { int ret = FAIL; /* Return status variable */ herr_t status = FAIL; /* Return status variable */ hid_t zaID = FAIL; /* HDF5 type za ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ zaID = (hid_t)ZaID; status = HE5_ZAcompinfo(zaID, fieldname, compcode, compparm); if (status == FAIL) { sprintf(errbuf , "Compression information for \"%s\" not found.\n", fieldname); H5Epush(__FILE__, "HE5_ZAcompinfoF", __LINE__, H5E_BTREE, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAwritecharF | | | | DESCRIPTION: Writes data to a character string field (FORTRAN wrapper | | around ZAwrite) | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | ZaID int ZA structure ID | | fieldname char fieldname | | elemlen int each element length in array of string | | numelem int number of elements in declared buffer | | array | | fortstart long start array | | fortstride long stride array | | fortedge long edge array | | | | OUTPUTS: | | data void data buffer for write | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Feb 04 S.ZHAO For an array of character string dataset. | | Jun 04 S.Zhao Added one more argument (numelem). | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAwritecharF(int ZaID, char *fieldname, int elemlen, int numelem, long fortstart[], long fortstride[], long fortedge[], void *data) { int ret = SUCCEED; /* int return status variable */ int i; /* Loop index */ int rank = 0; /* Field rank */ herr_t status = SUCCEED; /* routine return status variable */ hid_t ntype[1] = {FAIL}; /* Field datatype ID */ hid_t zaID = FAIL; /* HDF-EOS za ID */ hssize_t *start = (hssize_t *)NULL;/* Pointer to start array (C order)*/ hsize_t dims[HE5_DTSETRANKMAX]; /* Field dimensions */ hsize_t *stride = (hsize_t *)NULL;/* Pointer to stride array (C order)*/ hsize_t *edge = (hsize_t *)NULL;/* Pointer to edge array (C order) */ char *errbuf = (char *)NULL; /* error message buffer */ char **strdatabuf = NULL; /* string data buffer */ int nelem = 0; /* number of elements in array of str*/ int strsize = 0; /* each str length in array of str */ char *blankPtr = (char *)NULL; /* pointer to blank character */ char *tmpString = (char *)NULL;/* pointer to temp string */ int attr = 0; /* attribute value */ hsize_t count[1]; /* number of attribute elements */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_ZAwritecharF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } zaID = (hid_t)ZaID; /* Initialize dims[] array */ /* ----------------------- */ for ( i = 0; i < HE5_DTSETRANKMAX; i++) dims[ i ] = 0; /* Get field info */ /* --------------- */ status = HE5_ZAinfo(zaID, fieldname, &rank, dims, ntype, NULL, NULL); if (status != FAIL) { start = (hssize_t *)calloc(rank, sizeof(hssize_t)); if(start == NULL) { sprintf(errbuf,"Cannot allocate memory for start.\n"); H5Epush(__FILE__, "HE5_ZAwritecharF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } stride = (hsize_t *)calloc(rank, sizeof(hsize_t)); if(stride == NULL) { sprintf(errbuf,"Cannot allocate memory for stride.\n"); H5Epush(__FILE__, "HE5_ZAwritecharF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(errbuf); return(FAIL); } edge = (hsize_t *)calloc(rank, sizeof(hsize_t)); if(edge == NULL) { sprintf(errbuf,"Cannot allocate memory for edge.\n"); H5Epush(__FILE__, "HE5_ZAwritecharF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(stride); free(errbuf); return(FAIL); } /* Reverse order of dimensions (FORTRAN -> C) */ /* ------------------------------------------ */ for (i = 0; i < rank; i++) { start[i] = (hssize_t)fortstart[rank - 1 - i]; stride[i] = (hsize_t)fortstride[rank - 1 - i]; edge[i] = (hsize_t)fortedge[rank - 1 - i]; } strsize = elemlen; nelem = dims[0]; tmpString = (char *)calloc(sizeof(char),strsize+1); if(tmpString == NULL) { sprintf(errbuf,"Cannot allocate memory for tmpString.\n"); H5Epush(__FILE__, "HE5_ZAwritecharF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(stride); free(edge); free(errbuf); return(FAIL); } strdatabuf = (char **)malloc(nelem*sizeof(char *)); for (i = 0; i C) */ /* ------------------------------------------ */ for (i = 0; i < rank; i++) { start[i] = (hssize_t)fortstart[rank - 1 - i]; stride[i] = (hsize_t)fortstride[rank - 1 - i]; edge[i] = (hsize_t)fortedge[rank - 1 - i]; } myedge = (hsize_t *)calloc(rank, sizeof(hsize_t)); if(myedge == NULL) { sprintf(errbuf,"Cannot allocate memory for edge.\n"); H5Epush(__FILE__, "HE5_ZAwriteF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(stride); free(edge); free(errbuf); return(FAIL); } for (i = 0; i < rank; i++) { if(edge[i] > dims[i]) myedge[i] = dims[i]; else myedge[i] = edge[i]; } status = HE5_ZAwrrdfield(zaID, fieldname, "w", start, stride, myedge, data); if (status == FAIL) { sprintf(errbuf, "Cannot write data to the field \"%s\".",fieldname) ; H5Epush(__FILE__, "HE5_ZAwriteF", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(stride); free(edge); free(myedge); free(errbuf); return(FAIL); } free(start); free(stride); free(edge); free(myedge); free(errbuf); } else { sprintf(errbuf, "Error calling HE5_ZAinfo() from FORTRAN wrapper. \n") ; H5Epush(__FILE__, "HE5_ZAwriteF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); status = FAIL; free(errbuf); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAwrattr | | | | DESCRIPTION: FORTRAN wrapper to write/update attribute in a za. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | ZaID int ZA structure ID | | attrname char* attribute name | | numtype int attribute HDF numbertype | | fortcount[] long number of attribute elements | | datbuf void I/O buffer | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | Mar 04 S.Zhao Modified for a character string attribute. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAwrattr(int ZaID, char *attrname, int numtype, long fortcount[], void * datbuf) { int ret = FAIL;/* int return status variable */ int rank = 1; /* Note: It is assumed that fortcout has just */ /* one element to agree with EHattr function */ int i; /* Loop index */ hid_t zaID = FAIL;/* HDF-EOS za ID */ hid_t numbertype = FAIL;/* HDF5 data type ID */ herr_t status = FAIL;/* routine return status variable */ hsize_t *count = (hsize_t *)NULL;/* Pointer to count array (C order)*/ char *errbuf = (char *)NULL; /* error message buffer */ char *tempbuf = (char *)NULL; /* temp buffer */ numbertype = HE5_EHconvdatatype(numtype); if(numbertype == FAIL) { H5Epush(__FILE__, "HE5_ZAwrattr", __LINE__, H5E_DATATYPE, H5E_BADVALUE, "Error calling HE5_EHconvdatatype() from FORTRAN wrapper."); HE5_EHprint("Error: Error calling HE5_EHconvdatatype() from FORTRAN wrapper, occured", __FILE__, __LINE__); return(FAIL); } /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_ZAwrattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Allocate memory for "count" array */ /* --------------------------------- */ count = (hsize_t *)calloc(rank, sizeof(hsize_t)); if( count == NULL) { sprintf(errbuf,"Cannot allocate memory for count.\n"); H5Epush(__FILE__, "HE5_ZAwrattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Reverse order of dimensions (FORTRAN -> C) */ /* ------------------------------------------ */ for (i = 0; i < rank; i++) { count[i] = (hsize_t)fortcount[rank - 1 - i]; } zaID = (hid_t)ZaID; if ((numbertype == HE5T_CHARSTRING) || (numbertype == H5T_NATIVE_CHAR) || (numbertype == H5T_C_S1)) { if (strlen((char *)datbuf) < count[0]) { sprintf(errbuf,"Size of databuf is less than the number of attribute elements.\n"); H5Epush(__FILE__, "HE5_ZAwrattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); return(FAIL); } /* Allocate memory for temp buffer */ /* ------------------------------- */ tempbuf = (char * )calloc((count[0]+1), sizeof(char)); if(tempbuf == NULL) { sprintf(errbuf,"Cannot allocate memory for temp buffer.\n"); H5Epush(__FILE__, "HE5_ZAwrattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); return(FAIL); } strncpy(tempbuf, (char *)datbuf, count[0]); tempbuf[count[0]] = '\0'; /* Call ZAwriteattr() */ /* ------------------ */ status = HE5_ZAwriteattr(zaID, attrname, numbertype, count, tempbuf); if( status == FAIL) { sprintf(errbuf,"Cannot write data to the attribute \"%s\".\n", attrname); H5Epush(__FILE__, "HE5_ZAwrattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); free(tempbuf); return(FAIL); } free(count); free(errbuf); free(tempbuf); } else { /* Call ZAwriteattr() */ /* ------------------ */ status = HE5_ZAwriteattr(zaID, attrname, numbertype, count, datbuf); if( status == FAIL) { sprintf(errbuf,"Cannot write data to the attribute \"%s\".\n", attrname); H5Epush(__FILE__, "HE5_ZAwrattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); return(FAIL); } free(count); free(errbuf); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAsetfill (FORTRAN wrapper) | | | | DESCRIPTION: Sets fill value for the specified field. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | ZaID int ZA structure ID | | fieldname char* field name | | fillval void* fill value | | | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAsetfill(int ZaID, char *fieldname, int numtype, void *fillval) { int ret = FAIL;/* int return status variable */ herr_t status = FAIL;/* return status variable */ hid_t numbertype = FAIL;/* HDF5 data tyope ID */ hid_t zaID = FAIL;/* HDF5 za ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ numbertype = HE5_EHconvdatatype(numtype); if(numbertype == FAIL) { sprintf(errbuf,"Cannot convert to HDF5 type data type ID from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_ZAsetfill", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } zaID = (hid_t)ZaID; status = HE5_ZAsetfillvalue(zaID, fieldname, numbertype, fillval); if (status == FAIL) { sprintf(errbuf,"Cannot set fill value for the field \"%s\".\n", fieldname); H5Epush(__FILE__, "HE5_ZAsetfill", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAgetfill (FORTRAN wrapper) | | | | DESCRIPTION: Retrieves fill value for a specified field. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | ZaID int ZA structure ID | | fieldname char* field name | | | | OUTPUTS: | | fillval void* fill value | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAgetfill(int ZaID, char *fieldname, void *fillval) { int ret = FAIL;/* routine return status variable */ herr_t status = FAIL;/* routine return status variable */ hid_t zaID = FAIL;/* HDF5 type za ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ zaID = (hid_t)ZaID; status = HE5_ZAgetfillvalue(zaID, fieldname, fillval); if (status == FAIL) { sprintf(errbuf,"Cannot get fill value for the field \"%s\".\n", fieldname); H5Epush(__FILE__, "HE5_ZAgetfill", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } ret = (int)status; return (ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAreadF | | | | DESCRIPTION: Reads data from field (FORTRAN wrapper around ZAread) | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | ZaID int ZA structure ID | | fieldname char fieldname | | fortstart long start array | | fortstride long stride array | | fortedge long edge array | | buffer void data buffer for read | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAreadF(int ZaID, char *fieldname, long fortstart[], long fortstride[], long fortedge[], void *buffer) { int ret = SUCCEED; /* routine return status variable */ int i = 0; /* Loop index */ int rank = 0; /* Field rank */ hid_t ntype[1] = {FAIL}; /* Field data type ID */ hid_t zaID = FAIL; /* za HDF5 type ID */ herr_t status = SUCCEED; /* routine return status variable */ hssize_t *start = (hssize_t *)NULL;/* Pointer to start array (C order) */ hsize_t dims[HE5_DTSETRANKMAX]; /* Field dimensions */ hsize_t *stride = (hsize_t *)NULL; /* Pointer to stride array (C order)*/ hsize_t *edge = (hsize_t *)NULL; /* Pointer to edge array (C order) */ char *errbuf = (char *)NULL; /* error message buffer */ /* Allocate memory for error message buffers */ /* ----------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_ZAreadF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } zaID = (hid_t)ZaID; /* Initialize dims[] array */ /* ----------------------- */ for ( i = 0; i < HE5_DTSETRANKMAX; i++) dims[ i ] = 0; /* Get field info */ /* -------------- */ status = HE5_ZAinfo(zaID, fieldname, &rank, dims, ntype, NULL,NULL); if (status != FAIL) { start = (hssize_t *)calloc(rank, sizeof(hssize_t)); if(start == NULL) { sprintf(errbuf,"Cannot allocate memory for start.\n"); H5Epush(__FILE__, "HE5_ZAreadF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } stride = (hsize_t *)calloc(rank, sizeof(hsize_t)); if(stride == NULL) { sprintf(errbuf,"Cannot allocate memory for stride.\n"); H5Epush(__FILE__, "HE5_ZAreadF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(errbuf); return(FAIL); } edge = (hsize_t *)calloc(rank, sizeof(hsize_t)); if(edge == NULL) { sprintf(errbuf,"Cannot allocate memory for edge.\n"); H5Epush(__FILE__, "HE5_ZAreadF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(stride); free(errbuf); return(FAIL); } /* Reverse order of dimensions (FORTRAN -> C) */ /* ------------------------------------------ */ for (i = 0; i < rank; i++) { start[i] = (hssize_t)fortstart[rank - 1 - i]; stride[i] = (hsize_t)fortstride[rank - 1 - i]; edge[i] = (hsize_t)fortedge[rank - 1 - i]; } /* Read data from the field */ /* ------------------------ */ status = HE5_ZAwrrdfield(zaID, fieldname, "r", start, stride, edge, buffer); if (status == FAIL) { sprintf(errbuf, "Cannot read data from the \"%s\" field.",fieldname) ; H5Epush(__FILE__, "HE5_ZAreadF", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(stride); free(edge); free(errbuf); return(FAIL); } free(start); free(stride); free(edge); free(errbuf); } else { sprintf(errbuf, "Fieldname \"%s\" does not exist.",fieldname) ; H5Epush(__FILE__, "HE5_ZAreadF", __LINE__, H5E_DATASET, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); status = FAIL; } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAreadcharF | | | | DESCRIPTION: Reads data from a character string field (FORTRAN wrapper | | around ZAread) | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | ZaID int ZA structure ID | | fieldname char fieldname | | elemlen int each element length in array of string | | numelem int number of elements in declared buffer | | array | | fortstart long start array | | fortstride long stride array | | fortedge long edge array | | buffer void data buffer for read | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Apr 04 S.Zhao For an array of character string dataset. | | Jun 04 S.Zhao Added two more arguments (elemlen and numelem). | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAreadcharF(int ZaID, char *fieldname, int elemlen, int numelem, long fortstart[], long fortstride[], long fortedge[], void *buffer) { int ret = SUCCEED; /* routine return status variable */ int i = 0; /* Loop index */ int rank = 0; /* Field rank */ hid_t ntype[1] = {FAIL}; /* Field data type ID */ hid_t zaID = FAIL; /* za HDF5 type ID */ herr_t status = SUCCEED; /* routine return status variable */ hssize_t *start = (hssize_t *)NULL;/* Pointer to start array (C order) */ hsize_t dims[HE5_DTSETRANKMAX]; /* Field dimensions */ hsize_t *stride = (hsize_t *)NULL; /* Pointer to stride array (C order)*/ hsize_t *edge = (hsize_t *)NULL; /* Pointer to edge array (C order) */ char *errbuf = (char *)NULL; /* error message buffer */ char **strdatabuf = NULL; /* string data buffer */ int stlen = 0; /* whole string array length */ int nelem = 0; /* number of elements in array of str */ int strsize = 0; /* each str length in array of str */ int attr = 0; /* attribute value */ int j = 0; /* Loop index */ int num_elem_passed_out; int numread; /* Allocate memory for error message buffers */ /* ----------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_ZAreadcharF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } zaID = (hid_t)ZaID; /* Initialize dims[] array */ /* ----------------------- */ for ( i = 0; i < HE5_DTSETRANKMAX; i++) dims[ i ] = 0; /* Get field info */ /* -------------- */ status = HE5_ZAinfo(zaID, fieldname, &rank, dims, ntype, NULL,NULL); if (status != FAIL) { start = (hssize_t *)calloc(rank, sizeof(hssize_t)); if(start == NULL) { sprintf(errbuf,"Cannot allocate memory for start.\n"); H5Epush(__FILE__, "HE5_ZAreadcharF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } stride = (hsize_t *)calloc(rank, sizeof(hsize_t)); if(stride == NULL) { sprintf(errbuf,"Cannot allocate memory for stride.\n"); H5Epush(__FILE__, "HE5_ZAreadcharF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(errbuf); return(FAIL); } edge = (hsize_t *)calloc(rank, sizeof(hsize_t)); if(edge == NULL) { sprintf(errbuf,"Cannot allocate memory for edge.\n"); H5Epush(__FILE__, "HE5_ZAreadcharF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(stride); free(errbuf); return(FAIL); } /* Reverse order of dimensions (FORTRAN -> C) */ /* ------------------------------------------ */ for (i = 0; i < rank; i++) { start[i] = (hssize_t)fortstart[rank - 1 - i]; stride[i] = (hsize_t)fortstride[rank - 1 - i]; edge[i] = (hsize_t)fortedge[rank - 1 - i]; } status = HE5_ZAreadlocattr(zaID, fieldname, "StringLengthAttribute", &attr); if (status == FAIL) { sprintf(errbuf, "Cannot read attribute from the field \"%s\".",fieldname) ; H5Epush(__FILE__, "HE5_ZAreadcharF", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(stride); free(edge); free(errbuf); return(FAIL); } if(elemlen < attr ) { sprintf(errbuf, "Element length passed in is not correct. Should be same as in declration"); H5Epush(__FILE__, "HE5_ZAreadcharF", __LINE__, H5E_DATASET, H5E_READERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(start); free(stride); free(edge); free(errbuf); return(FAIL); } strsize = attr; stlen = dims[0] * strsize; nelem = stlen / strsize; strdatabuf = (char **)malloc(nelem*sizeof(char *)); for (i = 0; i C) */ /* ------------------------------------------ */ for (i = 0; i < rank; i++) { count[i] = (hsize_t)fortcount[rank - 1 - i]; } zaID = (hid_t)ZaID; if ((numbertype == HE5T_CHARSTRING) || (numbertype == H5T_NATIVE_CHAR) || (numbertype == H5T_C_S1)) { if (strlen((char *)datbuf) < count[0]) { sprintf(errbuf,"Size of databuf is less than the number of local attribute elements.\n"); H5Epush(__FILE__, "HE5_ZAwrlattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); return(FAIL); } /* Allocate memory for temp buffer */ /* ------------------------------- */ tempbuf = (char * )calloc((count[0]+1), sizeof(char)); if(tempbuf == NULL) { sprintf(errbuf,"Cannot allocate memory for temp buffer.\n"); H5Epush(__FILE__, "HE5_ZAwrlattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); return(FAIL); } strncpy(tempbuf, (char *)datbuf, count[0]); tempbuf[count[0]] = '\0'; /* Write local attribute buffer */ /* ---------------------------- */ status = HE5_ZAwritelocattr(zaID, fieldname, attrname, numbertype, count, tempbuf); if(status == FAIL) { sprintf(errbuf,"Cannot write local attribute value.\n"); H5Epush(__FILE__, "HE5_ZAwrlattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); free(tempbuf); return(FAIL); } free(count); free(errbuf); free(tempbuf); } else { /* Write local attribute buffer */ /* ---------------------------- */ status = HE5_ZAwritelocattr(zaID, fieldname, attrname, numbertype, count, datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot write local attribute value.\n"); H5Epush(__FILE__, "HE5_ZAwrlattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); return(FAIL); } free(count); free(errbuf); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZArdlattr (FORTRAN wrapper) | | | | DESCRIPTION: Reads attribute associated with a specified field in a za. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | ZaID int ZA structure ID | | fieldname char fieldname | | attrname char attribute name | | | | OUTPUTS: | | datbuf void I/O buffer | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZArdlattr(int ZaID, char *fieldname, char *attrname, void *datbuf) { int ret = FAIL;/* return status variable */ herr_t status = FAIL;/* return status variable */ hid_t zaID = FAIL;/* HDF5 type za ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ zaID = (hid_t)ZaID; status = HE5_ZAreadlocattr(zaID,fieldname, attrname, datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot read Attribute \"%s\" associated wth the \"%s\" field.\n", attrname,fieldname); H5Epush(__FILE__, "HE5_ZArdlattr", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAinqdimsF | | | | DESCRIPTION: Returns dimension names and values defined in ZA structure | | (FORTRAN Wrapper) | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nDim long Number of defined dimensions | | | | INPUTS: | | ZaID int ZA structure ID | | | | OUTPUTS: | | dimlist char* Dimension names (comma-separated) | | dims long Dimension values | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_ZAinqdimsF(int ZaID, char *dimlist, long dims[]) { int i = 0; /* Loop index */ hid_t zaID = FAIL;/* HDF5 type za ID */ long nDim = FAIL;/* (return) number of dimensions */ long strbufsize = 0; /* String size variable */ hsize_t *tdims = (hsize_t *)NULL;/* Dimension variable */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ zaID = (hid_t)ZaID; nDim = HE5_ZAnentries(zaID, 0, &strbufsize); if(nDim == FAIL) { sprintf(errbuf,"Error calling ZAnentries() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_ZAinqdimsF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } tdims = (hsize_t *)calloc(nDim, sizeof(hsize_t)); if(tdims == NULL) { sprintf(errbuf,"Cannot allocate memory for tdims.\n"); H5Epush(__FILE__, "HE5_ZAinqdimsF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } nDim = HE5_ZAinqdims(zaID, dimlist, tdims); if(nDim == FAIL) { sprintf(errbuf,"Error calling HE5_ZAinqdims() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_ZAinqdimsF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(tdims); return(FAIL); } /* Convert data type */ /* ----------------- */ for(i = 0; i < nDim; i++) dims[i] = (long)tdims[i]; free(tdims); return (nDim); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAinquireF (FORTRAN wrapper) | | | | DESCRIPTION: Inquires about data fields in za | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nflds long Number of data fields in za | | | | INPUTS: | | ZaID int ZA structure ID | | | | OUTPUTS: | | fieldlist char Field names (comma-separated) | | rank int Array of ranks | | ntype int data type class ID | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_ZAinquireF(int ZaID, char *fieldlist, int rank[], int ntype[]) { long nflds = FAIL; /* Number of Data fields */ long i; /* Looop index */ hid_t zaID = FAIL; /* HDF5 type za ID */ hid_t *dtype = (hid_t *)NULL; /* Data type ID */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ zaID = (hid_t)ZaID; /* Call "HE5_ZAinquire" routine to get number of fields */ /* ---------------------------------------------------- */ nflds = HE5_ZAinquire(zaID, fieldlist, NULL, NULL); if (nflds == FAIL) { sprintf(errbuf, "Cannot get the number of fields in \"Data Fields\" group. \n"); H5Epush(__FILE__, "HE5_ZAinquireF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } dtype = (hid_t *)calloc(nflds, sizeof(hid_t)); if (dtype == NULL) { sprintf(errbuf, "Cannot allocate memory. \n"); H5Epush(__FILE__, "HE5_ZAinquireF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } nflds = HE5_ZAinquire(zaID, fieldlist, rank, dtype); if (nflds == FAIL) { sprintf(errbuf, "Cannot get the number of fields in \"Data Fields\" group. \n"); H5Epush(__FILE__, "HE5_ZAinquireF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(dtype); return(FAIL); } for (i = 0; i < nflds; i++) ntype[i] = (int)dtype[i]; free(dtype); return(nflds); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAdiminfoF | | | | DESCRIPTION: FORTRAN wrapper for ZAdiminfo to retrieve size of specified | | dimension. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | size long None Size of dimension | | | | INPUTS: | | ZaID int None ZA structure ID | | dimname char* None Dimension name | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_ZAdiminfoF(int ZaID, char *dimname) { long size = 0; /* dimension size (return) */ hid_t zaID = FAIL; /* HDF5 data type ID */ hsize_t tsize = 0; /* size variable */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ zaID = (hid_t)ZaID; tsize = HE5_ZAdiminfo(zaID, dimname); if (tsize == 0) { sprintf(errbuf, "Error calling ZAdiminfo() from FORTRAN wrapper. \n"); H5Epush(__FILE__, "HE5_ZAdiminfoF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } size = (long)tsize; return(size); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAinfoF | | | | DESCRIPTION: FORTRAN wrapper around ZAinfo | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | ZaID int ZA structure id | | fieldname char name of field | | | | OUTPUTS: | | rank long rank of field (# of dims) | | dims long field dimensions | | ntype int field number type | | fortdimlist char field dimension list (FORTRAN order) | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAinfoF(int ZaID, char *fieldname, int *rank, long dims[], int *ntype, char *fortdimlist, char *fortmaxdimlist) { int ret = SUCCEED; /* routine return status variable */ int j = 0; /* Loop Index */ herr_t status = SUCCEED; /* routine return status variable */ hid_t zaID = FAIL; /* HDF5 type data type ID */ hid_t dtype[1] = {FAIL}; /* Data type ID */ hsize_t tempdims[HE5_DTSETRANKMAX];/* Dimension sizes array */ hsize_t swap = 0; /* Temporary dimension size */ char *errbuf = (char *)NULL; /* error message buffer */ /* Dimension lists in C order */ /* -------------------------- */ char *dimlist = (char *)NULL; char *maxdimlist = (char *)NULL; /* Allocate memory for error message buffers */ /* ----------------------------------------- */ errbuf = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_ZAinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Allocate space for C order dimension list */ /* ----------------------------------------- */ maxdimlist = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char)); dimlist = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char)); if(dimlist == NULL || maxdimlist == NULL) { sprintf(errbuf,"Cannot allocate memory for input list.\n"); H5Epush(__FILE__, "HE5_ZAinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } zaID = (hid_t)ZaID; /* Initialize tempdims[] array */ /* --------------------------- */ for ( j = 0; j < HE5_DTSETRANKMAX; j++) tempdims[ j ] = 0; /* Get field info */ /* -------------- */ status = HE5_ZAinfo(zaID, fieldname, rank, tempdims, dtype, dimlist, maxdimlist); if (status == SUCCEED) { for (j = 0; j < *rank / 2; j++) { swap = tempdims[*rank - 1 - j]; tempdims[*rank - 1 - j] = tempdims[j]; tempdims[j] = swap; } /* change the datatype */ /* ------------------- */ for (j = 0; j < *rank; j++) dims[j] = (long)tempdims[j]; /* Reverse order of dimensions entries in dimension list */ /* ----------------------------------------------------- */ if(fortdimlist != (char *)NULL) { status = HE5_EHrevflds(dimlist, fortdimlist); if(status == FAIL) { sprintf(errbuf,"Cannot reverse entries in dimension list.\n"); H5Epush(__FILE__, "HE5_ZAinfoF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(maxdimlist); return(FAIL); } } if(fortmaxdimlist != (char *)NULL) { status = HE5_EHrevflds(maxdimlist, fortmaxdimlist); if(status == FAIL) { sprintf(errbuf,"Cannot reverse entries in maximum dimension list.\n"); H5Epush(__FILE__, "HE5_ZAinfoF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); free(maxdimlist); return(FAIL); } } } *ntype = (int)dtype[0]; free(maxdimlist); free(dimlist); free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAchunkinfoF | | | | DESCRIPTION: FORTRAN wrapper for ZAchunkinfo | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | ZaID int ZA structure ID | | fieldname char* name of field | | | | OUTPUTS: | | ndims int* rank of a dataset | | dims long the array containing sizes | | of each dimension of a chunk | | | | NOTES: | | | | | | Date Programmer Description | | ========= ============ ============================================ | | Dec 03 S.Zhao Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAchunkinfoF(int ZaID, char *fieldname, int *ndims, long dims[]) { int ret = FAIL; /* return status */ int j = 0; /* Loop index */ herr_t status = FAIL; /* return status */ hid_t zaID = FAIL; /* HDF5 type za ID */ hsize_t tempdims[HE5_DTSETRANKMAX]; /* Temporary dimension sizes array */ hsize_t swap = 0; /* Temporary dimension size */ char *errbuf = (char *)NULL; /* error message buffer */ /* Allocate memory for error message buffer */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_ZAchunkinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Initialize tempdims[] array */ /* --------------------------- */ for ( j = 0; j < HE5_DTSETRANKMAX; j++) tempdims[ j ] = 0; zaID = (hid_t)ZaID; status = HE5_ZAchunkinfo(zaID, fieldname, ndims, tempdims); if(status == FAIL) { sprintf(errbuf,"Error calling ZAchunkinfo() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_ZAchunkinfoF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } for (j = 0; j < *ndims / 2; j++) { swap = tempdims[*ndims - 1 - j]; tempdims[*ndims - 1 - j] = tempdims[j]; tempdims[j] = swap; } for (j = 0; j < *ndims; j++) dims[j] = (long)tempdims[j]; free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAwrgattr | | | | DESCRIPTION: FORTRAN wrapper to write/update group attribute in a za. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | ZaID int ZA structure ID | | attrname char* group attribute name | | numtype int group attribute HDF numbertype | | fortcount[] long number of group attribute elements | | datbuf void I/O buffer | | | | OUTPUTS: | | None | | It is assumed that fortcout has just one element to agree | | with EHattr() call. | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | Mar 04 S.Zhao Modified for a character string attribute. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAwrgattr(int ZaID, char *attrname, int numtype, long fortcount[], void *datbuf) { int ret = FAIL; /* (int) return status variable */ int rank = 1; /* Rank variable */ int i; /* Loop index */ herr_t status = FAIL; /* routine return status variable */ hid_t zaID = FAIL; /* HDF5 type za ID */ hid_t numbertype = FAIL; /* HDF5 data type ID */ hsize_t *count = (hsize_t *)NULL;/* Pointer to count array (C order) */ char *errbuf = (char *)NULL; /* error message buffer */ char *tempbuf = (char *)NULL; /* temp buffer */ /* Allocate memory for error message buffers */ /* ----------------------------------------- */ errbuf = (char *)calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_ZAwrgattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Get HDF5 data type ID */ /* --------------------- */ numbertype = HE5_EHconvdatatype(numtype); if(numbertype == FAIL) { sprintf(errbuf,"Cannot convert to HDF5 type data type ID.\n"); H5Epush(__FILE__, "HE5_ZAwrgattr", __LINE__, H5E_DATATYPE, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } count = (hsize_t *)calloc(rank, sizeof(hsize_t)); if( count == NULL) { sprintf(errbuf,"Cannot allocate memory for count.\n"); H5Epush(__FILE__, "HE5_ZAwrgattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Reverse order of dimensions (FORTRAN -> C) */ /* ------------------------------------------ */ for (i = 0; i < rank; i++) count[i] = (hsize_t)fortcount[rank - 1 - i]; zaID = (hid_t)ZaID; if ((numbertype == HE5T_CHARSTRING) || (numbertype == H5T_NATIVE_CHAR) || (numbertype == H5T_C_S1)) { if (strlen((char *)datbuf) < count[0]) { sprintf(errbuf,"Size of databuf is less than the number of group attribute elements.\n"); H5Epush(__FILE__, "HE5_ZAwrgattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); return(FAIL); } /* Allocate memory for temp buffer */ /* ------------------------------- */ tempbuf = (char * )calloc((count[0]+1), sizeof(char)); if(tempbuf == NULL) { sprintf(errbuf,"Cannot allocate memory for temp buffer.\n"); H5Epush(__FILE__, "HE5_ZAwrgattr", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(errbuf); return(FAIL); } strncpy(tempbuf,(char *)datbuf, count[0]); tempbuf[count[0]] = '\0'; status = HE5_ZAwritegrpattr(zaID, attrname, numbertype, count, tempbuf); if(status == FAIL) { sprintf(errbuf,"Cannot write group attribute value.\n"); H5Epush(__FILE__, "HE5_ZAwrgattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); free(tempbuf); return(FAIL); } free(count); free(errbuf); free(tempbuf); } else { status = HE5_ZAwritegrpattr(zaID, attrname, numbertype, count, datbuf); if(status == FAIL) { sprintf(errbuf,"Cannot write group attribute value.\n"); H5Epush(__FILE__, "HE5_ZAwrgattr", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); return(FAIL); } free(count); free(errbuf); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAatinfo | | | | DESCRIPTION: FORTRAN wrapper for ZAattrinfo | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | ZaID int ZA structure ID | | attrname char* attribute name | | | | OUTPUTS: | | numbertype int attribute HDF numbertype | | fortcount long Number of attribute elements | | | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | | | -----------------------------------------------------------------------------*/ int HE5_ZAatinfo(int ZaID, char *attrname, int *numbertype, long *fortcount) { int ret = FAIL; /* (int) return status variable */ herr_t status = FAIL; /* return status variable */ hid_t *ntype = (hid_t *)NULL;/* Data type ID */ hid_t zaID = FAIL; /* HDF5 type za ID */ hsize_t *count = (hsize_t *)NULL;/* Pointer to count (C order) */ char *errbuf = (char *)NULL; /* error message buffer */ /* Allocate memory for error message buffers */ /* ----------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_ZAatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } count = (hsize_t *) calloc(1, sizeof(hsize_t)); if( count == NULL) { sprintf(errbuf,"Cannot allocate memory for count.\n"); H5Epush(__FILE__, "HE5_ZAatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } ntype = (hid_t *) calloc(1, sizeof(hid_t)); if(ntype == NULL) { sprintf(errbuf,"Cannot allocate memory for ntype.\n"); H5Epush(__FILE__, "HE5_ZAatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); return(FAIL); } zaID = (hid_t)ZaID; status = HE5_ZAattrinfo(zaID, attrname, ntype, count); if(status == FAIL) { sprintf(errbuf,"Cannot get information about attribute \"%s\".\n", attrname); H5Epush(__FILE__, "HE5_ZAatinfo", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); free(ntype); return(FAIL); } *fortcount = (long)(*count); *numbertype = (int)(*ntype); free(errbuf); free(count); free(ntype); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAatinfo2 | | | | DESCRIPTION: FORTRAN wrapper for ZAattrinfo2 | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | ZaID int ZA structure ID | | attrname char* attribute name | | | | OUTPUTS: | | numbertype int attribute HDF numbertype | | fortcount long Number of attribute elements | | fortsize long buf size of attribute elements | | | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | | | -----------------------------------------------------------------------------*/ int HE5_ZAatinfo2(int ZaID, char *attrname, int *numbertype, long *fortcount, long *fortsize) { int ret = FAIL; /* (int) return status variable */ herr_t status = FAIL; /* return status variable */ hid_t *ntype = (hid_t *)NULL;/* Data type ID */ hid_t zaID = FAIL; /* HDF5 type za ID */ hsize_t *count = (hsize_t *)NULL;/* Pointer to count */ hsize_t *size = (hsize_t *)NULL;/* Pointer to array elemet size*/ char *errbuf = (char *)NULL; /* error message buffer */ /* Allocate memory for error message buffers */ /* ----------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_ZAatinfo2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } count = (hsize_t *) calloc(1, sizeof(hsize_t)); if( count == NULL) { sprintf(errbuf,"Cannot allocate memory for count.\n"); H5Epush(__FILE__, "HE5_ZAatinfo2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } size = (hsize_t *) calloc(1, sizeof(hsize_t)); if( size == NULL) { sprintf(errbuf,"Cannot allocate memory for size.\n"); H5Epush(__FILE__, "HE5_ZAatinfo2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } ntype = (hid_t *) calloc(1, sizeof(hid_t)); if(ntype == NULL) { sprintf(errbuf,"Cannot allocate memory for ntype.\n"); H5Epush(__FILE__, "HE5_ZAatinfo2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); return(FAIL); } zaID = (hid_t)ZaID; status = HE5_ZAattrinfo2(zaID, attrname, ntype, count, size); if(status == FAIL) { sprintf(errbuf,"Cannot get information about attribute \"%s\".\n", attrname); H5Epush(__FILE__, "HE5_ZAatinfo2", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); free(ntype); return(FAIL); } *fortcount = (long)(*count); *fortsize = (long)(*size); *numbertype = (int)(*ntype); free(errbuf); free(count); free(size); free(ntype); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAgatinfo | | | | DESCRIPTION: FORTRAN wrapper for ZAgrpattrinfo | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | ZaID int ZA structure ID | | attrname char* attribute name | | | | OUTPUTS: | | numbertype int attribute HDF numbertype | | fortcount long Number of attribute elements | | | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | | | -----------------------------------------------------------------------------*/ int HE5_ZAgatinfo(int ZaID, char *attrname, int *numbertype, long *fortcount) { int ret = FAIL; /* (int) return status variable */ herr_t status = FAIL; /* routine return status variable */ hid_t *ntype = (hid_t *)NULL; /* Data type ID */ hid_t zaID = FAIL; /* HDF5 type za ID */ hsize_t *count = (hsize_t *)NULL;/* Pointer to count (C order) */ char *errbuf = (char *)NULL; /* error message buffer */ /* Allocate memory for error message buffers */ /* ----------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_ZAgatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } count = (hsize_t *)calloc(1, sizeof(hsize_t)); if( count == NULL) { sprintf(errbuf,"Cannot allocate memory for count.\n"); H5Epush(__FILE__, "HE5_ZAgatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } ntype = (hid_t *)calloc(1, sizeof(hid_t)); if( ntype == NULL) { sprintf(errbuf,"Cannot allocate memory for ntype.\n"); H5Epush(__FILE__, "HE5_ZAgatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); return(FAIL); } zaID = (hid_t)ZaID; status = HE5_ZAgrpattrinfo(zaID, attrname, ntype, count); if(status == FAIL) { sprintf(errbuf,"Cannot get information about group attribute.\n"); H5Epush(__FILE__, "HE5_ZAgatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); free(ntype); return(FAIL); } *fortcount = (long)(*count); *numbertype = (int)(*ntype); free(errbuf); free(count); free(ntype); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAgatinfo2 | | | | DESCRIPTION: FORTRAN wrapper for ZAgrpattrinfo2 | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | ZaID int ZA structure ID | | attrname char* attribute name | | | | OUTPUTS: | | numbertype int attribute HDF numbertype | | fortcount long Number of attribute elements | | fortsize long buf size of attribute elements | | | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | | | -----------------------------------------------------------------------------*/ int HE5_ZAgatinfo2(int ZaID, char *attrname, int *numbertype, long *fortcount, long *fortsize) { int ret = FAIL; /* (int) return status variable */ herr_t status = FAIL; /* routine return status variable */ hid_t *ntype = (hid_t *)NULL; /* Data type ID */ hid_t zaID = FAIL; /* HDF5 type za ID */ hsize_t *count = (hsize_t *)NULL;/* Pointer to count */ hsize_t *size = (hsize_t *)NULL;/* Pointer to size of array element*/ char *errbuf = (char *)NULL; /* error message buffer */ /* Allocate memory for error message buffers */ /* ----------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_ZAgatinfo2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } count = (hsize_t *)calloc(1, sizeof(hsize_t)); if( count == NULL) { sprintf(errbuf,"Cannot allocate memory for count.\n"); H5Epush(__FILE__, "HE5_ZAgatinfo2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } size = (hsize_t *)calloc(1, sizeof(hsize_t)); if( size == NULL) { sprintf(errbuf,"Cannot allocate memory for size.\n"); H5Epush(__FILE__, "HE5_ZAgatinfo2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } ntype = (hid_t *)calloc(1, sizeof(hid_t)); if( ntype == NULL) { sprintf(errbuf,"Cannot allocate memory for ntype.\n"); H5Epush(__FILE__, "HE5_ZAgatinfo2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); return(FAIL); } zaID = (hid_t)ZaID; status = HE5_ZAgrpattrinfo2(zaID, attrname, ntype, count, size); if(status == FAIL) { sprintf(errbuf,"Cannot get information about group attribute.\n"); H5Epush(__FILE__, "HE5_ZAgatinfo2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); free(ntype); return(FAIL); } *fortcount = (long)(*count); *fortsize = (long)(*size); *numbertype = (int)(*ntype); free(errbuf); free(count); free(size); free(ntype); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAinqgattrs (FORTRAN wrapper) | | | | DESCRIPTION: Retrieves the number of attributes and string length of | | attribute list in "Data Fields" group | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nattr long Number of attributes in "Data Fields" | | group. | | | | INPUTS: | | ZaID int ZA structure ID | | | | OUTPUTS: | | attrnames char Attribute names in "Data Fields" group | | (Comma-separated list) | | strbufsize long Attributes name list string length | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_ZAinqgattrs(int ZaID, char *attrnames, long *strbufsize) { long nattr = FAIL; /* Number of attributes (return) */ hid_t zaID = FAIL; /* HDF5 type za ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ zaID = (hid_t)ZaID; nattr = HE5_ZAinqgrpattrs(zaID, attrnames, strbufsize); if ( nattr < 0 ) { sprintf(errbuf, "Cannot retrieve the attributes. \n"); H5Epush(__FILE__, "HE5_ZAinqgattrs", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return(nattr); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAinqattrsF (FORTRAN wrapper) | | | | DESCRIPTION: Retrieves information about attributes defined in ZA | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nattr long Number of attributes in za struct | | | | INPUTS: | | ZaID int ZA structure ID | | | | OUTPUTS: | | attrnames char Attribute names in za struct | | (Comma-separated list) | | strbufsize long Attributes name list string length | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_ZAinqattrsF(int ZaID, char *attrnames, long *strbufsize) { long nattr = FAIL; /* Number of attributes (return) */ hid_t zaID = FAIL; /* HDF5 type za ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ zaID = (hid_t)ZaID; nattr = HE5_ZAinqattrs(zaID, attrnames, strbufsize); if ( nattr < 0 ) { sprintf(errbuf, "Cannot retrieve the attributes. \n"); H5Epush(__FILE__, "HE5_ZAinqattrsF", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return(nattr); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAlatinfo | | | | DESCRIPTION: FORTRAN wrapper for ZAlocattrinfo | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | ZaID int ZA structure ID | | fieldname char* field name name | | | | OUTPUTS: | | attrname char* attribute name | | numbertype int attribute HDF numbertype | | fortcount long Number of attribute elements | | | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | | | -----------------------------------------------------------------------------*/ int HE5_ZAlatinfo(int ZaID, char *fieldname, char *attrname, int *numbertype, long *fortcount) { int ret = FAIL; /* (int) return status variable */ herr_t status = FAIL; /* routine return status variable */ hid_t *ntype = (hid_t *)NULL; /* Data type ID */ hid_t zaID = FAIL; /* HDF5 type za ID */ hsize_t *count = (hsize_t *)NULL;/* Pointer to count (C order) */ char *errbuf = (char *)NULL; /* error message buffer */ /* Allocate memory for error message buffers */ /* ----------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_ZAlatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } count = (hsize_t *)calloc(1, sizeof(hsize_t)); if( count == NULL) { sprintf(errbuf,"Cannot allocate memory for count.\n"); H5Epush(__FILE__, "HE5_ZAlatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } ntype = (hid_t *)calloc(1, sizeof(hid_t)); if( ntype == NULL) { sprintf(errbuf,"Cannot allocate memory for ntype.\n"); H5Epush(__FILE__, "HE5_ZAlatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); return(FAIL); } zaID = (hid_t)ZaID; status = HE5_ZAlocattrinfo(zaID, fieldname, attrname, ntype, count); if(status == FAIL) { sprintf(errbuf,"Cannot get information about local attribute.\n"); H5Epush(__FILE__, "HE5_ZAlatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); free(ntype); return(FAIL); } *fortcount = (long)(*count); *numbertype = (int)(*ntype); free(errbuf); free(count); free(ntype); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAlatinfo2 | | | | DESCRIPTION: FORTRAN wrapper for ZAlocattrinfo2 | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | ZaID int ZA structure ID | | fieldname char* field name name | | | | OUTPUTS: | | attrname char* attribute name | | numbertype int attribute HDF numbertype | | fortcount long Number of attribute elements | | fortsize long buf size of attribute elements | | | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | | | -----------------------------------------------------------------------------*/ int HE5_ZAlatinfo2(int ZaID, char *fieldname, char *attrname, int *numbertype, long *fortcount, long *fortsize) { int ret = FAIL; /* (int) return status variable */ herr_t status = FAIL; /* routine return status variable */ hid_t *ntype = (hid_t *)NULL; /* Data type ID */ hid_t zaID = FAIL; /* HDF5 type za ID */ hsize_t *count = (hsize_t *)NULL;/* Pointer to count (C order) */ hsize_t *size = (hsize_t *)NULL;/* Pointer to size of array elements*/ char *errbuf = (char *)NULL; /* error message buffer */ /* Allocate memory for error message buffers */ /* ----------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_ZAlatinfo2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } count = (hsize_t *)calloc(1, sizeof(hsize_t)); if( count == NULL) { sprintf(errbuf,"Cannot allocate memory for count.\n"); H5Epush(__FILE__, "HE5_ZAlatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } size = (hsize_t *)calloc(1, sizeof(hsize_t)); if( size == NULL) { sprintf(errbuf,"Cannot allocate memory for size.\n"); H5Epush(__FILE__, "HE5_ZAlatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } ntype = (hid_t *)calloc(1, sizeof(hid_t)); if( ntype == NULL) { sprintf(errbuf,"Cannot allocate memory for ntype.\n"); H5Epush(__FILE__, "HE5_ZAlatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); return(FAIL); } zaID = (hid_t)ZaID; status = HE5_ZAlocattrinfo(zaID, fieldname, attrname, ntype, count); if(status == FAIL) { sprintf(errbuf,"Cannot get information about local attribute.\n"); H5Epush(__FILE__, "HE5_ZAlatinfo", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(count); free(ntype); return(FAIL); } *fortcount = (long)(*count); *fortsize = (long)(*size); *numbertype = (int)(*ntype); free(errbuf); free(count); free(size); free(ntype); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAinqlattrs (FORTRAN wrapper) | | | | DESCRIPTION: Retrieves the number of attributes and string length of | | attribute list associated with a specified field in the | | "Data Fields" group. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nattr long Number of attributes in "Data Fields" | | group. | | | | INPUTS: | | ZaID int ZA structure ID | | fieldname char field name | | | | OUTPUTS: | | attrnames char Attribute names in "Data Fields" group | | (Comma-separated list) | | strbufsize long Attributes name list string length | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_ZAinqlattrs(int ZaID, char *fieldname, char *attrnames, long *strbufsize) { long nattr = FAIL; /* Number of attributes */ hid_t zaID = FAIL; /* HDF5 type za ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ zaID = (hid_t)ZaID; nattr = HE5_ZAinqlocattrs(zaID, fieldname, attrnames, strbufsize); if ( nattr < 0 ) { sprintf(errbuf, "Cannot retrieve the attributes. \n"); H5Epush(__FILE__, "HE5_ZAinqlattrs", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return (nattr); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAidtype | | | | DESCRIPTION: Inquires about data fields in za (FORTRAN Wrapper) | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | ZaID int ZA structure ID | | fieldname char* Field name | | attrname char* Attribute name | | fieldgroup int Field group id | | | | OUTPUTS: | | Type int* | | Class int* | | Order int* | | size long* | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAidtype(int ZaID, char *fieldname, char *attrname, int fieldgroup, int *Type, int *Class, int *Order, long *size) { int ret = FAIL; /* (int) status variable */ herr_t status = FAIL; /* return status variable */ size_t *tsize = (size_t *)NULL; /* data size variable */ hid_t *typeID = (hid_t *)NULL; /* HDF5 Data type ID */ hid_t zaID = FAIL; /* HDF5 type za ID */ H5T_class_t *classID = (H5T_class_t *)NULL;/* Data type class ID */ H5T_order_t *order = (H5T_order_t *)NULL;/* Byte order of datatype */ char *errbuf = (char *)NULL; /* error message buffer */ /* Allocate memory for error message buffers */ /* ----------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_ZAidtype", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } typeID = (hid_t *)calloc(1, sizeof(hid_t)); if(typeID == NULL) { sprintf(errbuf,"Cannot allocate memory for typeID.\n"); H5Epush(__FILE__, "HE5_ZAidtype", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } tsize = (size_t *)calloc(1, sizeof(size_t)); if(tsize == NULL) { sprintf(errbuf,"Cannot allocate memory for tsize.\n"); H5Epush(__FILE__, "HE5_ZAidtype", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(typeID); return(FAIL); } classID = (H5T_class_t *)calloc(1, sizeof(H5T_class_t)); if(classID == (H5T_class_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for classID.\n"); H5Epush(__FILE__, "HE5_ZAidtype", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(typeID); free(tsize); return(FAIL); } order = (H5T_order_t *)calloc(1, sizeof(H5T_order_t)); if(order == (H5T_order_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for order.\n"); H5Epush(__FILE__, "HE5_ZAidtype", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(typeID); free(tsize); free(classID); return(FAIL); } zaID = (hid_t)ZaID; /* Get data type information */ /* ------------------------- */ status = HE5_ZAinqdatatype(zaID, fieldname, attrname, fieldgroup, typeID, classID, order, tsize); if(status == FAIL) { sprintf(errbuf,"Cannot get information about data type.\n"); H5Epush(__FILE__, "HE5_ZAidtype", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(typeID); free(tsize); free(classID); free(order); return(FAIL); } *Type = (int)(*typeID); *Class = (int)(*classID); *Order = (int)(*order); *size = (long)(*tsize); free(errbuf); free(typeID); free(classID); free(order); free(tsize); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAinqzaF (FORTRAN wrapper) | | | | DESCRIPTION: Returns number and names of za structures in file | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nza long Number of ZA structures in file | | | | INPUTS: | | filename char HDF-EOS filename | | | | OUTPUTS: | | zalist char List of za names (comma-separated) | | strbufsize long Length of zalist | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_ZAinqzaF(char *filename, char *zalist, long *strbufsize) { long nza = FAIL;/* Number of za structures in file */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ nza = HE5_ZAinqza(filename, zalist, strbufsize); if ( nza < 0 ) { sprintf(errbuf,"Cannot get information about za."); H5Epush(__FILE__, "HE5_ZAinqzaF", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return(nza); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAnentriesF (FORTRAN wrapper) | | | | DESCRIPTION: Returns number of entries and string buffer size | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nEntries long Number of entries | | | | INPUTS: | | ZaID int ZA structure ID | | entrycode int Entry code | | | | OUTPUTS: | | strbufsize long Length of comma-separated list | | (Does not include null-terminator | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_ZAnentriesF(int ZaID, int entrycode, long *strbufsize) { long nEntries = FAIL; /* Number of entries */ hid_t zaID = FAIL; /* HDF5 type za ID */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Buffer for error message */ zaID = (hid_t)ZaID; nEntries = HE5_ZAnentries(zaID, entrycode, strbufsize); if (nEntries < 0) { sprintf(errbuf,"Failed to get number of entries in a za."); H5Epush(__FILE__, "HE5_ZAnentriesF", __LINE__, H5E_ARGS, H5E_BADVALUE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return(nEntries); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAsetaliasF (FORTRAN wrapper) | | | | DESCRIPTION: Defines alias for a specified field name | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | ret int Return status | | | | INPUTS: | | ZaID int ZA structure ID | | fieldname char Original field name | | | | OUTPUTS: | | fortaliaslist char Comma separated list of aliases for| | the field name | | | | NOTES: | | None | | | | Date Programmer Description | | ======= ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAsetaliasF(int ZaID, char *fieldname, char *fortaliaslist) { int ret = FAIL;/* (int)Return status variable */ herr_t status = FAIL;/* return status variable */ hid_t zaID = FAIL;/* HDF5 type za ID */ char *aliaslist = NULL;/* C-order list of aliases */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ zaID = (hid_t)ZaID; /* Allocate space for C order alias list */ /* ------------------------------------- */ aliaslist = (char *)calloc(strlen(fortaliaslist) + 1, sizeof(char)); if(aliaslist == NULL) { sprintf(errbuf,"Cannot allocate memory for aliaslist.\n"); H5Epush(__FILE__, "HE5_ZAsetaliasF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Reverse entries in alias list (FORTRAN -> C) */ /* -------------------------------------------- */ status = HE5_EHrevflds(fortaliaslist, aliaslist); if(status == FAIL) { sprintf(errbuf,"Cannot reverse entries in alias list.\n"); H5Epush(__FILE__, "HE5_ZAsetaliasF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(aliaslist); return(FAIL); } /* Call ZAsetalias() */ /* ----------------- */ status = HE5_ZAsetalias(zaID, fieldname, aliaslist); if ( status == FAIL ) { sprintf(errbuf, "Error calling ZAsetalias() from FORTRAN wrapper. \n"); H5Epush(__FILE__, "HE5_ZAsetaliasF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(aliaslist); return(FAIL); } free(aliaslist); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAdropaliasF (FORTRAN wrapper) | | | | DESCRIPTION: Removes the alias for a specified field name | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | ret int Return status | | | | INPUTS: | | ZaID int ZA structure ID | | aliasname char Alias name to remove | | fldgroup int Field group flag | | | | OUTPUTS: | | | | NOTES: | | None | | | | | | Date Programmer Description | | ======= ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAdropaliasF(int ZaID, int fldgroup, char *aliasname) { int ret = FAIL;/* (int)Return status variable */ herr_t status = FAIL;/* return status variable */ hid_t zaID = FAIL;/* HDF5 type za ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ zaID = (hid_t)ZaID; status = HE5_ZAdropalias(zaID, fldgroup, aliasname); if(status == FAIL) { sprintf(errbuf,"Error calling ZAdropalias() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_ZAdropaliasF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAinqfldaliasF (FORTRAN wrapper) | | | | DESCRIPTION: Retrieves the number of fields & aliases and string length of| | fields & aliases list in "Data Fields" group | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nfldalias long Number of fields & aliases in "Data | | Fields" group. | | | | INPUTS: | | ZaID int za structure ID | | | | OUTPUTS: | | fldalias char* Fields & aliases names in "Data Fields" | | group (Comma-separated list) | | strbufsize long* Fields & aliases name list string length| | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Mar 03 S.Zhao Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_ZAinqfldaliasF(int ZaID, char *fldalias, long *strbufsize) { long nfldalias = FAIL; /* Number of fields & aliases (return) */ hid_t zaID = FAIL; /* HDF5 type za ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ zaID = (hid_t)ZaID; nfldalias = HE5_ZAinqfldalias(zaID, fldalias, strbufsize); if ( nfldalias < 0 ) { sprintf(errbuf, "Cannot retrieve the fields & aliases. \n"); H5Epush(__FILE__, "HE5_ZAinqfldaliasF", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return(nfldalias); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAaliasinfoF (FORTRAN wrapper) | | | | DESCRIPTION: Retrieves information about field aliases | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | ret int Return status | | | | INPUTS: | | ZaID int ZA structure ID | | aliasname char alias name | | fldgroup int Field group flag | | | | OUTPUTS: | | length int Buffer size | | buffer char Buffer with original field name | | | | NOTES: | | None | | | | | | Date Programmer Description | | ======= ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAaliasinfoF(int ZaID, int fldgroup, char *aliasname, int *length, char *buffer) { int ret = FAIL;/* (int) return status variable */ herr_t status = FAIL;/* return status variable */ hid_t zaID = FAIL;/* HDF5 type za ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ zaID = (hid_t)ZaID; status = HE5_ZAaliasinfo(zaID, fldgroup, aliasname, length, buffer); if(status == FAIL) { sprintf(errbuf,"Error calling ZAaliasinfo() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_ZAaliasinfoF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAfldrenameF (FORTRAN wrapper) | | | | DESCRIPTION: Changes the field name | | | | | | Return Value Type Units Description | | ============ =========== ========= ================================= | | ret int Return status | | | | INPUTS: | | ZaID int ZA structure ID | | oldfieldname char Original field name | | | | OUTPUTS: | | newfieldname char New field name | | | | NOTES: | | None | | | | | | Date Programmer Description | | ======= ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAfldrenameF(int ZaID, char *oldfieldname, char *newfieldname) { int ret = FAIL;/* (int)Return status variable */ herr_t status = FAIL;/* return status variable */ hid_t zaID = FAIL;/* HDF5 type za ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ zaID = (hid_t)ZaID; status = HE5_ZAfldrename(zaID, oldfieldname, newfieldname); if(status == FAIL) { sprintf(errbuf,"Error calling ZAfldrename() from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_ZAfldrenameF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAdefcomchunkF (FORTRAN wrapper) | | | | DESCRIPTION: Defines compression type and parameters and sets chunking | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int None return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | ZaID int ZA structure ID | | compcode int compression code | | compparm int compression parameters | | rank int rank of a dataset | | *dim long pointer to the array containing sizes | | of each dimension of a chunk | | | | OUTPUTS: | | None | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAdefcomchunkF(int ZaID, int compcode, int *compparm, int rank, long *dim) { int ret = FAIL; /* return status */ int j = 0; /* Loop index */ herr_t status = FAIL; /* return status */ hsize_t *tempdims = (hsize_t *)NULL;/* Temporary variable */ hid_t zaID = FAIL; /* HDF5 type za ID */ char *errbuf = (char *)NULL; /* error message buffer */ /* Allocate memory for error message buffer */ /* ---------------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_ZAdefcomchunkF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Allocate space for C order dimension list */ /* ----------------------------------------- */ tempdims = (hsize_t *)calloc(rank, sizeof(hsize_t)); if(tempdims == (hsize_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for tempdims.\n"); H5Epush(__FILE__, "HE5_ZAdefcomchunkF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Change from FORTRAN to C dimension order */ /* ---------------------------------------- */ for (j = 0; j < rank; j++) tempdims[j] = (hsize_t)dim[ rank - 1 - j ]; zaID = (hid_t)ZaID; /* Call HE5_ZAdefcomchunk() */ /* ------------------------ */ status = HE5_ZAdefcomchunk(zaID, compcode, compparm, rank, tempdims); if (status == FAIL) { sprintf(errbuf, "Error calling HE5_ZAdefcomchunk from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_ZAdefcomchunkF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(tempdims); return(FAIL); } free(tempdims); free(errbuf); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAsetextdataF (FORTRAN wrapper) | | | | DESCRIPTION: Sets external data files. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | ret int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | ZaID int ZA structure ID | | fortfilelist char* list of external files (FORTRAN order) | | offset long array of offsets (in bytes) from the | | beginning of the file to the location | | in the file where the data starts | | size long array of sizes (in bytes) reserved in | | the file for the data. | | | | OUTPUTS: | | None | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAsetextdataF(int ZaID, char *fortfilelist, long offset[], long size[]) { int ret = FAIL; /* return status variable */ herr_t status = FAIL; /* Return status variable */ hid_t zaID = FAIL; /* ZA HDF5 type ID */ off_t *off = (off_t *)NULL; /* Array of data offsets */ long nentries = 0; /* Number of list entries */ long i; /* Loop index */ hsize_t *sz = (hsize_t *)NULL;/* Array of data sizes */ char *filelist = (char *)NULL; /* Files list (C order) */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ /* Allocate space for C order file list */ /* ------------------------------------ */ filelist = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char)); if(filelist == NULL) { sprintf(errbuf,"Cannot allocate memory for input list.\n"); H5Epush(__FILE__, "HE5_ZAsetextdataF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Reverse entries in input list */ /* ----------------------------- */ status = HE5_EHrevflds(fortfilelist, filelist); if(status == FAIL) { sprintf(errbuf,"Cannot reverse entries in file list.\n"); H5Epush(__FILE__, "HE5_ZAsetextdataF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(filelist); return(FAIL); } /* Parse the list of entries to get number of files */ /* ------------------------------------------------ */ nentries = HE5_EHparsestr(filelist, ',', NULL, NULL); if(nentries <= 0) { sprintf(errbuf,"Cannot parse the input list/input list is empty.\n"); H5Epush(__FILE__, "HE5_ZAsetextdataF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(filelist); return(FAIL); } /* Allocate space for offset array */ /* ------------------------------- */ off = (off_t *)calloc(nentries, sizeof(off_t)); if(off == (off_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for input offset array.\n"); H5Epush(__FILE__, "HE5_ZAsetextdataF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(filelist); return(FAIL); } /* Allocate space for size array */ /* ----------------------------- */ sz = (hsize_t *)calloc(nentries, sizeof(hsize_t)); if(sz == (hsize_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for input size array.\n"); H5Epush(__FILE__, "HE5_ZAsetextdataF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(filelist); free(off); return(FAIL); } /* Copy the elements of input arrays */ /* --------------------------------- */ for (i = 0; i < nentries; i++) { off[ nentries - 1 - i ] = (off_t)offset[ i ]; sz[ nentries - 1 - i ] = (hsize_t)size[ i ]; } zaID = (hid_t)ZaID; /* Call the C function */ /* ------------------- */ status = HE5_ZAsetextdata(zaID, filelist, off, sz); if (status == FAIL) { sprintf(errbuf, "Error calling HE5_ZAsetextdata from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_ZAsetextdataF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(filelist); free(off); free(sz); return(FAIL); } if (filelist != NULL) free(filelist); if (off != NULL) free(off); if (sz != NULL) free(sz); ret = (int)status; return(ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAgetextdataF (FORTRAN wrapper) | | | | DESCRIPTION: Gets external data files information. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nfiles int number of external files SUCCEED, | | (-1) FAIL | | | | INPUTS: | | ZaID int ZA structure ID | | fieldname char* External field name | | | | OUTPUTS: | | namelength long Length of each name entry | | fortfilelist char* List of file names (FORTRAN order) | | offset long array of offsets (in bytes) from the | | beginning of the file to the location | | in the file where the data starts | | size long array of sizes (in bytes) reserved in | | the file for the data. | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Aug 02 S.ZHAO Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAgetextdataF(int ZaID, char *fieldname, long namelength, char *fortfilelist, long offset[], long size[]) { int nfiles = FAIL; /* number of files (return) */ int i; /* Loop index */ herr_t status = FAIL; /* Return status variable */ hid_t zaID = FAIL; /* ZA HDF5 type ID */ off_t *off = (off_t *)NULL; /* Array of data offsets */ hsize_t *sz = (hsize_t *)NULL;/* Array of sizes */ size_t nmlen = 0; /* Each entry string length */ char *filelist = (char *)NULL; /* Files list (C order) */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Error message buffer */ /* Allocate space for C order output file list */ /* ------------------------------------------- */ filelist = (char *)calloc(HE5_HDFE_UTLBUFSIZE, sizeof(char)); if(filelist == NULL) { sprintf(errbuf,"Cannot allocate memory for output list.\n"); H5Epush(__FILE__, "HE5_ZAgetextdataF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } /* Allocate space for offset array */ /* ------------------------------- */ off = (off_t *)calloc(HE5_FLDNUMBERMAX , sizeof(off_t)); if(off == (off_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for input offset array.\n"); H5Epush(__FILE__, "HE5_ZAgetextdataF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(filelist); return(FAIL); } /* Allocate space for size array */ /* ----------------------------- */ sz = (hsize_t *)calloc(HE5_FLDNUMBERMAX, sizeof(hsize_t)); if(sz == (hsize_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for input size array.\n"); H5Epush(__FILE__, "HE5_ZAgetextdataF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(filelist); free(off); return(FAIL); } zaID = (hid_t)ZaID; nmlen = (size_t)namelength; /* Call the C function */ /* ------------------- */ nfiles = HE5_ZAgetextdata(zaID, fieldname, nmlen, filelist, off, sz); if (nfiles == FAIL) { sprintf(errbuf, "Error calling HE5_ZAgetextdata from FORTRAN wrapper.\n"); H5Epush(__FILE__, "HE5_ZAgetextdataF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(filelist); free(off); free(sz); return(FAIL); } /* Reverse entries in output list */ /* ----------------------------- */ status = HE5_EHrevflds(filelist, fortfilelist); if(status == FAIL) { sprintf(errbuf,"Cannot reverse entries in output file list.\n"); H5Epush(__FILE__, "HE5_ZAgetextdataF", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(filelist); free(off); free(sz); return(FAIL); } /* Populate the output arrays */ /* -------------------------- */ for (i = 0; i < nfiles; i++) { offset[ nfiles - 1 - i ] = (long)off[ i ]; size[ nfiles - 1 - i ] = (long)sz[ i ]; } if (filelist != NULL) free(filelist); if (off != NULL) free(off); if (sz != NULL) free(sz); return(nfiles); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAwrdmeta | | | | DESCRIPTION: Defines structural metadata for pre-existing data | | field within ZA structure (FORTRAN) | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | ZaID int ZA structure ID | | fieldname char fieldname | | fortdimlist char Dimension list (comma-separated list) | | FORTRAN dimesion order | | mvalue int field type | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jun 05 S. Zhao Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAwrdmeta(int ZaID, char *fieldname, char *fortdimlist, int mvalue) { int ret = FAIL; /* (int) return status variable */ herr_t status = FAIL; /* routine return status variable */ hid_t zaID = FAIL; /* HDF5 type za ID */ hid_t numbertype = FAIL; /* HDF5 type data type ID */ char *dimlist = (char *)NULL; /* Dimension list (C order) */ char *errbuf = (char *)NULL; /* error message buffer */ zaID = (hid_t)ZaID; numbertype = HE5_EHconvdatatype(mvalue); if(numbertype == FAIL) { H5Epush(__FILE__, "HE5_ZAwrdmeta", __LINE__, H5E_DATATYPE, H5E_BADVALUE, "Cannot convert datatype for FORTRAN wrapper."); HE5_EHprint("Error: Cannot convert datatype for FORTRAN wrapper, occured", __FILE__, __LINE__); return(FAIL); } /* Allocate memory for error message buffers */ /* ----------------------------------------- */ errbuf = (char * )calloc(HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_ZAwrdmeta", __LINE__, H5E_RESOURCE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /* Allocate space for C order dimension list */ /* ----------------------------------------- */ dimlist = (char *) calloc(strlen(fortdimlist) + 1, sizeof(char)); if(dimlist == NULL) { sprintf(errbuf,"Cannot allocate memory for dimlist.\n"); H5Epush(__FILE__, "HE5_ZAwrdmeta", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Reverse entries in dimension list (FORTRAN -> C) */ /* ------------------------------------------------ */ status = HE5_EHrevflds(fortdimlist, dimlist); if(status == FAIL) { sprintf(errbuf,"Cannot reverse entries in dimension list.\n"); H5Epush(__FILE__, "HE5_ZAwrdmeta", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); return(FAIL); } /* Call Write Metadata routine */ /* --------------------------- */ status = HE5_ZAwritedatameta(zaID, fieldname, dimlist, numbertype); if(status == FAIL) { sprintf(errbuf,"Cannot write \"%s\" field metadata.\n", fieldname); H5Epush(__FILE__, "HE5_ZAwrdmeta", __LINE__, H5E_FUNC, H5E_CANTINIT, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); free(dimlist); return(FAIL); } free(dimlist); free(errbuf); ret = (int)status; return (ret); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAgetaliaslistF (FORTRAN wrapper) | | | | DESCRIPTION: Retrieves the number of aliases and aliases list in "Data | | Fields" group | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nalias long number of aliases in "Data Fields" | | group | | | | INPUTS: | | ZaID int za structure ID | | fldgroup int field group flag | | | | OUTPUTS: | | aliaslist char* list of aliases in "Data Fields" group | | (comma-separated list) | | strbufsize long* length of aliases list | | | | | | NOTES: | | | | Date Programmer Description | | ====== ============ ================================================= | | Jul 05 S.Zhao Original development | | Dec 05 T.Roegner NCR 44092 - Added CYGWIN capability | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_ZAgetaliaslistF(int ZaID, int fldgroup, char *aliaslist, long *strbufsize) { long nalias = FAIL; /* Number of aliases (return) */ hid_t zaID = FAIL; /* HDF5 type za ID */ char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ zaID = (hid_t)ZaID; nalias = HE5_ZAgetaliaslist(zaID, fldgroup, aliaslist, strbufsize); if (nalias < 0) { sprintf(errbuf, "Cannot retrieve the aliases. \n"); H5Epush(__FILE__, "HE5_ZAgetaliaslistF", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return(nalias); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAsetdimscale2F (FORTRAN wrapper for HE5_ZAsetdimscale2) | | | | DESCRIPTION: Defines a dimension scale for a fields dimension in a ZA | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID int ZA structure ID | | fieldname char field name | | dimname char dim name | | dimscalename char dim scale name | | dim long Dimemsion value | | numbertype_in int dim scale data type such as DFNT_INT32, | | DFNT_FLOAT64, DFNT_FLOAT32, etc. | | data void data buffer for write | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | March 17 Abe Taaheri Original Programmer | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAsetdimscale2F(int ZaID, char *fieldname, char *dimname, char *dimscalename, long dim, int numbertype_in, void * data) { herr_t status; hid_t zaID; char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ zaID = (hid_t)ZaID; status = HE5_ZAsetdimscale2(zaID, fieldname, dimname, dimscalename, (hsize_t) dim, (hid_t) numbertype_in, data); if (status < 0) { sprintf(errbuf, "Cannot set dimension scale %s for field %s. \n", dimname, fieldname); H5Epush(__FILE__, "HE5_ZAsetdimscale2F", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return((int)status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAsetdimscaleF (FORTRAN wrapper) | | | | DESCRIPTION: Defines a dimension scale for a fields dimension in a ZA | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID int ZA structure ID | | fieldname char field name | | dimname char dim name | | dim long Dimemsion value | | numbertype_in int dim scale data type such as DFNT_INT32, | | DFNT_FLOAT64, DFNT_FLOAT32, etc. | | data void data buffer for write | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | May 10 Abe Taaheri Original Programmer | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAsetdimscaleF(int ZaID, char *fieldname, char *dimname, long dim, int numbertype_in, void * data) { herr_t status; hid_t zaID; char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ zaID = (hid_t)ZaID; status = HE5_ZAsetdimscale(zaID, fieldname, dimname, (hsize_t) dim, (hid_t) numbertype_in, data); if (status < 0) { sprintf(errbuf, "Cannot set dimension scale %s for field %s. \n", dimname, fieldname); H5Epush(__FILE__, "HE5_ZAsetdimscaleF", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return((int)status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAdefdimscale2F (FORTRAN wrapper for HE5_ZAdefdimscale2) | | | | DESCRIPTION: Defines dimension scale for a dimension for all fields in a ZA| | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID int ZA structure ID | | dimname char dim name | | dimscalename char dim scale name | | dim long Dimemsion value | | numbertype_in int dim scale data type such as DFNT_INT32, | | DFNT_FLOAT64, DFNT_FLOAT32, etc. | | data void data buffer for write | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | March 17 Abe Taaheri Original Programmer | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAdefdimscale2F(int ZaID, char *dimname, char *dimscalename, long dim, int numbertype_in, void * data) { herr_t status; hid_t zaID; char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ zaID = (hid_t)ZaID; status = HE5_ZAdefdimscale2(zaID, dimname, dimscalename, (hsize_t) dim, (hid_t) numbertype_in, data); if (status < 0) { sprintf(errbuf, "Cannot set dimension scale %s for all fields in ZA. \n", dimname); H5Epush(__FILE__, "HE5_ZAdefdimscale2F", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return((int)status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAdefdimscaleF (FORTRAN wrapper) | | | | DESCRIPTION: Defines dimension scale for a dimension for all fields in a ZA| | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID int ZA structure ID | | dimname char dim name | | dim long Dimemsion value | | numbertype_in int dim scale data type such as DFNT_INT32, | | DFNT_FLOAT64, DFNT_FLOAT32, etc. | | data void data buffer for write | | | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jan 14 Abe Taaheri Original Programmer | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAdefdimscaleF(int ZaID, char *dimname, long dim, int numbertype_in, void * data) { herr_t status; hid_t zaID; char errbuf[HE5_HDFE_ERRBUFSIZE];/* Error message buffer */ zaID = (hid_t)ZaID; status = HE5_ZAdefdimscale(zaID, dimname, (hsize_t) dim, (hid_t) numbertype_in, data); if (status < 0) { sprintf(errbuf, "Cannot set dimension scale %s for all fields in ZA. \n", dimname); H5Epush(__FILE__, "HE5_ZAdefdimscaleF", __LINE__, H5E_DATASET, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return((int)status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAgetdimscaleF (FORTRAN wrapper) | | | | DESCRIPTION: Get dimension scale for a dimension of a field in a ZA | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return databuffsize SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID int ZA structure ID | | fieldname char field name | | dimname char dim name | | | | | | OUTPUTS: | | dimsize long dimension size | | ntype int number type | | databuff void data buffer for read | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | May 10 Abe Taaheri Original Programmer | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_ZAgetdimscaleF(int ZaID, char *fieldname, char *dimname, long *dimsize, int *ntype, void * databuff) { hsize_t databuffsize = (hsize_t)FAIL;/* Size of buffer */ hid_t zaID = FAIL; /* HDF5 type za ID */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Buffer for error message */ hsize_t ds; hid_t numtype; zaID = (hid_t)ZaID; databuffsize = HE5_ZAgetdimscale(zaID, fieldname, dimname, &ds, &numtype, databuff); *dimsize = (long) ds; *ntype = (int) numtype; if ( databuffsize < 0 ) { sprintf(errbuf,"Cannot get dimension scale %s for field %s. \n", dimname, fieldname); H5Epush(__FILE__, "HE5_ZAgetdimscaleF", __LINE__, H5E_OHDR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return((long)databuffsize); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAreaddscaleattrF (FORTRAN wrapper) | | | | DESCRIPTION: Reads attribute associated with a dimension scale field | | from a ZA. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID int None HDF-EOS type ZA ID | | fieldname char field name | | attrname char attribute name | | | | OUTPUTS: | | datbuf void I/O buffer | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | Jun 10 Abe Taaheri Original development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAreaddscaleattrF(int ZaID, char *fieldname, char *attrname, void *datbuf) { herr_t status = FAIL; /* return status */ hid_t zaID = FAIL; /* HDF5 type za ID */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Buffer for error message */ zaID = (hid_t)ZaID; status = HE5_ZAreaddscaleattr(zaID, fieldname, attrname, datbuf); if ( status < 0 ) { sprintf(errbuf,"Cannot read attribute %s for dimension scale %s. \n", attrname, fieldname); H5Epush(__FILE__, "HE5_ZAreaddscaleattrF", __LINE__, H5E_IO, H5E_SEEKERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return((int)status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAwritedscaleattrF (FORTRAN wrapper) | | | | DESCRIPTION: Writes/updates attribute associated with a dimension scale | | field in a ZA. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID int ZA structure ID | | fieldname char* dimension scale SDS name | | attrname char* attribute name | | numtype int attribute datatype ID | | count[] long Number of attribute elements | | datbuf void I/O buffer | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | May 10 Abe Taaheri Original development. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAwritedscaleattrF(int ZaID, char *fieldname, char *attrname, int numtype, long count[], void *datbuf) { herr_t status = FAIL; /* return status */ hid_t zaID = FAIL; /* HDF5 type za ID */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Buffer for error message */ hsize_t fort_count[HE5_FLDNUMBERMAX]; zaID = (hid_t)ZaID; fort_count[0] = (hsize_t)count[0]; status = HE5_ZAwritedscaleattr(zaID, fieldname, attrname, (hid_t)numtype, fort_count, datbuf); if ( status < 0 ) { sprintf(errbuf,"Cannot write attribute %s for dimension scale %s. \n", attrname, fieldname); H5Epush(__FILE__, "HE5_ZAwritedscaleattrF", __LINE__, H5E_ATTR, H5E_WRITEERROR, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return((int)status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAdscaleattrinfoF (FORTRAN wrapper) | | | | DESCRIPTION: Retrieves information about dimension scale attribute | | (attribute associated with a specified dimension scale field) | | in a ZA. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID int None HDF-EOS type ZA ID | | fieldname char* field name | | attrname char* attribute name | | | | OUTPUTS: | | ntype int attribute data type ID | | fortcount long Number of attribute elements | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | May 10 Abe Taaheri Original Development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAdscaleattrinfoF(int ZaID, char *fieldname, char *attrname, int *ntype, long *fortcount) { herr_t status = FAIL; /* return status */ hid_t zaID = FAIL; /* HDF5 type za ID */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Buffer for error message */ hsize_t *count = (hsize_t *)NULL; /* C-order count array */ hid_t *dtype = (hid_t *)NULL; /* Data type class ID */ zaID = (hid_t)ZaID; dtype = (hid_t *)calloc(1, sizeof(hid_t)); if(dtype == (hid_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for \"dtype\".\n"); H5Epush(__FILE__, "HE5_ZAdscaleattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } count = (hsize_t *)calloc(1, sizeof(hsize_t)); if(count == NULL) { sprintf(errbuf,"Cannot allocate memory for \"count\".\n"); H5Epush(__FILE__, "HE5_ZAdscaleattrinfoF", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(dtype); return(FAIL); } count[0] = 0; status = HE5_ZAdscaleattrinfo(zaID, fieldname, attrname, dtype, count); if ( status == FAIL) { sprintf(errbuf, "Cannot retrieve attribute info for the %s dimension scale. \n", fieldname); H5Epush(__FILE__, "HE5_ZAdscaleattrinfoF", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(dtype); return(FAIL); } *fortcount = (long)(*count); *ntype = (int)(*dtype); free(count); free(dtype); return((int)status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAdscaleattrinfoF2 (FORTRAN wrapper) | | | | DESCRIPTION: Retrieves information about dimension scale attribute | | (attribute associated with a specified dimension scale field) | | in a ZA. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID int None HDF-EOS type ZA ID | | fieldname char* field name | | attrname char* attribute name | | | | OUTPUTS: | | ntype int attribute data type ID | | fortcount long Number of attribute elements | | fortsize long buf size of attribute elements | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | May 10 Abe Taaheri Original Development | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAdscaleattrinfoF2(int ZaID, char *fieldname, char *attrname, int *ntype, long *fortcount, long *fortsize) { herr_t status = FAIL; /* return status */ hid_t zaID = FAIL; /* HDF5 type za ID */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Buffer for error message */ hsize_t *count = (hsize_t *)NULL; /* count of array elements */ hsize_t *size = (hsize_t *)NULL; /* size of array elements */ hid_t *dtype = (hid_t *)NULL; /* Data type class ID */ zaID = (hid_t)ZaID; dtype = (hid_t *)calloc(1, sizeof(hid_t)); if(dtype == (hid_t *)NULL) { sprintf(errbuf,"Cannot allocate memory for \"dtype\".\n"); H5Epush(__FILE__, "HE5_ZAdscaleattrinfoF2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); return(FAIL); } count = (hsize_t *)calloc(1, sizeof(hsize_t)); if(count == NULL) { sprintf(errbuf,"Cannot allocate memory for \"count\".\n"); H5Epush(__FILE__, "HE5_ZAdscaleattrinfoF2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(dtype); return(FAIL); } size = (hsize_t *)calloc(1, sizeof(hsize_t)); if(size == NULL) { sprintf(errbuf,"Cannot allocate memory for \"size\".\n"); H5Epush(__FILE__, "HE5_ZAdscaleattrinfoF2", __LINE__, H5E_RESOURCE, H5E_NOSPACE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(dtype); return(FAIL); } count[0] = 0; status = HE5_ZAdscaleattrinfo2(zaID, fieldname, attrname, dtype, count, size); if ( status == FAIL) { sprintf(errbuf, "Cannot retrieve attribute info for the %s dimension scale. \n", fieldname); H5Epush(__FILE__, "HE5_ZAdscaleattrinfoF2", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(count); free(dtype); return(FAIL); } *fortcount = (long)(*count); *fortsize = (long)(*size); *ntype = (int)(*dtype); free(count); free(size); free(dtype); return((int)status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAinqdscaleattrsF (FORTRAN wrapper) | | | | DESCRIPTION: Retrieves the number of attributes and string length of | | attribute list associated with a specified dimension scale | | in a ZA. | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | nattr long number of attributes (-1 if fails) | | | | INPUTS: | | zaID int None HDF-EOS type ZA ID | | fieldname char dimension scale name | | attrnames char attribute name(s) | | | | OUTPUTS: | | strbufsize long String length of attribute (in bytes) | | | | NOTES: | | | | None | | | | Date Programmer Description | | ====== ============ ================================================= | | June 10 Abe Taaheri Original development. | | | | END_PROLOG | -----------------------------------------------------------------------------*/ long HE5_ZAinqdscaleattrsF(int ZaID, char *fieldname, char *attrnames, long *strbufsize) { long status = FAIL; /* return status */ hid_t zaID = FAIL; /* HDF5 type za ID */ char errbuf[HE5_HDFE_ERRBUFSIZE]; /* Buffer for error message */ zaID = (hid_t)ZaID; status = HE5_ZAinqdscaleattrs(zaID, fieldname, attrnames, strbufsize); if ( status == FAIL ) { sprintf(errbuf, "Cannot find the attribute %s for dimension scale %s. \n",attrnames,fieldname); H5Epush(__FILE__, "HE5_ZAinqdscaleattrsF", __LINE__, H5E_ATTR, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); } return (status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAsetflddimlabel | | | | DESCRIPTION: Sets label for a dimension in a field in a za. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | | | INPUTS: | | zaID hid_t za structure ID | | fieldname char field name | | dimname char Dimension name | | dimlabel char Dimemsion label | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | July 18 Abe Taaheri Original Programmer | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAsetflddimlabel(hid_t zaID, char *fieldname, char *dimname, char *dimlabel) { hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t did; /* Field dataset id */ long idx = FAIL; /* Za index */ char olddimlabel[64]={""}; int olddimlabelexist = 0; unsigned int Dimindex; char tempdimlist[HE5_HDFE_DIMBUFSIZE];/* Dimension list */ int rank = FAIL; /* Rank of dataset */ hsize_t tempdims[HE5_DTSETRANKMAX]; /* Dimension sizes array */ int i, found; int labelsize; char *errbuf = (char *)NULL; /* buffer for error message*/ herr_t status; hid_t dtype = FAIL; /* data type ID */ HE5_LOCK; CHECKNAME(fieldname); CHECKNAME(dimname); CHECKNAME(dimlabel); /* Allocate memory for error buffer */ /* -------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_ZAsetflddimlabel", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /************************************************************************ * Check for proper za ID and return HDF-EOS file ID, SDinterface ID, * * and za root Vgroup ID * ************************************************************************/ status = HE5_ZAchkzaid(zaID, " HE5_ZAsetflddimlabel", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for za ID failed.\n"); H5Epush(__FILE__, "HE5_ZAsetdimscale", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } labelsize = (int)HE5_ZAgetflddimlabel(zaID, fieldname, dimname, olddimlabel); if( labelsize == FAIL ) { sprintf(errbuf, "Getting dimlabel failed.\n"); H5Epush(__FILE__, "HE5_ZAsetflddimlabel", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } else { if(strcmp(olddimlabel, "") !=0) { olddimlabelexist = 1; } } if(strcmp(dimlabel, olddimlabel)== 0) { /* no need for setting label. It is alread has vbeen set */ free(errbuf); return(SUCCEED); } /* Loop through all datasets in za */ /* ------------------------------ */ for (i = 0; i < HE5_ZAXZa[idx].nDFLD; i++) { /* Get dataset name */ if( strcmp(fieldname, HE5_ZAXZa[ idx ].ddataset[ i ].name) == 0 ) { found = 1; did = HE5_ZAXZa[ idx ].ddataset[ i ].ID; break; } } if(found != 1) /* did not find fieldname */ { sprintf(errbuf, "Fieldname \"%s\" does not exist.\n", fieldname); H5Epush(__FILE__, "HE5_ZAsetflddimlabel", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* if olddimlabel exist, replace it; Otherwise write the new dimlabel */ /* 1. get dim index .... */ /* for this field see if the dimlist contains dimname */ status = HE5_ZAinfo(zaID, fieldname, &rank, tempdims, &dtype, tempdimlist, NULL); if (status != SUCCEED) { sprintf(errbuf, "Field \"%s\" not found.\n", fieldname); H5Epush(__FILE__, "HE5_ZAsetflddimlabel", __LINE__, H5E_ARGS, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } Dimindex = FAIL; Dimindex = HE5_EHstrwithin(dimname, tempdimlist, ','); if (Dimindex == FAIL) /* dimension not found */ { sprintf(errbuf, "Dimension dimname \"%s\" not found in Field \"%s\" .\n", dimname, fieldname); H5Epush(__FILE__, "HE5_ZAsetflddimlabel", __LINE__, H5E_ARGS, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } status = (int)H5DSset_label(did, Dimindex, dimlabel); if(status <0) { sprintf(errbuf, "Setting label for dimension index %d failed.\n", Dimindex ); H5Epush(__FILE__, "HE5_ZAsetflddimlabel", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } COMPLETION: HE5_UNLOCK; return(status); } /*----------------------------------------------------------------------------| | BEGIN_PROLOG | | | | FUNCTION: HE5_ZAgetflddimlabel | | | | DESCRIPTION: Gets label for a dimension in a field in a za. | | | | | | Return Value Type Units Description | | ============ ====== ========= ===================================== | | status int return status (0) SUCCEED, (-1) FAIL | | or the buffer size for label | | | | INPUTS: | | zaID hid_t za structure ID | | fieldname char field name | | dimname char Dimension name | | dimlabel char Dimemsion label | | | | OUTPUTS: | | None | | | | NOTES: | | | | | | Date Programmer Description | | ====== ============ ================================================= | | July 18 Abe Taaheri Original Programmer | | | | END_PROLOG | -----------------------------------------------------------------------------*/ int HE5_ZAgetflddimlabel(hid_t zaID, char *fieldname, char *dimname, char *dimlabel) { hid_t fid = FAIL; /* HDF-EOS file ID */ hid_t gid = FAIL; /* "HDFEOS" group ID */ hid_t did; /* Field dataset id */ long idx = FAIL; /* Za index */ char olddimlabel[64]; int olddimlabelexist = 0; unsigned int Dimindex; char tempdimlist[HE5_HDFE_DIMBUFSIZE];/* Dimension list */ int rank = FAIL; /* Rank of dataset */ hsize_t tempdims[HE5_DTSETRANKMAX]; /* Dimension sizes array */ int i, found; int labelsize; char *errbuf = (char *)NULL; /* buffer for error message*/ int status; hid_t dtype = FAIL; /* data type ID */ char tempdimlabel[128]; HE5_LOCK; CHECKNAME(fieldname); CHECKNAME(dimname); /* Allocate memory for error buffer */ /* -------------------------------- */ errbuf = (char * )calloc( HE5_HDFE_ERRBUFSIZE, sizeof(char)); if(errbuf == NULL) { H5Epush(__FILE__, "HE5_ZAsetflddimlabel", __LINE__, H5E_FILE, H5E_NOSPACE, "Cannot allocate memory for error buffer."); HE5_EHprint("Error: Cannot allocate memory for error buffer, occured", __FILE__, __LINE__); return(FAIL); } /************************************************************************ * Check for proper za ID and return HDF-EOS file ID, SDinterface ID, * * and za root Vgroup ID * ************************************************************************/ status = (int)HE5_ZAchkzaid(zaID, " HE5_ZAgetflddimlabel", &fid, &gid, &idx); if ( status == FAIL ) { sprintf(errbuf, "Checking for za ID failed.\n"); H5Epush(__FILE__, "HE5_ZAgetdimscale", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* Loop through all datasets in za */ /* ------------------------------ */ for (i = 0; i < HE5_ZAXZa[idx].nDFLD; i++) { /* Get dataset name */ if( strcmp(fieldname, HE5_ZAXZa[ idx ].ddataset[ i ].name) == 0 ) { found = 1; did = HE5_ZAXZa[ idx ].ddataset[ i ].ID; break; } } if(found != 1) /* did not find fieldname */ { sprintf(errbuf, "Fieldname \"%s\" does not exist.\n", fieldname); H5Epush(__FILE__, "HE5_ZAgetflddimlabel", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } /* if olddimlabel exist, replace it; Otherwise write the new dimlabel */ /* 1. get dim index .... */ /* for this field see if the dimlist contains dimname */ status = (int)HE5_ZAinfo(zaID, fieldname, &rank, tempdims, &dtype, tempdimlist, NULL); if (status != SUCCEED) { sprintf(errbuf, "Field \"%s\" not found.\n", fieldname); H5Epush(__FILE__, "HE5_ZAgetflddimlabel", __LINE__, H5E_ARGS, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } Dimindex = FAIL; Dimindex = HE5_EHstrwithin(dimname, tempdimlist, ','); if (Dimindex == FAIL) /* dimension not found */ { sprintf(errbuf, "Dimension dimname \"%s\" not found in Field \"%s\" .\n", dimname, fieldname); H5Epush(__FILE__, "HE5_ZAgetflddimlabel", __LINE__, H5E_ARGS, H5E_NOTFOUND, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } strcpy(tempdimlabel,""); status = (int)H5DSget_label(did, Dimindex, tempdimlabel, (size_t)MAX_NAME); if(status <0) { sprintf(errbuf, "Getting label for dimension index %d failed.\n", Dimindex ); H5Epush(__FILE__, "HE5_ZAgetflddimlabel", __LINE__, H5E_ARGS, H5E_BADRANGE, errbuf); HE5_EHprint(errbuf, __FILE__, __LINE__); free(errbuf); return(FAIL); } if(dimlabel == NULL) { int len = 0; len = strlen(tempdimlabel); status = len; } else { strcpy(dimlabel, tempdimlabel); status = SUCCEED; } COMPLETION: HE5_UNLOCK; free(errbuf); return(status); } #ifndef __cplusplus /* HDF types used in FORTRAN bindings */ #define INT32 INT #define INT32V INTV #define PINT32 PINT /* File/ZA access routines */ FCALLSCFUN2(INT, HE5_ZAopenF, HE5_ZAOPEN, he5_zaopen, STRING, INT) FCALLSCFUN2(INT, HE5_ZAcreateF, HE5_ZACREATE, he5_zacreate, INT, STRING) FCALLSCFUN2(INT, HE5_ZAattachF, HE5_ZAATTACH, he5_zaattach, INT, STRING) FCALLSCFUN1(INT, HE5_ZAdetachF, HE5_ZADETACH, he5_zadetach, INT) FCALLSCFUN1(INT, HE5_ZAcloseF, HE5_ZACLOSE, he5_zaclose, INT) /* Definition routines */ FCALLSCFUN3(INT, HE5_ZAdefdimF, HE5_ZADEFDIM, he5_zadefdim, INT, STRING, LONG) FCALLSCFUN5(INT, HE5_ZAdefineF, HE5_ZADEFINE, he5_zadefine, INT, STRING, STRING, STRING, INT) FCALLSCFUN3(INT, HE5_ZAdefcompF, HE5_ZADEFCOMP, he5_zadefcomp, INT, INT, PINT) FCALLSCFUN3(INT, HE5_ZAdefchunkF, HE5_ZADEFCHUNK, he5_zadefchunk, INT, INT, PLONG) FCALLSCFUN5(INT, HE5_ZAdefcomchunkF, HE5_ZADEFCOMCH, he5_zadefcomch, INT, INT, PINT, INT, PLONG) FCALLSCFUN3(INT, HE5_ZAfldrenameF, HE5_ZAFLDRNM, he5_zafldrnm, INT, STRING, STRING) /* I/O routines */ FCALLSCFUN6(INT, HE5_ZAwriteF, HE5_ZAWRITE, he5_zawrite, INT, STRING, LONGV, LONGV, LONGV,PVOID) FCALLSCFUN8(INT, HE5_ZAwritecharF, HE5_ZAWRITECHAR, he5_zawritechar, INT, STRING, INT, INT, LONGV, LONGV, LONGV,PVOID) FCALLSCFUN6(INT, HE5_ZAreadF, HE5_ZAREAD, he5_zaread, INT, STRING, LONGV, LONGV, LONGV, PVOID) FCALLSCFUN8(INT, HE5_ZAreadcharF, HE5_ZAREADCHAR, he5_zareadchar, INT, STRING, INT, INT, LONGV, LONGV, LONGV, PVOID) FCALLSCFUN5(INT, HE5_ZAwrattr, HE5_ZAWRATTR, he5_zawrattr,INT,STRING,INT,LONGV,PVOID) FCALLSCFUN5(INT, HE5_ZAwrgattr, HE5_ZAWRGATTR, he5_zawrgattr, INT, STRING, INT, LONGV,PVOID) FCALLSCFUN6(INT, HE5_ZAwrlattr, HE5_ZAWRLATTR, he5_zawrlattr, INT, STRING,STRING,INT,LONGV,PVOID) FCALLSCFUN3(INT, HE5_ZArdattr, HE5_ZARDATTR, he5_zardattr, INT, STRING, PVOID) FCALLSCFUN3(INT, HE5_ZArdgattr, HE5_ZARDGATTR, he5_zardgattr,INT,STRING,PVOID) FCALLSCFUN4(INT, HE5_ZArdlattr, HE5_ZARDLATTR, he5_zardlattr,INT,STRING,STRING,PVOID) FCALLSCFUN4(INT, HE5_ZAsetfill, HE5_ZASETFILL, he5_zasetfill, INT, STRING, INT, PVOID) FCALLSCFUN3(INT, HE5_ZAgetfill, HE5_ZAGETFILL, he5_zagetfill, INT, STRING, PVOID) FCALLSCFUN3(INT, HE5_ZAsetaliasF, HE5_ZASETALIAS, he5_zasetalias, INT, STRING, STRING) FCALLSCFUN3(INT, HE5_ZAdropaliasF, HE5_ZADRPALIAS, he5_zadrpalias, INT, INT, STRING) FCALLSCFUN4(INT, HE5_ZAwrdmeta, HE5_ZAWRDMETA, he5_zawrdmeta, INT, STRING, STRING, INT) /* Inquiry routines */ FCALLSCFUN3(LONG, HE5_ZAinqzaF, HE5_ZAINQZA, he5_zainqza, STRING, PSTRING,PLONG) FCALLSCFUN3(LONG, HE5_ZAnentriesF, HE5_ZANENTRIES, he5_zanentries,INT,INT,PLONG) FCALLSCFUN2(LONG, HE5_ZAdiminfoF, HE5_ZANDIMINFO, he5_zadiminfo, INT, STRING) FCALLSCFUN7(INT, HE5_ZAinfoF, HE5_ZAINFO, he5_zainfo,INT,STRING,PINT,LONGV,PINT,PSTRING,PSTRING) FCALLSCFUN3(LONG, HE5_ZAinqdimsF, HE5_ZAINQDIMS, he5_zainqdims,INT,PSTRING,LONGV) FCALLSCFUN4(LONG, HE5_ZAinquireF, HE5_ZAINQUIRE, he5_zainquire, INT,PSTRING, INTV, INTV) FCALLSCFUN4(INT, HE5_ZAatinfo, HE5_ZAATTRINFO, he5_zaattrinfo, INT, STRING, PINT, PLONG) FCALLSCFUN4(INT, HE5_ZAgatinfo, HE5_ZAGATTRINFO, he5_zagattrinfo, INT, STRING, PINT, PLONG) FCALLSCFUN5(INT, HE5_ZAlatinfo, HE5_ZALATTRINFO, he5_zalattrinfo, INT, STRING, STRING, PINT, PLONG) FCALLSCFUN5(INT, HE5_ZAatinfo2, HE5_ZAATTRINFO2, he5_zaattrinfo2, INT, STRING, PINT, PLONG, PLONG) FCALLSCFUN5(INT, HE5_ZAgatinfo2, HE5_ZAGATTRINFO2, he5_zagattrinfo2, INT, STRING, PINT, PLONG, PLONG) FCALLSCFUN6(INT, HE5_ZAlatinfo2, HE5_ZALATTRINFO2, he5_zalattrinfo2, INT, STRING, STRING, PINT, PLONG, PLONG) FCALLSCFUN4(INT, HE5_ZAcompinfoF, HE5_ZACOMPINFO, he5_zacompinfo, INT, STRING,PINT, INTV) FCALLSCFUN3(LONG, HE5_ZAinqattrsF, HE5_ZAINQATTRS, he5_zainqattrs,INT,PSTRING,PLONG) FCALLSCFUN4(LONG, HE5_ZAinqlattrs, HE5_ZAINQLATTRS, he5_zainqlattrs,INT,STRING,PSTRING,PLONG) FCALLSCFUN3(LONG, HE5_ZAinqgattrs, HE5_ZAINQGATTRS, he5_zainqgattrs,INT,PSTRING,PLONG) FCALLSCFUN8(INT, HE5_ZAidtype, HE5_ZAIDYPEF, he5_zaidtype, INT,STRING,STRING,INT,PINT,PINT,PINT,PLONG) FCALLSCFUN5(INT, HE5_ZAaliasinfoF, HE5_ZAALIASINFO, he5_zaaliasinfo, INT, INT, STRING, PINT, STRING) FCALLSCFUN3(LONG, HE5_ZAinqfldaliasF, HE5_ZAINQFLDALIAS, he5_zainqfldalias,INT,PSTRING,PLONG) FCALLSCFUN4(INT, HE5_ZAchunkinfoF, HE5_ZACHUNKINFO, he5_zachunkinfo,INT,STRING,PINT,LONGV) FCALLSCFUN4(LONG, HE5_ZAgetaliaslistF, HE5_ZAGETALIASLIST, he5_zagetaliaslist,INT,INT,PSTRING,PLONG) FCALLSCFUN5(INT, HE5_ZAdefdimscaleF, HE5_ZADEFDIMSCALE, he5_zadefdimscale,INT,STRING,LONG,INT,PVOID) FCALLSCFUN6(INT, HE5_ZAdefdimscale2F, HE5_ZADEFDIMSCALE2, he5_zadefdimscale2,INT,STRING,STRING,LONG,INT,PVOID) FCALLSCFUN6(INT, HE5_ZAsetdimscaleF, HE5_ZASETDIMSCALE, he5_zasetdimscale,INT,STRING,STRING,LONG,INT,PVOID) FCALLSCFUN7(INT, HE5_ZAsetdimscale2F, HE5_ZASETDIMSCALE2, he5_zasetdimscale2,INT,STRING,STRING,STRING,LONG,INT,PVOID) FCALLSCFUN6(LONG, HE5_ZAgetdimscaleF, HE5_ZAGETDIMSCALE, he5_zagetdimscale,INT,STRING,STRING,PLONG,PINT,PVOID) FCALLSCFUN4(INT, HE5_ZAreaddscaleattrF,HE5_ZAREADDSCALEATTR, he5_zareaddscaleattr,INT,STRING,STRING,PVOID) FCALLSCFUN6(INT, HE5_ZAwritedscaleattrF, HE5_ZAWRITEDSCALEATTR, he5_zawritedscaleattr,INT,STRING,STRING,INT,LONGV,PVOID) FCALLSCFUN5(INT, HE5_ZAdscaleattrinfoF, HE5_ZADSCALEATTRINFO, he5_zadscaleattrinfo,INT,STRING,STRING,PINT,PLONG) FCALLSCFUN6(INT, HE5_ZAdscaleattrinfoF2, HE5_ZADSCALEATTRINFO2, he5_zadscaleattrinfo2,INT,STRING,STRING,PINT,PLONG,PLONG) FCALLSCFUN4(INT, HE5_ZAinqdscaleattrsF, HE5_ZAINQDSCALATTRS, he5_zainqdscaleattrs,INT,STRING,STRING,PLONG) FCALLSCFUN4(INT, HE5_ZAsetflddimlabel, HE5_ZASETFLDDIMLABEL, he5_zasetflddimlabel, INT, STRING, STRING, STRING); FCALLSCFUN4(INT, HE5_ZAgetflddimlabel, HE5_ZAGETFLDDIMLABEL, he5_zagetflddimlabel, INT, STRING, STRING, STRING); /* EXTERNAL DATA FILE INTERFACE */ FCALLSCFUN4(INT, HE5_ZAsetextdataF, HE5_ZASETXDAT, he5_zasetxdat,INT,STRING,LONGV,LONGV) FCALLSCFUN6(INT, HE5_ZAgetextdataF, HE5_ZAGETXDAT, he5_zagetxdat,INT,STRING,LONG,PSTRING,LONGV,LONGV) #endif hdf-eos5-2.0/testdrivers/000077500000000000000000000000001507520047200153455ustar00rootroot00000000000000hdf-eos5-2.0/testdrivers/Makefile.am000066400000000000000000000006761507520047200174120ustar00rootroot00000000000000# testdrivers top-level Makefile.am # The testdrivers directory should be placed in the HDF-EOS5 directory; # this file should be located at hdfeos5/testdrivers/Makefile.am # Include boilerplate definitions (from HDF-EOS5 configuration) include $(top_srcdir)/config/include.am # Only recurse into the threads directory if threads are being used. if HDF5_THREADSAFE SUBDIRS=swath grid point za threads else SUBDIRS=swath grid point za endif hdf-eos5-2.0/testdrivers/Makefile.in000066400000000000000000000450031507520047200174140ustar00rootroot00000000000000# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # testdrivers top-level Makefile.am # The testdrivers directory should be placed in the HDF-EOS5 directory; # this file should be located at hdfeos5/testdrivers/Makefile.am VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(top_srcdir)/config/include.am $(srcdir)/Makefile.in \ $(srcdir)/Makefile.am README subdir = testdrivers ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/stdlib.m4 $(top_srcdir)/m4/stdinc.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/HE5_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = swath grid point za threads DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FC = @FC@ FCFLAGS = @FCFLAGS@ FFLAGS = @FFLAGS@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ ac_ct_FC = @ac_ct_FC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ LIBHDFEOS5 = $(top_builddir)/src/libhe5_hdfeos.la LIBGCTP = $(top_builddir)/gctp/src/libGctp.la @HDF5_THREADSAFE_FALSE@SUBDIRS = swath grid point za # Include boilerplate definitions (from HDF-EOS5 configuration) # Only recurse into the threads directory if threads are being used. @HDF5_THREADSAFE_TRUE@SUBDIRS = swath grid point za threads all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/include.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign testdrivers/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign testdrivers/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/config/include.am: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-libtool cscopelist-am ctags \ ctags-am distclean distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ ps ps-am tags tags-am uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: hdf-eos5-2.0/testdrivers/README000077500000000000000000000060541507520047200162350ustar00rootroot00000000000000============================================================================== FILE: README UPDATED: 06/20/01 A.M. Aug 02 S.Z ============================================================================== These files are provided as an aid to the user for examples in how to use the HDF-EOS library. The test drivers have been run on every platform supported by the Toolkit. Platforms supported by the Toolkit are listed in the README file located in doc directory. NOTE: YOU MUST HAVE ALL OF THE TEXT DATA FILES IN THE SAME DIRECTORY AS YOUR POINT TEST DRIVERS. THEY WILL CRASH WITHOUT THEM ! THESE DATA FILES ARE: fixedBuoy0.txt fixedBuoy1s.txt floatBuoy1.txt fixedBuoy1.txt floatBuoy0.txt simple.txt DRIVER(S) PLATFORM(S) ========= =========== TestSwath.c C on all supported platforms TestGrid.c TestPoint.c TestZa.c TestProfile.c TestAlias.c testswath32.f FORTRAN 77 on all supported platforms testgrid32.f FORTRAN 90 on SGI for 32-bit testpoint32.f testza32.f testswath64.f FORTRAN 90 on SGI for 64-bit testgrid64.f testpoint64.f testza64.f COMPILING TEST DRIVERS ====================== Below are samples of how the test driver can be compilied and linked to create executables. The HDFSYS flag is set by the user. The list below gives what it should be for each supported platform: PLATFORM HDFSYS FLAG ======== =========== Dec DEC_ALPHA Sgi IRIX Sgi Power Chall. SGI64 Ibm IBM6000 Sun Solaris 2.5 SUN5 Hp HP9000 Linux LINUX ============================================================================== Swath/Point/ZA ------------------------------------------------------------------------------ cc -DHDFSYS -o filename.o -I$HDFINC -I$HDFEOS_INC -c filename.c cc -DHDFSYS -o filename filename.o -L$HDFLIB -L$HDFEOS_LIB \ -lhe5_hdfeos -lhdf5 -lnsl -lm NOTE: substitute "filename" with the name of a driver, AND THE ORDER OF THE LIBRARIES IS IMPORTANT. IN ADDITION: NOTICE THAT WE POINT TO BOTH STANDARD HDF AND HDFEOS LIBRARIES. THE "-lnsl" FLAG IS REQUIRED FOR THE SUN PLATFORMS ONLY ============================================================================== Grid ------------------------------------------------------------------------------ cc -DHDFSYS -o filename.o -I$HDFINC -I$HDFEOS_INC -c filename.c cc -DHDFSYS -o filename filename.o -L$HDFLIB -L$HDFEOS_LIB \ -lhe5_hdfeos -lGctp -lhdf5 -lnsl -lm NOTE: ON LINUX PLATFORM YOU ALSO NEED "-lz" NOTE: subsitute "filename" with the name of a driver, AND THE ORDER OF THE LIBRARIES IS IMPORTANT. IN ADDITION: NOTICE THAT THE GCTP LIBRARY IS SECOND IN THE LIBRARY LIST. ALSO: YOU NEED TO POINT TO WHERE THE GEOLIB LIBRARY IS LOCATED ON YOUR SYSTEM. THE "-lnsl" FLAG IS REQUIRED FOR THE SUN PLATFORMS ONLY ============================================================================== hdf-eos5-2.0/testdrivers/grid/000077500000000000000000000000001507520047200162725ustar00rootroot00000000000000hdf-eos5-2.0/testdrivers/grid/Makefile.am000066400000000000000000000024671507520047200203370ustar00rootroot00000000000000# testdrivers/grid Makefile.am # Boilerplate definitions include $(top_srcdir)/config/include.am EXTRA_DIST = hdfeos5.inc hdfeos5_64.inc # Link against HDF-EOS5 include files and both the HDF-EOS5 and libGCTP # libraries AM_CPPFLAGS=-I$(top_srcdir)/include LDADD=$(LIBHDFEOS5) $(LIBGCTP) # Build TestGrid. Since no sources are listed, build it from TestGrid.c check_PROGRAMS = TestGrid if F2CFORTRAN_CONDITIONAL if F2CFORTRAN_32PTR_CONDITIONAL check_PROGRAMS += testgrid32 if SZIP_ENCODER_CONDITIONAL testgrid32_SOURCES = testgrid_szip32.f else testgrid32_SOURCES = testgrid32.f endif else check_PROGRAMS += testgrid64 if SZIP_ENCODER_CONDITIONAL testgrid64_SOURCES = testgrid_szip64.f else testgrid64_SOURCES = testgrid64.f endif endif endif # Run TestGrid as a test when the user types 'make check' TEST_SEQUENCES=test_c VERBOSE_TEST_SEQUENCES=test_c_verbose if F2CFORTRAN_CONDITIONAL if F2CFORTRAN_32PTR_CONDITIONAL TEST_SEQUENCES+=test_32f VERBOSE_TEST_SEQUENCES+=test_32f else TEST_SEQUENCES+=test_64f VERBOSE_TEST_SEQUENCES+=test_64f endif endif test_c: $(check_PROGRAMS) ./TestGrid test_c_verbose: $(check_PROGRAMS) ./TestGrid -v h test_32f: $(check_PROGRAMS) ./testgrid32 test_64f: $(check_PROGRAMS) ./testgrid64 check-local: $(TEST_SEQUENCES) verbose_check: $(VERBOSE_TEST_SEQUENCES) .PHONY: $(TEST_SEQUENCES) hdf-eos5-2.0/testdrivers/grid/Makefile.in000066400000000000000000000525551507520047200203530ustar00rootroot00000000000000# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # testdrivers/grid Makefile.am VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(top_srcdir)/config/include.am $(srcdir)/Makefile.in \ $(srcdir)/Makefile.am $(top_srcdir)/config/depcomp check_PROGRAMS = TestGrid$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2) @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am__append_1 = testgrid32 @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am__append_2 = testgrid64 @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am__append_3 = test_32f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am__append_4 = test_32f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am__append_5 = test_64f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am__append_6 = test_64f subdir = testdrivers/grid ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/stdlib.m4 $(top_srcdir)/m4/stdinc.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/HE5_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am__EXEEXT_1 = testgrid32$(EXEEXT) @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am__EXEEXT_2 = testgrid64$(EXEEXT) TestGrid_SOURCES = TestGrid.c TestGrid_OBJECTS = TestGrid.$(OBJEXT) TestGrid_LDADD = $(LDADD) TestGrid_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = am__testgrid32_SOURCES_DIST = testgrid32.f testgrid_szip32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@@SZIP_ENCODER_CONDITIONAL_FALSE@am_testgrid32_OBJECTS = testgrid32.$(OBJEXT) @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@@SZIP_ENCODER_CONDITIONAL_TRUE@am_testgrid32_OBJECTS = testgrid_szip32.$(OBJEXT) testgrid32_OBJECTS = $(am_testgrid32_OBJECTS) testgrid32_LDADD = $(LDADD) testgrid32_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__testgrid64_SOURCES_DIST = testgrid64.f testgrid_szip64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@@SZIP_ENCODER_CONDITIONAL_FALSE@am_testgrid64_OBJECTS = testgrid64.$(OBJEXT) @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@@SZIP_ENCODER_CONDITIONAL_TRUE@am_testgrid64_OBJECTS = testgrid_szip64.$(OBJEXT) testgrid64_OBJECTS = $(am_testgrid64_OBJECTS) testgrid64_LDADD = $(LDADD) testgrid64_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = F77COMPILE = $(F77) $(AM_FFLAGS) $(FFLAGS) LTF77COMPILE = $(LIBTOOL) $(AM_V_lt) --tag=F77 $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) AM_V_F77 = $(am__v_F77_@AM_V@) am__v_F77_ = $(am__v_F77_@AM_DEFAULT_V@) am__v_F77_0 = @echo " F77 " $@; am__v_F77_1 = F77LD = $(F77) F77LINK = $(LIBTOOL) $(AM_V_lt) --tag=F77 $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(F77LD) $(AM_FFLAGS) $(FFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_F77LD = $(am__v_F77LD_@AM_V@) am__v_F77LD_ = $(am__v_F77LD_@AM_DEFAULT_V@) am__v_F77LD_0 = @echo " F77LD " $@; am__v_F77LD_1 = SOURCES = TestGrid.c $(testgrid32_SOURCES) $(testgrid64_SOURCES) DIST_SOURCES = TestGrid.c $(am__testgrid32_SOURCES_DIST) \ $(am__testgrid64_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FC = @FC@ FCFLAGS = @FCFLAGS@ FFLAGS = @FFLAGS@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ ac_ct_FC = @ac_ct_FC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ LIBHDFEOS5 = $(top_builddir)/src/libhe5_hdfeos.la LIBGCTP = $(top_builddir)/gctp/src/libGctp.la # Boilerplate definitions EXTRA_DIST = hdfeos5.inc hdfeos5_64.inc # Link against HDF-EOS5 include files and both the HDF-EOS5 and libGCTP # libraries AM_CPPFLAGS = -I$(top_srcdir)/include LDADD = $(LIBHDFEOS5) $(LIBGCTP) @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@@SZIP_ENCODER_CONDITIONAL_FALSE@testgrid32_SOURCES = testgrid32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@@SZIP_ENCODER_CONDITIONAL_TRUE@testgrid32_SOURCES = testgrid_szip32.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@@SZIP_ENCODER_CONDITIONAL_FALSE@testgrid64_SOURCES = testgrid64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@@SZIP_ENCODER_CONDITIONAL_TRUE@testgrid64_SOURCES = testgrid_szip64.f # Run TestGrid as a test when the user types 'make check' TEST_SEQUENCES = test_c $(am__append_3) $(am__append_5) VERBOSE_TEST_SEQUENCES = test_c_verbose $(am__append_4) \ $(am__append_6) all: all-am .SUFFIXES: .SUFFIXES: .c .f .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/include.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign testdrivers/grid/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign testdrivers/grid/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/config/include.am: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list TestGrid$(EXEEXT): $(TestGrid_OBJECTS) $(TestGrid_DEPENDENCIES) $(EXTRA_TestGrid_DEPENDENCIES) @rm -f TestGrid$(EXEEXT) $(AM_V_CCLD)$(LINK) $(TestGrid_OBJECTS) $(TestGrid_LDADD) $(LIBS) testgrid32$(EXEEXT): $(testgrid32_OBJECTS) $(testgrid32_DEPENDENCIES) $(EXTRA_testgrid32_DEPENDENCIES) @rm -f testgrid32$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(testgrid32_OBJECTS) $(testgrid32_LDADD) $(LIBS) testgrid64$(EXEEXT): $(testgrid64_OBJECTS) $(testgrid64_DEPENDENCIES) $(EXTRA_testgrid64_DEPENDENCIES) @rm -f testgrid64$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(testgrid64_OBJECTS) $(testgrid64_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TestGrid.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< .f.o: $(AM_V_F77)$(F77COMPILE) -c -o $@ $< .f.obj: $(AM_V_F77)$(F77COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .f.lo: $(AM_V_F77)$(LTF77COMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-local check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am check-local clean \ clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \ ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am test_c: $(check_PROGRAMS) ./TestGrid test_c_verbose: $(check_PROGRAMS) ./TestGrid -v h test_32f: $(check_PROGRAMS) ./testgrid32 test_64f: $(check_PROGRAMS) ./testgrid64 check-local: $(TEST_SEQUENCES) verbose_check: $(VERBOSE_TEST_SEQUENCES) .PHONY: $(TEST_SEQUENCES) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: hdf-eos5-2.0/testdrivers/grid/TestGrid.c000077500000000000000000010063451507520047200201770ustar00rootroot00000000000000/* *********************************************************** * FILENAME: TestGrid.c * * * * PURPOSE: To test HDF-EOS v.3 Grid interface * * * * Author: * * A. Muslimov /Emergent IT Inc. * * Adura Adekunjo /L3 Comm. EER corp * * Shen Zhao L-3 Comm. GSI * * * * History: * * August 1999 AM Initial version * * 11-Apr-2001 AM Updated * * 02-Dec-2004 AA Updated with testdrivers for * * some new functions (NCR 41197) * * April 2005 SZ Added the EASE grid test case * * * * * *********************************************************** */ #include #include #define BUFSIZE 256 int main(int argc, char *argv[]) { FILE *fp; herr_t status = FAIL; hid_t gdfidc_simple = FAIL; hid_t GDid_UTM3 = FAIL; hid_t GDid_UTM = FAIL; hid_t GDid_GEO = FAIL; hid_t GDid_POLAR_N = FAIL; hid_t GDid_POLAR_S = FAIL; hid_t GDid_IGOODE = FAIL; hid_t GDid_SOM = FAIL; hid_t GDid_LAMAZ = FAIL; hid_t GDid_HOM = FAIL; hid_t GDid_LAMCON = FAIL; hid_t GDid_TM = FAIL; hid_t GDid_POLY = FAIL; hid_t GDid_IS = FAIL; hid_t GDid_MERCAT = FAIL; hid_t GDid_ALBERS = FAIL; hid_t RegionID = FAIL; hid_t PeriodID = FAIL; hid_t NewRegionID = FAIL; hid_t datatype = FAIL; hid_t dtype = FAIL; hid_t return_val = FAIL; int i, j; int Verbosity = 4; int errcnt = 0; int ZoneCode; int SphereCode; int proj_code = FAIL; int z_code = FAIL; int s_code = FAIL; int origin_code = FAIL; int pixreg_code = FAIL; int fieldgroup = FAIL; int *rank; int Rank = FAIL; int tilerank, tilecode; int compcode = 4; int compparm[5] = { 0, 0, 0, 0, 0}; int Attr[4]; int grpattr[3] = {3,7,11}; int gattrvalOut[3] = {0,0,0}; int Attr_out[4] = {-1,-1,-1,-1}; int ndim = FAIL; int nflds = FAIL; hid_t *ntype1; hid_t *ntype; H5T_class_t classid = H5T_NO_CLASS; H5T_order_t order = H5T_ORDER_ERROR; long list_size = FAIL; long strbufsize = FAIL; long *RowVal; long *ColVal; long BufSize = FAIL; long NumPix; long index = 0; long xdim = 0; long ydim = 0; long number = FAIL; float attr[4] = {1.1,2.2,3.3,4.4}; float attrvalOut[4] = { 0, 0, 0, 0}; float fillvalue = -1.11111; float fillvalue_inq = -1.111111; float cnt_UTM = -799.0; float cnt_LAMCON = -134.5; float cnt_time = 35232487.2; float *Buffer_UTM; float *Buffer_LAMCON; float *Buffer_mercat; float *time; float *DatBuf; float *VoltDataOut; float veg[200][120]; double uplft[2] = {0, 0}; double lowrgt[2] = {0, 0}; double *ProjParm; double uplft_out[2] = {-1., -1.}; double lowrgt_out[2] = {-1., -1.}; double *ProjParm_out; double CorLon[2]; double CorLat[2]; double StartTime; double StopTime; double LonVal[5]; double LatVal[5]; double *DatBuf2; char *str_buf; char *str_buf2; char *ObjNamesPtr; hssize_t start[2] = { 0, 0 }; hsize_t ndims = 0; hsize_t CurrentSize[1] = { 0 }; hsize_t stride[2] = { 1, 1 }; hsize_t edge[2] = {1, 1 }; hsize_t dims[8] = {0, 0, 0, 0, 0, 0, 0, 0 }; hsize_t tiledims[8]; hsize_t count; hsize_t *CountPtr = (hsize_t *)NULL; hsize_t Gsize[1] = { 3 }; size_t size = 0; hid_t GDid_EASE = FAIL; long index1 = 0; long index2 = 0; long xdim_ease = 1383; long ydim_ease = 586; float easecnt = 2001.0; /*float easeray[1383][586]; float easeray2[1383][586];*/ float *easeray; float *easeray2; double rcord[4], scord[4]; int npnts; long xdimsize,ydimsize; double longitude[4], latitude[4]; /* ******************************************************************************** * Get comand-line argument (Verbosity) * ******************************************************************************** */ for (i = 1; i < argc; i++) { if ((argc > i + 1) && ((HDstrcmp(argv[i], "-verbose") == 0) || (HDstrcmp(argv[i], "-v") == 0))) { if (argv[i + 1][0] == 'l') Verbosity = 4; else if (argv[i + 1][0] == 'm') Verbosity = 6; else if (argv[i + 1][0] == 'h') Verbosity = 10; else Verbosity = atoi(argv[i + 1]); } } /* Allocate memory for arrays */ Buffer_UTM = (float *)calloc( 4800, sizeof(float) ); Buffer_LAMCON = (float *)calloc( 60021, sizeof(float) ); Buffer_mercat = (float *)calloc( 60021, sizeof(float) ); time = (float *)calloc( 4800, sizeof(float) ); str_buf = (char *)calloc( 256, sizeof(char ) ); str_buf2 = (char *)calloc( 256, sizeof(char ) ); ProjParm_out = (double *)calloc( 16, sizeof(double) ); for ( i = 0; i < 16; i++) { ProjParm_out[ i ] = -0.99999; } ProjParm = (double *)calloc( 16, sizeof(double) ); /* Populate arrays */ while( index < 4800 ) { Buffer_UTM[ index ] = cnt_UTM; cnt_UTM += (float)0.4; index++; } index = 0; while( index < 60021 ) { Buffer_LAMCON[ index ] = cnt_LAMCON; cnt_LAMCON += 0.04; index++; } index = 0; while( index < 60021 ) { Buffer_mercat[ index ] = cnt_LAMCON; cnt_LAMCON += 0.2; index++; } index = 0; while(index < 4800) { time[ index ] = cnt_time; cnt_time += 70.7; index++; } /* index1 = 0; index2 = 0; while(index1 < xdim_ease) { while(index2 < ydim_ease) { easeray[index1][index2] = easecnt; index2++; easecnt = easecnt + 0.2; } index1++; index2 = 0; } index1 = 0; index2 = 0; while(index1 < xdim_ease) { while(index2 < ydim_ease) { easeray2[index1][index2] = easecnt; index2++; easecnt = easecnt - .9; } index1++; index2 = 0; }*/ index1=0; index2=0; xdim_ease =1383; ydim_ease = 586; easeray = (float *) malloc(1383 * 586 * sizeof(float)); for (index1=0; index1&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(top_srcdir)/config/include.am $(srcdir)/Makefile.in \ $(srcdir)/Makefile.am $(top_srcdir)/config/depcomp check_PROGRAMS = TestPoint$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2) @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am__append_1 = testpoint32 @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am__append_2 = testpoint64 @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am__append_3 = test_32f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am__append_4 = test_32f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am__append_5 = test_64f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am__append_6 = test_64f subdir = testdrivers/point ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/stdlib.m4 $(top_srcdir)/m4/stdinc.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/HE5_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am__EXEEXT_1 = testpoint32$(EXEEXT) @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am__EXEEXT_2 = testpoint64$(EXEEXT) TestPoint_SOURCES = TestPoint.c TestPoint_OBJECTS = TestPoint.$(OBJEXT) TestPoint_LDADD = $(LDADD) TestPoint_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = am__testpoint32_SOURCES_DIST = testpoint32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am_testpoint32_OBJECTS = testpoint32.$(OBJEXT) testpoint32_OBJECTS = $(am_testpoint32_OBJECTS) testpoint32_LDADD = $(LDADD) testpoint32_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__testpoint64_SOURCES_DIST = testpoint64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am_testpoint64_OBJECTS = testpoint64.$(OBJEXT) testpoint64_OBJECTS = $(am_testpoint64_OBJECTS) testpoint64_LDADD = $(LDADD) testpoint64_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = F77COMPILE = $(F77) $(AM_FFLAGS) $(FFLAGS) LTF77COMPILE = $(LIBTOOL) $(AM_V_lt) --tag=F77 $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) AM_V_F77 = $(am__v_F77_@AM_V@) am__v_F77_ = $(am__v_F77_@AM_DEFAULT_V@) am__v_F77_0 = @echo " F77 " $@; am__v_F77_1 = F77LD = $(F77) F77LINK = $(LIBTOOL) $(AM_V_lt) --tag=F77 $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(F77LD) $(AM_FFLAGS) $(FFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_F77LD = $(am__v_F77LD_@AM_V@) am__v_F77LD_ = $(am__v_F77LD_@AM_DEFAULT_V@) am__v_F77LD_0 = @echo " F77LD " $@; am__v_F77LD_1 = SOURCES = TestPoint.c $(testpoint32_SOURCES) $(testpoint64_SOURCES) DIST_SOURCES = TestPoint.c $(am__testpoint32_SOURCES_DIST) \ $(am__testpoint64_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FC = @FC@ FCFLAGS = @FCFLAGS@ FFLAGS = @FFLAGS@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ ac_ct_FC = @ac_ct_FC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ LIBHDFEOS5 = $(top_builddir)/src/libhe5_hdfeos.la LIBGCTP = $(top_builddir)/gctp/src/libGctp.la # Boilerplate definitions EXTRA_DIST = hdfeos5.inc hdfeos5_64.inc fixedBuoy0.txt fixedBuoy1.txt floatBuoy0.txt floatBuoy1.txt simple.txt # Link against HDF-EOS5 and libGCTP AM_CPPFLAGS = -I$(top_srcdir)/include LDADD = $(LIBHDFEOS5) $(LIBGCTP) @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@testpoint32_SOURCES = testpoint32.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@testpoint64_SOURCES = testpoint64.f # Run TestPoint as a test when the user types 'make check' TEST_SEQUENCES = test_c $(am__append_3) $(am__append_5) VERBOSE_TEST_SEQUENCES = test_c_verbose $(am__append_4) \ $(am__append_6) all: all-am .SUFFIXES: .SUFFIXES: .c .f .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/include.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign testdrivers/point/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign testdrivers/point/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/config/include.am: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list TestPoint$(EXEEXT): $(TestPoint_OBJECTS) $(TestPoint_DEPENDENCIES) $(EXTRA_TestPoint_DEPENDENCIES) @rm -f TestPoint$(EXEEXT) $(AM_V_CCLD)$(LINK) $(TestPoint_OBJECTS) $(TestPoint_LDADD) $(LIBS) testpoint32$(EXEEXT): $(testpoint32_OBJECTS) $(testpoint32_DEPENDENCIES) $(EXTRA_testpoint32_DEPENDENCIES) @rm -f testpoint32$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(testpoint32_OBJECTS) $(testpoint32_LDADD) $(LIBS) testpoint64$(EXEEXT): $(testpoint64_OBJECTS) $(testpoint64_DEPENDENCIES) $(EXTRA_testpoint64_DEPENDENCIES) @rm -f testpoint64$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(testpoint64_OBJECTS) $(testpoint64_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TestPoint.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< .f.o: $(AM_V_F77)$(F77COMPILE) -c -o $@ $< .f.obj: $(AM_V_F77)$(F77COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .f.lo: $(AM_V_F77)$(LTF77COMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-local check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am check-local clean \ clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \ ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am test_c: $(check_PROGRAMS) ./TestPoint test_c_verbose: $(check_PROGRAMS) ./TestPoint -v h test_32f: $(check_PROGRAMS) ./testpoint32 test_64f: $(check_PROGRAMS) ./testpoint64 check-local: $(TEST_SEQUENCES) verbose_check: $(VERBOSE_TEST_SEQUENCES) .PHONY: $(TEST_SEQUENCES) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: hdf-eos5-2.0/testdrivers/point/TestPoint.c000077500000000000000000003153151507520047200206060ustar00rootroot00000000000000/* ********************************************************* * FILE: TestPoint.c * * PURPOSE: To test HDF-EOS v.5.1 Point interface * * Author: A. Muslimov, Emergent IT Inc. * * Date: June 2001 * ********************************************************* */ #include #include #define NAMEBUF_SIZE 100 /* Set up namebuf value in case the input file is in * a different directory and "srcdir" is set in the * environment. */ static void setup_namebuf(char *namebuf, char *filename) { char * srcdir; srcdir = getenv("srcdir"); if(srcdir != NULL && (strlen(srcdir) + strlen(filename) + 2) <= NAMEBUF_SIZE) { strcpy(namebuf, srcdir); strcat(namebuf, "/"); strcat(namebuf, filename); } else { strcpy(namebuf, filename); } } int main(int argc, char *argv[]) { FILE *fp; FILE *fp_in; herr_t status = FAIL; hid_t ptfid = FAIL; hid_t PTid1 = FAIL; hid_t PTid2 = FAIL; hid_t PTid3 = FAIL; hid_t datatype = FAIL; int CLLoop; int Verbosity = 4; int errcnt = 0; int i, j; int n; int date; int wgt; int IntAttr = 9999; int attr = 9999; int attr1[ 5 ] = { 1, 2, 3, 4, 5}; int attr2[ 5 ] = { 10, 20, 30, 40, 50}; int nflds = FAIL; int fieldgroup = FAIL; int return_val = FAIL; long nattr = FAIL; long strbufsize = FAIL; H5T_class_t classid = H5T_NO_CLASS; H5T_order_t order = H5T_ORDER_ERROR; typedef struct { double time; float concentr[4]; char spec[8]; } InputData1; typedef struct { char label[16]; double lon; double lat; int date; char id[8]; } InputData2; typedef struct { double time; float rain; float temp; char id[8]; } InputData3; typedef struct { char label[10]; int date; int weight; char id[8]; } InputData4; typedef struct { double time; double lon; double lat; float rain; float temp; char id[8]; } InputData5; typedef struct { double time; float con[4]; char spec[8]; } Sensor; hsize_t count[8]; hsize_t nrecs = 0; hsize_t nrec = 1; hssize_t recs[32]; size_t datasize = 0; size_t size = 0; float conc[4]; float rain; float temp; float flt = -7.5; double time; double lon; double lat; char spc[8]; char desc[16]; char id[ 2 ]; HE5_CmpDTSinfo level; HE5_CmpDTSinfo inInfo; HE5_CmpDTSinfo inInfo2; HE5_CmpDTSinfo *dtsinfo; InputData1 datbuf_1[20]; InputData2 datbuf_2[5]; InputData3 datbuf_3[25]; InputData4 datbuf_4[5]; InputData5 datbuf_5[30]; InputData1 buf_1; Sensor s[50]; double s1[50]; char namebuf[NAMEBUF_SIZE]; /* ******************************************************************************** * Get comand-line argument (Verbosity) * ******************************************************************************** */ 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]); } } setup_namebuf(namebuf, "TestPoint_c.txtout"); MESSAGE(11,fp=fopen(namebuf,"w");); MESSAGE(4,printf("Testing Point C interface \n");); MESSAGE(4,printf("========================= \n\n");); MESSAGE(11,fprintf(fp,"Testing Point C interface \n");); MESSAGE(11,fprintf(fp,"========================= \n\n");); /* ********************************************************************************* * Testing PTopen * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_PTopen... \n");); MESSAGE(4,printf("\t===================== \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTopen... \n");); MESSAGE(11,fprintf(fp,"\t===================== \n");); ptfid = HE5_PTopen("SimplePoint.he5", H5F_ACC_TRUNC); if (ptfid == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\t\t*** Successfully opened the point file ****\n");); MESSAGE(11,fprintf(fp,"\t\t*** Successfully opened the point file ****\n");); } /* ********************************************************************************* * Testing HE5_PTcreate * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_PTcreate... \n");); MESSAGE(4,printf("\t======================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTcreate... \n");); MESSAGE(11,fprintf(fp,"\t======================= \n");); MESSAGE(6,printf("\t\tCreating point \"Simple Point\" \n");); MESSAGE(11,fprintf(fp,"\t\tCreating point \"Simple Point\" \n");); PTid1 = HE5_PTcreate(ptfid, "Simple Point"); if (PTid1 == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\t\t*** Successfully created the point \"Simple Point\" ****\n");); MESSAGE(11,fprintf(fp,"\t\t*** Successfully created the point \"Simple Point\" ****\n");); } /* ********************************************************************************* * Testing HE5_PTcreate * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_PTcreate... \n");); MESSAGE(4,printf("\t======================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTcreate... \n");); MESSAGE(11,fprintf(fp,"\t======================= \n");); MESSAGE(6,printf("\t\tCreating point \"FixedBuoy Point\" \n");); MESSAGE(11,fprintf(fp,"\t\tCreating point \"FixedBuoy Point\" \n");); PTid2 = HE5_PTcreate(ptfid, "FixedBuoy Point"); if (PTid2 == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\t\t*** Successfully created the point \"FixedBuoy Point\" ****\n");); MESSAGE(11,fprintf(fp,"\t\t*** Successfully created the point \"FixedBuoy Point\" ****\n");); } /* ********************************************************************************* * Testing HE5_PTcreate * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_PTcreate... \n");); MESSAGE(4,printf("\t======================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTcreate... \n");); MESSAGE(11,fprintf(fp,"\t======================= \n");); MESSAGE(6,printf("\t\tCreating point \"FloatBuoy Point\" \n");); MESSAGE(11,fprintf(fp,"\t\tCreating point \"FloatBuoy Point\" \n");); PTid3 = HE5_PTcreate(ptfid, "FloatBuoy Point"); if (PTid3 == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\t\t*** Successfully created the point \"FloatBuoy Point\" ****\n");); MESSAGE(11,fprintf(fp,"\t\t*** Successfully created the point \"FloatBuoy Point\" ****\n");); } /* ********************************************************************************* * Testing HE5_PTdetach * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTdetach... \n");); MESSAGE(4,printf("\t======================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdetach... \n");); MESSAGE(11,fprintf(fp,"\t======================= \n");); MESSAGE(6,printf("\t\tDetaching from the point \"Simple Point\" \n");); MESSAGE(11,fprintf(fp,"\t\tDetaching from the point \"Simple Point\" \n");); status = HE5_PTdetach(PTid1); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTdetach();\n");); MESSAGE(8,printf("\t\tStatus returned by HE5_PTdetach() %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdetach();\n");); MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdetach() %d\n",status);); } /* ********************************************************************************* * Testing HE5_PTdetach * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTdetach... \n");); MESSAGE(4,printf("\t======================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdetach... \n");); MESSAGE(11,fprintf(fp,"\t======================= \n");); MESSAGE(6,printf("\t\tDetaching from the point \"FixedBuoy Point\" \n");); MESSAGE(11,fprintf(fp,"\t\tDetaching from the point \"FixedBuoy Point\" \n");); status = HE5_PTdetach(PTid2); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTdetach();\n");); MESSAGE(8,printf("\t\tStatus returned by HE5_PTdetach() %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdetach();\n");); MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdetach() %d\n",status);); } /* ********************************************************************************* * Testing HE5_PTdetach * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTdetach... \n");); MESSAGE(4,printf("\t======================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdetach... \n");); MESSAGE(11,fprintf(fp,"\t======================= \n");); MESSAGE(6,printf("\t\tDetaching from the point \"FloatBuoy Point\" \n");); MESSAGE(11,fprintf(fp,"\t\tDetaching from the point \"FloatBuoy Point\" \n");); status = HE5_PTdetach(PTid3); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTdetach();\n");); MESSAGE(8,printf("\t\tStatus returned by HE5_PTdetach() %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdetach();\n");); MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdetach() %d\n",status);); } /* ********************************************************************************* * Testing HE5_PTattach * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTattach... \n");); MESSAGE(4,printf("\t======================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTattach... \n");); MESSAGE(11,fprintf(fp,"\t======================= \n");); MESSAGE(6,printf("\t\tAttaching to the point \"Simple Point\" \n");); MESSAGE(11,fprintf(fp,"\t\tAttaching to the point \"Simple Point\" \n");); PTid1 = HE5_PTattach(ptfid, "Simple Point"); if (PTid1 == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tPTid1 = HE5_PTattach(ptfid, \"Simple Point\");\n");); MESSAGE(8,printf("\t\tThe point ID returned by HE5_PTattach() %d\n",PTid1);); MESSAGE(11,fprintf(fp,"\t\tPTid1 = HE5_PTattach(ptfid, \"Simple Point\");\n");); MESSAGE(11,fprintf(fp,"\t\tThe point ID returned by HE5_PTattach() %d\n",PTid1) ;); } dtsinfo = (HE5_CmpDTSinfo *)calloc(1, sizeof(HE5_CmpDTSinfo)); /* Set up level data structure */ /* --------------------------- */ dtsinfo->nfields = 3; dtsinfo->rank[0] = 1; dtsinfo->rank[1] = 1; dtsinfo->rank[2] = 1; dtsinfo->offset[0] = HOFFSET(InputData1, time); dtsinfo->offset[1] = HOFFSET(InputData1, concentr); dtsinfo->offset[2] = HOFFSET(InputData1, spec); dtsinfo->dtype[0] = H5T_NATIVE_DOUBLE; dtsinfo->dtype[1] = H5T_NATIVE_FLOAT; dtsinfo->dtype[2] = H5T_NATIVE_CHAR; dtsinfo->array[0] = 0; dtsinfo->array[1] = 1; dtsinfo->array[2] = 1; for (i = 0; i < 3; i++) dtsinfo->fieldname[i] = (char *)calloc(64, sizeof(char)); strcpy(dtsinfo->fieldname[0],"Time"); strcpy(dtsinfo->fieldname[1],"Concentration"); strcpy(dtsinfo->fieldname[2],"Species"); dtsinfo->dims[0][0] = 1; dtsinfo->dims[1][0] = 4; dtsinfo->dims[2][0] = 8; dtsinfo->datasize = (size_t)sizeof(InputData1); /* ********************************************************************************* * Testing HE5_PTdeflevel * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTdeflevel... \n");); MESSAGE(4,printf("\t========================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdeflevel... \n");); MESSAGE(11,fprintf(fp,"\t========================= \n");); MESSAGE(6,printf("\t\tDefining level \"Sensor\" \n");); MESSAGE(11,fprintf(fp,"\t\tDefining level \"Sensor\" \n");); status = HE5_PTdeflevel(PTid1, "Sensor", dtsinfo); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTdeflevel();\n");); MESSAGE(8,printf("\t\tStatus returned by HE5_PTdeflevel() %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdeflevel();\n");); MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdeflevel() %d\n",status);); } for (i = 0; i < 3; i++) { free(dtsinfo->fieldname[i]); dtsinfo->fieldname[i] = NULL; } free(dtsinfo); /* ********************************************************************************* * Testing HE5_PTdetach * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTdetach... \n");); MESSAGE(4,printf("\t======================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdetach... \n");); MESSAGE(11,fprintf(fp,"\t======================= \n");); MESSAGE(6,printf("\t\tDetaching from the point \"Simple Point\" \n");); MESSAGE(11,fprintf(fp,"\t\tDetaching from the point \"Simple Point\" \n");); status = HE5_PTdetach(PTid1); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTdetach();\n");); MESSAGE(8,printf("\t\tStatus returned by HE5_PTdetach() %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdetach();\n");); MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdetach() %d\n",status);); } /* ********************************************************************************* * Testing HE5_PTattach * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTattach... \n");); MESSAGE(4,printf("\t======================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTattach... \n");); MESSAGE(11,fprintf(fp,"\t======================= \n");); MESSAGE(6,printf("\t\tAttaching to the point \"FixedBuoy Point\" \n");); MESSAGE(11,fprintf(fp,"\t\tAttaching to the point \"FixedBuoy Point\" \n");); PTid2 = HE5_PTattach(ptfid, "FixedBuoy Point"); if (PTid2 == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tPTid2 = HE5_PTattach(ptfid, \"FixedBuoy Point\");\n");); MESSAGE(8,printf("\t\tThe point ID returned by HE5_PTattach() %d\n",PTid2);); MESSAGE(11,fprintf(fp,"\t\tPTid2 = HE5_PTattach(ptfid, \"FixedBuoy Point\");\n");); MESSAGE(11,fprintf(fp,"\t\tThe point ID returned by HE5_PTattach() %d\n",PTid2) ;); } dtsinfo = (HE5_CmpDTSinfo *)calloc(1, sizeof(HE5_CmpDTSinfo)); /* Set up level data struvcture */ /* ---------------------------- */ dtsinfo->nfields = 5; dtsinfo->rank[0] = 1; dtsinfo->rank[1] = 1; dtsinfo->rank[2] = 1; dtsinfo->rank[3] = 1; dtsinfo->rank[4] = 1; dtsinfo->array[0] = 1; dtsinfo->array[1] = 0; dtsinfo->array[2] = 0; dtsinfo->array[3] = 0; dtsinfo->array[4] = 1; dtsinfo->offset[0] = HOFFSET(InputData2, label); dtsinfo->offset[1] = HOFFSET(InputData2, lon); dtsinfo->offset[2] = HOFFSET(InputData2, lat); dtsinfo->offset[3] = HOFFSET(InputData2, date); dtsinfo->offset[4] = HOFFSET(InputData2, id); dtsinfo->dtype[0] = H5T_NATIVE_CHAR; dtsinfo->dtype[1] = H5T_NATIVE_DOUBLE; dtsinfo->dtype[2] = H5T_NATIVE_DOUBLE; dtsinfo->dtype[3] = H5T_NATIVE_INT; dtsinfo->dtype[4] = H5T_NATIVE_CHAR; for (i = 0; i < 5; i++) dtsinfo->fieldname[i] = (char *)calloc(64, sizeof(char)); strcpy(dtsinfo->fieldname[0],"Label"); strcpy(dtsinfo->fieldname[1],"Longitude"); strcpy(dtsinfo->fieldname[2],"Latitude"); strcpy(dtsinfo->fieldname[3],"DeployDate"); strcpy(dtsinfo->fieldname[4],"ID"); dtsinfo->dims[0][0] = 8; dtsinfo->dims[1][0] = 1; dtsinfo->dims[2][0] = 1; dtsinfo->dims[3][0] = 1; dtsinfo->dims[4][0] = 8; dtsinfo->datasize = (size_t)sizeof(InputData2); /* ********************************************************************************* * Testing HE5_PTdeflevel * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTdeflevel... \n");); MESSAGE(4,printf("\t========================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdeflevel... \n");); MESSAGE(11,fprintf(fp,"\t========================= \n");); MESSAGE(6,printf("\t\tDefining level \"Desc-Loc\" \n");); MESSAGE(11,fprintf(fp,"\t\tDefining level \"Desc-Loc\" \n");); status = HE5_PTdeflevel(PTid2, "Desc-Loc", dtsinfo); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTdeflevel();\n");); MESSAGE(8,printf("\t\tStatus returned by HE5_PTdeflevel() %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdeflevel();\n");); MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdeflevel() %d\n",status);); } for (i = 0; i < 5; i++) free(dtsinfo->fieldname[i]); free(dtsinfo); dtsinfo = (HE5_CmpDTSinfo *)calloc(1, sizeof(HE5_CmpDTSinfo)); /* Set up level data structure */ /* --------------------------- */ dtsinfo->nfields = 4; dtsinfo->rank[0] = 1; dtsinfo->rank[1] = 1; dtsinfo->rank[2] = 1; dtsinfo->rank[3] = 1; dtsinfo->array[0] = 0; dtsinfo->array[1] = 0; dtsinfo->array[2] = 0; dtsinfo->array[3] = 1; dtsinfo->offset[0] = HOFFSET(InputData3, time); dtsinfo->offset[1] = HOFFSET(InputData3, rain); dtsinfo->offset[2] = HOFFSET(InputData3, temp); dtsinfo->offset[3] = HOFFSET(InputData3, id); dtsinfo->dtype[0] = H5T_NATIVE_DOUBLE; dtsinfo->dtype[1] = H5T_NATIVE_FLOAT; dtsinfo->dtype[2] = H5T_NATIVE_FLOAT; dtsinfo->dtype[3] = H5T_NATIVE_CHAR; for (i = 0; i < 4; i++) dtsinfo->fieldname[i] = (char *)calloc(64, sizeof(char)); strcpy(dtsinfo->fieldname[0],"Time"); strcpy(dtsinfo->fieldname[1],"Rainfall"); strcpy(dtsinfo->fieldname[2],"Temperature"); strcpy(dtsinfo->fieldname[3],"ID"); dtsinfo->dims[0][0] = 1; dtsinfo->dims[1][0] = 1; dtsinfo->dims[2][0] = 1; dtsinfo->dims[3][0] = 8; dtsinfo->datasize = (size_t)sizeof(InputData3); /* ********************************************************************************* * Testing HE5_PTdeflevel * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTdeflevel... \n");); MESSAGE(4,printf("\t========================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdeflevel... \n");); MESSAGE(11,fprintf(fp,"\t========================= \n");); MESSAGE(6,printf("\t\tDefining level \"Observations\" \n");); MESSAGE(11,fprintf(fp,"\t\tDefining level \"Observations\" \n");); status = HE5_PTdeflevel(PTid2, "Observations", dtsinfo); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTdeflevel();\n");); MESSAGE(8,printf("\t\tStatus returned by HE5_PTdeflevel() %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdeflevel();\n");); MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdeflevel() %d\n",status);); } for (i = 0; i < 4; i++) free(dtsinfo->fieldname[i]); free(dtsinfo); /* ********************************************************************************* * Testing HE5_PTdeflinkage * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTdeflinkage... \n");); MESSAGE(4,printf("\t=========================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdeflinkage... \n");); MESSAGE(11,fprintf(fp,"\t=========================== \n");); MESSAGE(6,printf("\t\tDefining linkage between levels \"Desc-Loc\" and \"Observations\" \n");); MESSAGE(11,fprintf(fp,"\t\tDefining linkage between levels \"Desc-Loc\" and \"Observations\" \n");); status = HE5_PTdeflinkage(PTid2, "Desc-Loc", "Observations", "ID"); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTdeflinkage();\n");); MESSAGE(8,printf("\t\tStatus returned by HE5_PTdeflinkage() %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdeflinkage();\n");); MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdeflinkage() %d\n",status);); } /* ********************************************************************************* * Testing HE5_PTdetach * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTdetach... \n");); MESSAGE(4,printf("\t======================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdetach... \n");); MESSAGE(11,fprintf(fp,"\t======================= \n");); MESSAGE(6,printf("\t\tDetaching from the point \"FixedBuoy Point\" \n");); MESSAGE(11,fprintf(fp,"\t\tDetaching from the point \"FixedBuoy Point\" \n");); status = HE5_PTdetach(PTid2); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTdetach();\n");); MESSAGE(8,printf("\t\tStatus returned by HE5_PTdetach() %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdetach();\n");); MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdetach() %d\n",status);); } /* ********************************************************************************* * Testing HE5_PTattach * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTattach... \n");); MESSAGE(4,printf("\t======================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTattach... \n");); MESSAGE(11,fprintf(fp,"\t======================= \n");); MESSAGE(6,printf("\t\tAttaching to the point \"FloatBuoy Point\" \n");); MESSAGE(11,fprintf(fp,"\t\tAttaching to the point \"FloatBuoy Point\" \n");); PTid3 = HE5_PTattach(ptfid, "FloatBuoy Point"); if (PTid3 == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tPTid3 = HE5_PTattach(ptfid, \"FloatBuoy Point\");\n");); MESSAGE(8,printf("\t\tThe point ID returned by HE5_PTattach() %d\n",PTid3);); MESSAGE(11,fprintf(fp,"\t\tPTid3 = HE5_PTattach(ptfid, \"FloatBuoy Point\");\n");); MESSAGE(11,fprintf(fp,"\t\tThe point ID returned by HE5_PTattach() %d\n",PTid3) ;); } dtsinfo = (HE5_CmpDTSinfo *)calloc(1, sizeof(HE5_CmpDTSinfo)); /* Set up level data structure */ /* --------------------------- */ dtsinfo->nfields = 4; dtsinfo->rank[0] = 1; dtsinfo->rank[1] = 1; dtsinfo->rank[2] = 1; dtsinfo->rank[3] = 1; dtsinfo->array[0] = 1; dtsinfo->array[1] = 0; dtsinfo->array[2] = 0; dtsinfo->array[3] = 1; dtsinfo->offset[0] = HOFFSET(InputData4, label); dtsinfo->offset[1] = HOFFSET(InputData4, date); dtsinfo->offset[2] = HOFFSET(InputData4, weight); dtsinfo->offset[3] = HOFFSET(InputData4, id); dtsinfo->dtype[0] = H5T_NATIVE_CHAR; dtsinfo->dtype[1] = H5T_NATIVE_INT; dtsinfo->dtype[2] = H5T_NATIVE_INT; dtsinfo->dtype[3] = H5T_NATIVE_CHAR; for (i = 0; i < 4; i++) dtsinfo->fieldname[i] = (char *)calloc(64, sizeof(char)); strcpy(dtsinfo->fieldname[0],"Label"); strcpy(dtsinfo->fieldname[1],"DeployDate"); strcpy(dtsinfo->fieldname[2],"Weight"); strcpy(dtsinfo->fieldname[3],"ID"); dtsinfo->dims[0][0] = 8; dtsinfo->dims[1][0] = 1; dtsinfo->dims[2][0] = 1; dtsinfo->dims[3][0] = 8; dtsinfo->datasize = (size_t)sizeof(InputData4); /* ********************************************************************************* * Testing HE5_PTdeflevel * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTdeflevel... \n");); MESSAGE(4,printf("\t========================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdeflevel... \n");); MESSAGE(11,fprintf(fp,"\t========================= \n");); MESSAGE(6,printf("\t\tDefining level \"Description\" \n");); MESSAGE(11,fprintf(fp,"\t\tDefining level \"Description\" \n");); status = HE5_PTdeflevel(PTid3, "Description", dtsinfo); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTdeflevel();\n");); MESSAGE(8,printf("\t\tStatus returned by HE5_PTdeflevel() %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdeflevel();\n");); MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdeflevel() %d\n",status);); } for (i = 0; i < 4; i++) free(dtsinfo->fieldname[i]); free(dtsinfo); dtsinfo = (HE5_CmpDTSinfo *)calloc(1, sizeof(HE5_CmpDTSinfo)); /* Set up level data structure */ /* --------------------------- */ dtsinfo->nfields = 6; dtsinfo->rank[0] = 1; dtsinfo->rank[1] = 1; dtsinfo->rank[2] = 1; dtsinfo->rank[3] = 1; dtsinfo->rank[4] = 1; dtsinfo->rank[5] = 1; dtsinfo->array[0] = 0; dtsinfo->array[1] = 0; dtsinfo->array[2] = 0; dtsinfo->array[3] = 0; dtsinfo->array[4] = 0; dtsinfo->array[5] = 1; dtsinfo->offset[0] = HOFFSET(InputData5, time); dtsinfo->offset[1] = HOFFSET(InputData5, lon); dtsinfo->offset[2] = HOFFSET(InputData5, lat); dtsinfo->offset[3] = HOFFSET(InputData5, rain); dtsinfo->offset[4] = HOFFSET(InputData5, temp); dtsinfo->offset[5] = HOFFSET(InputData5, id); dtsinfo->dtype[0] = H5T_NATIVE_DOUBLE; dtsinfo->dtype[1] = H5T_NATIVE_DOUBLE; dtsinfo->dtype[2] = H5T_NATIVE_DOUBLE; dtsinfo->dtype[3] = H5T_NATIVE_FLOAT; dtsinfo->dtype[4] = H5T_NATIVE_FLOAT; dtsinfo->dtype[5] = H5T_NATIVE_CHAR; for (i = 0; i < 6; i++) dtsinfo->fieldname[i] = (char *)calloc(64, sizeof(char)); strcpy(dtsinfo->fieldname[0],"Time"); strcpy(dtsinfo->fieldname[1],"Longitude"); strcpy(dtsinfo->fieldname[2],"Latitude"); strcpy(dtsinfo->fieldname[3],"Rainfall"); strcpy(dtsinfo->fieldname[4],"Temperature"); strcpy(dtsinfo->fieldname[5],"ID"); dtsinfo->dims[0][0] = 1; dtsinfo->dims[1][0] = 1; dtsinfo->dims[2][0] = 1; dtsinfo->dims[3][0] = 1; dtsinfo->dims[4][0] = 1; dtsinfo->dims[5][0] = 8; dtsinfo->datasize = (size_t)sizeof(InputData5); /* ********************************************************************************* * Testing HE5_PTdeflevel * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTdeflevel... \n");); MESSAGE(4,printf("\t========================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdeflevel... \n");); MESSAGE(11,fprintf(fp,"\t========================= \n");); MESSAGE(6,printf("\t\tDefining level \"Measurements\" \n");); MESSAGE(11,fprintf(fp,"\t\tDefining level \"Measurements\" \n");); status = HE5_PTdeflevel(PTid3, "Measurements", dtsinfo); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTdeflevel();\n");); MESSAGE(8,printf("\t\tStatus returned by HE5_PTdeflevel() %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdeflevel();\n");); MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdeflevel() %d\n",status);); } for (i = 0; i < 6; i++) free(dtsinfo->fieldname[i]); free(dtsinfo); /* ********************************************************************************* * Testing HE5_PTdeflinkage * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTdeflinkage... \n");); MESSAGE(4,printf("\t=========================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdeflinkage... \n");); MESSAGE(11,fprintf(fp,"\t=========================== \n");); MESSAGE(6,printf("\t\tDefining linkage between levels \"Description\" and \"Measurements\" \n");); MESSAGE(11,fprintf(fp,"\t\tDefining linkage between levels \"Description\" and \"Measurements\" \n");); status = HE5_PTdeflinkage(PTid3, "Description", "Measurements", "ID"); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTdeflinkage();\n");); MESSAGE(8,printf("\t\tStatus returned by HE5_PTdeflinkage() %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdeflinkage();\n");); MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdeflinkage() %d\n",status);); } /* ********************************************************************************* * Testing HE5_PTdetach * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTdetach... \n");); MESSAGE(4,printf("\t======================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdetach... \n");); MESSAGE(11,fprintf(fp,"\t======================= \n");); MESSAGE(6,printf("\t\tDetaching from the point \"FloatBuoy Point\" \n");); MESSAGE(11,fprintf(fp,"\t\tDetaching from the point \"FloatBuoy Point\" \n");); status = HE5_PTdetach(PTid3); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTdetach();\n");); MESSAGE(8,printf("\t\tStatus returned by HE5_PTdetach() %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdetach();\n");); MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdetach() %d\n",status);); } /* ********************************************************************************* * Testing HE5_PTattach * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTattach... \n");); MESSAGE(4,printf("\t======================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTattach... \n");); MESSAGE(11,fprintf(fp,"\t======================= \n");); MESSAGE(6,printf("\t\tAttaching to the point \"Simple Point\" \n");); MESSAGE(11,fprintf(fp,"\t\tAttaching to the point \"Simple Point\" \n");); PTid1 = HE5_PTattach(ptfid, "Simple Point"); if (PTid1 == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tPTid1 = HE5_PTattach(ptfid, \"Simple Point\");\n");); MESSAGE(8,printf("\t\tThe point ID returned by HE5_PTattach() %d\n",PTid1);); MESSAGE(11,fprintf(fp,"\t\tPTid1 = HE5_PTattach(ptfid, \"Simple Point\");\n");); MESSAGE(11,fprintf(fp,"\t\tThe point ID returned by HE5_PTattach() %d\n",PTid1) ;); } setup_namebuf(namebuf, "simple.txt"); fp_in = fopen(namebuf, "r"); n = 0; while(fscanf(fp_in, "%lf %f %f %f %f %s", &time, &conc[0], &conc[1], &conc[2], &conc[3], spc) != -1) { datbuf_1[n].time = time; datbuf_1[n].concentr[0] = conc[0]; datbuf_1[n].concentr[1] = conc[1]; datbuf_1[n].concentr[2] = conc[2]; datbuf_1[n].concentr[3] = conc[3]; memmove(datbuf_1[n].spec, spc, sizeof(char)*strlen(spc)); datbuf_1[n].spec[strlen(spc)] = 0; n++; } fclose(fp_in); datasize = (size_t)sizeof(InputData1); count[0] = n; /* ********************************************************************************* * Testing HE5_PTwritelevel * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTwritelevel... \n");); MESSAGE(4,printf("\t=========================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTwritelevel... \n");); MESSAGE(11,fprintf(fp,"\t=========================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tWriting records to the point \"Simple Point\" level 0 \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tWriting records to the point \"Simple Point\" level 0 \n");); status = HE5_PTwritelevel(PTid1, 0, count, &datasize, datbuf_1); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTwritelevel();\n");); MESSAGE(8,printf("\t\tStatus returned by HE5_PTwritelevel() %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTwritelevel();\n");); MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTwritelevel() %d\n",status);); } /* ********************************************************************************* * Testing HE5_PTdetach * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTdetach... \n");); MESSAGE(4,printf("\t======================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdetach... \n");); MESSAGE(11,fprintf(fp,"\t======================= \n");); MESSAGE(6,printf("\t\tDetaching from the point \"Simple Point\" \n");); MESSAGE(11,fprintf(fp,"\t\tDetaching from the point \"Simple Point\" \n");); status = HE5_PTdetach(PTid1); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTdetach();\n");); MESSAGE(8,printf("\t\tStatus returned by HE5_PTdetach() %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdetach();\n");); MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdetach() %d\n",status);); } /* ********************************************************************************* * Testing HE5_PTattach * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTattach... \n");); MESSAGE(4,printf("\t======================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTattach... \n");); MESSAGE(11,fprintf(fp,"\t======================= \n");); MESSAGE(6,printf("\t\tAttaching to the point \"FixedBuoy Point\" \n");); MESSAGE(11,fprintf(fp,"\t\tAttaching to the point \"FixedBuoy Point\" \n");); PTid2 = HE5_PTattach(ptfid, "FixedBuoy Point"); if (PTid2 == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tPTid2 = HE5_PTattach(ptfid, \"FixedBuoy Point\");\n");); MESSAGE(8,printf("\t\tThe point ID returned by HE5_PTattach() %d\n",PTid2);); MESSAGE(11,fprintf(fp,"\t\tPTid2 = HE5_PTattach(ptfid, \"FixedBuoy Point\");\n");); MESSAGE(11,fprintf(fp,"\t\tThe point ID returned by HE5_PTattach() %d\n",PTid2) ;); } setup_namebuf(namebuf, "fixedBuoy0.txt"); fp_in = fopen(namebuf, "r"); n = 0; while(fscanf(fp_in, "%s %lf %lf %d %s", desc, &lon, &lat, &date, id) != -1) { strcpy(datbuf_2[n].label, desc); datbuf_2[n].lon = lon; datbuf_2[n].lat = lat; datbuf_2[n].date = date; memmove(datbuf_2[n].id, id, sizeof(char)*strlen(id)); datbuf_2[n].id[strlen(id)] = 0; n++; } fclose(fp_in); datasize = (size_t)sizeof(InputData2); count[0] = n; /* ********************************************************************************* * Testing HE5_PTwritelevel * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTwritelevel... \n");); MESSAGE(4,printf("\t=========================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTwritelevel... \n");); MESSAGE(11,fprintf(fp,"\t=========================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tWriting records to the point \"FixedBuoy Point\" level 0 \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tWriting records to the point \"FixedBuoy Point\" level 0 \n");); status = HE5_PTwritelevel(PTid2, 0, count, &datasize, datbuf_2); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTwritelevel();\n");); MESSAGE(8,printf("\t\tStatus returned by HE5_PTwritelevel() %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTwritelevel();\n");); MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTwritelevel() %d\n",status);); } setup_namebuf(namebuf, "fixedBuoy1.txt"); fp_in = fopen(namebuf, "r"); n = 0; while(fscanf(fp_in, "%lf %f %f %s", &time, &rain, &temp, id) != -1) { datbuf_3[n].time = time; datbuf_3[n].rain = rain; datbuf_3[n].temp = temp; memmove(datbuf_3[n].id, id, sizeof(char)*strlen(id)); datbuf_3[n].id[strlen(id)] = 0; n++; } fclose(fp_in); datasize = (size_t)sizeof(InputData3); count[0] = n; /* ********************************************************************************* * Testing HE5_PTwritelevel * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTwritelevel... \n");); MESSAGE(4,printf("\t=========================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTwritelevel... \n");); MESSAGE(11,fprintf(fp,"\t=========================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tWriting records to the point \"FixedBuoy Point\" level 1 \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tWriting records to the point \"FixedBuoy Point\" level 1 \n");); status = HE5_PTwritelevel(PTid2, 1, count, &datasize, datbuf_3); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTwritelevel();\n");); MESSAGE(8,printf("\t\tStatus returned by HE5_PTwritelevel() %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTwritelevel();\n");); MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTwritelevel() %d\n",status);); } /* ********************************************************************************* * Testing HE5_PTwriteattr * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTwriteattr... \n");); MESSAGE(4,printf("\t========================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTwriteattr... \n");); MESSAGE(11,fprintf(fp,"\t========================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tWriting attribute to the point \"FixedBuoy Point\" \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tWriting attribute to the point \"FixedBuoy Point\" \n");); count[0] = 1; status = HE5_PTwriteattr(PTid2, "GlobalAttr_Integer", H5T_NATIVE_INT, count, &IntAttr); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTwriteattr();\n");); MESSAGE(8,printf("\t\tStatus returned by HE5_PTwriteattr() %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTwriteattr();\n");); MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTwriteattr() %d\n",status);); } /* ********************************************************************************* * Testing HE5_PTwriteattr * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTwriteattr... \n");); MESSAGE(4,printf("\t========================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTwriteattr... \n");); MESSAGE(11,fprintf(fp,"\t========================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tWriting attribute to the point \"FixedBuoy Point\" \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tWriting attribute to the point \"FixedBuoy Point\" \n");); count[0] = 1; status = HE5_PTwriteattr(PTid2, "GlobalAttribute_int", H5T_NATIVE_INT, count, &attr); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTwriteattr();\n");); MESSAGE(8,printf("\t\tStatus returned by HE5_PTwriteattr() %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTwriteattr();\n");); MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTwriteattr() %d\n",status);); } /* ********************************************************************************* * Testing HE5_PTwritegrpattr * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTwritegrpattr... \n");); MESSAGE(4,printf("\t============================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTwritegrpattr... \n");); MESSAGE(11,fprintf(fp,"\t============================= \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tWriting group attribute to the point \"FixedBuoy Point\" \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tWriting group attribute to the point \"FixedBuoy Point\" \n");); count[0] = 5; status = HE5_PTwritegrpattr(PTid2, "GroupAttribute", H5T_NATIVE_INT, count, attr1); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTwritegrpattr();\n");); MESSAGE(8,printf("\t\tStatus returned by HE5_PTwritegrpattr() %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTwritegrpattr();\n");); MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTwritegrpattr() %d\n",status);); } /* ********************************************************************************* * Testing HE5_PTwritelocattr * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTwritelocattr... \n");); MESSAGE(4,printf("\t============================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTwritelocattr... \n");); MESSAGE(11,fprintf(fp,"\t============================= \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tWriting local attribute to the point \"FixedBuoy Point\" \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tWriting local attribute to the point \"FixedBuoy Point\" \n");); status = HE5_PTwritelocattr(PTid2, "Observations", "LocalAttribute", H5T_NATIVE_INT, count, attr2); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTwritelocattr();\n");); MESSAGE(8,printf("\t\tStatus returned by HE5_PTwritelocattr() %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTwritelocattr();\n");); MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTwritelocattr() %d\n",status);); } /* ********************************************************************************* * Testing HE5_PTdetach * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTdetach... \n");); MESSAGE(4,printf("\t======================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdetach... \n");); MESSAGE(11,fprintf(fp,"\t======================= \n");); MESSAGE(6,printf("\t\tDetaching from the point \"FixedBuoy Point\" \n");); MESSAGE(11,fprintf(fp,"\t\tDetaching from the point \"FixedBuoy Point\" \n");); status = HE5_PTdetach(PTid2); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTdetach();\n");); MESSAGE(8,printf("\t\tStatus returned by HE5_PTdetach() %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdetach();\n");); MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdetach() %d\n",status);); } /* ********************************************************************************* * Testing HE5_PTattach * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTattach... \n");); MESSAGE(4,printf("\t======================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTattach... \n");); MESSAGE(11,fprintf(fp,"\t======================= \n");); MESSAGE(6,printf("\t\tAttaching to the point \"FloatBuoy Point\" \n");); MESSAGE(11,fprintf(fp,"\t\tAttaching to the point \"FloatBuoy Point\" \n");); PTid3 = HE5_PTattach(ptfid, "FloatBuoy Point"); if (PTid3 == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tPTid3 = HE5_PTattach(ptfid, \"FloatBuoy Point\");\n");); MESSAGE(8,printf("\t\tThe point ID returned by HE5_PTattach() %d\n",PTid3);); MESSAGE(11,fprintf(fp,"\t\tPTid3 = HE5_PTattach(ptfid, \"FloatBuoy Point\");\n");); MESSAGE(11,fprintf(fp,"\t\tThe point ID returned by HE5_PTattach() %d\n",PTid3) ;); } setup_namebuf(namebuf, "floatBuoy0.txt"); fp_in = fopen(namebuf, "r"); n = 0; while(fscanf(fp_in, "%s %d %d %s", desc, &date, &wgt, id) != -1) { strcpy(datbuf_4[n].label, desc); datbuf_4[n].date = date; datbuf_4[n].weight = wgt; memmove(datbuf_4[n].id, id, sizeof(char)*strlen(id)); datbuf_4[n].id[strlen(id)] = 0; n++; } fclose(fp_in); datasize = (size_t)sizeof(InputData4); count[0] = n; /* ********************************************************************************* * Testing HE5_PTwritelevel * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTwritelevel... \n");); MESSAGE(4,printf("\t=========================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTwritelevel... \n");); MESSAGE(11,fprintf(fp,"\t=========================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tWriting records to the point \"FloatBuoy Point\" level 0 \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tWriting records to the point \"FloatBuoy Point\" level 0 \n");); status = HE5_PTwritelevel(PTid3, 0, count, &datasize, datbuf_4); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTwritelevel();\n");); MESSAGE(8,printf("\t\tStatus returned by HE5_PTwritelevel() %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTwritelevel();\n");); MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTwritelevel() %d\n",status);); } setup_namebuf(namebuf, "floatBuoy1.txt"); fp_in = fopen(namebuf, "r"); n = 0; while(fscanf(fp_in, "%lf %lf %lf %f %f %s", &time, &lon, &lat, &rain, &temp, id) != -1) { datbuf_5[n].time = time; datbuf_5[n].lon = lon; datbuf_5[n].lat = lat; datbuf_5[n].rain = rain; datbuf_5[n].temp = temp; memmove(datbuf_5[n].id, id,sizeof(char)*strlen(id)); datbuf_5[n].id[strlen(id)] = 0; n++; } fclose(fp_in); datasize = (size_t)sizeof(InputData5); count[0] = n; /* ********************************************************************************* * Testing HE5_PTwritelevel * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTwritelevel... \n");); MESSAGE(4,printf("\t=========================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTwritelevel... \n");); MESSAGE(11,fprintf(fp,"\t=========================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tWriting records to the point \"FloatBuoy Point\" level 1 \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tWriting records to the point \"FloatBuoy Point\" level 1 \n");); status = HE5_PTwritelevel(PTid3, 1, count, &datasize, datbuf_5); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTwritelevel();\n");); MESSAGE(8,printf("\t\tStatus returned by HE5_PTwritelevel() %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTwritelevel();\n");); MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTwritelevel() %d\n",status);); } /* ********************************************************************************* * Testing HE5_PTwriteattr * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTwriteattr... \n");); MESSAGE(4,printf("\t========================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTwriteattr... \n");); MESSAGE(11,fprintf(fp,"\t========================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tWriting attribute to the point \"FloatBuoy Point\" \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tWriting attribute to the point \"FloatBuoy Point\" \n");); count[0] = 1; status = HE5_PTwriteattr(PTid3, "GlobalAttr", H5T_NATIVE_FLOAT, count, &flt); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTwriteattr();\n");); MESSAGE(8,printf("\t\tStatus returned by HE5_PTwriteattr() %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTwriteattr();\n");); MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTwriteattr() %d\n",status);); } /* ********************************************************************************* * Testing HE5_PTwriteattr * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTwriteattr... \n");); MESSAGE(4,printf("\t========================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTwriteattr... \n");); MESSAGE(11,fprintf(fp,"\t========================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tWriting attribute to the point \"FloatBuoy Point\" \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tWriting attribute to the point \"FloatBuoy Point\" \n");); count[0] = 1; status = HE5_PTwriteattr(PTid3, "GlobalAttribute_float", H5T_NATIVE_FLOAT, count, &flt); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTwriteattr();\n");); MESSAGE(8,printf("\t\tStatus returned by HE5_PTwriteattr() %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTwriteattr();\n");); MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTwriteattr() %d\n",status);); } /* ********************************************************************************* * Testing HE5_PTdetach * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTdetach... \n");); MESSAGE(4,printf("\t======================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdetach... \n");); MESSAGE(11,fprintf(fp,"\t======================= \n");); MESSAGE(6,printf("\t\tDetaching from the point \"FloatBuoy Point\" \n");); MESSAGE(11,fprintf(fp,"\t\tDetaching from the point \"FloatBuoy Point\" \n");); status = HE5_PTdetach(PTid3); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTdetach();\n");); MESSAGE(8,printf("\t\tStatus returned by HE5_PTdetach() %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdetach();\n");); MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdetach() %d\n",status);); } /* ********************************************************************************* * Testing HE5_PTclose * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_PTclose... \n");); MESSAGE(4,printf("\t====================== \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTclose... \n");); MESSAGE(11,fprintf(fp,"\t====================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tClosing the file \"SimplePoint.he5\" \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tClosing the file \"SimplePoint.he5\" \n");); status = HE5_PTclose(ptfid); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\t\tSuccessfully clossed the \"SimplePoint.he5\" file \n");); MESSAGE(11,fprintf(fp,"\t\tSuccessfully clossed the \"SimplePoint.he5\" file \n");); } /* ********************************************************************************* * Testing HE5_PTopen * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTopen... \n");); MESSAGE(4,printf("\t===================== \n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTopen... \n");); MESSAGE(11,fprintf(fp,"\t===================== \n");); ptfid = HE5_PTopen("SimplePoint.he5",H5F_ACC_RDWR); if (ptfid == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\t\t*** Successfully re-opened the point file ****\n");); MESSAGE(11,fprintf(fp,"\t\t*** Successfully re-opened the point file ****\n");); } /* ********************************************************************************* * Testing HE5_PTattach * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTattach... \n");); MESSAGE(4,printf("\t======================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTattach... \n");); MESSAGE(11,fprintf(fp,"\t======================= \n");); MESSAGE(6,printf("\t\tAttaching to the point \"Simple Point\" \n");); MESSAGE(11,fprintf(fp,"\t\tAttaching to the point \"Simple Point\" \n");); PTid1 = HE5_PTattach(ptfid, "Simple Point"); if (PTid1 == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tPTid1 = HE5_PTattach(ptfid, \"Simple Point\");\n");); MESSAGE(8,printf("\t\tThe point ID returned by HE5_PTattach() %d\n",PTid1);); MESSAGE(11,fprintf(fp,"\t\tPTid1 = HE5_PTattach(ptfid, \"Simple Point\");\n");); MESSAGE(11,fprintf(fp,"\t\tThe point ID returned by HE5_PTattach() %d\n",PTid1) ;); } /* ********************************************************************************* * Testing HE5_PTlevelinfo * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTlevelinfo... \n");); MESSAGE(4,printf("\t========================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTlevelinfo... \n");); MESSAGE(11,fprintf(fp,"\t========================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieving level information for point \"Simple Point\" \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieving level information for point \"Simple Point\" \n");); status = HE5_PTlevelinfo(PTid1, 0, &level); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { nflds = level.nfields; MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\t status = HE5_PTlevelinfo();\n");); MESSAGE(8,printf("\t\tValue returned by HE5_PTlevelinfo() %d\n", status);); MESSAGE(8,printf("\t\tNumber of fields in level: %d\n", nflds);); for (i = 0; i < nflds; i++) { MESSAGE(8,printf("Field name: %s \n", level.fieldname[i]);); MESSAGE(8,printf("Field rank: %d \n", level.rank[i]);); MESSAGE(8,printf("Field type ID: %d \n", level.dtype[i]);); for (j = 0; j < level.rank[i]; j++) MESSAGE(8,printf("Field dims: %d \n", (int)level.dims[i][j]);); MESSAGE(8,printf("Field class: %d \n", level.dclass[i]);); } MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTlevelinfo(); \n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_PTlevelinfo() %d\n", status);); MESSAGE(11,fprintf(fp,"\t\tNumber of fields in level: %d\n", nflds);); for (i = 0; i < nflds; i++) { MESSAGE(11,fprintf(fp,"Field name: %s \n", level.fieldname[i]);); MESSAGE(11,fprintf(fp,"Field rank: %d \n", level.rank[i]);); MESSAGE(11,fprintf(fp,"Field type ID: %d \n", level.dtype[i]);); for (j = 0; j < level.rank[i]; j++) MESSAGE(11,fprintf(fp,"Field dims: %d \n", (int)level.dims[i][j]);); MESSAGE(11,fprintf(fp,"Field class: %d \n", level.dclass[i]);); } } /* ********************************************************************************* * Testing HE5_PTnrecs * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTnrecs... \n");); MESSAGE(4,printf("\t====================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTnrecs... \n");); MESSAGE(11,fprintf(fp,"\t====================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieving number of records in level 0 in point \"Simple Point\' \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieving number of records in level 0 in point \"Simple Point\" \n");); nrecs = HE5_PTnrecs(PTid1, 0); if (nrecs == 0) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tnrecs = HE5_PTnrecs();\n");); MESSAGE(8,printf("\t\tNumber of records returned by HE5_PTnrecs(): %lu \n",(unsigned long)nrecs);); MESSAGE(11,fprintf(fp,"\t\tnrecs = HE5_PTnrecs();\n");); MESSAGE(11,fprintf(fp,"\t\tNumber of records returned by HE5_PTnrecs(): %lu \n", (unsigned long)nrecs);); } datasize = (size_t)sizeof(Sensor); inInfo.nfields = nflds; inInfo.datasize = (size_t)sizeof(Sensor); inInfo.rank[0] = 1; inInfo.rank[1] = 1; inInfo.rank[2] = 1; inInfo.offset[0] = HOFFSET(Sensor, time); inInfo.offset[1] = HOFFSET(Sensor, con); inInfo.offset[2] = HOFFSET(Sensor, spec); inInfo.dtype[0] = H5T_NATIVE_DOUBLE; inInfo.dtype[1] = H5T_NATIVE_FLOAT; inInfo.dtype[2] = H5T_NATIVE_CHAR; inInfo.dclass[0] = H5T_NO_CLASS; inInfo.dclass[1] = H5T_NO_CLASS; inInfo.dclass[2] = H5T_NO_CLASS; inInfo.dims[0][0] = 1; inInfo.dims[1][0] = 4; inInfo.dims[2][0] = 8; inInfo.array[0] = 0; inInfo.array[1] = 1; inInfo.array[2] = 1; for( i = 0; i < nflds; i++) { inInfo.fieldname[i] = (char *)calloc(64, sizeof(char)); strcpy(inInfo.fieldname[i], level.fieldname[i]); } /* ********************************************************************************* * Testing HE5_PTreadlevel * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTreadlevel... \n");); MESSAGE(4,printf("\t========================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTreadlevel... \n");); MESSAGE(11,fprintf(fp,"\t========================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieving field values for point \"Simple Point\" \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieving field values for point \"Simple Point\" \n");); status = HE5_PTreadlevel(PTid1, 0, &inInfo, &datasize, s); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTreadlevel();\n");); MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTreadlevel() %d\n", status);); MESSAGE(8,printf("\n");); for (i = 0; i < nrecs; i++) { MESSAGE(8,printf("%lf %f %f %f %f %s\n", s[i].time, s[i].con[0], s[i].con[1],s[i].con[2], s[i].con[3], s[i].spec);); MESSAGE(11,fprintf(fp,"%lf %f %f %f %f %s\n", s[i].time, s[i].con[0], s[i].con[1],s[i].con[2], s[i].con[3], s[i].spec);); } } for (i = 0; i < nflds; i++) if (inInfo.fieldname[i] != NULL) free(inInfo.fieldname[i]); datasize = (size_t)sizeof(double); inInfo2.nfields = 1; inInfo2.datasize = (size_t)sizeof(double); inInfo2.rank[0] = 1; inInfo2.offset[0] = 0; inInfo2.dtype[0] = H5T_NATIVE_DOUBLE; inInfo2.dclass[0] = H5T_FLOAT; inInfo2.dims[0][0] = 1; inInfo2.array[0] = 0; inInfo2.fieldname[0] = (char *)calloc(64, sizeof(char)); strcpy(inInfo2.fieldname[0], level.fieldname[0]); /* ********************************************************************************* * Testing HE5_PTreadlevel * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTreadlevel... \n");); MESSAGE(4,printf("\t========================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTreadlevel... \n");); MESSAGE(11,fprintf(fp,"\t========================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieving field values for point \"Simple Point\" \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieving field values for point \"Simple Point\" \n");); status = HE5_PTreadlevel(PTid1, 0, &inInfo2, &datasize, s1); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTreadlevel();\n");); MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTreadlevel() %d\n", status);); MESSAGE(8,printf("\n");); for (i = 0; i < nrecs; i++) { MESSAGE(8,printf("%lf \n", s1[i]);); MESSAGE(11,fprintf(fp,"%lf \n", s1[i]);); } } if (inInfo2.fieldname[0] != NULL) free(inInfo2.fieldname[0]); for (i = 0; i < nflds; i++) if(level.fieldname[i] != NULL) H5free_memory(level.fieldname[i]); /* ********************************************************************************* * Testing HE5_PTdetach * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTdetach... \n");); MESSAGE(4,printf("\t======================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdetach... \n");); MESSAGE(11,fprintf(fp,"\t======================= \n");); MESSAGE(6,printf("\t\tDetaching from the point \"Simple Point\" \n");); MESSAGE(11,fprintf(fp,"\t\tDetaching from the point \"Simple Point\" \n");); status = HE5_PTdetach(PTid1); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTdetach();\n");); MESSAGE(8,printf("\t\tStatus returned by HE5_PTdetach() %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdetach();\n");); MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdetach() %d\n",status);); } /* ********************************************************************************* * Testing HE5_PTattach * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTattach... \n");); MESSAGE(4,printf("\t======================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTattach... \n");); MESSAGE(11,fprintf(fp,"\t======================= \n");); MESSAGE(6,printf("\t\tAttaching to the point \"FixedBuoy Point\" \n");); MESSAGE(11,fprintf(fp,"\t\tAttaching to the point \"FixedBuoy Point\" \n");); PTid2 = HE5_PTattach(ptfid, "FixedBuoy Point"); if (PTid2 == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tPTid2 = HE5_PTattach(ptfid, \"FixedBuoy Point\");\n");); MESSAGE(8,printf("\t\tThe point ID returned by HE5_PTattach() %d\n",PTid2);); MESSAGE(11,fprintf(fp,"\t\tPTid2 = HE5_PTattach(ptfid, \"FixedBuoy Point\");\n");); MESSAGE(11,fprintf(fp,"\t\tThe point ID returned by HE5_PTattach() %d\n",PTid2) ;); } /* ********************************************************************************* * Testing HE5_PTinqattrs * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTinqattrs... \n");); MESSAGE(4,printf("\t========================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTinqattrs... \n");); MESSAGE(11,fprintf(fp,"\t========================= \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieving the number of attributes in the point \"FixedBuoy Point\".\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieving the number of attributes in the point \"FixedBuoy Point\".\n");); nattr = HE5_PTinqattrs(PTid2, NULL, &strbufsize); if (nattr < 0) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(8,printf("\t\tnattr = HE5_PTinqattrs();\n");); MESSAGE(8,printf("\t\tNumber of attributes returned by HE5_PTinqattrs(): %li\n", nattr);); MESSAGE(8,printf("\t\tString length of the attribute list: %li\n", strbufsize);); MESSAGE(11,fprintf(fp,"\t\tnattr = HE5_PTinqattrs();\n");); MESSAGE(11,fprintf(fp,"\t\tNumber of attributes returned by HE5_PTinqattrs(): %li\n", nattr);); MESSAGE(11,fprintf(fp,"\t\tString length of the attribute list: %li\n", strbufsize);); } /* ********************************************************************************* * Testing HE5_PTreadattr * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTreadattr... \n");); MESSAGE(4,printf("\t========================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTreadattr... \n");); MESSAGE(11,fprintf(fp,"\t========================= \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tReading value of the attribute \"GlobalAttr_Integer\" in the point \"FixedBuoy Point\" \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tReading value of the attribute \"GlobalAttr_Integer\" in the point \"FixedBuoy Point\" \n");); status = HE5_PTreadattr(PTid2, "GlobalAttr_Integer", &IntAttr); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTreadattr();\n");); MESSAGE(8,printf("\t\tStatus returned by HE5_PTreadattr() %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTreadattr();\n");); MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTreadattr() %d\n",status);); MESSAGE(8,printf("\n");); MESSAGE(8,printf("\t\t Attribute value reads\n");); MESSAGE(8,printf("\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t Attribute value reads\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(8,printf("\t\t %d\n", IntAttr);); MESSAGE(11,fprintf(fp,"\t\t %d\n", IntAttr);); } /* ********************************************************************************* * Testing HE5_PTdetach * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTdetach... \n");); MESSAGE(4,printf("\t======================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdetach... \n");); MESSAGE(11,fprintf(fp,"\t======================= \n");); MESSAGE(6,printf("\t\tDetaching from the point \"FixedBuoy Point\" \n");); MESSAGE(11,fprintf(fp,"\t\tDetaching from the point \"FixedBuoy Point\" \n");); status = HE5_PTdetach(PTid2); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTdetach();\n");); MESSAGE(8,printf("\t\tStatus returned by HE5_PTdetach() %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdetach();\n");); MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdetach() %d\n",status);); } /* ********************************************************************************* * Testing HE5_PTclose * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_PTclose... \n");); MESSAGE(4,printf("\t====================== \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTclose... \n");); MESSAGE(11,fprintf(fp,"\t====================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tClosing the file \"SimplePoint.he5\" \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tClosing the file \"SimplePoint.he5\" \n");); status = HE5_PTclose(ptfid); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\t\tSuccessfully clossed the \"SimplePoint.he5\" file \n");); MESSAGE(11,fprintf(fp,"\t\tSuccessfully clossed the \"SimplePoint.he5\" file \n");); } /* ********************************************************************************* * Testing HE5_PTopen * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTopen... \n");); MESSAGE(4,printf("\t===================== \n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTopen... \n");); MESSAGE(11,fprintf(fp,"\t===================== \n");); ptfid = HE5_PTopen("SimplePoint.he5",H5F_ACC_RDWR); if (ptfid == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\t\t*** Successfully re-opened the point file ****\n");); MESSAGE(11,fprintf(fp,"\t\t*** Successfully re-opened the point file ****\n");); } /* ********************************************************************************* * Testing HE5_PTattach * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTattach... \n");); MESSAGE(4,printf("\t======================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTattach... \n");); MESSAGE(11,fprintf(fp,"\t======================= \n");); MESSAGE(6,printf("\t\tAttaching to the point \"Simple Point\" \n");); MESSAGE(11,fprintf(fp,"\t\tAttaching to the point \"Simple Point\" \n");); PTid1 = HE5_PTattach(ptfid, "Simple Point"); if (PTid1 == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tPTid1 = HE5_PTattach(ptfid, \"Simple Point\");\n");); MESSAGE(8,printf("\t\tThe point ID returned by HE5_PTattach() %d\n",PTid1);); MESSAGE(11,fprintf(fp,"\t\tPTid1 = HE5_PTattach(ptfid, \"Simple Point\");\n");); MESSAGE(11,fprintf(fp,"\t\tThe point ID returned by HE5_PTattach() %d\n",PTid1) ;); } /* ********************************************************************************* * Testing HE5_PTupdatelevel * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTupdatelevel... \n");); MESSAGE(4,printf("\t============================ \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTupdatelevel... \n");); MESSAGE(11,fprintf(fp,"\t============================ \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tUpdating level \"Concentration\" in point \"Simple Point\" \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tUpdating level \"Concentration\" in point \"Simple Point\" \n");); recs[0] = 0; buf_1.time = 13131313.0; buf_1.concentr[0] = 1.11; buf_1.concentr[1] = 2.22; buf_1.concentr[2] = 3.33; buf_1.concentr[3] = 4.44; strcpy(buf_1.spec,"AM"); status = HE5_PTupdatelevel(PTid1, 0, "Concentration", nrec, recs, &buf_1); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTupdatelevel();\n");); MESSAGE(8,printf("\t\tStatus returned by HE5_PTupdatelevel() %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTupdatelevel();\n");); MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTupdatelevel() %d\n",status);); } /* ********************************************************************************* * Testing HE5_PTdetach * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTdetach... \n");); MESSAGE(4,printf("\t======================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdetach... \n");); MESSAGE(11,fprintf(fp,"\t======================= \n");); MESSAGE(6,printf("\t\tDetaching from the point \"Simple Point\" \n");); MESSAGE(11,fprintf(fp,"\t\tDetaching from the point \"Simple Point\" \n");); status = HE5_PTdetach(PTid1); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTdetach();\n");); MESSAGE(8,printf("\t\tStatus returned by HE5_PTdetach() %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdetach();\n");); MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdetach() %d\n",status);); } /* ********************************************************************************* * Testing HE5_PTattach * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTattach... \n");); MESSAGE(4,printf("\t======================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTattach... \n");); MESSAGE(11,fprintf(fp,"\t======================= \n");); MESSAGE(6,printf("\t\tAttaching to the point \"FixedBuoy Point\" \n");); MESSAGE(11,fprintf(fp,"\t\tAttaching to the point \"FixedBuoy Point\" \n");); PTid2 = HE5_PTattach(ptfid, "FixedBuoy Point"); if (PTid2 == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tPTid2 = HE5_PTattach(ptfid, \"FixedBuoy Point\");\n");); MESSAGE(8,printf("\t\tThe point ID returned by HE5_PTattach() %d\n",PTid2);); MESSAGE(11,fprintf(fp,"\t\tPTid2 = HE5_PTattach(ptfid, \"FixedBuoy Point\");\n");); MESSAGE(11,fprintf(fp,"\t\tThe point ID returned by HE5_PTattach() %d\n",PTid2) ;); } /* ********************************************************************************* * Testing HE5_PTinqdatatype * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTinqdatatype... \n");); MESSAGE(4,printf("\t============================ \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTinqdatatype... \n");); MESSAGE(11,fprintf(fp,"\t============================ \n");); MESSAGE(6,printf("\t\tInquiring datatype information for \"Observations\" \n");); MESSAGE(11,fprintf(fp,"\t\tInquiring datatype information for \"Observations\" \n");); fieldgroup = HE5_HDFE_DATAGROUP; status = HE5_PTinqdatatype(PTid2, "Observations", NULL, fieldgroup, &datatype, &classid, &order, &size); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTinqdatatype();\n");); MESSAGE(8,printf("\t\tThe status returned by HE5_PTinqdatatype() %d\n",status);); MESSAGE(8,printf("\tdatatype: %d \n", (int)datatype);); MESSAGE(8,printf("\tclass ID: %d \n", (int)classid);); MESSAGE(8,printf("\tsize: %d \n", (int)size);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTinqdatatype();\n");); MESSAGE(11,fprintf(fp,"\t\tThe status returned by HE5_PTinqdatatype() %d\n",status) ;); MESSAGE(11,fprintf(fp,"\tdatatype: %d \n", (int)datatype);); MESSAGE(11,fprintf(fp,"\tclass ID: %d \n", (int)classid);); MESSAGE(11,fprintf(fp,"\tsize: %d \n", (int)size);); } fieldgroup = HE5_HDFE_ATTRGROUP; status = HE5_PTinqdatatype(PTid2, NULL, "GlobalAttribute_int", fieldgroup, &datatype, &classid, &order, &size); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTinqdatatype();\n");); MESSAGE(8,printf("\t\tThe status returned by HE5_PTinqdatatype() %d\n",status);); MESSAGE(8,printf("\tdatatype: %d \n", (int)datatype);); MESSAGE(8,printf("\tclass ID: %d \n", (int)classid);); MESSAGE(8,printf("\torder: %d \n", (int)order);); MESSAGE(8,printf("\tsize: %d \n", (int)size);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTinqdatatype();\n");); MESSAGE(11,fprintf(fp,"\t\tThe status returned by HE5_PTinqdatatype() %d\n",status) ;); MESSAGE(11,fprintf(fp,"\tdatatype: %d \n", (int)datatype);); MESSAGE(11,fprintf(fp,"\tclass ID: %d \n", (int)classid);); MESSAGE(11,fprintf(fp,"\torder: %d \n", (int)order);); MESSAGE(11,fprintf(fp,"\tsize: %d \n", (int)size);); } fieldgroup = HE5_HDFE_GRPATTRGROUP; status = HE5_PTinqdatatype(PTid2, NULL, "GroupAttribute", fieldgroup, &datatype, &classid, &order, &size); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTinqdatatype();\n");); MESSAGE(8,printf("\t\tThe status returned by HE5_PTinqdatatype() %d\n",status);); MESSAGE(8,printf("\tdatatype: %d \n", (int)datatype);); MESSAGE(8,printf("\tclass ID: %d \n", (int)classid);); MESSAGE(8,printf("\torder: %d \n", (int)order);); MESSAGE(8,printf("\tsize: %d \n", (int)size);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTinqdatatype();\n");); MESSAGE(11,fprintf(fp,"\t\tThe status returned by HE5_PTinqdatatype() %d\n",status) ;); MESSAGE(11,fprintf(fp,"\tdatatype: %d \n", (int)datatype);); MESSAGE(11,fprintf(fp,"\tclass ID: %d \n", (int)classid);); MESSAGE(11,fprintf(fp,"\torder: %d \n", (int)order);); MESSAGE(11,fprintf(fp,"\tsize: %d \n", (int)size);); } fieldgroup = HE5_HDFE_LOCATTRGROUP; status = HE5_PTinqdatatype(PTid2, "Observations", "LocalAttribute", fieldgroup, &datatype, &classid, &order, &size); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTinqdatatype();\n");); MESSAGE(8,printf("\t\tThe status returned by HE5_PTinqdatatype() %d\n",status);); MESSAGE(8,printf("\tdatatype: %d \n", (int)datatype);); MESSAGE(8,printf("\tclass ID: %d \n", (int)classid);); MESSAGE(8,printf("\torder: %d \n", (int)order);); MESSAGE(8,printf("\tsize: %d \n", (int)size);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTinqdatatype();\n");); MESSAGE(11,fprintf(fp,"\t\tThe status returned by HE5_PTinqdatatype() %d\n",status) ;); MESSAGE(11,fprintf(fp,"\tdatatype: %d \n", (int)datatype);); MESSAGE(11,fprintf(fp,"\tclass ID: %d \n", (int)classid);); MESSAGE(11,fprintf(fp,"\torder: %d \n", (int)order);); MESSAGE(11,fprintf(fp,"\tsize: %d \n", (int)size);); } /* ********************************************************************************* * Testing HE5_PTdetach * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_PTdetach... \n");); MESSAGE(4,printf("\t======================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTdetach... \n");); MESSAGE(11,fprintf(fp,"\t======================= \n");); MESSAGE(6,printf("\t\tDetaching from the point \"FixedBuoy Point\" \n");); MESSAGE(11,fprintf(fp,"\t\tDetaching from the point \"FixedBuoy Point\" \n");); status = HE5_PTdetach(PTid2); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PTdetach();\n");); MESSAGE(8,printf("\t\tStatus returned by HE5_PTdetach() %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PTdetach();\n");); MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_PTdetach() %d\n",status);); } /* ********************************************************************************* * Testing HE5_PTclose * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_PTclose... \n");); MESSAGE(4,printf("\t====================== \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PTclose... \n");); MESSAGE(11,fprintf(fp,"\t====================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tClosing the file \"SimplePoint.he5\" \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tClosing the file \"SimplePoint.he5\" \n");); status = HE5_PTclose(ptfid); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\t\tSuccessfully clossed the SimplePoint.he5 file \n");); MESSAGE(11,fprintf(fp,"\t\tSuccessfully clossed the SimplePoint.he5 file \n");); MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t ........... End of Testing. \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t ............. End of Testing. \n");); } if (errcnt == 0) { MESSAGE(11,printf("\n");); MESSAGE(11,printf("\n");); MESSAGE(11,printf("\t\t A L L T E S T S P A S S E D \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t A L L T E S T S P A S S E D \n");); return_val = 0; } else { MESSAGE(11,printf("\n");); MESSAGE(11,printf("\n");); MESSAGE(11,printf("\t\t%d T E S T S F A I L E D \n",errcnt);); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t%d T E S T S F A I L E D \n",errcnt);); return_val = 1; } MESSAGE(11,fclose(fp);); return return_val; } hdf-eos5-2.0/testdrivers/point/fixedBuoy0.txt000077500000000000000000000002071507520047200212570ustar00rootroot00000000000000Pacific -140.2520148 -10.3024294 891218 P Atlantic -54.8270879 43.1362228 900228 A Indian 71.7147412 7.4254709 900912 I hdf-eos5-2.0/testdrivers/point/fixedBuoy1.txt000077500000000000000000000012501507520047200212570ustar00rootroot00000000000000 83422000.0 1.1 21.63 P 83555918.7 0.7 24.21 A 83726878.2 2.7 23.83 P 83842994.7 4.3 22.63 P 84013712.3 0.7 20.35 A 84063571.3 2.8 20.84 P 84245234.1 1.7 24.52 I 84251741.0 1.4 20.98 I 84412971.8 3.6 20.41 A 84419483.0 1.8 22.01 P 84452408.0 3.4 23.20 P 84623981.3 4.0 23.91 I 84655020.8 3.2 21.79 A 84736992.5 4.6 23.61 P 84835587.2 3.6 20.38 A 84915081.1 5.1 20.10 P 84970587.0 1.1 24.63 P 85058206.4 1.3 22.98 I 85076367.6 2.7 22.62 P 85111729.5 1.0 22.01 P hdf-eos5-2.0/testdrivers/point/floatBuoy0.txt000077500000000000000000000001211507520047200212600ustar00rootroot00000000000000Pacific 901023 1200 P Atlantic 890419 2550 A Indian 900605 800 I hdf-eos5-2.0/testdrivers/point/floatBuoy1.txt000077500000000000000000000027341507520047200212750ustar00rootroot00000000000000 34532000.0 -56.795451 46.929101 3.5 22.74 A 34655930.8 -51.144523 39.393151 0.3 22.25 A 34761777.4 73.005232 4.068124 3.9 22.60 I 34924857.4 -51.289537 47.272357 0.6 24.23 A 35010197.1 -137.896588 -10.438813 3.1 23.24 P 35113965.3 70.943919 4.989471 3.7 21.05 I 35146430.0 -141.334164 -8.035026 0.9 23.16 P 35180802.9 -51.291848 47.940175 4.6 21.68 A 35286334.7 -141.921518 -9.133087 1.1 20.25 P 35359789.3 -139.960931 -11.797505 1.8 24.37 P 35510873.5 -56.995840 44.141150 3.7 23.12 A 35583198.0 73.083084 10.349487 3.0 24.63 I 35741969.4 -138.607937 -10.352329 4.3 24.05 P 35811504.6 -52.535794 38.967934 1.1 23.50 A 35890062.6 71.995167 6.438556 1.5 23.14 I 36015258.2 -51.100562 39.280490 1.9 20.31 A 36176650.2 -141.603094 -10.410025 2.9 21.33 P 36292709.9 -53.052534 44.477106 2.1 23.65 A 36307577.3 -53.937608 38.710016 5.0 20.06 A 36384294.9 -55.381183 41.246119 4.0 23.34 A 36576747.4 -141.588561 -9.158308 0.5 20.79 P 36725342.2 -51.199441 38.061798 2.4 20.01 A 36758333.4 -138.998487 -8.706307 0.3 22.07 P 36841499.9 72.256089 8.036737 3.9 24.41 I 37021357.5 -139.961167 -11.094212 0.6 23.02 P hdf-eos5-2.0/testdrivers/point/hdfeos5.inc000066400000000000000000000351131507520047200205310ustar00rootroot00000000000000! * ========================================================== ! * File: hdfeos5.inc ! * Author: A. Muslimov, Emergent Technology Services, Inc. ! * Date: March 11, 2002 ! * Purpose: Fortran header file for HDFEOS5 routines ! * ========================================================== ! * Contents: ! * HDFEOS5 data type tags ! * HDFEOS5 logical constants ! * HDFEOS5 file access tags ! * HDFEOS5/GCTP library codes ! * ! * =========================================================== ! HDFEOS5 DATA TYPE TAGS ! ======================= integer HE5T_NATIVE_INT integer HE5T_NATIVE_UINT integer HE5T_NATIVE_SHORT integer HE5T_NATIVE_USHORT integer HE5T_NATIVE_SCHAR integer HE5T_NATIVE_UCHAR integer HE5T_NATIVE_LONG integer HE5T_NATIVE_ULONG integer HE5T_NATIVE_LLONG integer HE5T_NATIVE_ULLONG integer HE5T_NATIVE_FLOAT integer HE5T_NATIVE_REAL integer HE5T_NATIVE_DOUBLE integer HE5T_NATIVE_LDOUBLE integer HE5T_NATIVE_INT8 integer HE5T_NATIVE_UINT8 integer HE5T_NATIVE_INT16 integer HE5T_NATIVE_UINT16 integer HE5T_NATIVE_INT32 integer HE5T_NATIVE_UINT32 integer HE5T_NATIVE_INT64 integer HE5T_NATIVE_UINT64 integer HE5T_NATIVE_B8 integer HE5T_NATIVE_B16 integer HE5T_NATIVE_B32 integer HE5T_NATIVE_B64 integer HE5T_NATIVE_HSIZE integer HE5T_NATIVE_HERR integer HE5T_NATIVE_HBOOL integer HE5T_STD_I8BE integer HE5T_STD_I8LE integer HE5T_STD_I16BE integer HE5T_STD_I16LE integer HE5T_STD_I32BE integer HE5T_STD_I32LE integer HE5T_STD_I64BE integer HE5T_STD_I64LE integer HE5T_STD_U8BE integer HE5T_STD_U8LE integer HE5T_STD_U16BE integer HE5T_STD_U16LE integer HE5T_STD_U32BE integer HE5T_STD_U32LE integer HE5T_STD_U64BE integer HE5T_STD_U64LE integer HE5T_STD_B8BE integer HE5T_STD_B8LE integer HE5T_STD_B16BE integer HE5T_STD_B16LE integer HE5T_STD_B32BE integer HE5T_STD_B32LE integer HE5T_STD_B64BE integer HE5T_STD_B64LE integer HE5T_IEEE_F32BE integer HE5T_IEEE_F32LE integer HE5T_IEEE_F64BE integer HE5T_IEEE_F64LE integer HE5T_NATIVE_CHAR integer HE5T_CHARSTRING parameter(HE5T_NATIVE_INT = 0) parameter(HE5T_NATIVE_UINT = 1) parameter(HE5T_NATIVE_SHORT = 2) parameter(HE5T_NATIVE_USHORT = 3) parameter(HE5T_NATIVE_SCHAR = 4) parameter(HE5T_NATIVE_UCHAR = 5) parameter(HE5T_NATIVE_LONG = 6) parameter(HE5T_NATIVE_ULONG = 7) parameter(HE5T_NATIVE_LLONG = 8) parameter(HE5T_NATIVE_ULLONG = 9) parameter(HE5T_NATIVE_FLOAT =10) parameter(HE5T_NATIVE_REAL =10) parameter(HE5T_NATIVE_DOUBLE =11) parameter(HE5T_NATIVE_LDOUBLE =12) parameter(HE5T_NATIVE_INT8 =13) parameter(HE5T_NATIVE_UINT8 =14) parameter(HE5T_NATIVE_INT16 =15) parameter(HE5T_NATIVE_UINT16 =16) parameter(HE5T_NATIVE_INT32 =17) parameter(HE5T_NATIVE_UINT32 =18) parameter(HE5T_NATIVE_INT64 =19) parameter(HE5T_NATIVE_UINT64 =20) parameter(HE5T_NATIVE_B8 =21) parameter(HE5T_NATIVE_B16 =22) parameter(HE5T_NATIVE_B32 =23) parameter(HE5T_NATIVE_B64 =24) parameter(HE5T_NATIVE_HSIZE =25) parameter(HE5T_NATIVE_HERR =26) parameter(HE5T_NATIVE_HBOOL =27) parameter(HE5T_STD_I8BE =28) parameter(HE5T_STD_I8LE =29) parameter(HE5T_STD_I16BE =30) parameter(HE5T_STD_I16LE =31) parameter(HE5T_STD_I32BE =32) parameter(HE5T_STD_I32LE =33) parameter(HE5T_STD_I64BE =34) parameter(HE5T_STD_I64LE =35) parameter(HE5T_STD_U8BE =36) parameter(HE5T_STD_U8LE =37) parameter(HE5T_STD_U16BE =38) parameter(HE5T_STD_U16LE =39) parameter(HE5T_STD_U32BE =40) parameter(HE5T_STD_U32LE =41) parameter(HE5T_STD_U64BE =42) parameter(HE5T_STD_U64LE =43) parameter(HE5T_STD_B8BE =44) parameter(HE5T_STD_B8LE =45) parameter(HE5T_STD_B16BE =46) parameter(HE5T_STD_B16LE =47) parameter(HE5T_STD_B32BE =48) parameter(HE5T_STD_B32LE =49) parameter(HE5T_STD_B64BE =50) parameter(HE5T_STD_B64LE =51) parameter(HE5T_IEEE_F32BE =52) parameter(HE5T_IEEE_F32LE =53) parameter(HE5T_IEEE_F64BE =54) parameter(HE5T_IEEE_F64LE =55) parameter(HE5T_NATIVE_CHAR =56) parameter(HE5T_CHARSTRING =57) integer HE5S_UNLIMITED_F parameter(HE5S_UNLIMITED_F = -1) ! HDFEOS5 FILE ACCESS TAGS ! ======================== integer HE5F_ACC_RDWR integer HE5F_ACC_RDONLY integer HE5F_ACC_TRUNC parameter(HE5F_ACC_RDWR = 100) parameter(HE5F_ACC_RDONLY = 101) parameter(HE5F_ACC_TRUNC = 102) ! TOOLKIT FILE ACCESS TAGS ! ======================== integer HDF4_ACC_RDONLY integer HDF4_ACC_RDWR integer HDF4_ACC_CREATE integer HDF5_ACC_RDONLY integer HDF5_ACC_RDWR integer HDF5_ACC_CREATE parameter(HDF4_ACC_RDONLY = 1) parameter(HDF4_ACC_RDWR = 3) parameter(HDF4_ACC_CREATE = 4) parameter(HDF5_ACC_RDONLY = 11) parameter(HDF5_ACC_RDWR = 13) parameter(HDF5_ACC_CREATE = 14) ! HDFEOS5 MERGE CODES ! ==================== integer HE5_HDFE_NOMERGE integer HE5_HDFE_AUTOMERGE parameter(HE5_HDFE_NOMERGE =0) parameter(HE5_HDFE_AUTOMERGE =1) ! HDFEOS5 XXentries CODES ! ======================= integer HE5_HDFE_NENTDIM integer HE5_HDFE_NENTMAP integer HE5_HDFE_NENTIMAP integer HE5_HDFE_NENTGFLD integer HE5_HDFE_NENTDFLD parameter(HE5_HDFE_NENTDIM =0) parameter(HE5_HDFE_NENTMAP =1) parameter(HE5_HDFE_NENTIMAP =2) parameter(HE5_HDFE_NENTGFLD =3) parameter(HE5_HDFE_NENTDFLD =4) ! HDFEOS5 ANGLE CONVERSION CODES ! ============================== integer HE5_HDFE_RAD_DEG integer HE5_HDFE_DEG_RAD integer HE5_HDFE_DMS_DEG integer HE5_HDFE_DEG_DMS integer HE5_HDFE_RAD_DMS integer HE5_HDFE_DMS_RAD parameter(HE5_HDFE_RAD_DEG =0) parameter(HE5_HDFE_DEG_RAD =1) parameter(HE5_HDFE_DMS_DEG =2) parameter(HE5_HDFE_DEG_DMS =3) parameter(HE5_HDFE_RAD_DMS =4) parameter(HE5_HDFE_DMS_RAD =5) ! HDFEOS5 SWATH SUBSET CODES ! ========================== integer HE5_HDFE_MIDPOINT integer HE5_HDFE_ENDPOINT integer HE5_HDFE_ANYPOINT integer HE5_HDFE_INTERNAL integer HE5_HDFE_EXTERNAL integer HE5_HDFE_NOPREVSUB parameter(HE5_HDFE_MIDPOINT =0) parameter(HE5_HDFE_ENDPOINT =1) parameter(HE5_HDFE_ANYPOINT =2) parameter(HE5_HDFE_INTERNAL =0) parameter(HE5_HDFE_EXTERNAL =1) parameter(HE5_HDFE_NOPREVSUB =-1) ! HDFEOS5 GRID ORIGIN CODES ! ========================= integer HE5_HDFE_GD_UL integer HE5_HDFE_GD_UR integer HE5_HDFE_GD_LL integer HE5_HDFE_GD_LR parameter(HE5_HDFE_GD_UL =0) parameter(HE5_HDFE_GD_UR =1) parameter(HE5_HDFE_GD_LL =2) parameter(HE5_HDFE_GD_LR =3) ! HDFEOS5 PIXEL REGISTRATION CODES ! ================================ integer HE5_HDFE_CENTER integer HE5_HDFE_CORNER parameter(HE5_HDFE_CENTER =0) parameter(HE5_HDFE_CORNER =1) ! HDFEOS5 GCTP PROJECTION CODES ! ============================= integer HE5_GCTP_GEO integer HE5_GCTP_UTM integer HE5_GCTP_SPCS integer HE5_GCTP_ALBERS integer HE5_GCTP_LAMCC integer HE5_GCTP_MERCAT integer HE5_GCTP_PS integer HE5_GCTP_POLYC integer HE5_GCTP_EQUIDC integer HE5_GCTP_TM integer HE5_GCTP_STEREO integer HE5_GCTP_LAMAZ integer HE5_GCTP_AZMEQD integer HE5_GCTP_GNOMON integer HE5_GCTP_ORTHO integer HE5_GCTP_GVNSP integer HE5_GCTP_SNSOID integer HE5_GCTP_EQRECT integer HE5_GCTP_MILLER integer HE5_GCTP_VGRINT integer HE5_GCTP_HOM integer HE5_GCTP_ROBIN integer HE5_GCTP_SOM integer HE5_GCTP_ALASKA integer HE5_GCTP_GOOD integer HE5_GCTP_MOLL integer HE5_GCTP_IMOLL integer HE5_GCTP_HAMMER integer HE5_GCTP_WAGIV integer HE5_GCTP_WAGVII integer HE5_GCTP_OBLEQA integer HE5_GCTP_ISINUS parameter(HE5_GCTP_GEO =0) parameter(HE5_GCTP_UTM =1) parameter(HE5_GCTP_SPCS =2) parameter(HE5_GCTP_ALBERS =3) parameter(HE5_GCTP_LAMCC =4) parameter(HE5_GCTP_MERCAT =5) parameter(HE5_GCTP_PS =6) parameter(HE5_GCTP_POLYC =7) parameter(HE5_GCTP_EQUIDC =8) parameter(HE5_GCTP_TM =9) parameter(HE5_GCTP_STEREO =10) parameter(HE5_GCTP_LAMAZ =11) parameter(HE5_GCTP_AZMEQD =12) parameter(HE5_GCTP_GNOMON =13) parameter(HE5_GCTP_ORTHO =14) parameter(HE5_GCTP_GVNSP =15) parameter(HE5_GCTP_SNSOID =16) parameter(HE5_GCTP_EQRECT =17) parameter(HE5_GCTP_MILLER =18) parameter(HE5_GCTP_VGRINT =19) parameter(HE5_GCTP_HOM =20) parameter(HE5_GCTP_ROBIN =21) parameter(HE5_GCTP_SOM =22) parameter(HE5_GCTP_ALASKA =23) parameter(HE5_GCTP_GOOD =24) parameter(HE5_GCTP_MOLL =25) parameter(HE5_GCTP_IMOLL =26) parameter(HE5_GCTP_HAMMER =27) parameter(HE5_GCTP_WAGIV =28) parameter(HE5_GCTP_WAGVII =29) parameter(HE5_GCTP_OBLEQA =30) parameter(HE5_GCTP_ISINUS =99) ! HDFEOS5 TILIND/COMPRESSION CODES ! ================================ integer HE5_HDFE_NOTILE integer HE5_HDFE_TILE integer HE5_HDFE_COMP_NONE integer HE5_HDFE_COMP_RLE integer HE5_HDFE_COMP_NBIT integer HE5_HDFE_COMP_SKPHUFF integer HE5_HDFE_COMP_DEFLATE integer HE5_HDFE_COMP_SZIP_CHIP integer HE5_HDFE_COMP_SZIP_K13 integer HE5_HDFE_COMP_SZIP_EC integer HE5_HDFE_COMP_SZIP_NN integer HE5_HDFE_COMP_SZIP_K13orEC integer HE5_HDFE_COMP_SZIP_K13orNN integer HE5_HDFE_COMP_SHUF_DEFLATE integer HE5_HDFE_COMP_SHUF_SZIP_CHIP integer HE5_HDFE_COMP_SHUF_SZIP_K13 integer HE5_HDFE_COMP_SHUF_SZIP_EC integer HE5_HDFE_COMP_SHUF_SZIP_NN integer HE5_HDFE_COMP_SHUF_SZIP_K13orEC integer HE5_HDFE_COMP_SHUF_SZIP_K13orNN parameter(HE5_HDFE_NOTILE =0) parameter(HE5_HDFE_TILE =1) parameter(HE5_HDFE_COMP_NONE =0) parameter(HE5_HDFE_COMP_RLE =1) parameter(HE5_HDFE_COMP_NBIT =2) parameter(HE5_HDFE_COMP_SKPHUFF =3) parameter(HE5_HDFE_COMP_DEFLATE =4) parameter(HE5_HDFE_COMP_SZIP_CHIP =5) parameter(HE5_HDFE_COMP_SZIP_K13 =6) parameter(HE5_HDFE_COMP_SZIP_EC =7) parameter(HE5_HDFE_COMP_SZIP_NN =8) parameter(HE5_HDFE_COMP_SZIP_K13orEC =9) parameter(HE5_HDFE_COMP_SZIP_K13orNN =10) parameter(HE5_HDFE_COMP_SHUF_DEFLATE =11) parameter(HE5_HDFE_COMP_SHUF_SZIP_CHIP =12) parameter(HE5_HDFE_COMP_SHUF_SZIP_K13 =13) parameter(HE5_HDFE_COMP_SHUF_SZIP_EC =14) parameter(HE5_HDFE_COMP_SHUF_SZIP_NN =15) parameter(HE5_HDFE_COMP_SHUF_SZIP_K13orEC =16) parameter(HE5_HDFE_COMP_SHUF_SZIP_K13orNN =17) ! HDFEOS5 GROUP CODES ! =================== integer HE5_HDFE_GEOGROUP integer HE5_HDFE_DATAGROUP integer HE5_HDFE_ATTRGROUP integer HE5_HDFE_GRPATTRGROUP integer HE5_HDFE_LOCATTRGROUP integer HE5_HDFE_PROFGROUP integer HE5_HDFE_PROFGRPATTRGROUP integer HE5_HDFE_GEOGRPATTRGROUP parameter(HE5_HDFE_GEOGROUP =0) parameter(HE5_HDFE_DATAGROUP =1) parameter(HE5_HDFE_ATTRGROUP =2) parameter(HE5_HDFE_GRPATTRGROUP =3) parameter(HE5_HDFE_LOCATTRGROUP =4) parameter(HE5_HDFE_PROFGROUP =5) parameter(HE5_HDFE_PROFGRPATTRGROUP =6) parameter(HE5_HDFE_GEOGRPATTRGROUP =7) hdf-eos5-2.0/testdrivers/point/hdfeos5_64.inc000066400000000000000000000010151507520047200210340ustar00rootroot00000000000000! * ========================================================== ! * File: hdfeos5_64.inc ! * Author: A. Muslimov, Emergent Technology Services, Inc. ! * Date: March 19, 2002 ! * Purpose: Fortran header file for HDFEOS5 routines on 64 ! * bit platforms ! * ========================================================== ! * Contents: ! * ! * ! * =========================================================== integer*8 HE5S_UNLIMITED_F_64 parameter(HE5S_UNLIMITED_F_64 = -1) hdf-eos5-2.0/testdrivers/point/simple.txt000077500000000000000000000011661507520047200205370ustar00rootroot00000000000000 46353400.0 2.98 3.99 2.63 1.41 CO 46572420.7 3.99 4.52 2.35 2.52 CO2 46853103.3 2.11 3.10 4.81 1.83 CO 47485493.4 3.39 3.02 3.09 3.90 CO2 48066418.5 2.06 4.49 1.67 1.74 O3 48474414.6 1.06 4.63 4.44 3.33 CO2 48866282.4 2.18 2.02 1.41 1.00 O3 49388188.2 3.73 2.00 2.30 1.46 O3 49858070.5 2.97 3.75 2.33 5.02 NOx 50370437.1 4.38 3.70 1.96 3.11 NOx 50515373.3 0.24 1.91 4.33 1.49 CO 51257471.8 3.62 1.40 0.48 2.32 CO2 51708197.8 3.53 3.16 2.01 1.56 O3 51859454.7 0.62 0.76 2.06 4.01 O3 52433289.8 1.68 1.35 1.71 4.06 O3 hdf-eos5-2.0/testdrivers/point/testpoint32.f000077500000000000000000003363341507520047200210620ustar00rootroot00000000000000 c---------------------------------------------------------------------------- c FILE: testpoint32.f c PURPOSE: To test HDF-EOS5 Point interface c---------------------------------------------------------------------------- program he5_pttestpoint32 implicit none include 'hdfeos5.inc' integer status integer ptfid integer ptid1, ptid2, ptid3 integer ptid integer rank_1(3) integer rank_2(5) integer rank_3(4) integer rank_4(4) integer rank_5(6) integer dtype_1(3) integer dtype_2(5) integer dtype_3(4) integer dtype_4(4) integer dtype_5(6) integer array_1(3) integer array_2(5) integer array_3(4) integer array_4(4) integer array_5(6) integer i, zero integer rank integer datatype integer attr integer nflds integer level integer arr_rank integer dtype(3) integer nrecs integer nlevels integer attr1(5) integer attr2(5) integer ntype integer classid integer order integer fieldgroup integer he5_ptopen integer he5_ptcreate integer he5_ptdetach integer he5_ptclose integer he5_ptattach integer he5_ptdeflevel integer he5_ptdeflinkage integer he5_ptwritelevel integer he5_ptfort2c integer he5_ptwrbckptr integer he5_ptwrfwdptr integer he5_ptwriteattr integer he5_ptreadlevel integer he5_ptlevelinfo integer he5_ptnrecs integer he5_ptnlevels integer he5_ptnfields integer he5_ptc2fort integer he5_ptinqattrs integer he5_ptreadattr integer he5_ptupdatelevel integer he5_ptwritegrpattr integer he5_ptwritelocattr integer he5_ptinqgrpattrs integer he5_ptinqlocattrs integer he5_ptattrinfo integer he5_ptgrpattrinfo integer he5_ptlocattrinfo integer he5_ptreadgrpattr integer he5_ptreadlocattr integer he5_ptinqdatatype integer*4 dims_1(3,1) integer*4 dims_2(5,1) integer*4 dims_3(4,1) integer*4 dims_4(4,1) integer*4 dims_5(6,1) integer*4 n integer*4 count(1) integer*4 dimens(2) integer*4 fortcount(8) integer*4 date_tt integer*4 date(3) integer*4 date4_tt integer*4 date4(3) integer*4 wgt_tt integer*4 wgt(3) integer*4 datasize integer*4 rank_tt(3) integer*4 offset_tt(3) integer*4 dtype_tt(3) integer*4 dim_sizes_tt(3) integer*4 nattr integer*4 strbufsize integer*4 recs(32) integer*4 nrec integer*4 sz integer*4 size real*4 flt real*4 concentration_tt(4) real*4 conc(15,4) real*4 outconc(4,15) real*4 rain_tt real*4 rain(20) real*4 temp_tt real*4 temp(20) real*4 rain5_tt real*4 rain5(25) real*4 temp5_tt real*4 temp5(25) real*4 con(4,15) real*4 outcon(15,4) real*4 conc_tt(4) real*8 time_tt real*8 time(15) real*8 lon_tt real*8 lon(3) real*8 lat_tt real*8 lat(3) real*8 time3_tt real*8 time3(20) real*8 time5_tt real*8 time5(25) real*8 lon5_tt real*8 lon5(25) real*8 lat5_tt real*8 lat5(25) character*240 fieldlist1 character*240 fieldlist2 character*240 fieldlist3 character*240 fieldlist4 character*240 fieldlist5 character*80 levelname character*20 parent character*20 child character*20 linkfield character*80 fieldname character*80 attrname character*8 spc_tt character*8 spc(15) character*8 desc_tt character*8 desc(3) character*8 id_tt character*8 id(3) character*8 id3_tt character*8 id3(20) character*8 desc4_tt character*8 desc4(3) character*8 id4_tt character*8 id4(3) character*8 id5_tt character*8 id5(25) character*80 fieldname3(3) character*240 fieldlist character*240 attrlist character*8 spec(15) character*1 null_char_0 open(unit=1, file="testpoint32_f.txtout", status = "UNKNOWN") write(*,*)' ' write(1,*)' ' write(*,*)'Testing he5_ptath FORTRAN 77 interface' write(*,*)'======================================' write(1,*)'Testing he5_ptath FORTRAN 77 interface' write(1,*)'======================================' write(*,*)' ' write(1,*)' ' zero=0 c Test Case -- he5_ptopen c write(*,*)'Testing he5_ptopen ' write(*,*)'=====================' write(1,*)'Testing he5_ptopen ' write(1,*)'=====================' ptfid = he5_ptopen('point.he5',HE5F_ACC_TRUNC) if (ptfid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptfid= he5_ptopen("point.he5",HE5F_ACC_TRUNC)' write(*,*)' Value returned by he5_ptopen ', ptfid write(1,*)' ptfid= he5_ptopen("point.he5",HE5F_ACC_TRUNC)' write(1,*)' Value returned by he5_ptopen ', ptfid endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptcreate c write(*,*)'Testing he5_ptcreate ' write(*,*)'=====================' write(1,*)'Testing he5_ptcreate ' write(1,*)'=====================' ptid1 = he5_ptcreate(ptfid, "Simple Point") if (ptid1 .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptid1 = he5_ptcreate(ptfid, "Simple Point")' write(*,*)' Value returned by he5_ptcreate ', ptid1 write(1,*)' ptid1 = he5_ptcreate(ptfid, "Simple Point")' write(1,*)' Value returned by he5_ptcreate ', ptid1 endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptcreate c write(*,*)'Testing he5_ptcreate ' write(*,*)'=====================' write(1,*)'Testing he5_ptcreate ' write(1,*)'=====================' ptid2 = he5_ptcreate(ptfid, "FixedBuoy Point") if (ptid2 .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptid2 = he5_ptcreate(ptfid, "FixedBuoy Point")' write(*,*)' Value returned by he5_ptcreate ', ptid2 write(1,*)' ptid2 = he5_ptcreate(ptfid, "FixedBuoy Point")' write(1,*)' Value returned by he5_ptcreate ', ptid2 endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptcreate c write(*,*)'Testing he5_ptcreate ' write(*,*)'=====================' write(1,*)'Testing he5_ptcreate ' write(1,*)'=====================' ptid3 = he5_ptcreate(ptfid, "FloatBuoy Point") if (ptid3 .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptid3 = he5_ptcreate(ptfid, "FloatBuoy Point")' write(*,*)' Value returned by he5_ptcreate ', ptid3 write(1,*)' ptid3 = he5_ptcreate(ptfid, "FloatBuoy Point")' write(1,*)' Value returned by he5_ptcreate ', ptid3 endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptdetach c write(1,27) write(*,*)'Testing he5_ptdetach ' write(*,*)'=====================' write(1,*)'Testing he5_ptdetach ' write(1,*)'=====================' status = he5_ptdetach(ptid1) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdetach(ptid1)' write(*,*)' Value returned by he5_ptdetach ', status write(1,*)' status = he5_ptdetach(ptid1)' write(1,*)' Value returned by he5_ptdetach ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptdetach c write(1,27) write(*,*)'Testing he5_ptdetach ' write(*,*)'=====================' write(1,*)'Testing he5_ptdetach ' write(1,*)'=====================' status = he5_ptdetach(ptid2) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdetach(ptid2)' write(*,*)' Value returned by he5_ptdetach ', status write(1,*)' status = he5_ptdetach(ptid2)' write(1,*)' Value returned by he5_ptdetach ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptdetach c write(1,27) write(*,*)'Testing he5_ptdetach ' write(*,*)'=====================' write(1,*)'Testing he5_ptdetach ' write(1,*)'=====================' status = he5_ptdetach(ptid3) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdetach(ptid3)' write(*,*)' Value returned by he5_ptdetach ', status write(1,*)' status = he5_ptdetach(ptid3)' write(1,*)' Value returned by he5_ptdetach ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptclose c write(*,*)'Testing he5_ptclose ' write(*,*)'=====================' write(1,*)'Testing he5_ptclose ' write(1,*)'=====================' status = he5_ptclose(ptfid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptclose(ptfid)' write(*,*)' Value returned by he5_ptclose ', status write(1,*)' status = he5_ptclose(ptfid)' write(1,*)' Value returned by he5_ptclose ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptopen c write(*,*)'Testing he5_ptopen ' write(*,*)'=====================' write(1,*)'Testing he5_ptopen ' write(1,*)'=====================' ptfid = he5_ptopen('point.he5',HE5F_ACC_RDWR) if (ptfid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptfid= he5_ptopen("point.he5",HE5F_ACC_RDWR)' write(*,*)' Value returned by he5_ptopen ', ptfid write(1,*)' ptfid= he5_ptopen("point.he5",HE5F_ACC_RDWR)' write(1,*)' Value returned by he5_ptopen ', ptfid endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptattach c write(1,27) write(*,*)'Testing he5_ptattach ' write(*,*)'=====================' write(1,*)'Testing he5_ptattach ' write(1,*)'=====================' ptid = he5_ptattach(ptfid, "Simple Point") if (ptid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptid = he5_ptattach(ptfid, "Simple Point")' write(*,*)' Value returned by he5_ptattach ', ptid write(1,*)' ptid = he5_ptattach(ptfid, "Simple Point")' write(1,*)' Value returned by he5_ptattach ', ptid endif write(*,*)' ' write(1,*)' ' c Populate input information structure c ------------------------------------ levelname = 'Sensor' rank_1(1) = 1 rank_1(2) = 1 rank_1(3) = 1 fieldlist1 = 'Time,Concentration,Species' dtype_1(1) = HE5T_NATIVE_DOUBLE dtype_1(2) = HE5T_NATIVE_FLOAT dtype_1(3) = HE5T_NATIVE_CHAR array_1(1) = 0 array_1(2) = 1 array_1(3) = 1 dims_1(1,1) = 1 dims_1(2,1) = 4 dims_1(3,1) = 8 c Test Case -- he5_ptdeflevel c write(1,27) write(*,*)'Testing he5_ptdeflevel ' write(*,*)'=====================' write(1,*)'Testing he5_ptdeflevel ' write(1,*)'=====================' status = he5_ptdeflevel(ptid, levelname, rank_1, fieldlist1, 1dims_1, dtype_1, array_1) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdeflevel(ptid, levelname, rank_1' write(*,*)' fieldlist1,dims_1, dtype_1, array_1)' write(*,*)' Value returned by he5_ptdeflevel ', status write(1,*)' status = he5_ptdeflevel(ptid, levelname, rank_1' write(1,*)' fieldlist1,dims_1, dtype_1, array_1)' write(1,*)' Value returned by he5_ptdeflevel ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptdetach c write(1,27) write(*,*)'Testing he5_ptdetach ' write(*,*)'=====================' write(1,*)'Testing he5_ptdetach ' write(1,*)'=====================' status = he5_ptdetach(ptid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdetach(ptid)' write(*,*)' Value returned by he5_ptdetach ', status write(1,*)' status = he5_ptdetach(ptid)' write(1,*)' Value returned by he5_ptdetach ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptattach c write(1,27) write(*,*)'Testing he5_ptattach ' write(*,*)'=====================' write(1,*)'Testing he5_ptattach ' write(1,*)'=====================' ptid = he5_ptattach(ptfid, "FixedBuoy Point") if (ptid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptid = he5_ptattach(ptfid, "FixedBuoy Point")' write(*,*)' Value returned by he5_ptattach ', ptid write(1,*)' ptid = he5_ptattach(ptfid, "FixedBuoy Point")' write(1,*)' Value returned by he5_ptattach ', ptid endif write(*,*)' ' write(1,*)' ' c Populate input information structure c ------------------------------------ levelname = 'Desc-Loc' rank_2(1) = 1 rank_2(2) = 1 rank_2(3) = 1 rank_2(4) = 1 rank_2(5) = 1 fieldlist2 = 'Label,Longitude,Latitude,DeployDate,ID' dtype_2(1) = HE5T_NATIVE_CHAR dtype_2(2) = HE5T_NATIVE_DOUBLE dtype_2(3) = HE5T_NATIVE_DOUBLE dtype_2(4) = HE5T_NATIVE_INT dtype_2(5) = HE5T_NATIVE_CHAR array_2(1) = 1 array_2(2) = 0 array_2(3) = 0 array_2(4) = 0 array_2(5) = 1 dims_2(1,1) = 8 dims_2(2,1) = 1 dims_2(3,1) = 1 dims_2(4,1) = 1 dims_2(5,1) = 8 c Test Case -- he5_ptdeflevel c write(1,27) write(*,*)'Testing he5_ptdeflevel ' write(*,*)'=====================' write(1,*)'Testing he5_ptdeflevel ' write(1,*)'=====================' status = he5_ptdeflevel(ptid, levelname, rank_2, fieldlist2, 1dims_2, dtype_2, array_2) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdeflevel(ptid, levelname, rank_2' write(*,*)' fieldlist2,dims_2, dtype_2, array_2)' write(*,*)' Value returned by he5_ptdeflevel ', status write(1,*)' status = he5_ptdeflevel(ptid, levelname, rank_2' write(1,*)' fieldlist2,dims_2, dtype_2, array_2)' write(1,*)' Value returned by he5_ptdeflevel ', status endif write(*,*)' ' write(1,*)' ' c Populate input information structure c ------------------------------------ levelname = 'Observations' rank_3(1) = 1 rank_3(2) = 1 rank_3(3) = 1 rank_3(4) = 1 fieldlist3 = 'Time,Rainfall,Temperature,ID' dtype_3(1) = HE5T_NATIVE_DOUBLE dtype_3(2) = HE5T_NATIVE_FLOAT dtype_3(3) = HE5T_NATIVE_FLOAT dtype_3(4) = HE5T_NATIVE_CHAR array_3(1) = 0 array_3(2) = 0 array_3(3) = 0 array_3(4) = 1 dims_3(1,1) = 1 dims_3(2,1) = 1 dims_3(3,1) = 1 dims_3(4,1) = 8 c Test Case -- he5_ptdeflevel c write(1,27) write(*,*)'Testing he5_ptdeflevel ' write(*,*)'======================' write(1,*)'Testing he5_ptdeflevel ' write(1,*)'======================' status = he5_ptdeflevel(ptid, levelname, rank_3, fieldlist3, 1dims_3, dtype_3, array_3) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdeflevel(ptid, levelname, rank_3' write(*,*)' fieldlist3,dims_3, dtype_3, array_3)' write(*,*)' Value returned by he5_ptdeflevel ', status write(1,*)' status = he5_ptdeflevel(ptid, levelname, rank_3' write(1,*)' fieldlist3,dims_3, dtype_3, array_3)' write(1,*)' Value returned by he5_ptdeflevel ', status endif write(*,*)' ' write(1,*)' ' parent = 'Desc-Loc' child = 'Observations' linkfield = 'ID' c Test Case -- he5_ptdeflinkage c write(*,*)'Testing he5_ptdeflinkage ' write(*,*)'========================' write(1,*)'Testing he5_ptdeflinkage ' write(1,*)'========================' status = he5_ptdeflinkage(ptid, parent, child, linkfield) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdeflinkage(ptid, parent, child,' write(*,*)' linkfield)' write(*,*)' Value returned by he5_ptdeflinkage ', status write(1,*)' status = he5_ptdeflinkage(ptid, parent, child,' write(1,*)' linkfield)' write(1,*)' Value returned by he5_ptdeflinkage ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptdetach c write(1,27) write(*,*)'Testing he5_ptdetach ' write(*,*)'=====================' write(1,*)'Testing he5_ptdetach ' write(1,*)'=====================' status = he5_ptdetach(ptid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdetach(ptid)' write(*,*)' Value returned by he5_ptdetach ', status write(1,*)' status = he5_ptdetach(ptid)' write(1,*)' Value returned by he5_ptdetach ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptattach c write(1,27) write(*,*)'Testing he5_ptattach ' write(*,*)'=====================' write(1,*)'Testing he5_ptattach ' write(1,*)'=====================' ptid = he5_ptattach(ptfid, "FloatBuoy Point") if (ptid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptid = he5_ptattach(ptfid, "FloatBuoy Point")' write(*,*)' Value returned by he5_ptattach ', ptid write(1,*)' ptid = he5_ptattach(ptfid, "FloatBuoy Point")' write(1,*)' Value returned by he5_ptattach ', ptid endif write(*,*)' ' write(1,*)' ' levelname = 'Description' rank_4(1) = 1 rank_4(2) = 1 rank_4(3) = 1 rank_4(4) = 1 fieldlist4 = 'Label,DeployDate,Weight,ID' dtype_4(1) = HE5T_NATIVE_CHAR dtype_4(2) = HE5T_NATIVE_INT dtype_4(3) = HE5T_NATIVE_INT dtype_4(4) = HE5T_NATIVE_CHAR array_4(1) = 1 array_4(2) = 0 array_4(3) = 0 array_4(4) = 1 dims_4(1,1) = 8 dims_4(2,1) = 1 dims_4(3,1) = 1 dims_4(4,1) = 8 c Test Case -- he5_ptdeflevel c write(1,27) write(*,*)'Testing he5_ptdeflevel ' write(*,*)'=====================' write(1,*)'Testing he5_ptdeflevel ' write(1,*)'=====================' status = he5_ptdeflevel(ptid, levelname, rank_4, fieldlist4, 1dims_4, dtype_4, array_4) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdeflevel(ptid, levelname, rank_4' write(*,*)' fieldlist4,dims_4, dtype_4, array_4)' write(*,*)' Value returned by he5_ptdeflevel ', status write(1,*)' status = he5_ptdeflevel(ptid, levelname, rank_4' write(1,*)' fieldlist4,dims_4, dtype_4, array_4)' write(1,*)' Value returned by he5_ptdeflevel ', status endif write(*,*)' ' write(1,*)' ' levelname = 'Measurements' rank_5(1) = 1 rank_5(2) = 1 rank_5(3) = 1 rank_5(4) = 1 rank_5(5) = 1 rank_5(6) = 1 fieldlist5 = 'Time,Longitude,Latitude,Rainfall,Temperature,ID' dtype_5(1) = HE5T_NATIVE_DOUBLE dtype_5(2) = HE5T_NATIVE_DOUBLE dtype_5(3) = HE5T_NATIVE_DOUBLE dtype_5(4) = HE5T_NATIVE_FLOAT dtype_5(5) = HE5T_NATIVE_FLOAT dtype_5(6) = HE5T_NATIVE_CHAR array_5(1) = 0 array_5(2) = 0 array_5(3) = 0 array_5(4) = 0 array_5(5) = 0 array_5(6) = 1 dims_5(1,1) = 1 dims_5(2,1) = 1 dims_5(3,1) = 1 dims_5(4,1) = 1 dims_5(5,1) = 1 dims_5(6,1) = 8 c Test Case -- he5_ptdeflevel c write(1,27) write(*,*)'Testing he5_ptdeflevel ' write(*,*)'=====================' write(1,*)'Testing he5_ptdeflevel ' write(1,*)'=====================' status = he5_ptdeflevel(ptid, levelname, rank_5, fieldlist5, 1dims_5, dtype_5, array_5) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdeflevel(ptid, levelname, rank_5' write(*,*)' fieldlist5,dims_5, dtype_5, array_5)' write(*,*)' Value returned by he5_ptdeflevel ', status write(1,*)' status = he5_ptdeflevel(ptid, levelname, rank_5' write(1,*)' fieldlist5,dims_5, dtype_5, array_5)' write(1,*)' Value returned by he5_ptdeflevel ', status endif write(*,*)' ' write(1,*)' ' parent = 'Description' child = 'Measurements' linkfield = 'ID' c Test Case -- he5_ptdeflinkage c write(*,*)'Testing he5_ptdeflinkage ' write(*,*)'=====================' write(1,*)'Testing he5_ptdeflinkage ' write(1,*)'=====================' status = he5_ptdeflinkage(ptid, parent, child, linkfield) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdeflinkage(ptid, parent, child,' write(*,*)' linkfield)' write(*,*)' Value returned by he5_ptdeflinkage ', status write(1,*)' status = he5_ptdeflinkage(ptid, parent, child,' write(1,*)' linkfield)' write(1,*)' Value returned by he5_ptdeflinkage ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptdetach c write(1,27) write(*,*)'Testing he5_ptdetach ' write(*,*)'=====================' write(1,*)'Testing he5_ptdetach ' write(1,*)'=====================' status = he5_ptdetach(ptid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdetach(ptid)' write(*,*)' Value returned by he5_ptdetach ', status write(1,*)' status = he5_ptdetach(ptid)' write(1,*)' Value returned by he5_ptdetach ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptclose c write(*,*)'Testing he5_ptclose ' write(*,*)'=====================' write(1,*)'Testing he5_ptclose ' write(1,*)'=====================' status = he5_ptclose(ptfid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptclose(ptfid)' write(*,*)' Value returned by he5_ptclose ', status write(1,*)' status = he5_ptclose(ptfid)' write(1,*)' Value returned by he5_ptclose ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptopen c write(*,*)'Testing he5_ptopen ' write(*,*)'=====================' write(1,*)'Testing he5_ptopen ' write(1,*)'=====================' ptfid = he5_ptopen('point.he5',HE5F_ACC_RDWR) if (ptfid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptfid= he5_ptopen("point.he5",HE5F_ACC_RDWR)' write(*,*)' Value returned by he5_ptopen ', ptfid write(1,*)' ptfid= he5_ptopen("point.he5",HE5F_ACC_RDWR)' write(1,*)' Value returned by he5_ptopen ', ptfid endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptattach c write(1,27) write(*,*)'Testing he5_ptattach ' write(*,*)'=====================' write(1,*)'Testing he5_ptattach ' write(1,*)'=====================' ptid = he5_ptattach(ptfid, "Simple Point") if (ptid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptid = he5_ptattach(ptfid, "Simple Point")' write(*,*)' Value returned by he5_ptattach ', ptid write(1,*)' ptid = he5_ptattach(ptfid, "Simple Point")' write(1,*)' Value returned by he5_ptattach ', ptid endif write(*,*)' ' write(1,*)' ' c Read Simple Point c ----------------- open(unit=10, file='simple.txt', status='OLD') n = 0 do 10 i=1,1000 read(10, 110, end=100) time_tt, concentration_tt(1), 1 concentration_tt(2), 2 concentration_tt(3), 3 concentration_tt(4), 4 spc_tt time(i) = time_tt conc(i,1) = concentration_tt(1) conc(i,2) = concentration_tt(2) conc(i,3) = concentration_tt(3) conc(i,4) = concentration_tt(4) spc(i) = spc_tt n = n + 1 10 continue 100 close(unit=10) 110 format(F13.1,F6.2,F6.2,F6.2,F6.2,2X,A8) count(1) = n fieldname = 'Time' datatype = HE5T_NATIVE_DOUBLE c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 0, count, fieldname, 1datatype, time) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,0,count,' write(*,*)' fieldname,datatype, time)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,0,count,' write(1,*)' fieldname,datatype, time)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' c.....Convert array to 'C' order dimens(1) = 15 dimens(2) = 4 rank = 2 datatype = HE5T_NATIVE_FLOAT c Test Case -- he5_ptfort2c c write(1,27) write(*,*)'Testing he5_ptfort2c ' write(*,*)'=====================' write(1,*)'Testing he5_ptfort2c ' write(1,*)'=====================' status = he5_ptfort2c(dimens, rank, datatype, conc, 1outconc) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptfort2c(dimens,rank,datatype,conc,' write(*,*)' outconc)' write(*,*)' Value returned by he5_ptfort2c ', status write(1,*)' status = he5_ptfort2c(dimens,rank,datatype,conc,' write(1,*)' outconc)' write(1,*)' Value returned by he5_ptfort2c ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'Concentration' c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 0, count, fieldname, 1datatype, outconc) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,0,count,' write(*,*)' fieldname,datatype, outconc)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,0,count,' write(1,*)' fieldname,datatype, outconc)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'Species' datatype = HE5T_NATIVE_CHAR status = he5_ptwritelevel(ptid, 0, count, fieldname, 1datatype, spc) write(*,*) 'Status returned by he5_ptwritelevel(): ',status c Test Case -- he5_ptdetach c write(1,27) write(*,*)'Testing he5_ptdetach ' write(*,*)'=====================' write(1,*)'Testing he5_ptdetach ' write(1,*)'=====================' status = he5_ptdetach(ptid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdetach(ptid)' write(*,*)' Value returned by he5_ptdetach ', status write(1,*)' status = he5_ptdetach(ptid)' write(1,*)' Value returned by he5_ptdetach ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptattach c write(1,27) write(*,*)'Testing he5_ptattach ' write(*,*)'=====================' write(1,*)'Testing he5_ptattach ' write(1,*)'=====================' ptid = he5_ptattach(ptfid, "FixedBuoy Point") if (ptid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptid = he5_ptattach(ptfid, "FixedBuoy Point")' write(*,*)' Value returned by he5_ptattach ', ptid write(1,*)' ptid = he5_ptattach(ptfid, "FixedBuoy Point")' write(1,*)' Value returned by he5_ptattach ', ptid endif write(*,*)' ' write(1,*)' ' c Read FixedBuoy Point c -------------------- open(unit=11, file='fixedBuoy0.txt', status='OLD') n = 0 do 20 i=1,1000 read(11, 210, end=200) desc_tt, lon_tt, lat_tt, date_tt, 1id_tt desc(i) = desc_tt lon(i) = lon_tt lat(i) = lat_tt date(i) = date_tt id(i) = id_tt n = n + 1 20 continue 200 close(unit=11) 210 format(A8,F13.7,F13.7,I7,1X,A8) count(1) = n fieldname = 'Label' datatype = HE5T_NATIVE_CHAR c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 0, count, fieldname, 1datatype, desc) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,0,count,' write(*,*)' fieldname,datatype, desc)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,0,count,' write(1,*)' fieldname,datatype, desc)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'Longitude' datatype = HE5T_NATIVE_DOUBLE c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 0, count, fieldname, 1datatype, lon) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,0,count,' write(*,*)' fieldname,datatype, lon)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,0,count,' write(1,*)' fieldname,datatype, lon)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'Latitude' datatype = HE5T_NATIVE_DOUBLE c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 0, count, fieldname, 1datatype, lat) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,0,count,' write(*,*)' fieldname,datatype, lat)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,0,count,' write(1,*)' fieldname,datatype, lat)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'DeployDate' datatype = HE5T_NATIVE_INT c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 0, count, fieldname, 1datatype, date) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,0,count,' write(*,*)' fieldname,datatype, date)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,0,count,' write(1,*)' fieldname,datatype, date)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'ID' datatype = HE5T_NATIVE_CHAR c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 0, count, fieldname, 1datatype, id) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,0,count,' write(*,*)' fieldname,datatype, id)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,0,count,' write(1,*)' fieldname,datatype, id)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' c Read FixedBuoy Point - Level 1 c ------------------------------ open(unit=12, file='fixedBuoy1.txt', status='OLD') n = 0 do 30 i=1,1000 read(12, 310, end=300) time3_tt, rain_tt, temp_tt, id3_tt time3(i) = time3_tt rain(i) = rain_tt temp(i) = temp_tt id3(i) = id3_tt n = n + 1 30 continue 300 close(unit=12) 310 format(F13.2,F8.1,F8.2,3X,A8) count(1) = n fieldname = 'Time' datatype = HE5T_NATIVE_DOUBLE c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 1, count, fieldname, 1datatype, time3) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,1,count,' write(*,*)' fieldname,datatype, time3)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,1,count,' write(1,*)' fieldname,datatype, time3)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'Rainfall' datatype = HE5T_NATIVE_FLOAT c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 1, count, fieldname, 1datatype, rain) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,1,count,' write(*,*)' fieldname,datatype, rain)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,1,count,' write(1,*)' fieldname,datatype, rain)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'Temperature' datatype = HE5T_NATIVE_FLOAT c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 1, count, fieldname, 1datatype, temp) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,1,count,' write(*,*)' fieldname,datatype, temp)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,1,count,' write(1,*)' fieldname,datatype, temp)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'ID' datatype = HE5T_NATIVE_CHAR c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 1, count, fieldname, 1datatype, id3) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,1,count,' write(*,*)' fieldname,datatype, id3)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,1,count,' write(1,*)' fieldname,datatype, id3)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptwrbckptr c write(1,27) write(*,*)'Testing he5_ptwrbckptr ' write(*,*)'=====================' write(1,*)'Testing he5_ptwrbckptr ' write(1,*)'=====================' status = he5_ptwrbckptr(ptid,1) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwrbckptr(ptid,1)' write(*,*)' Value returned by he5_ptwrbckptr ', status write(1,*)' status = he5_ptwrbckptr(ptid,1)' write(1,*)' Value returned by he5_ptwrbckptr ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptwrfwdptr c write(1,27) write(*,*)'Testing he5_ptwrfwdptr ' write(*,*)'=====================' write(1,*)'Testing he5_ptwrfwdptr ' write(1,*)'=====================' status = he5_ptwrfwdptr(ptid,1) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwrfwdptr(ptid,1)' write(*,*)' Value returned by he5_ptwrfwdptr ', status write(1,*)' status = he5_ptwrfwdptr(ptid,1)' write(1,*)' Value returned by he5_ptwrfwdptr ', status endif write(*,*)' ' write(1,*)' ' c Write attributes to "Fixed Buoy Point" c -------------------------------------- attrname = 'GlobalAttribute_int' ntype = HE5T_NATIVE_INT fortcount(1) = 1 attr = 9999 c Test Case -- he5_ptwriteattr c write(1,27) write(*,*)'Testing he5_ptwriteattr ' write(*,*)'=====================' write(1,*)'Testing he5_ptwriteattr ' write(1,*)'=====================' status = he5_ptwriteattr(ptid,attrname,ntype,fortcount, 1attr) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwriteattr(ptid,attrname,' write(*,*)' ntype,fortcount,attr)' write(*,*)' Value returned by he5_ptwriteattr ', status write(1,*)' status = he5_ptwriteattr(ptid,attrname,' write(1,*)' ntype,fortcount,attr)' write(1,*)' Value returned by he5_ptwriteattr ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptdetach c write(1,27) write(*,*)'Testing he5_ptdetach ' write(*,*)'=====================' write(1,*)'Testing he5_ptdetach ' write(1,*)'=====================' status = he5_ptdetach(ptid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdetach(ptid)' write(*,*)' Value returned by he5_ptdetach ', status write(1,*)' status = he5_ptdetach(ptid)' write(1,*)' Value returned by he5_ptdetach ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptattach c write(1,27) write(*,*)'Testing he5_ptattach ' write(*,*)'=====================' write(1,*)'Testing he5_ptattach ' write(1,*)'=====================' ptid = he5_ptattach(ptfid, "FloatBuoy Point") if (ptid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptid = he5_ptattach(ptfid, "FloatBuoy Point")' write(*,*)' Value returned by he5_ptattach ', ptid write(1,*)' ptid = he5_ptattach(ptfid, "FloatBuoy Point")' write(1,*)' Value returned by he5_ptattach ', ptid endif write(*,*)' ' write(1,*)' ' c Read FloatBuoy Point - Level 0 c ------------------------------ open(unit=14, file='floatBuoy0.txt', status='OLD') n = 0 do 40 i=1,1000 read(14, 410, end=400) desc4_tt, date4_tt, wgt_tt, id4_tt desc4(i) = desc4_tt date4(i) = date4_tt wgt(i) = wgt_tt id4(i) = id4_tt n = n + 1 40 continue 400 close(unit=14) 410 format(A8,I8,I7,2X,A8) count(1) = n fieldname = 'Label' datatype = HE5T_NATIVE_CHAR c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 0, count, fieldname, 1datatype, desc4) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,0,count,' write(*,*)' fieldname,datatype, desc4)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,0,count,' write(1,*)' fieldname,datatype, desc4)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'DeployDate' datatype = HE5T_NATIVE_INT c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 0, count, fieldname, 1datatype, date4) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,0,count,' write(*,*)' fieldname,datatype, date4)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,0,count,' write(1,*)' fieldname,datatype, date4)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'Weight' datatype = HE5T_NATIVE_INT c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 0, count, fieldname, 1datatype, wgt) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,0,count,' write(*,*)' fieldname,datatype, wgt)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,0,count,' write(1,*)' fieldname,datatype, wgt)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'ID' datatype = HE5T_NATIVE_CHAR c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 0, count, fieldname, 1datatype, id4) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,0,count,' write(*,*)' fieldname,datatype, id4)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,0,count,' write(1,*)' fieldname,datatype, id4)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' c Read FixedBuoy Point - Level 1 c ------------------------------ open(unit=15, file='floatBuoy1.txt', status='OLD') n = 0 do 50 i=1,1000 read(15, 510, end=500) time5_tt, lon5_tt, lat5_tt, 1rain5_tt,temp5_tt,id5_tt time5(i) = time5_tt lon5(i) = lon5_tt lat5(i) = lat5_tt rain5(i) = rain5_tt temp5(i) = temp5_tt id5(i) = id5_tt n = n + 1 50 continue 500 close(unit=15) 510 format(F13.1,F13.6,F13.6,F8.1,F8.2,3X,A8) count(1) = n fieldname = 'Time' datatype = HE5T_NATIVE_DOUBLE c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 1, count, fieldname, 1datatype, time5) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,1,count,' write(*,*)' fieldname,datatype, time5)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,1,count,' write(1,*)' fieldname,datatype, time5)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'Longitude' datatype = HE5T_NATIVE_DOUBLE c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 1, count, fieldname, 1datatype, lon5) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,1,count,' write(*,*)' fieldname,datatype, lon5)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,1,count,' write(1,*)' fieldname,datatype, lon5)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'Latitude' datatype = HE5T_NATIVE_DOUBLE c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 1, count, fieldname, 1datatype, lat5) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,1,count,' write(*,*)' fieldname,datatype, lat5)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,1,count,' write(1,*)' fieldname,datatype, lat5)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'Rainfall' datatype = HE5T_NATIVE_FLOAT c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 1, count, fieldname, 1datatype, rain5) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,1,count,' write(*,*)' fieldname,datatype, rain5)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,1,count,' write(1,*)' fieldname,datatype, rain5)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'Temperature' datatype = HE5T_NATIVE_FLOAT c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 1, count, fieldname, 1datatype, temp5) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,1,count,' write(*,*)' fieldname,datatype, temp5)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,1,count,' write(1,*)' fieldname,datatype, temp5)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'ID' datatype = HE5T_NATIVE_CHAR c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 1, count, fieldname, 1datatype, id5) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,1,count,' write(*,*)' fieldname,datatype, id5)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,1,count,' write(1,*)' fieldname,datatype, id5)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptwrbckptr c write(*,*)'Testing he5_ptwrbckptr ' write(*,*)'======================' write(1,*)'Testing he5_ptwrbckptr ' write(1,*)'======================' status = he5_ptwrbckptr(ptid,1) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwrbckptr(ptid,1)' write(*,*)' Value returned by he5_ptwrbckptr ', status write(1,*)' status = he5_ptwrbckptr(ptid,1)' write(1,*)' Value returned by he5_ptwrbckptr ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptwrfwdptr c write(*,*)'Testing he5_ptwrfwdptr ' write(*,*)'======================' write(1,*)'Testing he5_ptwrfwdptr ' write(1,*)'======================' status = he5_ptwrfwdptr(ptid,1) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwrfwdptr(ptid,1)' write(*,*)' Value returned by he5_ptwrfwdptr ', status write(1,*)' status = he5_ptwrfwdptr(ptid,1)' write(1,*)' Value returned by he5_ptwrfwdptr ', status endif write(*,*)' ' write(1,*)' ' c Write attributes to "Float Buoy Point" c -------------------------------------- attrname = 'GlobalAttribute_float' ntype = HE5T_NATIVE_FLOAT fortcount(1) = 1 flt = -7.5 c Test Case -- he5_ptwriteattr c write(*,*)'Testing he5_ptwriteattr ' write(*,*)'======================' write(1,*)'Testing he5_ptwriteattr ' write(1,*)'======================' status = he5_ptwriteattr(ptid,attrname, 1ntype,fortcount,flt) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwriteattr(ptid,attrname,' write(*,*)' ntype,fortcount,flt)' write(*,*)' Value returned by he5_ptwriteattr ', status write(1,*)' status = he5_ptwriteattr(ptid,attrname,' write(1,*)' ntype,fortcount,flt)' write(1,*)' Value returned by he5_ptwriteattr ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptdetach c write(1,27) write(*,*)'Testing he5_ptdetach ' write(*,*)'=====================' write(1,*)'Testing he5_ptdetach ' write(1,*)'=====================' status = he5_ptdetach(ptid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdetach(ptid)' write(*,*)' Value returned by he5_ptdetach ', status write(1,*)' status = he5_ptdetach(ptid)' write(1,*)' Value returned by he5_ptdetach ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptclose c write(*,*)'Testing he5_ptclose ' write(*,*)'=====================' write(1,*)'Testing he5_ptclose ' write(1,*)'=====================' status = he5_ptclose(ptfid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptclose(ptfid)' write(*,*)' Value returned by he5_ptclose ', status write(1,*)' status = he5_ptclose(ptfid)' write(1,*)' Value returned by he5_ptclose ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptopen c write(*,*)'Testing he5_ptopen ' write(*,*)'=====================' write(1,*)'Testing he5_ptopen ' write(1,*)'=====================' ptfid = he5_ptopen('point.he5',HE5F_ACC_RDONLY) if (ptfid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptfid= he5_ptopen("point.he5",HE5F_ACC_RDONLY)' write(*,*)' Value returned by he5_ptopen ', ptfid write(1,*)' ptfid= he5_ptopen("point.he5",HE5F_ACC_RDONLY)' write(1,*)' Value returned by he5_ptopen ', ptfid endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptattach c write(1,27) write(*,*)'Testing he5_ptattach ' write(*,*)'=====================' write(1,*)'Testing he5_ptattach ' write(1,*)'=====================' ptid = he5_ptattach(ptfid, "Simple Point") if (ptid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptid = he5_ptattach(ptfid, "Simple Point")' write(*,*)' Value returned by he5_ptattach ', ptid write(1,*)' ptid = he5_ptattach(ptfid, "Simple Point")' write(1,*)' Value returned by he5_ptattach ', ptid endif write(*,*)' ' write(1,*)' ' c Get level information c --------------------- level = 0 c Test Case -- he5_ptlevelinfo c write(*,*)'Testing he5_ptlevelinfo ' write(*,*)'=====================' write(1,*)'Testing he5_ptlevelinfo ' write(1,*)'=====================' status = he5_ptlevelinfo(ptid, level, levelname, rank_tt, 1fieldlist, dim_sizes_tt, datasize, offset_tt, dtype_tt) if (ptfid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status=he5_ptlevelinfo(ptid,level,levelname,' write(*,*)' rank_tt,fieldlist,dim_sizes_tt,' write(*,*)' datasize,offset_tt,dtype_tt)' write(*,*)' Value returned by he5_ptlevelinfo ', status write(1,*)' status=he5_ptlevelinfo(ptid,level,levelname,' write(1,*)' rank_tt,fieldlist,dim_sizes_tt,' write(1,*)' datasize,offset_tt,dtype_tt)' write(1,*)' Value returned by he5_ptlevelinfo ', status endif write(*,*)' ' write(1,*)' ' c Get the number of records in level c ---------------------------------- level = 0 c Test Case -- he5_ptnrecs c write(*,*)'Testing he5_ptnrecs ' write(*,*)'=====================' write(1,*)'Testing he5_ptnrecs ' write(1,*)'=====================' nrecs = he5_ptnrecs(ptid, level) if (nrecs .le. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' nrecs = he5_ptnrecs(ptid, level)' write(*,*)' Value returned by he5_ptnrecs ', nrecs write(1,*)' nrecs = he5_ptnrecs(ptid, level)' write(1,*)' Value returned by he5_ptnrecs ', nrecs endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptnlevels c write(*,*)'Testing he5_ptnlevels ' write(*,*)'=====================' write(1,*)'Testing he5_ptnlevels ' write(1,*)'=====================' nlevels = he5_ptnlevels(ptid) if (nlevels .le. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' nlevels = he5_ptnlevels(ptid)' write(*,*)' Value returned by he5_ptnlevels ', nlevels write(1,*)' nlevels = he5_ptnlevels(ptid)' write(1,*)' Value returned by he5_ptnlevels ', nlevels endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptnfields c write(*,*)'Testing he5_ptnfields ' write(*,*)'=====================' write(1,*)'Testing he5_ptnfields ' write(1,*)'=====================' nflds = he5_ptnfields(ptid, level, fieldlist, strbufsize) if (nflds .le. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' nflds = he5_ptnfields(ptid, level,' write(*,*)' fieldlist, strbufsize)' write(*,*)' Value returned by he5_ptnfields ', nflds write(1,*)' nflds = he5_ptnfields(ptid, level,' write(1,*)' fieldlist, strbufsize)' write(1,*)' Value returned by he5_ptnfields ', nflds endif write(*,*)' ' write(1,*)' ' c Populate input information structure c ------------------------------------ dtype(1) = HE5T_NATIVE_DOUBLE dtype(2) = HE5T_NATIVE_FLOAT dtype(3) = HE5T_NATIVE_CHAR c Read the level data and print out c --------------------------------- fieldname3(1) = 'Time' c Test Case -- he5_ptreadlevel c write(*,*)'Testing he5_ptreadlevel ' write(*,*)'=====================' write(1,*)'Testing he5_ptreadlevel ' write(1,*)'=====================' status = he5_ptreadlevel(ptid, 0, fieldname3(1), 1dtype(1), time) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptreadlevel(ptid, 0, fieldname3(1),' write(*,*)' dtype(1), time)' write(*,*)' Value returned by he5_ptreadlevel ', status write(1,*)' status = he5_ptreadlevel(ptid, 0, fieldname3(1),' write(1,*)' dtype(1), time)' write(1,*)' Value returned by he5_ptreadlevel ', status endif write(*,*)' ' write(1,*)' ' fieldname3(2) = 'Concentration' c Test Case -- he5_ptreadlevel c write(*,*)'Testing he5_ptreadlevel ' write(*,*)'=====================' write(1,*)'Testing he5_ptreadlevel ' write(1,*)'=====================' status = he5_ptreadlevel(ptid, 0, fieldname3(2), 1dtype(2), con) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptreadlevel(ptid, 0, fieldname3(2),' write(*,*)' dtype(2), con)' write(*,*)' Value returned by he5_ptreadlevel ', status write(1,*)' status = he5_ptreadlevel(ptid, 0, fieldname3(2),' write(1,*)' dtype(2), con)' write(1,*)' Value returned by he5_ptreadlevel ', status endif write(*,*)' ' write(1,*)' ' c Convert 'C' array to Fortran order c ---------------------------------- dimens(1) = 15 dimens(2) = 4 arr_rank = 2 datatype = HE5T_NATIVE_FLOAT ccc status = he5_ptc2fort(dimens, arr_rank, datatype, con, ccc 1outcon) ccc write(*,*) 'Status returned by he5_ptc2fort(): ',status c Test Case -- he5_ptc2fort c write(1,27) write(*,*)'Testing he5_ptc2fort ' write(*,*)'=====================' write(1,*)'Testing he5_ptc2fort ' write(1,*)'=====================' status = he5_ptc2fort(dimens, arr_rank, datatype, con, 1outcon) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptc2fort(dimens,arr_rank,' write(*,*)' datatype,con,outcon)' write(*,*)' Value returned by he5_ptc2fort ', status write(1,*)' status = he5_ptc2fort(dimens,arr_rank,' write(1,*)' datatype,con,outcon)' write(1,*)' Value returned by he5_ptc2fort ', status endif write(*,*)' ' write(1,*)' ' fieldname3(3) = 'Species' c Test Case -- he5_ptreadlevel c write(*,*)'Testing he5_ptreadlevel ' write(*,*)'=====================' write(1,*)'Testing he5_ptreadlevel ' write(1,*)'=====================' status = he5_ptreadlevel(ptid, 0, fieldname3(3), 1dtype(3), spec) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptreadlevel(ptid, 0, fieldname3(3),' write(*,*)' dtype(3), spec)' write(*,*)' Value returned by he5_ptreadlevel ', status write(1,*)' status = he5_ptreadlevel(ptid, 0, fieldname3(3),' write(1,*)' dtype(3), spec)' write(1,*)' Value returned by he5_ptreadlevel ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptdetach c write(1,27) write(*,*)'Testing he5_ptdetach ' write(*,*)'=====================' write(1,*)'Testing he5_ptdetach ' write(1,*)'=====================' status = he5_ptdetach(ptid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdetach(ptid)' write(*,*)' Value returned by he5_ptdetach ', status write(1,*)' status = he5_ptdetach(ptid)' write(1,*)' Value returned by he5_ptdetach ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptattach c write(1,27) write(*,*)'Testing he5_ptattach ' write(*,*)'=====================' write(1,*)'Testing he5_ptattach ' write(1,*)'=====================' ptid = he5_ptattach(ptfid, "FixedBuoy Point") if (ptid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptid = he5_ptattach(ptfid, "FixedBuoy Point")' write(*,*)' Value returned by he5_ptattach ', ptid write(1,*)' ptid = he5_ptattach(ptfid, "FixedBuoy Point")' write(1,*)' Value returned by he5_ptattach ', ptid endif write(*,*)' ' write(1,*)' ' attrname = 'GlobalAttribute_int' nattr = he5_ptinqattrs(ptid,attrlist,strbufsize) c Test Case -- he5_ptinqattrs c write(*,*)'Testing he5_ptinqattrs ' write(*,*)'======================' write(1,*)'Testing he5_ptinqattrs ' write(1,*)'======================' nattr = he5_ptinqattrs(ptid,attrlist,strbufsize) if (nattr .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' nattr = he5_ptinqattrs(ptid,attrlist,strbufsize)' write(*,*)' Value returned by he5_ptinqattrs ', nattr write(1,*)' nattr = he5_ptinqattrs(ptid,attrlist,strbufsize)' write(1,*)' Value returned by he5_ptinqattrs ', nattr endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptreadattr c write(*,*)'Testing he5_ptreadattr ' write(*,*)'======================' write(1,*)'Testing he5_ptreadattr ' write(1,*)'======================' status = he5_ptreadattr(ptid,attrname,attr) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptreadattr(ptid,attrname,attr)' write(*,*)' Value returned by he5_ptreadattr ', nattr write(1,*)' status = he5_ptreadattr(ptid,attrname,attr)' write(1,*)' Value returned by he5_ptreadattr ', nattr endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptdetach c write(1,27) write(*,*)'Testing he5_ptdetach ' write(*,*)'=====================' write(1,*)'Testing he5_ptdetach ' write(1,*)'=====================' status = he5_ptdetach(ptid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdetach(ptid)' write(*,*)' Value returned by he5_ptdetach ', status write(1,*)' status = he5_ptdetach(ptid)' write(1,*)' Value returned by he5_ptdetach ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptclose c write(*,*)'Testing he5_ptclose ' write(*,*)'=====================' write(1,*)'Testing he5_ptclose ' write(1,*)'=====================' status = he5_ptclose(ptfid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptclose(ptfid)' write(*,*)' Value returned by he5_ptclose ', status write(1,*)' status = he5_ptclose(ptfid)' write(1,*)' Value returned by he5_ptclose ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptopen c write(*,*)'Testing he5_ptopen ' write(*,*)'=====================' write(1,*)'Testing he5_ptopen ' write(1,*)'=====================' ptfid = he5_ptopen('point.he5',HE5F_ACC_RDWR) if (ptfid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptfid= he5_ptopen("point.he5",HE5F_ACC_RDWR)' write(*,*)' Value returned by he5_ptopen ', ptfid write(1,*)' ptfid= he5_ptopen("point.he5",HE5F_ACC_RDWR)' write(1,*)' Value returned by he5_ptopen ', ptfid endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptattach c write(1,27) write(*,*)'Testing he5_ptattach ' write(*,*)'=====================' write(1,*)'Testing he5_ptattach ' write(1,*)'=====================' ptid = he5_ptattach(ptfid, "Simple Point") if (ptid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptid = he5_ptattach(ptfid, "Simple Point")' write(*,*)' Value returned by he5_ptattach ', ptid write(1,*)' ptid = he5_ptattach(ptfid, "Simple Point")' write(1,*)' Value returned by he5_ptattach ', ptid endif write(*,*)' ' write(1,*)' ' dtype(1) = HE5T_NATIVE_DOUBLE dtype(2) = HE5T_NATIVE_FLOAT dtype(3) = HE5T_NATIVE_CHAR nrec = 1 recs(1) = 0 level = 0 fieldname = 'Concentration' conc_tt(1) = 1.11 conc_tt(2) = 2.22 conc_tt(3) = 3.33 conc_tt(4) = 4.44 c Test Case -- he5_ptupdatelevel c write(*,*)'Testing he5_ptupdatelevel ' write(*,*)'=========================' write(1,*)'Testing he5_ptupdatelevel ' write(1,*)'=========================' status = he5_ptupdatelevel(ptid, level, fieldname, nrec, 1recs, dtype(2), conc_tt) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptupdatelevel(ptid, level,' write(*,*)' fieldname, nrec, recs,' write(*,*)' dtype(2), conc_tt)' write(*,*)' Value returned by he5_ptupdatelevel ', status write(1,*)' status = he5_ptupdatelevel(ptid, level,' write(1,*)' fieldname, nrec, recs,' write(1,*)' dtype(2), conc_tt)' write(1,*)' Value returned by he5_ptupdatelevel ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'Time' time_tt = 13131313.0 c Test Case -- he5_ptupdatelevel c write(*,*)'Testing he5_ptupdatelevel ' write(*,*)'=========================' write(1,*)'Testing he5_ptupdatelevel ' write(1,*)'=========================' status = he5_ptupdatelevel(ptid, level, fieldname, nrec, 1recs, dtype(1), time_tt) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptupdatelevel(ptid, level,' write(*,*)' fieldname, nrec, recs,' write(*,*)' dtype(1), time_tt)' write(*,*)' Value returned by he5_ptupdatelevel ', status write(1,*)' status = he5_ptupdatelevel(ptid, level,' write(1,*)' fieldname, nrec, recs,' write(1,*)' dtype(1), time_tt)' write(1,*)' Value returned by he5_ptupdatelevel ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'Species' spc_tt = 'AM' c Test Case -- he5_ptupdatelevel c write(*,*)'Testing he5_ptupdatelevel ' write(*,*)'=========================' write(1,*)'Testing he5_ptupdatelevel ' write(1,*)'=========================' status = he5_ptupdatelevel(ptid, level, fieldname, nrec, 1recs, dtype(3), spc_tt) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptupdatelevel(ptid, level,' write(*,*)' fieldname, nrec, recs,' write(*,*)' dtype(3), spc_tt)' write(*,*)' Value returned by he5_ptupdatelevel ', status write(1,*)' status = he5_ptupdatelevel(ptid, level,' write(1,*)' fieldname, nrec, recs,' write(1,*)' dtype(3), spc_tt)' write(1,*)' Value returned by he5_ptupdatelevel ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptdetach c write(1,27) write(*,*)'Testing he5_ptdetach ' write(*,*)'=====================' write(1,*)'Testing he5_ptdetach ' write(1,*)'=====================' status = he5_ptdetach(ptid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdetach(ptid)' write(*,*)' Value returned by he5_ptdetach ', status write(1,*)' status = he5_ptdetach(ptid)' write(1,*)' Value returned by he5_ptdetach ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptclose c write(*,*)'Testing he5_ptclose ' write(*,*)'=====================' write(1,*)'Testing he5_ptclose ' write(1,*)'=====================' status = he5_ptclose(ptfid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptclose(ptfid)' write(*,*)' Value returned by he5_ptclose ', status write(1,*)' status = he5_ptclose(ptfid)' write(1,*)' Value returned by he5_ptclose ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptopen c write(*,*)'Testing he5_ptopen ' write(*,*)'=====================' write(1,*)'Testing he5_ptopen ' write(1,*)'=====================' ptfid = he5_ptopen('point.he5',HE5F_ACC_RDWR) if (ptfid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptfid= he5_ptopen("point.he5",HE5F_ACC_RDWR)' write(*,*)' Value returned by he5_ptopen ', ptfid write(1,*)' ptfid= he5_ptopen("point.he5",HE5F_ACC_RDWR)' write(1,*)' Value returned by he5_ptopen ', ptfid endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptattach c write(1,27) write(*,*)'Testing he5_ptattach ' write(*,*)'=====================' write(1,*)'Testing he5_ptattach ' write(1,*)'=====================' ptid = he5_ptattach(ptfid, "FixedBuoy Point") if (ptid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptid = he5_ptattach(ptfid, "FixedBuoy Point")' write(*,*)' Value returned by he5_ptattach ', ptid write(1,*)' ptid = he5_ptattach(ptfid, "FixedBuoy Point")' write(1,*)' Value returned by he5_ptattach ', ptid endif write(*,*)' ' write(1,*)' ' c Write attributes to "Fixed Buoy Point" c -------------------------------------- attrname = 'GlobalAttribute_int' ntype = HE5T_NATIVE_INT fortcount(1) = 1 attr = 9999 c Test Case -- he5_ptwriteattr c write(*,*)'Testing he5_ptwriteattr ' write(*,*)'=======================' write(1,*)'Testing he5_ptwriteattr ' write(1,*)'=======================' status = he5_ptwriteattr(ptid,attrname,ntype,fortcount, 1attr) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwriteattr(ptid,attrname,' write(*,*)' ntype,fortcount,attr)' write(*,*)' Value returned by he5_ptwriteattr ', status write(1,*)' status = he5_ptwriteattr(ptid,attrname,' write(1,*)' ntype,fortcount,attr)' write(1,*)' Value returned by he5_ptwriteattr ', status endif write(*,*)' ' write(1,*)' ' attrname = 'GroupAttribute' ntype = HE5T_NATIVE_INT fortcount(1) = 5 attr1(1) = 1 attr1(2) = 2 attr1(3) = 3 attr1(4) = 4 attr1(5) = 5 c Test Case -- he5_ptwritegrpattr c write(*,*)'Testing he5_ptwritegrpattr ' write(*,*)'==========================' write(1,*)'Testing he5_ptwritegrpattr ' write(1,*)'==========================' status = he5_ptwritegrpattr(ptid,attrname,ntype,fortcount, 1attr1) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritegrpattr(ptid,attrname,' write(*,*)' ntype,fortcount,attr1)' write(*,*)' Value returned by he5_ptclose ', status write(1,*)' status = he5_ptwritegrpattr(ptid,attrname,' write(1,*)' ntype,fortcount,attr1)' write(1,*)' Value returned by he5_ptclose ', status endif write(*,*)' ' write(1,*)' ' levelname = 'Observations' attrname = 'LocalAttribute' ntype = HE5T_NATIVE_INT fortcount(1) = 5 attr2(1) = 10 attr2(2) = 20 attr2(3) = 30 attr2(4) = 40 attr2(5) = 50 c Test Case -- he5_ptwritelocattr c write(*,*)'Testing he5_ptwritelocattr ' write(*,*)'==========================' write(1,*)'Testing he5_ptwritelocattr ' write(1,*)'==========================' status = he5_ptwritelocattr(ptid,levelname,attrname, 1ntype,fortcount,attr2) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelocattr(ptid,' write(*,*)' levelname,attrname,ntype,' write(*,*)' fortcount,attr2)' write(*,*)' Value returned by he5_ptwritelocattr ', status write(1,*)' status = he5_ptwritelocattr(ptid,' write(1,*)' levelname,attrname,ntype,' write(1,*)' fortcount,attr2)' write(1,*)' Value returned by he5_ptwritelocattr ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptdetach c write(1,27) write(*,*)'Testing he5_ptdetach ' write(*,*)'=====================' write(1,*)'Testing he5_ptdetach ' write(1,*)'=====================' status = he5_ptdetach(ptid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdetach(ptid)' write(*,*)' Value returned by he5_ptdetach ', status write(1,*)' status = he5_ptdetach(ptid)' write(1,*)' Value returned by he5_ptdetach ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptattach c write(1,27) write(*,*)'Testing he5_ptattach ' write(*,*)'=====================' write(1,*)'Testing he5_ptattach ' write(1,*)'=====================' ptid = he5_ptattach(ptfid, "FixedBuoy Point") if (ptid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptid = he5_ptattach(ptfid, "FixedBuoy Point")' write(*,*)' Value returned by he5_ptattach ', ptid write(1,*)' ptid = he5_ptattach(ptfid, "FixedBuoy Point")' write(1,*)' Value returned by he5_ptattach ', ptid endif write(*,*)' ' write(1,*)' ' attrname = 'GlobalAttribute_float' ntype = HE5T_NATIVE_FLOAT fortcount(1) = 1 flt = -7.5 c Test Case -- he5_ptwriteattr c write(*,*)'Testing he5_ptwriteattr ' write(*,*)'=======================' write(1,*)'Testing he5_ptwriteattr ' write(1,*)'=======================' status = he5_ptwriteattr(ptid,attrname, 1ntype,fortcount,flt) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwriteattr(ptid,attrname,' write(*,*)' ntype,fortcount,flt)' write(*,*)' Value returned by he5_ptwriteattr ', status write(1,*)' status = he5_ptwriteattr(ptid,attrname,' write(1,*)' ntype,fortcount,flt)' write(1,*)' Value returned by he5_ptwriteattr ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptdetach c write(1,27) write(*,*)'Testing he5_ptdetach ' write(*,*)'=====================' write(1,*)'Testing he5_ptdetach ' write(1,*)'=====================' status = he5_ptdetach(ptid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdetach(ptid)' write(*,*)' Value returned by he5_ptdetach ', status write(1,*)' status = he5_ptdetach(ptid)' write(1,*)' Value returned by he5_ptdetach ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptclose c write(*,*)'Testing he5_ptclose ' write(*,*)'=====================' write(1,*)'Testing he5_ptclose ' write(1,*)'=====================' status = he5_ptclose(ptfid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptclose(ptfid)' write(*,*)' Value returned by he5_ptclose ', status write(1,*)' status = he5_ptclose(ptfid)' write(1,*)' Value returned by he5_ptclose ', status endif write(*,*)' ' write(1,*)' ' null_char_0 = '0' c Test Case -- he5_ptopen c write(*,*)'Testing he5_ptopen ' write(*,*)'=====================' write(1,*)'Testing he5_ptopen ' write(1,*)'=====================' ptfid = he5_ptopen('point.he5',HE5F_ACC_RDONLY) if (ptfid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptfid= he5_ptopen("point.he5",HE5F_ACC_RDONLY)' write(*,*)' Value returned by he5_ptopen ', ptfid write(1,*)' ptfid= he5_ptopen("point.he5",HE5F_ACC_RDONLY)' write(1,*)' Value returned by he5_ptopen ', ptfid endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptattach c write(1,27) write(*,*)'Testing he5_ptattach ' write(*,*)'=====================' write(1,*)'Testing he5_ptattach ' write(1,*)'=====================' ptid = he5_ptattach(ptfid, "FixedBuoy Point") if (ptid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptid = he5_ptattach(ptfid, "FixedBuoy Point")' write(*,*)' Value returned by he5_ptattach ', ptid write(1,*)' ptid = he5_ptattach(ptfid, "FixedBuoy Point")' write(1,*)' Value returned by he5_ptattach ', ptid endif write(*,*)' ' write(1,*)' ' c Global Attributes c ----------------- attrname = 'GlobalAttribute_int' print *,'Global Attribute: ' c Test Case -- he5_ptreadattr c write(*,*)'Testing he5_ptreadattr ' write(*,*)'======================' write(1,*)'Testing he5_ptreadattr ' write(1,*)'======================' status = he5_ptreadattr(ptid,attrname,attr) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptreadattr(ptid,attrname,attr)' write(*,*)' Value returned by he5_ptreadattr ', status write(1,*)' status = he5_ptreadattr(ptid,attrname,attr)' write(1,*)' Value returned by he5_ptreadattr ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptinqattrs c write(*,*)'Testing he5_ptinqattrs ' write(*,*)'======================' write(1,*)'Testing he5_ptinqattrs ' write(1,*)'======================' nattr = he5_ptinqattrs(ptid,null_char_0,strbufsize) if (nattr .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' nattr = he5_ptinqattrs(ptid,' write(*,*)' null_char_0,strbufsize)' write(*,*)' Value returned by he5_ptinqattrs ', nattr write(1,*)' nattr = he5_ptinqattrs(ptid,' write(1,*)' null_char_0,strbufsize)' write(1,*)' Value returned by he5_ptinqattrs ', nattr endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptinqattrs c write(*,*)'Testing he5_ptinqattrs ' write(*,*)'======================' write(1,*)'Testing he5_ptinqattrs ' write(1,*)'======================' nattr = he5_ptinqattrs(ptid,attrlist,strbufsize) if (nattr .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' nattr = he5_ptinqattrs(ptid,attrlist,strbufsize)' write(*,*)' Value returned by he5_ptinqattrs ', nattr write(1,*)' nattr = he5_ptinqattrs(ptid,attrlist,strbufsize)' write(1,*)' Value returned by he5_ptinqattrs ', nattr endif write(*,*)' ' write(1,*)' ' attrname = 'GlobalAttribute_int' c Test Case -- he5_ptattrinfo c write(*,*)'Testing he5_ptattrinfo ' write(*,*)'======================' write(1,*)'Testing he5_ptattrinfo ' write(1,*)'======================' status = he5_ptattrinfo(ptid,attrname,ntype,sz) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptattrinfo(ptid,attrname,ntype,sz)' write(*,*)' Value returned by he5_ptattrinfo ', status write(1,*)' status = he5_ptattrinfo(ptid,attrname,ntype,sz)' write(1,*)' Value returned by he5_ptattrinfo ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptattrinfo c write(*,*)'Testing he5_ptattrinfo ' write(*,*)'======================' write(1,*)'Testing he5_ptattrinfo ' write(1,*)'======================' status = he5_ptattrinfo(ptid,attrname,ntype,sz) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptattrinfo(ptid,attrname,ntype,sz)' write(*,*)' Value returned by he5_ptattrinfo ', status write(1,*)' status = he5_ptattrinfo(ptid,attrname,ntype,sz)' write(1,*)' Value returned by he5_ptattrinfo ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptreadattr c write(*,*)'Testing he5_ptreadattr ' write(*,*)'======================' write(1,*)'Testing he5_ptreadattr ' write(1,*)'======================' status = he5_ptreadattr(ptid,attrname,flt) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptreadattr(ptid,attrname,flt)' write(*,*)' Value returned by he5_ptreadattr ', status write(1,*)' status = he5_ptreadattr(ptid,attrname,flt)' write(1,*)' Value returned by he5_ptreadattr ', status endif write(*,*)' ' write(1,*)' ' attrname = 'GroupAttribute' c Test Case -- he5_ptreadgrpattr c write(*,*)'Testing he5_ptreadgrpattr' write(*,*)'=========================' write(1,*)'Testing he5_ptreadgrpattr' write(1,*)'=========================' status = he5_ptreadgrpattr(ptid,attrname,attr1) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptreadgrpattr(ptid,attrname,attr1)' write(*,*)' Value returned by he5_ptreadgrpattr ', status write(1,*)' status = he5_ptreadgrpattr(ptid,attrname,attr1)' write(1,*)' Value returned by he5_ptreadgrpattr ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptinqgrpattrs c write(*,*)'Testing he5_ptinqgrpattrs ' write(*,*)'=========================' write(1,*)'Testing he5_ptinqgrpattrs ' write(1,*)'=========================' nattr = he5_ptinqgrpattrs(ptid,null_char_0,strbufsize) if (nattr .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' nattr = he5_ptinqgrpattrs(ptid,' write(*,*)' null_char_0,strbufsize)' write(*,*)' Value returned by he5_ptinqgrpattrs ', nattr write(1,*)' nattr = he5_ptinqgrpattrs(ptid,' write(1,*)' null_char_0,strbufsize)' write(1,*)' Value returned by he5_ptinqgrpattrs ', nattr endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptinqgrpattrs c write(*,*)'Testing he5_ptinqgrpattrs ' write(*,*)'=========================' write(1,*)'Testing he5_ptinqgrpattrs ' write(1,*)'=========================' nattr = he5_ptinqgrpattrs(ptid,attrlist,strbufsize) if (nattr .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' nattr = he5_ptinqgrpattrs(ptid,' write(*,*)' attrlist,strbufsize)' write(*,*)' Value returned by he5_ptinqgrpattrs ', status write(1,*)' nattr = he5_ptinqgrpattrs(ptid,' write(1,*)' attrlist,strbufsize)' write(1,*)' Value returned by he5_ptinqgrpattrs ', status endif write(*,*)' ' write(1,*)' ' attrname = 'GroupAttribute' c Test Case -- he5_ptgrpattrinfo c write(*,*)'Testing he5_ptgrpattrinfo ' write(*,*)'=========================' write(1,*)'Testing he5_ptgrpattrinfo ' write(1,*)'=========================' status = he5_ptgrpattrinfo(ptid,attrname,ntype,sz) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptgrpattrinfo(ptid,' write(*,*)' attrname,ntype,sz)' write(*,*)' Value returned by he5_ptgrpattrinfo ', status write(1,*)' status = he5_ptgrpattrinfo(ptid,' write(1,*)' attrname,ntype,sz)' write(1,*)' Value returned by he5_ptgrpattrinfo ', status endif write(*,*)' ' write(1,*)' ' attrname = 'LocalAttribute' levelname = 'Observations' c Test Case -- he5_ptreadlocattr c write(*,*)'Testing he5_ptreadlocattr ' write(*,*)'=========================' write(1,*)'Testing he5_ptreadlocattr ' write(1,*)'=========================' status = he5_ptreadlocattr(ptid,levelname,attrname,attr2) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptreadlocattr(ptid,' write(*,*)' levelname,attrname,attr2)' write(*,*)' Value returned by he5_ptreadlocattr ', status write(1,*)' status = he5_ptreadlocattr(ptid,' write(1,*)' levelname,attrname,attr2)' write(1,*)' Value returned by he5_ptreadlocattr ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptinqlocattrs c write(*,*)'Testing he5_ptinqlocattrs ' write(*,*)'=========================' write(1,*)'Testing he5_ptinqlocattrs ' write(1,*)'=========================' nattr = he5_ptinqlocattrs(ptid,levelname,null_char_0,strbufsize) if (nattr .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' nattr = he5_ptinqlocattrs(ptid,' write(*,*)' levelname,null_char_0,strbufsize)' write(*,*)' Value returned by he5_ptinqlocattrs ', nattr write(1,*)' nattr = he5_ptinqlocattrs(ptid,' write(1,*)' levelname,null_char_0,strbufsize)' write(1,*)' Value returned by he5_ptinqlocattrs ', nattr endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptinqlocattrs c write(*,*)'Testing he5_ptinqlocattrs ' write(*,*)'=====================' write(1,*)'Testing he5_ptinqlocattrs ' write(1,*)'=====================' nattr = he5_ptinqlocattrs(ptid,levelname,attrlist,strbufsize) if (nattr .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' nattr = he5_ptinqlocattrs(ptid,' write(*,*)' levelname,attrlist,strbufsize)' write(*,*)' Value returned by he5_ptinqlocattrs ', nattr write(1,*)' nattr = he5_ptinqlocattrs(ptid,' write(1,*)' levelname,attrlist,strbufsize)' write(1,*)' Value returned by he5_ptinqlocattrs ', nattr endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptlocattrinfo c write(*,*)'Testing he5_ptlocattrinfo ' write(*,*)'=========================' write(1,*)'Testing he5_ptlocattrinfo ' write(1,*)'=========================' status = he5_ptlocattrinfo(ptid,levelname,attrname,ntype,sz) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptlocattrinfo(ptid,' write(*,*)' levelname,attrname,ntype,sz)' write(*,*)' Value returned by he5_ptlocattrinfo ', status write(1,*)' status = he5_ptlocattrinfo(ptid,' write(1,*)' levelname,attrname,ntype,sz)' write(1,*)' Value returned by he5_ptlocattrinfo ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptdetach c write(1,27) write(*,*)'Testing he5_ptdetach ' write(*,*)'=====================' write(1,*)'Testing he5_ptdetach ' write(1,*)'=====================' status = he5_ptdetach(ptid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdetach(ptid)' write(*,*)' Value returned by he5_ptdetach ', status write(1,*)' status = he5_ptdetach(ptid)' write(1,*)' Value returned by he5_ptdetach ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptclose c write(*,*)'Testing he5_ptclose ' write(*,*)'=====================' write(1,*)'Testing he5_ptclose ' write(1,*)'=====================' status = he5_ptclose(ptfid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptclose(ptfid)' write(*,*)' Value returned by he5_ptclose ', status write(1,*)' status = he5_ptclose(ptfid)' write(1,*)' Value returned by he5_ptclose ', status endif write(*,*)' ' write(1,*)' ' null_char_0 = '0' c Test Case -- he5_ptopen c write(*,*)'Testing he5_ptopen ' write(*,*)'=====================' write(1,*)'Testing he5_ptopen ' write(1,*)'=====================' ptfid = he5_ptopen('point.he5',HE5F_ACC_RDONLY) if (ptfid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptfid= he5_ptopen("point.he5",HE5F_ACC_RDONLY)' write(*,*)' Value returned by he5_ptopen ', ptfid write(1,*)' ptfid= he5_ptopen("point.he5",HE5F_ACC_RDONLY)' write(1,*)' Value returned by he5_ptopen ', ptfid endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptattach c write(1,27) write(*,*)'Testing he5_ptattach ' write(*,*)'=====================' write(1,*)'Testing he5_ptattach ' write(1,*)'=====================' ptid = he5_ptattach(ptfid, "FixedBuoy Point") if (ptid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptid = he5_ptattach(ptfid, "FixedBuoy Point")' write(*,*)' Value returned by he5_ptattach ', ptid write(1,*)' ptid = he5_ptattach(ptfid, "FixedBuoy Point")' write(1,*)' Value returned by he5_ptattach ', ptid endif write(*,*)' ' write(1,*)' ' fieldgroup = HE5_HDFE_DATAGROUP fieldname = 'Observations' c Test Case -- he5_ptinqdatatype c write(*,*)'Testing he5_ptinqdatatype ' write(*,*)'=========================' write(1,*)'Testing he5_ptinqdatatype ' write(1,*)'=========================' status = he5_ptinqdatatype(ptid,fieldname,null_char_0,fieldgroup, 1datatype,classid,order,size) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptinqdatatype(ptid,fieldname,' write(*,*)' null_char_0,fieldgroup,datatype,classid,' write(*,*)' order,size)' write(*,*)' Value returned by he5_ptinqdatatype ', status write(1,*)' status = he5_ptinqdatatype(ptid,fieldname,' write(1,*)' null_char_0,fieldgroup,datatype,classid,' write(1,*)' order,size)' write(1,*)' Value returned by he5_ptinqdatatype ', status endif write(*,*)' ' write(1,*)' ' fieldgroup = HE5_HDFE_ATTRGROUP attrname = 'GlobalAttribute_int' c Test Case -- he5_ptinqdatatype c write(*,*)'Testing he5_ptinqdatatype ' write(*,*)'=========================' write(1,*)'Testing he5_ptinqdatatype ' write(1,*)'=========================' status = he5_ptinqdatatype(ptid,null_char_0,attrname,fieldgroup, 1datatype,classid,order,size) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptinqdatatype(ptid,null_char_0,' write(*,*)' attrname,fieldgroup,datatype,' write(*,*)' classid,order,size)' write(*,*)' Value returned by he5_ptinqdatatype ', status write(1,*)' status = he5_ptinqdatatype(ptid,null_char_0,' write(1,*)' attrname,fieldgroup,datatype,' write(1,*)' classid,order,size)' write(1,*)' Value returned by he5_ptinqdatatype ', status endif write(*,*)' ' write(1,*)' ' fieldgroup = HE5_HDFE_GRPATTRGROUP attrname = 'GroupAttribute' c Test Case -- he5_ptinqdatatype c write(*,*)'Testing he5_ptinqdatatype ' write(*,*)'=========================' write(1,*)'Testing he5_ptinqdatatype ' write(1,*)'=========================' status = he5_ptinqdatatype(ptid,null_char_0,attrname,fieldgroup, 1datatype,classid,order,size) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptinqdatatype(ptid,null_char_0,' write(*,*)' attrname,fieldgroup,datatype,' write(*,*)' classid,order,size)' write(*,*)' Value returned by he5_ptinqdatatype ', status write(1,*)' status = he5_ptinqdatatype(ptid,null_char_0,' write(1,*)' attrname,fieldgroup,datatype,' write(1,*)' classid,order,size)' write(1,*)' Value returned by he5_ptinqdatatype ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'Observations' fieldgroup = HE5_HDFE_LOCATTRGROUP attrname = 'LocalAttribute' c Test Case -- he5_ptinqdatatype c write(*,*)'Testing he5_ptinqdatatype ' write(*,*)'=========================' write(1,*)'Testing he5_ptinqdatatype ' write(1,*)'=========================' status = he5_ptinqdatatype(ptid,fieldname,attrname,fieldgroup, 1datatype,classid,order,size) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptinqdatatype(ptid,fieldname,' write(*,*)' attrname,fieldgroup,datatype,' write(*,*)' classid,order,size)' write(*,*)' Value returned by he5_ptinqdatatype ', status write(1,*)' status = he5_ptinqdatatype(ptid,fieldname,' write(1,*)' attrname,fieldgroup,datatype,' write(1,*)' classid,order,size)' write(1,*)' Value returned by he5_ptinqdatatype ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptdetach c write(1,27) write(*,*)'Testing he5_ptdetach ' write(*,*)'=====================' write(1,*)'Testing he5_ptdetach ' write(1,*)'=====================' status = he5_ptdetach(ptid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdetach(ptid)' write(*,*)' Value returned by he5_ptdetach ', status write(1,*)' status = he5_ptdetach(ptid)' write(1,*)' Value returned by he5_ptdetach ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptclose c write(*,*)'Testing he5_ptclose ' write(*,*)'=====================' write(1,*)'Testing he5_ptclose ' write(1,*)'=====================' status = he5_ptclose(ptfid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptclose(ptfid)' write(*,*)' Value returned by he5_ptclose ', status write(1,*)' status = he5_ptclose(ptfid)' write(1,*)' Value returned by he5_ptclose ', status endif write(*,*)' ' write(1,*)' ' close(unit=1) 27 format(' ') 230 format('********Error unexpected**********') 240 format('***********Passed Test*********') stop end hdf-eos5-2.0/testdrivers/point/testpoint64.f000077500000000000000000003365151507520047200210700ustar00rootroot00000000000000 c---------------------------------------------------------------------------- c FILE: testpoint64.f c PURPOSE: To test HDF-EOS5 Point interface c Author: C. Praderas, Emergent IT Inc. c Date: June 2001 c---------------------------------------------------------------------------- program he5_pttestpoint64 implicit none include 'hdfeos5.inc' integer status integer ptfid integer ptid1, ptid2, ptid3 integer ptid integer rank_1(3) integer rank_2(5) integer rank_3(4) integer rank_4(4) integer rank_5(6) integer dtype_1(3) integer dtype_2(5) integer dtype_3(4) integer dtype_4(4) integer dtype_5(6) integer array_1(3) integer array_2(5) integer array_3(4) integer array_4(4) integer array_5(6) integer i, zero integer rank integer datatype integer attr integer nflds integer level integer arr_rank integer dtype(3) integer nrecs integer nlevels integer attr1(5) integer attr2(5) integer ntype integer classid integer order integer fieldgroup integer rank_tt(3) integer dtype_tt(3) integer he5_ptopen integer he5_ptcreate integer he5_ptdetach integer he5_ptclose integer he5_ptattach integer he5_ptdeflevel integer he5_ptdeflinkage integer he5_ptwritelevel integer he5_ptfort2c integer he5_ptwrbckptr integer he5_ptwrfwdptr integer he5_ptwriteattr integer he5_ptreadlevel integer he5_ptlevelinfo integer he5_ptnrecs integer he5_ptnlevels integer he5_ptnfields integer he5_ptc2fort integer he5_ptinqattrs integer he5_ptreadattr integer he5_ptupdatelevel integer he5_ptwritegrpattr integer he5_ptwritelocattr integer he5_ptinqgrpattrs integer he5_ptinqlocattrs integer he5_ptattrinfo integer he5_ptgrpattrinfo integer he5_ptlocattrinfo integer he5_ptreadgrpattr integer he5_ptreadlocattr integer he5_ptinqdatatype integer*8 dims_1(3,1) integer*8 dims_2(5,1) integer*8 dims_3(4,1) integer*8 dims_4(4,1) integer*8 dims_5(6,1) integer*8 n integer*8 count(1) integer*8 dimens(2) integer*8 fortcount(8) integer*8 datasize integer*8 offset_tt(3) integer*8 dim_sizes_tt(3) integer*8 nattr integer*8 strbufsize integer*8 recs(32) integer*8 nrec integer*8 sz integer*8 size integer*4 date_tt integer*4 date(3) integer*4 date4_tt integer*4 date4(3) integer*4 wgt_tt integer*4 wgt(3) real*4 flt real*4 concentration_tt(4) real*4 conc(15,4) real*4 outconc(4,15) real*4 rain_tt real*4 rain(20) real*4 temp_tt real*4 temp(20) real*4 rain5_tt real*4 rain5(25) real*4 temp5_tt real*4 temp5(25) real*4 con(4,15) real*4 outcon(15,4) real*4 conc_tt(4) real*8 time_tt real*8 time(15) real*8 lon_tt real*8 lon(3) real*8 lat_tt real*8 lat(3) real*8 time3_tt real*8 time3(20) real*8 time5_tt real*8 time5(25) real*8 lon5_tt real*8 lon5(25) real*8 lat5_tt real*8 lat5(25) character*240 fieldlist1 character*240 fieldlist2 character*240 fieldlist3 character*240 fieldlist4 character*240 fieldlist5 character*80 levelname character*20 parent character*20 child character*20 linkfield character*80 fieldname character*80 attrname character*8 spc_tt character*8 spc(15) character*8 desc_tt character*8 desc(3) character*8 id_tt character*8 id(3) character*8 id3_tt character*8 id3(20) character*8 desc4_tt character*8 desc4(3) character*8 id4_tt character*8 id4(3) character*8 id5_tt character*8 id5(25) character*80 fieldname3(3) character*240 fieldlist character*240 attrlist character*8 spec(15) character*1 null_char_0 open(unit=1, file="testpoint64_f.txtout", status = "UNKNOWN") write(*,*)' ' write(1,*)' ' write(*,*)'Testing he5_ptath FORTRAN 77 interface' write(*,*)'======================================' write(1,*)'Testing he5_ptath FORTRAN 77 interface' write(1,*)'======================================' write(*,*)' ' write(1,*)' ' zero=0 c Test Case -- he5_ptopen c write(*,*)'Testing he5_ptopen ' write(*,*)'=====================' write(1,*)'Testing he5_ptopen ' write(1,*)'=====================' ptfid = he5_ptopen('point.he5',HE5F_ACC_TRUNC) if (ptfid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptfid= he5_ptopen("point.he5",HE5F_ACC_TRUNC)' write(*,*)' Value returned by he5_ptopen ', ptfid write(1,*)' ptfid= he5_ptopen("point.he5",HE5F_ACC_TRUNC)' write(1,*)' Value returned by he5_ptopen ', ptfid endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptcreate c write(*,*)'Testing he5_ptcreate ' write(*,*)'=====================' write(1,*)'Testing he5_ptcreate ' write(1,*)'=====================' ptid1 = he5_ptcreate(ptfid, "Simple Point") if (ptid1 .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptid1 = he5_ptcreate(ptfid, "Simple Point")' write(*,*)' Value returned by he5_ptcreate ', ptid1 write(1,*)' ptid1 = he5_ptcreate(ptfid, "Simple Point")' write(1,*)' Value returned by he5_ptcreate ', ptid1 endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptcreate c write(*,*)'Testing he5_ptcreate ' write(*,*)'=====================' write(1,*)'Testing he5_ptcreate ' write(1,*)'=====================' ptid2 = he5_ptcreate(ptfid, "FixedBuoy Point") if (ptid2 .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptid2 = he5_ptcreate(ptfid, "FixedBuoy Point")' write(*,*)' Value returned by he5_ptcreate ', ptid2 write(1,*)' ptid2 = he5_ptcreate(ptfid, "FixedBuoy Point")' write(1,*)' Value returned by he5_ptcreate ', ptid2 endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptcreate c write(*,*)'Testing he5_ptcreate ' write(*,*)'=====================' write(1,*)'Testing he5_ptcreate ' write(1,*)'=====================' ptid3 = he5_ptcreate(ptfid, "FloatBuoy Point") if (ptid3 .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptid3 = he5_ptcreate(ptfid, "FloatBuoy Point")' write(*,*)' Value returned by he5_ptcreate ', ptid3 write(1,*)' ptid3 = he5_ptcreate(ptfid, "FloatBuoy Point")' write(1,*)' Value returned by he5_ptcreate ', ptid3 endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptdetach c write(1,27) write(*,*)'Testing he5_ptdetach ' write(*,*)'=====================' write(1,*)'Testing he5_ptdetach ' write(1,*)'=====================' status = he5_ptdetach(ptid1) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdetach(ptid1)' write(*,*)' Value returned by he5_ptdetach ', status write(1,*)' status = he5_ptdetach(ptid1)' write(1,*)' Value returned by he5_ptdetach ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptdetach c write(1,27) write(*,*)'Testing he5_ptdetach ' write(*,*)'=====================' write(1,*)'Testing he5_ptdetach ' write(1,*)'=====================' status = he5_ptdetach(ptid2) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdetach(ptid2)' write(*,*)' Value returned by he5_ptdetach ', status write(1,*)' status = he5_ptdetach(ptid2)' write(1,*)' Value returned by he5_ptdetach ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptdetach c write(1,27) write(*,*)'Testing he5_ptdetach ' write(*,*)'=====================' write(1,*)'Testing he5_ptdetach ' write(1,*)'=====================' status = he5_ptdetach(ptid3) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdetach(ptid3)' write(*,*)' Value returned by he5_ptdetach ', status write(1,*)' status = he5_ptdetach(ptid3)' write(1,*)' Value returned by he5_ptdetach ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptclose c write(*,*)'Testing he5_ptclose ' write(*,*)'=====================' write(1,*)'Testing he5_ptclose ' write(1,*)'=====================' status = he5_ptclose(ptfid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptclose(ptfid)' write(*,*)' Value returned by he5_ptclose ', status write(1,*)' status = he5_ptclose(ptfid)' write(1,*)' Value returned by he5_ptclose ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptopen c write(*,*)'Testing he5_ptopen ' write(*,*)'=====================' write(1,*)'Testing he5_ptopen ' write(1,*)'=====================' ptfid = he5_ptopen('point.he5',HE5F_ACC_RDWR) if (ptfid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptfid= he5_ptopen("point.he5",HE5F_ACC_RDWR)' write(*,*)' Value returned by he5_ptopen ', ptfid write(1,*)' ptfid= he5_ptopen("point.he5",HE5F_ACC_RDWR)' write(1,*)' Value returned by he5_ptopen ', ptfid endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptattach c write(1,27) write(*,*)'Testing he5_ptattach ' write(*,*)'=====================' write(1,*)'Testing he5_ptattach ' write(1,*)'=====================' ptid = he5_ptattach(ptfid, "Simple Point") if (ptid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptid = he5_ptattach(ptfid, "Simple Point")' write(*,*)' Value returned by he5_ptattach ', ptid write(1,*)' ptid = he5_ptattach(ptfid, "Simple Point")' write(1,*)' Value returned by he5_ptattach ', ptid endif write(*,*)' ' write(1,*)' ' c Populate input information structure c ------------------------------------ levelname = 'Sensor' rank_1(1) = 1 rank_1(2) = 1 rank_1(3) = 1 fieldlist1 = 'Time,Concentration,Species' dtype_1(1) = HE5T_NATIVE_DOUBLE dtype_1(2) = HE5T_NATIVE_FLOAT dtype_1(3) = HE5T_NATIVE_CHAR array_1(1) = 0 array_1(2) = 1 array_1(3) = 1 dims_1(1,1) = 1 dims_1(2,1) = 4 dims_1(3,1) = 8 c Test Case -- he5_ptdeflevel c write(1,27) write(*,*)'Testing he5_ptdeflevel ' write(*,*)'=====================' write(1,*)'Testing he5_ptdeflevel ' write(1,*)'=====================' status = he5_ptdeflevel(ptid, levelname, rank_1, fieldlist1, 1dims_1, dtype_1, array_1) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdeflevel(ptid, levelname, rank_1' write(*,*)' fieldlist1,dims_1, dtype_1, array_1)' write(*,*)' Value returned by he5_ptdeflevel ', status write(1,*)' status = he5_ptdeflevel(ptid, levelname, rank_1' write(1,*)' fieldlist1,dims_1, dtype_1, array_1)' write(1,*)' Value returned by he5_ptdeflevel ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptdetach c write(1,27) write(*,*)'Testing he5_ptdetach ' write(*,*)'=====================' write(1,*)'Testing he5_ptdetach ' write(1,*)'=====================' status = he5_ptdetach(ptid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdetach(ptid)' write(*,*)' Value returned by he5_ptdetach ', status write(1,*)' status = he5_ptdetach(ptid)' write(1,*)' Value returned by he5_ptdetach ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptattach c write(1,27) write(*,*)'Testing he5_ptattach ' write(*,*)'=====================' write(1,*)'Testing he5_ptattach ' write(1,*)'=====================' ptid = he5_ptattach(ptfid, "FixedBuoy Point") if (ptid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptid = he5_ptattach(ptfid, "FixedBuoy Point")' write(*,*)' Value returned by he5_ptattach ', ptid write(1,*)' ptid = he5_ptattach(ptfid, "FixedBuoy Point")' write(1,*)' Value returned by he5_ptattach ', ptid endif write(*,*)' ' write(1,*)' ' c Populate input information structure c ------------------------------------ levelname = 'Desc-Loc' rank_2(1) = 1 rank_2(2) = 1 rank_2(3) = 1 rank_2(4) = 1 rank_2(5) = 1 fieldlist2 = 'Label,Longitude,Latitude,DeployDate,ID' dtype_2(1) = HE5T_NATIVE_CHAR dtype_2(2) = HE5T_NATIVE_DOUBLE dtype_2(3) = HE5T_NATIVE_DOUBLE dtype_2(4) = HE5T_NATIVE_INT dtype_2(5) = HE5T_NATIVE_CHAR array_2(1) = 1 array_2(2) = 0 array_2(3) = 0 array_2(4) = 0 array_2(5) = 1 dims_2(1,1) = 8 dims_2(2,1) = 1 dims_2(3,1) = 1 dims_2(4,1) = 1 dims_2(5,1) = 8 c Test Case -- he5_ptdeflevel c write(1,27) write(*,*)'Testing he5_ptdeflevel ' write(*,*)'=====================' write(1,*)'Testing he5_ptdeflevel ' write(1,*)'=====================' status = he5_ptdeflevel(ptid, levelname, rank_2, fieldlist2, 1dims_2, dtype_2, array_2) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdeflevel(ptid, levelname, rank_2' write(*,*)' fieldlist2,dims_2, dtype_2, array_2)' write(*,*)' Value returned by he5_ptdeflevel ', status write(1,*)' status = he5_ptdeflevel(ptid, levelname, rank_2' write(1,*)' fieldlist2,dims_2, dtype_2, array_2)' write(1,*)' Value returned by he5_ptdeflevel ', status endif write(*,*)' ' write(1,*)' ' c Populate input information structure c ------------------------------------ levelname = 'Observations' rank_3(1) = 1 rank_3(2) = 1 rank_3(3) = 1 rank_3(4) = 1 fieldlist3 = 'Time,Rainfall,Temperature,ID' dtype_3(1) = HE5T_NATIVE_DOUBLE dtype_3(2) = HE5T_NATIVE_FLOAT dtype_3(3) = HE5T_NATIVE_FLOAT dtype_3(4) = HE5T_NATIVE_CHAR array_3(1) = 0 array_3(2) = 0 array_3(3) = 0 array_3(4) = 1 dims_3(1,1) = 1 dims_3(2,1) = 1 dims_3(3,1) = 1 dims_3(4,1) = 8 c Test Case -- he5_ptdeflevel c write(1,27) write(*,*)'Testing he5_ptdeflevel ' write(*,*)'======================' write(1,*)'Testing he5_ptdeflevel ' write(1,*)'======================' status = he5_ptdeflevel(ptid, levelname, rank_3, fieldlist3, 1dims_3, dtype_3, array_3) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdeflevel(ptid, levelname, rank_3' write(*,*)' fieldlist3,dims_3, dtype_3, array_3)' write(*,*)' Value returned by he5_ptdeflevel ', status write(1,*)' status = he5_ptdeflevel(ptid, levelname, rank_3' write(1,*)' fieldlist3,dims_3, dtype_3, array_3)' write(1,*)' Value returned by he5_ptdeflevel ', status endif write(*,*)' ' write(1,*)' ' parent = 'Desc-Loc' child = 'Observations' linkfield = 'ID' c Test Case -- he5_ptdeflinkage c write(*,*)'Testing he5_ptdeflinkage ' write(*,*)'========================' write(1,*)'Testing he5_ptdeflinkage ' write(1,*)'========================' status = he5_ptdeflinkage(ptid, parent, child, linkfield) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdeflinkage(ptid, parent, child,' write(*,*)' linkfield)' write(*,*)' Value returned by he5_ptdeflinkage ', status write(1,*)' status = he5_ptdeflinkage(ptid, parent, child,' write(1,*)' linkfield)' write(1,*)' Value returned by he5_ptdeflinkage ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptdetach c write(1,27) write(*,*)'Testing he5_ptdetach ' write(*,*)'=====================' write(1,*)'Testing he5_ptdetach ' write(1,*)'=====================' status = he5_ptdetach(ptid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdetach(ptid)' write(*,*)' Value returned by he5_ptdetach ', status write(1,*)' status = he5_ptdetach(ptid)' write(1,*)' Value returned by he5_ptdetach ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptattach c write(1,27) write(*,*)'Testing he5_ptattach ' write(*,*)'=====================' write(1,*)'Testing he5_ptattach ' write(1,*)'=====================' ptid = he5_ptattach(ptfid, "FloatBuoy Point") if (ptid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptid = he5_ptattach(ptfid, "FloatBuoy Point")' write(*,*)' Value returned by he5_ptattach ', ptid write(1,*)' ptid = he5_ptattach(ptfid, "FloatBuoy Point")' write(1,*)' Value returned by he5_ptattach ', ptid endif write(*,*)' ' write(1,*)' ' levelname = 'Description' rank_4(1) = 1 rank_4(2) = 1 rank_4(3) = 1 rank_4(4) = 1 fieldlist4 = 'Label,DeployDate,Weight,ID' dtype_4(1) = HE5T_NATIVE_CHAR dtype_4(2) = HE5T_NATIVE_INT dtype_4(3) = HE5T_NATIVE_INT dtype_4(4) = HE5T_NATIVE_CHAR array_4(1) = 1 array_4(2) = 0 array_4(3) = 0 array_4(4) = 1 dims_4(1,1) = 8 dims_4(2,1) = 1 dims_4(3,1) = 1 dims_4(4,1) = 8 c Test Case -- he5_ptdeflevel c write(1,27) write(*,*)'Testing he5_ptdeflevel ' write(*,*)'=====================' write(1,*)'Testing he5_ptdeflevel ' write(1,*)'=====================' status = he5_ptdeflevel(ptid, levelname, rank_4, fieldlist4, 1dims_4, dtype_4, array_4) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdeflevel(ptid, levelname, rank_4' write(*,*)' fieldlist4,dims_4, dtype_4, array_4)' write(*,*)' Value returned by he5_ptdeflevel ', status write(1,*)' status = he5_ptdeflevel(ptid, levelname, rank_4' write(1,*)' fieldlist4,dims_4, dtype_4, array_4)' write(1,*)' Value returned by he5_ptdeflevel ', status endif write(*,*)' ' write(1,*)' ' levelname = 'Measurements' rank_5(1) = 1 rank_5(2) = 1 rank_5(3) = 1 rank_5(4) = 1 rank_5(5) = 1 rank_5(6) = 1 fieldlist5 = 'Time,Longitude,Latitude,Rainfall,Temperature,ID' dtype_5(1) = HE5T_NATIVE_DOUBLE dtype_5(2) = HE5T_NATIVE_DOUBLE dtype_5(3) = HE5T_NATIVE_DOUBLE dtype_5(4) = HE5T_NATIVE_FLOAT dtype_5(5) = HE5T_NATIVE_FLOAT dtype_5(6) = HE5T_NATIVE_CHAR array_5(1) = 0 array_5(2) = 0 array_5(3) = 0 array_5(4) = 0 array_5(5) = 0 array_5(6) = 1 dims_5(1,1) = 1 dims_5(2,1) = 1 dims_5(3,1) = 1 dims_5(4,1) = 1 dims_5(5,1) = 1 dims_5(6,1) = 8 c Test Case -- he5_ptdeflevel c write(1,27) write(*,*)'Testing he5_ptdeflevel ' write(*,*)'=====================' write(1,*)'Testing he5_ptdeflevel ' write(1,*)'=====================' status = he5_ptdeflevel(ptid, levelname, rank_5, fieldlist5, 1dims_5, dtype_5, array_5) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdeflevel(ptid, levelname, rank_5' write(*,*)' fieldlist5,dims_5, dtype_5, array_5)' write(*,*)' Value returned by he5_ptdeflevel ', status write(1,*)' status = he5_ptdeflevel(ptid, levelname, rank_5' write(1,*)' fieldlist5,dims_5, dtype_5, array_5)' write(1,*)' Value returned by he5_ptdeflevel ', status endif write(*,*)' ' write(1,*)' ' parent = 'Description' child = 'Measurements' linkfield = 'ID' c Test Case -- he5_ptdeflinkage c write(*,*)'Testing he5_ptdeflinkage ' write(*,*)'=====================' write(1,*)'Testing he5_ptdeflinkage ' write(1,*)'=====================' status = he5_ptdeflinkage(ptid, parent, child, linkfield) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdeflinkage(ptid, parent, child,' write(*,*)' linkfield)' write(*,*)' Value returned by he5_ptdeflinkage ', status write(1,*)' status = he5_ptdeflinkage(ptid, parent, child,' write(1,*)' linkfield)' write(1,*)' Value returned by he5_ptdeflinkage ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptdetach c write(1,27) write(*,*)'Testing he5_ptdetach ' write(*,*)'=====================' write(1,*)'Testing he5_ptdetach ' write(1,*)'=====================' status = he5_ptdetach(ptid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdetach(ptid)' write(*,*)' Value returned by he5_ptdetach ', status write(1,*)' status = he5_ptdetach(ptid)' write(1,*)' Value returned by he5_ptdetach ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptclose c write(*,*)'Testing he5_ptclose ' write(*,*)'=====================' write(1,*)'Testing he5_ptclose ' write(1,*)'=====================' status = he5_ptclose(ptfid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptclose(ptfid)' write(*,*)' Value returned by he5_ptclose ', status write(1,*)' status = he5_ptclose(ptfid)' write(1,*)' Value returned by he5_ptclose ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptopen c write(*,*)'Testing he5_ptopen ' write(*,*)'=====================' write(1,*)'Testing he5_ptopen ' write(1,*)'=====================' ptfid = he5_ptopen('point.he5',HE5F_ACC_RDWR) if (ptfid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptfid= he5_ptopen("point.he5",HE5F_ACC_RDWR)' write(*,*)' Value returned by he5_ptopen ', ptfid write(1,*)' ptfid= he5_ptopen("point.he5",HE5F_ACC_RDWR)' write(1,*)' Value returned by he5_ptopen ', ptfid endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptattach c write(1,27) write(*,*)'Testing he5_ptattach ' write(*,*)'=====================' write(1,*)'Testing he5_ptattach ' write(1,*)'=====================' ptid = he5_ptattach(ptfid, "Simple Point") if (ptid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptid = he5_ptattach(ptfid, "Simple Point")' write(*,*)' Value returned by he5_ptattach ', ptid write(1,*)' ptid = he5_ptattach(ptfid, "Simple Point")' write(1,*)' Value returned by he5_ptattach ', ptid endif write(*,*)' ' write(1,*)' ' c Read Simple Point c ----------------- open(unit=10, file='simple.txt', status='OLD') n = 0 do 10 i=1,1000 read(10, 110, end=100) time_tt, concentration_tt(1), 1 concentration_tt(2), 2 concentration_tt(3), 3 concentration_tt(4), 4 spc_tt time(i) = time_tt conc(i,1) = concentration_tt(1) conc(i,2) = concentration_tt(2) conc(i,3) = concentration_tt(3) conc(i,4) = concentration_tt(4) spc(i) = spc_tt n = n + 1 10 continue 100 close(unit=10) 110 format(F13.1,F6.2,F6.2,F6.2,F6.2,2X,A8) count(1) = n fieldname = 'Time' datatype = HE5T_NATIVE_DOUBLE c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 0, count, fieldname, 1datatype, time) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,0,count,' write(*,*)' fieldname,datatype, time)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,0,count,' write(1,*)' fieldname,datatype, time)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' c.....Convert array to 'C' order dimens(1) = 15 dimens(2) = 4 rank = 2 datatype = HE5T_NATIVE_FLOAT c Test Case -- he5_ptfort2c c write(1,27) write(*,*)'Testing he5_ptfort2c ' write(*,*)'=====================' write(1,*)'Testing he5_ptfort2c ' write(1,*)'=====================' status = he5_ptfort2c(dimens, rank, datatype, conc, 1outconc) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptfort2c(dimens,rank,datatype,conc,' write(*,*)' outconc)' write(*,*)' Value returned by he5_ptfort2c ', status write(1,*)' status = he5_ptfort2c(dimens,rank,datatype,conc,' write(1,*)' outconc)' write(1,*)' Value returned by he5_ptfort2c ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'Concentration' c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 0, count, fieldname, 1datatype, outconc) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,0,count,' write(*,*)' fieldname,datatype, outconc)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,0,count,' write(1,*)' fieldname,datatype, outconc)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'Species' datatype = HE5T_NATIVE_CHAR status = he5_ptwritelevel(ptid, 0, count, fieldname, 1datatype, spc) write(*,*) 'Status returned by he5_ptwritelevel(): ',status c Test Case -- he5_ptdetach c write(1,27) write(*,*)'Testing he5_ptdetach ' write(*,*)'=====================' write(1,*)'Testing he5_ptdetach ' write(1,*)'=====================' status = he5_ptdetach(ptid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdetach(ptid)' write(*,*)' Value returned by he5_ptdetach ', status write(1,*)' status = he5_ptdetach(ptid)' write(1,*)' Value returned by he5_ptdetach ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptattach c write(1,27) write(*,*)'Testing he5_ptattach ' write(*,*)'=====================' write(1,*)'Testing he5_ptattach ' write(1,*)'=====================' ptid = he5_ptattach(ptfid, "FixedBuoy Point") if (ptid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptid = he5_ptattach(ptfid, "FixedBuoy Point")' write(*,*)' Value returned by he5_ptattach ', ptid write(1,*)' ptid = he5_ptattach(ptfid, "FixedBuoy Point")' write(1,*)' Value returned by he5_ptattach ', ptid endif write(*,*)' ' write(1,*)' ' c Read FixedBuoy Point c -------------------- open(unit=11, file='fixedBuoy0.txt', status='OLD') n = 0 do 20 i=1,1000 read(11, 210, end=200) desc_tt, lon_tt, lat_tt, date_tt, 1id_tt desc(i) = desc_tt lon(i) = lon_tt lat(i) = lat_tt date(i) = date_tt id(i) = id_tt n = n + 1 20 continue 200 close(unit=11) 210 format(A8,F13.7,F13.7,I7,1X,A8) count(1) = n fieldname = 'Label' datatype = HE5T_NATIVE_CHAR c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 0, count, fieldname, 1datatype, desc) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,0,count,' write(*,*)' fieldname,datatype, desc)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,0,count,' write(1,*)' fieldname,datatype, desc)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'Longitude' datatype = HE5T_NATIVE_DOUBLE c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 0, count, fieldname, 1datatype, lon) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,0,count,' write(*,*)' fieldname,datatype, lon)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,0,count,' write(1,*)' fieldname,datatype, lon)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'Latitude' datatype = HE5T_NATIVE_DOUBLE c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 0, count, fieldname, 1datatype, lat) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,0,count,' write(*,*)' fieldname,datatype, lat)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,0,count,' write(1,*)' fieldname,datatype, lat)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'DeployDate' datatype = HE5T_NATIVE_INT c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 0, count, fieldname, 1datatype, date) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,0,count,' write(*,*)' fieldname,datatype, date)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,0,count,' write(1,*)' fieldname,datatype, date)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'ID' datatype = HE5T_NATIVE_CHAR c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 0, count, fieldname, 1datatype, id) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,0,count,' write(*,*)' fieldname,datatype, id)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,0,count,' write(1,*)' fieldname,datatype, id)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' c Read FixedBuoy Point - Level 1 c ------------------------------ open(unit=12, file='fixedBuoy1.txt', status='OLD') n = 0 do 30 i=1,1000 read(12, 310, end=300) time3_tt, rain_tt, temp_tt, id3_tt time3(i) = time3_tt rain(i) = rain_tt temp(i) = temp_tt id3(i) = id3_tt n = n + 1 30 continue 300 close(unit=12) 310 format(F13.2,F8.1,F8.2,3X,A8) count(1) = n fieldname = 'Time' datatype = HE5T_NATIVE_DOUBLE c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 1, count, fieldname, 1datatype, time3) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,1,count,' write(*,*)' fieldname,datatype, time3)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,1,count,' write(1,*)' fieldname,datatype, time3)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'Rainfall' datatype = HE5T_NATIVE_FLOAT c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 1, count, fieldname, 1datatype, rain) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,1,count,' write(*,*)' fieldname,datatype, rain)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,1,count,' write(1,*)' fieldname,datatype, rain)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'Temperature' datatype = HE5T_NATIVE_FLOAT c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 1, count, fieldname, 1datatype, temp) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,1,count,' write(*,*)' fieldname,datatype, temp)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,1,count,' write(1,*)' fieldname,datatype, temp)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'ID' datatype = HE5T_NATIVE_CHAR c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 1, count, fieldname, 1datatype, id3) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,1,count,' write(*,*)' fieldname,datatype, id3)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,1,count,' write(1,*)' fieldname,datatype, id3)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptwrbckptr c write(1,27) write(*,*)'Testing he5_ptwrbckptr ' write(*,*)'=====================' write(1,*)'Testing he5_ptwrbckptr ' write(1,*)'=====================' status = he5_ptwrbckptr(ptid,1) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwrbckptr(ptid,1)' write(*,*)' Value returned by he5_ptwrbckptr ', status write(1,*)' status = he5_ptwrbckptr(ptid,1)' write(1,*)' Value returned by he5_ptwrbckptr ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptwrfwdptr c write(1,27) write(*,*)'Testing he5_ptwrfwdptr ' write(*,*)'=====================' write(1,*)'Testing he5_ptwrfwdptr ' write(1,*)'=====================' status = he5_ptwrfwdptr(ptid,1) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwrfwdptr(ptid,1)' write(*,*)' Value returned by he5_ptwrfwdptr ', status write(1,*)' status = he5_ptwrfwdptr(ptid,1)' write(1,*)' Value returned by he5_ptwrfwdptr ', status endif write(*,*)' ' write(1,*)' ' c Write attributes to "Fixed Buoy Point" c -------------------------------------- attrname = 'GlobalAttribute_int' ntype = HE5T_NATIVE_INT fortcount(1) = 1 attr = 9999 c Test Case -- he5_ptwriteattr c write(1,27) write(*,*)'Testing he5_ptwriteattr ' write(*,*)'=====================' write(1,*)'Testing he5_ptwriteattr ' write(1,*)'=====================' status = he5_ptwriteattr(ptid,attrname,ntype,fortcount, 1attr) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwriteattr(ptid,attrname,' write(*,*)' ntype,fortcount,attr)' write(*,*)' Value returned by he5_ptwriteattr ', status write(1,*)' status = he5_ptwriteattr(ptid,attrname,' write(1,*)' ntype,fortcount,attr)' write(1,*)' Value returned by he5_ptwriteattr ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptdetach c write(1,27) write(*,*)'Testing he5_ptdetach ' write(*,*)'=====================' write(1,*)'Testing he5_ptdetach ' write(1,*)'=====================' status = he5_ptdetach(ptid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdetach(ptid)' write(*,*)' Value returned by he5_ptdetach ', status write(1,*)' status = he5_ptdetach(ptid)' write(1,*)' Value returned by he5_ptdetach ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptattach c write(1,27) write(*,*)'Testing he5_ptattach ' write(*,*)'=====================' write(1,*)'Testing he5_ptattach ' write(1,*)'=====================' ptid = he5_ptattach(ptfid, "FloatBuoy Point") if (ptid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptid = he5_ptattach(ptfid, "FloatBuoy Point")' write(*,*)' Value returned by he5_ptattach ', ptid write(1,*)' ptid = he5_ptattach(ptfid, "FloatBuoy Point")' write(1,*)' Value returned by he5_ptattach ', ptid endif write(*,*)' ' write(1,*)' ' c Read FloatBuoy Point - Level 0 c ------------------------------ open(unit=14, file='floatBuoy0.txt', status='OLD') n = 0 do 40 i=1,1000 read(14, 410, end=400) desc4_tt, date4_tt, wgt_tt, id4_tt desc4(i) = desc4_tt date4(i) = date4_tt wgt(i) = wgt_tt id4(i) = id4_tt n = n + 1 40 continue 400 close(unit=14) 410 format(A8,I8,I7,2X,A8) count(1) = n fieldname = 'Label' datatype = HE5T_NATIVE_CHAR c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 0, count, fieldname, 1datatype, desc4) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,0,count,' write(*,*)' fieldname,datatype, desc4)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,0,count,' write(1,*)' fieldname,datatype, desc4)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'DeployDate' datatype = HE5T_NATIVE_INT c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 0, count, fieldname, 1datatype, date4) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,0,count,' write(*,*)' fieldname,datatype, date4)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,0,count,' write(1,*)' fieldname,datatype, date4)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'Weight' datatype = HE5T_NATIVE_INT c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 0, count, fieldname, 1datatype, wgt) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,0,count,' write(*,*)' fieldname,datatype, wgt)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,0,count,' write(1,*)' fieldname,datatype, wgt)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'ID' datatype = HE5T_NATIVE_CHAR c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 0, count, fieldname, 1datatype, id4) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,0,count,' write(*,*)' fieldname,datatype, id4)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,0,count,' write(1,*)' fieldname,datatype, id4)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' c Read FixedBuoy Point - Level 1 c ------------------------------ open(unit=15, file='floatBuoy1.txt', status='OLD') n = 0 do 50 i=1,1000 read(15, 510, end=500) time5_tt, lon5_tt, lat5_tt, 1rain5_tt,temp5_tt,id5_tt time5(i) = time5_tt lon5(i) = lon5_tt lat5(i) = lat5_tt rain5(i) = rain5_tt temp5(i) = temp5_tt id5(i) = id5_tt n = n + 1 50 continue 500 close(unit=15) 510 format(F13.1,F13.6,F13.6,F8.1,F8.2,3X,A8) count(1) = n fieldname = 'Time' datatype = HE5T_NATIVE_DOUBLE c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 1, count, fieldname, 1datatype, time5) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,1,count,' write(*,*)' fieldname,datatype, time5)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,1,count,' write(1,*)' fieldname,datatype, time5)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'Longitude' datatype = HE5T_NATIVE_DOUBLE c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 1, count, fieldname, 1datatype, lon5) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,1,count,' write(*,*)' fieldname,datatype, lon5)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,1,count,' write(1,*)' fieldname,datatype, lon5)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'Latitude' datatype = HE5T_NATIVE_DOUBLE c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 1, count, fieldname, 1datatype, lat5) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,1,count,' write(*,*)' fieldname,datatype, lat5)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,1,count,' write(1,*)' fieldname,datatype, lat5)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'Rainfall' datatype = HE5T_NATIVE_FLOAT c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 1, count, fieldname, 1datatype, rain5) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,1,count,' write(*,*)' fieldname,datatype, rain5)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,1,count,' write(1,*)' fieldname,datatype, rain5)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'Temperature' datatype = HE5T_NATIVE_FLOAT c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 1, count, fieldname, 1datatype, temp5) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,1,count,' write(*,*)' fieldname,datatype, temp5)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,1,count,' write(1,*)' fieldname,datatype, temp5)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'ID' datatype = HE5T_NATIVE_CHAR c Test Case -- he5_ptwritelevel c write(1,27) write(*,*)'Testing he5_ptwritelevel ' write(*,*)'========================' write(1,*)'Testing he5_ptwritelevel ' write(1,*)'========================' status = he5_ptwritelevel(ptid, 1, count, fieldname, 1datatype, id5) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelevel(ptid,1,count,' write(*,*)' fieldname,datatype, id5)' write(*,*)' Value returned by he5_ptwritelevel ', status write(1,*)' status = he5_ptwritelevel(ptid,1,count,' write(1,*)' fieldname,datatype, id5)' write(1,*)' Value returned by he5_ptwritelevel ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptwrbckptr c write(*,*)'Testing he5_ptwrbckptr ' write(*,*)'======================' write(1,*)'Testing he5_ptwrbckptr ' write(1,*)'======================' status = he5_ptwrbckptr(ptid,1) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwrbckptr(ptid,1)' write(*,*)' Value returned by he5_ptwrbckptr ', status write(1,*)' status = he5_ptwrbckptr(ptid,1)' write(1,*)' Value returned by he5_ptwrbckptr ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptwrfwdptr c write(*,*)'Testing he5_ptwrfwdptr ' write(*,*)'======================' write(1,*)'Testing he5_ptwrfwdptr ' write(1,*)'======================' status = he5_ptwrfwdptr(ptid,1) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwrfwdptr(ptid,1)' write(*,*)' Value returned by he5_ptwrfwdptr ', status write(1,*)' status = he5_ptwrfwdptr(ptid,1)' write(1,*)' Value returned by he5_ptwrfwdptr ', status endif write(*,*)' ' write(1,*)' ' c Write attributes to "Float Buoy Point" c -------------------------------------- attrname = 'GlobalAttribute_float' ntype = HE5T_NATIVE_FLOAT fortcount(1) = 1 flt = -7.5 c Test Case -- he5_ptwriteattr c write(*,*)'Testing he5_ptwriteattr ' write(*,*)'======================' write(1,*)'Testing he5_ptwriteattr ' write(1,*)'======================' status = he5_ptwriteattr(ptid,attrname, 1ntype,fortcount,flt) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwriteattr(ptid,attrname,' write(*,*)' ntype,fortcount,flt)' write(*,*)' Value returned by he5_ptwriteattr ', status write(1,*)' status = he5_ptwriteattr(ptid,attrname,' write(1,*)' ntype,fortcount,flt)' write(1,*)' Value returned by he5_ptwriteattr ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptdetach c write(1,27) write(*,*)'Testing he5_ptdetach ' write(*,*)'=====================' write(1,*)'Testing he5_ptdetach ' write(1,*)'=====================' status = he5_ptdetach(ptid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdetach(ptid)' write(*,*)' Value returned by he5_ptdetach ', status write(1,*)' status = he5_ptdetach(ptid)' write(1,*)' Value returned by he5_ptdetach ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptclose c write(*,*)'Testing he5_ptclose ' write(*,*)'=====================' write(1,*)'Testing he5_ptclose ' write(1,*)'=====================' status = he5_ptclose(ptfid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptclose(ptfid)' write(*,*)' Value returned by he5_ptclose ', status write(1,*)' status = he5_ptclose(ptfid)' write(1,*)' Value returned by he5_ptclose ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptopen c write(*,*)'Testing he5_ptopen ' write(*,*)'=====================' write(1,*)'Testing he5_ptopen ' write(1,*)'=====================' ptfid = he5_ptopen('point.he5',HE5F_ACC_RDONLY) if (ptfid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptfid= he5_ptopen("point.he5",HE5F_ACC_RDONLY)' write(*,*)' Value returned by he5_ptopen ', ptfid write(1,*)' ptfid= he5_ptopen("point.he5",HE5F_ACC_RDONLY)' write(1,*)' Value returned by he5_ptopen ', ptfid endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptattach c write(1,27) write(*,*)'Testing he5_ptattach ' write(*,*)'=====================' write(1,*)'Testing he5_ptattach ' write(1,*)'=====================' ptid = he5_ptattach(ptfid, "Simple Point") if (ptid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptid = he5_ptattach(ptfid, "Simple Point")' write(*,*)' Value returned by he5_ptattach ', ptid write(1,*)' ptid = he5_ptattach(ptfid, "Simple Point")' write(1,*)' Value returned by he5_ptattach ', ptid endif write(*,*)' ' write(1,*)' ' c Get level information c --------------------- level = 0 c Test Case -- he5_ptlevelinfo c write(*,*)'Testing he5_ptlevelinfo ' write(*,*)'=====================' write(1,*)'Testing he5_ptlevelinfo ' write(1,*)'=====================' status = he5_ptlevelinfo(ptid, level, levelname, rank_tt, 1fieldlist, dim_sizes_tt, datasize, offset_tt, dtype_tt) if (ptfid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status=he5_ptlevelinfo(ptid,level,levelname,' write(*,*)' rank_tt,fieldlist,dim_sizes_tt,' write(*,*)' datasize,offset_tt,dtype_tt)' write(*,*)' Value returned by he5_ptlevelinfo ', status write(1,*)' status=he5_ptlevelinfo(ptid,level,levelname,' write(1,*)' rank_tt,fieldlist,dim_sizes_tt,' write(1,*)' datasize,offset_tt,dtype_tt)' write(1,*)' Value returned by he5_ptlevelinfo ', status endif write(*,*)' ' write(1,*)' ' c Get the number of records in level c ---------------------------------- level = 0 c Test Case -- he5_ptnrecs c write(*,*)'Testing he5_ptnrecs ' write(*,*)'=====================' write(1,*)'Testing he5_ptnrecs ' write(1,*)'=====================' nrecs = he5_ptnrecs(ptid, level) if (nrecs .le. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' nrecs = he5_ptnrecs(ptid, level)' write(*,*)' Value returned by he5_ptnrecs ', nrecs write(1,*)' nrecs = he5_ptnrecs(ptid, level)' write(1,*)' Value returned by he5_ptnrecs ', nrecs endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptnlevels c write(*,*)'Testing he5_ptnlevels ' write(*,*)'=====================' write(1,*)'Testing he5_ptnlevels ' write(1,*)'=====================' nlevels = he5_ptnlevels(ptid) if (nlevels .le. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' nlevels = he5_ptnlevels(ptid)' write(*,*)' Value returned by he5_ptnlevels ', nlevels write(1,*)' nlevels = he5_ptnlevels(ptid)' write(1,*)' Value returned by he5_ptnlevels ', nlevels endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptnfields c write(*,*)'Testing he5_ptnfields ' write(*,*)'=====================' write(1,*)'Testing he5_ptnfields ' write(1,*)'=====================' nflds = he5_ptnfields(ptid, level, fieldlist, strbufsize) if (nflds .le. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' nflds = he5_ptnfields(ptid, level,' write(*,*)' fieldlist, strbufsize)' write(*,*)' Value returned by he5_ptnfields ', nflds write(1,*)' nflds = he5_ptnfields(ptid, level,' write(1,*)' fieldlist, strbufsize)' write(1,*)' Value returned by he5_ptnfields ', nflds endif write(*,*)' ' write(1,*)' ' c Populate input information structure c ------------------------------------ dtype(1) = HE5T_NATIVE_DOUBLE dtype(2) = HE5T_NATIVE_FLOAT dtype(3) = HE5T_NATIVE_CHAR c Read the level data and print out c --------------------------------- fieldname3(1) = 'Time' c Test Case -- he5_ptreadlevel c write(*,*)'Testing he5_ptreadlevel ' write(*,*)'=====================' write(1,*)'Testing he5_ptreadlevel ' write(1,*)'=====================' status = he5_ptreadlevel(ptid, 0, fieldname3(1), 1dtype(1), time) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptreadlevel(ptid, 0, fieldname3(1),' write(*,*)' dtype(1), time)' write(*,*)' Value returned by he5_ptreadlevel ', status write(1,*)' status = he5_ptreadlevel(ptid, 0, fieldname3(1),' write(1,*)' dtype(1), time)' write(1,*)' Value returned by he5_ptreadlevel ', status endif write(*,*)' ' write(1,*)' ' fieldname3(2) = 'Concentration' c Test Case -- he5_ptreadlevel c write(*,*)'Testing he5_ptreadlevel ' write(*,*)'=====================' write(1,*)'Testing he5_ptreadlevel ' write(1,*)'=====================' status = he5_ptreadlevel(ptid, 0, fieldname3(2), 1dtype(2), con) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptreadlevel(ptid, 0, fieldname3(2),' write(*,*)' dtype(2), con)' write(*,*)' Value returned by he5_ptreadlevel ', status write(1,*)' status = he5_ptreadlevel(ptid, 0, fieldname3(2),' write(1,*)' dtype(2), con)' write(1,*)' Value returned by he5_ptreadlevel ', status endif write(*,*)' ' write(1,*)' ' c Convert 'C' array to Fortran order c ---------------------------------- dimens(1) = 15 dimens(2) = 4 arr_rank = 2 datatype = HE5T_NATIVE_FLOAT ccc status = he5_ptc2fort(dimens, arr_rank, datatype, con, ccc 1outcon) ccc write(*,*) 'Status returned by he5_ptc2fort(): ',status c Test Case -- he5_ptc2fort c write(1,27) write(*,*)'Testing he5_ptc2fort ' write(*,*)'=====================' write(1,*)'Testing he5_ptc2fort ' write(1,*)'=====================' status = he5_ptc2fort(dimens, arr_rank, datatype, con, 1outcon) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptc2fort(dimens,arr_rank,' write(*,*)' datatype,con,outcon)' write(*,*)' Value returned by he5_ptc2fort ', status write(1,*)' status = he5_ptc2fort(dimens,arr_rank,' write(1,*)' datatype,con,outcon)' write(1,*)' Value returned by he5_ptc2fort ', status endif write(*,*)' ' write(1,*)' ' fieldname3(3) = 'Species' c Test Case -- he5_ptreadlevel c write(*,*)'Testing he5_ptreadlevel ' write(*,*)'=====================' write(1,*)'Testing he5_ptreadlevel ' write(1,*)'=====================' status = he5_ptreadlevel(ptid, 0, fieldname3(3), 1dtype(3), spec) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptreadlevel(ptid, 0, fieldname3(3),' write(*,*)' dtype(3), spec)' write(*,*)' Value returned by he5_ptreadlevel ', status write(1,*)' status = he5_ptreadlevel(ptid, 0, fieldname3(3),' write(1,*)' dtype(3), spec)' write(1,*)' Value returned by he5_ptreadlevel ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptdetach c write(1,27) write(*,*)'Testing he5_ptdetach ' write(*,*)'=====================' write(1,*)'Testing he5_ptdetach ' write(1,*)'=====================' status = he5_ptdetach(ptid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdetach(ptid)' write(*,*)' Value returned by he5_ptdetach ', status write(1,*)' status = he5_ptdetach(ptid)' write(1,*)' Value returned by he5_ptdetach ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptattach c write(1,27) write(*,*)'Testing he5_ptattach ' write(*,*)'=====================' write(1,*)'Testing he5_ptattach ' write(1,*)'=====================' ptid = he5_ptattach(ptfid, "FixedBuoy Point") if (ptid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptid = he5_ptattach(ptfid, "FixedBuoy Point")' write(*,*)' Value returned by he5_ptattach ', ptid write(1,*)' ptid = he5_ptattach(ptfid, "FixedBuoy Point")' write(1,*)' Value returned by he5_ptattach ', ptid endif write(*,*)' ' write(1,*)' ' attrname = 'GlobalAttribute_int' nattr = he5_ptinqattrs(ptid,attrlist,strbufsize) c Test Case -- he5_ptinqattrs c write(*,*)'Testing he5_ptinqattrs ' write(*,*)'======================' write(1,*)'Testing he5_ptinqattrs ' write(1,*)'======================' nattr = he5_ptinqattrs(ptid,attrlist,strbufsize) if (nattr .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' nattr = he5_ptinqattrs(ptid,attrlist,strbufsize)' write(*,*)' Value returned by he5_ptinqattrs ', nattr write(1,*)' nattr = he5_ptinqattrs(ptid,attrlist,strbufsize)' write(1,*)' Value returned by he5_ptinqattrs ', nattr endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptreadattr c write(*,*)'Testing he5_ptreadattr ' write(*,*)'======================' write(1,*)'Testing he5_ptreadattr ' write(1,*)'======================' status = he5_ptreadattr(ptid,attrname,attr) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptreadattr(ptid,attrname,attr)' write(*,*)' Value returned by he5_ptreadattr ', nattr write(1,*)' status = he5_ptreadattr(ptid,attrname,attr)' write(1,*)' Value returned by he5_ptreadattr ', nattr endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptdetach c write(1,27) write(*,*)'Testing he5_ptdetach ' write(*,*)'=====================' write(1,*)'Testing he5_ptdetach ' write(1,*)'=====================' status = he5_ptdetach(ptid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdetach(ptid)' write(*,*)' Value returned by he5_ptdetach ', status write(1,*)' status = he5_ptdetach(ptid)' write(1,*)' Value returned by he5_ptdetach ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptclose c write(*,*)'Testing he5_ptclose ' write(*,*)'=====================' write(1,*)'Testing he5_ptclose ' write(1,*)'=====================' status = he5_ptclose(ptfid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptclose(ptfid)' write(*,*)' Value returned by he5_ptclose ', status write(1,*)' status = he5_ptclose(ptfid)' write(1,*)' Value returned by he5_ptclose ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptopen c write(*,*)'Testing he5_ptopen ' write(*,*)'=====================' write(1,*)'Testing he5_ptopen ' write(1,*)'=====================' ptfid = he5_ptopen('point.he5',HE5F_ACC_RDWR) if (ptfid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptfid= he5_ptopen("point.he5",HE5F_ACC_RDWR)' write(*,*)' Value returned by he5_ptopen ', ptfid write(1,*)' ptfid= he5_ptopen("point.he5",HE5F_ACC_RDWR)' write(1,*)' Value returned by he5_ptopen ', ptfid endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptattach c write(1,27) write(*,*)'Testing he5_ptattach ' write(*,*)'=====================' write(1,*)'Testing he5_ptattach ' write(1,*)'=====================' ptid = he5_ptattach(ptfid, "Simple Point") if (ptid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptid = he5_ptattach(ptfid, "Simple Point")' write(*,*)' Value returned by he5_ptattach ', ptid write(1,*)' ptid = he5_ptattach(ptfid, "Simple Point")' write(1,*)' Value returned by he5_ptattach ', ptid endif write(*,*)' ' write(1,*)' ' dtype(1) = HE5T_NATIVE_DOUBLE dtype(2) = HE5T_NATIVE_FLOAT dtype(3) = HE5T_NATIVE_CHAR nrec = 1 recs(1) = 0 level = 0 fieldname = 'Concentration' conc_tt(1) = 1.11 conc_tt(2) = 2.22 conc_tt(3) = 3.33 conc_tt(4) = 4.44 c Test Case -- he5_ptupdatelevel c write(*,*)'Testing he5_ptupdatelevel ' write(*,*)'=========================' write(1,*)'Testing he5_ptupdatelevel ' write(1,*)'=========================' status = he5_ptupdatelevel(ptid, level, fieldname, nrec, 1recs, dtype(2), conc_tt) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptupdatelevel(ptid, level,' write(*,*)' fieldname, nrec, recs,' write(*,*)' dtype(2), conc_tt)' write(*,*)' Value returned by he5_ptupdatelevel ', status write(1,*)' status = he5_ptupdatelevel(ptid, level,' write(1,*)' fieldname, nrec, recs,' write(1,*)' dtype(2), conc_tt)' write(1,*)' Value returned by he5_ptupdatelevel ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'Time' time_tt = 13131313.0 c Test Case -- he5_ptupdatelevel c write(*,*)'Testing he5_ptupdatelevel ' write(*,*)'=========================' write(1,*)'Testing he5_ptupdatelevel ' write(1,*)'=========================' status = he5_ptupdatelevel(ptid, level, fieldname, nrec, 1recs, dtype(1), time_tt) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptupdatelevel(ptid, level,' write(*,*)' fieldname, nrec, recs,' write(*,*)' dtype(1), time_tt)' write(*,*)' Value returned by he5_ptupdatelevel ', status write(1,*)' status = he5_ptupdatelevel(ptid, level,' write(1,*)' fieldname, nrec, recs,' write(1,*)' dtype(1), time_tt)' write(1,*)' Value returned by he5_ptupdatelevel ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'Species' spc_tt = 'AM' c Test Case -- he5_ptupdatelevel c write(*,*)'Testing he5_ptupdatelevel ' write(*,*)'=========================' write(1,*)'Testing he5_ptupdatelevel ' write(1,*)'=========================' status = he5_ptupdatelevel(ptid, level, fieldname, nrec, 1recs, dtype(3), spc_tt) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptupdatelevel(ptid, level,' write(*,*)' fieldname, nrec, recs,' write(*,*)' dtype(3), spc_tt)' write(*,*)' Value returned by he5_ptupdatelevel ', status write(1,*)' status = he5_ptupdatelevel(ptid, level,' write(1,*)' fieldname, nrec, recs,' write(1,*)' dtype(3), spc_tt)' write(1,*)' Value returned by he5_ptupdatelevel ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptdetach c write(1,27) write(*,*)'Testing he5_ptdetach ' write(*,*)'=====================' write(1,*)'Testing he5_ptdetach ' write(1,*)'=====================' status = he5_ptdetach(ptid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdetach(ptid)' write(*,*)' Value returned by he5_ptdetach ', status write(1,*)' status = he5_ptdetach(ptid)' write(1,*)' Value returned by he5_ptdetach ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptclose c write(*,*)'Testing he5_ptclose ' write(*,*)'=====================' write(1,*)'Testing he5_ptclose ' write(1,*)'=====================' status = he5_ptclose(ptfid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptclose(ptfid)' write(*,*)' Value returned by he5_ptclose ', status write(1,*)' status = he5_ptclose(ptfid)' write(1,*)' Value returned by he5_ptclose ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptopen c write(*,*)'Testing he5_ptopen ' write(*,*)'=====================' write(1,*)'Testing he5_ptopen ' write(1,*)'=====================' ptfid = he5_ptopen('point.he5',HE5F_ACC_RDWR) if (ptfid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptfid= he5_ptopen("point.he5",HE5F_ACC_RDWR)' write(*,*)' Value returned by he5_ptopen ', ptfid write(1,*)' ptfid= he5_ptopen("point.he5",HE5F_ACC_RDWR)' write(1,*)' Value returned by he5_ptopen ', ptfid endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptattach c write(1,27) write(*,*)'Testing he5_ptattach ' write(*,*)'=====================' write(1,*)'Testing he5_ptattach ' write(1,*)'=====================' ptid = he5_ptattach(ptfid, "FixedBuoy Point") if (ptid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptid = he5_ptattach(ptfid, "FixedBuoy Point")' write(*,*)' Value returned by he5_ptattach ', ptid write(1,*)' ptid = he5_ptattach(ptfid, "FixedBuoy Point")' write(1,*)' Value returned by he5_ptattach ', ptid endif write(*,*)' ' write(1,*)' ' c Write attributes to "Fixed Buoy Point" c -------------------------------------- attrname = 'GlobalAttribute_int' ntype = HE5T_NATIVE_INT fortcount(1) = 1 attr = 9999 c Test Case -- he5_ptwriteattr c write(*,*)'Testing he5_ptwriteattr ' write(*,*)'=======================' write(1,*)'Testing he5_ptwriteattr ' write(1,*)'=======================' status = he5_ptwriteattr(ptid,attrname,ntype,fortcount, 1attr) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwriteattr(ptid,attrname,' write(*,*)' ntype,fortcount,attr)' write(*,*)' Value returned by he5_ptwriteattr ', status write(1,*)' status = he5_ptwriteattr(ptid,attrname,' write(1,*)' ntype,fortcount,attr)' write(1,*)' Value returned by he5_ptwriteattr ', status endif write(*,*)' ' write(1,*)' ' attrname = 'GroupAttribute' ntype = HE5T_NATIVE_INT fortcount(1) = 5 attr1(1) = 1 attr1(2) = 2 attr1(3) = 3 attr1(4) = 4 attr1(5) = 5 c Test Case -- he5_ptwritegrpattr c write(*,*)'Testing he5_ptwritegrpattr ' write(*,*)'==========================' write(1,*)'Testing he5_ptwritegrpattr ' write(1,*)'==========================' status = he5_ptwritegrpattr(ptid,attrname,ntype,fortcount, 1attr1) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritegrpattr(ptid,attrname,' write(*,*)' ntype,fortcount,attr1)' write(*,*)' Value returned by he5_ptclose ', status write(1,*)' status = he5_ptwritegrpattr(ptid,attrname,' write(1,*)' ntype,fortcount,attr1)' write(1,*)' Value returned by he5_ptclose ', status endif write(*,*)' ' write(1,*)' ' levelname = 'Observations' attrname = 'LocalAttribute' ntype = HE5T_NATIVE_INT fortcount(1) = 5 attr2(1) = 10 attr2(2) = 20 attr2(3) = 30 attr2(4) = 40 attr2(5) = 50 c Test Case -- he5_ptwritelocattr c write(*,*)'Testing he5_ptwritelocattr ' write(*,*)'==========================' write(1,*)'Testing he5_ptwritelocattr ' write(1,*)'==========================' status = he5_ptwritelocattr(ptid,levelname,attrname, 1ntype,fortcount,attr2) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwritelocattr(ptid,' write(*,*)' levelname,attrname,ntype,' write(*,*)' fortcount,attr2)' write(*,*)' Value returned by he5_ptwritelocattr ', status write(1,*)' status = he5_ptwritelocattr(ptid,' write(1,*)' levelname,attrname,ntype,' write(1,*)' fortcount,attr2)' write(1,*)' Value returned by he5_ptwritelocattr ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptdetach c write(1,27) write(*,*)'Testing he5_ptdetach ' write(*,*)'=====================' write(1,*)'Testing he5_ptdetach ' write(1,*)'=====================' status = he5_ptdetach(ptid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdetach(ptid)' write(*,*)' Value returned by he5_ptdetach ', status write(1,*)' status = he5_ptdetach(ptid)' write(1,*)' Value returned by he5_ptdetach ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptattach c write(1,27) write(*,*)'Testing he5_ptattach ' write(*,*)'=====================' write(1,*)'Testing he5_ptattach ' write(1,*)'=====================' ptid = he5_ptattach(ptfid, "FixedBuoy Point") if (ptid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptid = he5_ptattach(ptfid, "FixedBuoy Point")' write(*,*)' Value returned by he5_ptattach ', ptid write(1,*)' ptid = he5_ptattach(ptfid, "FixedBuoy Point")' write(1,*)' Value returned by he5_ptattach ', ptid endif write(*,*)' ' write(1,*)' ' attrname = 'GlobalAttribute_float' ntype = HE5T_NATIVE_FLOAT fortcount(1) = 1 flt = -7.5 c Test Case -- he5_ptwriteattr c write(*,*)'Testing he5_ptwriteattr ' write(*,*)'=======================' write(1,*)'Testing he5_ptwriteattr ' write(1,*)'=======================' status = he5_ptwriteattr(ptid,attrname, 1ntype,fortcount,flt) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptwriteattr(ptid,attrname,' write(*,*)' ntype,fortcount,flt)' write(*,*)' Value returned by he5_ptwriteattr ', status write(1,*)' status = he5_ptwriteattr(ptid,attrname,' write(1,*)' ntype,fortcount,flt)' write(1,*)' Value returned by he5_ptwriteattr ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptdetach c write(1,27) write(*,*)'Testing he5_ptdetach ' write(*,*)'=====================' write(1,*)'Testing he5_ptdetach ' write(1,*)'=====================' status = he5_ptdetach(ptid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdetach(ptid)' write(*,*)' Value returned by he5_ptdetach ', status write(1,*)' status = he5_ptdetach(ptid)' write(1,*)' Value returned by he5_ptdetach ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptclose c write(*,*)'Testing he5_ptclose ' write(*,*)'=====================' write(1,*)'Testing he5_ptclose ' write(1,*)'=====================' status = he5_ptclose(ptfid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptclose(ptfid)' write(*,*)' Value returned by he5_ptclose ', status write(1,*)' status = he5_ptclose(ptfid)' write(1,*)' Value returned by he5_ptclose ', status endif write(*,*)' ' write(1,*)' ' null_char_0 = '0' c Test Case -- he5_ptopen c write(*,*)'Testing he5_ptopen ' write(*,*)'=====================' write(1,*)'Testing he5_ptopen ' write(1,*)'=====================' ptfid = he5_ptopen('point.he5',HE5F_ACC_RDONLY) if (ptfid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptfid= he5_ptopen("point.he5",HE5F_ACC_RDONLY)' write(*,*)' Value returned by he5_ptopen ', ptfid write(1,*)' ptfid= he5_ptopen("point.he5",HE5F_ACC_RDONLY)' write(1,*)' Value returned by he5_ptopen ', ptfid endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptattach c write(1,27) write(*,*)'Testing he5_ptattach ' write(*,*)'=====================' write(1,*)'Testing he5_ptattach ' write(1,*)'=====================' ptid = he5_ptattach(ptfid, "FixedBuoy Point") if (ptid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptid = he5_ptattach(ptfid, "FixedBuoy Point")' write(*,*)' Value returned by he5_ptattach ', ptid write(1,*)' ptid = he5_ptattach(ptfid, "FixedBuoy Point")' write(1,*)' Value returned by he5_ptattach ', ptid endif write(*,*)' ' write(1,*)' ' c Global Attributes c ----------------- attrname = 'GlobalAttribute_int' print *,'Global Attribute: ' c Test Case -- he5_ptreadattr c write(*,*)'Testing he5_ptreadattr ' write(*,*)'======================' write(1,*)'Testing he5_ptreadattr ' write(1,*)'======================' status = he5_ptreadattr(ptid,attrname,attr) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptreadattr(ptid,attrname,attr)' write(*,*)' Value returned by he5_ptreadattr ', status write(1,*)' status = he5_ptreadattr(ptid,attrname,attr)' write(1,*)' Value returned by he5_ptreadattr ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptinqattrs c write(*,*)'Testing he5_ptinqattrs ' write(*,*)'======================' write(1,*)'Testing he5_ptinqattrs ' write(1,*)'======================' nattr = he5_ptinqattrs(ptid,null_char_0,strbufsize) if (nattr .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' nattr = he5_ptinqattrs(ptid,' write(*,*)' null_char_0,strbufsize)' write(*,*)' Value returned by he5_ptinqattrs ', nattr write(1,*)' nattr = he5_ptinqattrs(ptid,' write(1,*)' null_char_0,strbufsize)' write(1,*)' Value returned by he5_ptinqattrs ', nattr endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptinqattrs c write(*,*)'Testing he5_ptinqattrs ' write(*,*)'======================' write(1,*)'Testing he5_ptinqattrs ' write(1,*)'======================' nattr = he5_ptinqattrs(ptid,attrlist,strbufsize) if (nattr .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' nattr = he5_ptinqattrs(ptid,attrlist,strbufsize)' write(*,*)' Value returned by he5_ptinqattrs ', nattr write(1,*)' nattr = he5_ptinqattrs(ptid,attrlist,strbufsize)' write(1,*)' Value returned by he5_ptinqattrs ', nattr endif write(*,*)' ' write(1,*)' ' attrname = 'GlobalAttribute_int' c Test Case -- he5_ptattrinfo c write(*,*)'Testing he5_ptattrinfo ' write(*,*)'======================' write(1,*)'Testing he5_ptattrinfo ' write(1,*)'======================' status = he5_ptattrinfo(ptid,attrname,ntype,sz) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptattrinfo(ptid,attrname,ntype,sz)' write(*,*)' Value returned by he5_ptattrinfo ', status write(1,*)' status = he5_ptattrinfo(ptid,attrname,ntype,sz)' write(1,*)' Value returned by he5_ptattrinfo ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptattrinfo c write(*,*)'Testing he5_ptattrinfo ' write(*,*)'======================' write(1,*)'Testing he5_ptattrinfo ' write(1,*)'======================' status = he5_ptattrinfo(ptid,attrname,ntype,sz) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptattrinfo(ptid,attrname,ntype,sz)' write(*,*)' Value returned by he5_ptattrinfo ', status write(1,*)' status = he5_ptattrinfo(ptid,attrname,ntype,sz)' write(1,*)' Value returned by he5_ptattrinfo ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptreadattr c write(*,*)'Testing he5_ptreadattr ' write(*,*)'======================' write(1,*)'Testing he5_ptreadattr ' write(1,*)'======================' status = he5_ptreadattr(ptid,attrname,flt) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptreadattr(ptid,attrname,flt)' write(*,*)' Value returned by he5_ptreadattr ', status write(1,*)' status = he5_ptreadattr(ptid,attrname,flt)' write(1,*)' Value returned by he5_ptreadattr ', status endif write(*,*)' ' write(1,*)' ' attrname = 'GroupAttribute' c Test Case -- he5_ptreadgrpattr c write(*,*)'Testing he5_ptreadgrpattr' write(*,*)'=========================' write(1,*)'Testing he5_ptreadgrpattr' write(1,*)'=========================' status = he5_ptreadgrpattr(ptid,attrname,attr1) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptreadgrpattr(ptid,attrname,attr1)' write(*,*)' Value returned by he5_ptreadgrpattr ', status write(1,*)' status = he5_ptreadgrpattr(ptid,attrname,attr1)' write(1,*)' Value returned by he5_ptreadgrpattr ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptinqgrpattrs c write(*,*)'Testing he5_ptinqgrpattrs ' write(*,*)'=========================' write(1,*)'Testing he5_ptinqgrpattrs ' write(1,*)'=========================' nattr = he5_ptinqgrpattrs(ptid,null_char_0,strbufsize) if (nattr .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' nattr = he5_ptinqgrpattrs(ptid,' write(*,*)' null_char_0,strbufsize)' write(*,*)' Value returned by he5_ptinqgrpattrs ', nattr write(1,*)' nattr = he5_ptinqgrpattrs(ptid,' write(1,*)' null_char_0,strbufsize)' write(1,*)' Value returned by he5_ptinqgrpattrs ', nattr endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptinqgrpattrs c write(*,*)'Testing he5_ptinqgrpattrs ' write(*,*)'=========================' write(1,*)'Testing he5_ptinqgrpattrs ' write(1,*)'=========================' nattr = he5_ptinqgrpattrs(ptid,attrlist,strbufsize) if (nattr .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' nattr = he5_ptinqgrpattrs(ptid,' write(*,*)' attrlist,strbufsize)' write(*,*)' Value returned by he5_ptinqgrpattrs ', status write(1,*)' nattr = he5_ptinqgrpattrs(ptid,' write(1,*)' attrlist,strbufsize)' write(1,*)' Value returned by he5_ptinqgrpattrs ', status endif write(*,*)' ' write(1,*)' ' attrname = 'GroupAttribute' c Test Case -- he5_ptgrpattrinfo c write(*,*)'Testing he5_ptgrpattrinfo ' write(*,*)'=========================' write(1,*)'Testing he5_ptgrpattrinfo ' write(1,*)'=========================' status = he5_ptgrpattrinfo(ptid,attrname,ntype,sz) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptgrpattrinfo(ptid,' write(*,*)' attrname,ntype,sz)' write(*,*)' Value returned by he5_ptgrpattrinfo ', status write(1,*)' status = he5_ptgrpattrinfo(ptid,' write(1,*)' attrname,ntype,sz)' write(1,*)' Value returned by he5_ptgrpattrinfo ', status endif write(*,*)' ' write(1,*)' ' attrname = 'LocalAttribute' levelname = 'Observations' c Test Case -- he5_ptreadlocattr c write(*,*)'Testing he5_ptreadlocattr ' write(*,*)'=========================' write(1,*)'Testing he5_ptreadlocattr ' write(1,*)'=========================' status = he5_ptreadlocattr(ptid,levelname,attrname,attr2) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptreadlocattr(ptid,' write(*,*)' levelname,attrname,attr2)' write(*,*)' Value returned by he5_ptreadlocattr ', status write(1,*)' status = he5_ptreadlocattr(ptid,' write(1,*)' levelname,attrname,attr2)' write(1,*)' Value returned by he5_ptreadlocattr ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptinqlocattrs c write(*,*)'Testing he5_ptinqlocattrs ' write(*,*)'=========================' write(1,*)'Testing he5_ptinqlocattrs ' write(1,*)'=========================' nattr = he5_ptinqlocattrs(ptid,levelname,null_char_0,strbufsize) if (nattr .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' nattr = he5_ptinqlocattrs(ptid,' write(*,*)' levelname,null_char_0,strbufsize)' write(*,*)' Value returned by he5_ptinqlocattrs ', nattr write(1,*)' nattr = he5_ptinqlocattrs(ptid,' write(1,*)' levelname,null_char_0,strbufsize)' write(1,*)' Value returned by he5_ptinqlocattrs ', nattr endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptinqlocattrs c write(*,*)'Testing he5_ptinqlocattrs ' write(*,*)'=====================' write(1,*)'Testing he5_ptinqlocattrs ' write(1,*)'=====================' nattr = he5_ptinqlocattrs(ptid,levelname,attrlist,strbufsize) if (nattr .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' nattr = he5_ptinqlocattrs(ptid,' write(*,*)' levelname,attrlist,strbufsize)' write(*,*)' Value returned by he5_ptinqlocattrs ', nattr write(1,*)' nattr = he5_ptinqlocattrs(ptid,' write(1,*)' levelname,attrlist,strbufsize)' write(1,*)' Value returned by he5_ptinqlocattrs ', nattr endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptlocattrinfo c write(*,*)'Testing he5_ptlocattrinfo ' write(*,*)'=========================' write(1,*)'Testing he5_ptlocattrinfo ' write(1,*)'=========================' status = he5_ptlocattrinfo(ptid,levelname,attrname,ntype,sz) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptlocattrinfo(ptid,' write(*,*)' levelname,attrname,ntype,sz)' write(*,*)' Value returned by he5_ptlocattrinfo ', status write(1,*)' status = he5_ptlocattrinfo(ptid,' write(1,*)' levelname,attrname,ntype,sz)' write(1,*)' Value returned by he5_ptlocattrinfo ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptdetach c write(1,27) write(*,*)'Testing he5_ptdetach ' write(*,*)'=====================' write(1,*)'Testing he5_ptdetach ' write(1,*)'=====================' status = he5_ptdetach(ptid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdetach(ptid)' write(*,*)' Value returned by he5_ptdetach ', status write(1,*)' status = he5_ptdetach(ptid)' write(1,*)' Value returned by he5_ptdetach ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptclose c write(*,*)'Testing he5_ptclose ' write(*,*)'=====================' write(1,*)'Testing he5_ptclose ' write(1,*)'=====================' status = he5_ptclose(ptfid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptclose(ptfid)' write(*,*)' Value returned by he5_ptclose ', status write(1,*)' status = he5_ptclose(ptfid)' write(1,*)' Value returned by he5_ptclose ', status endif write(*,*)' ' write(1,*)' ' null_char_0 = '0' c Test Case -- he5_ptopen c write(*,*)'Testing he5_ptopen ' write(*,*)'=====================' write(1,*)'Testing he5_ptopen ' write(1,*)'=====================' ptfid = he5_ptopen('point.he5',HE5F_ACC_RDONLY) if (ptfid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptfid= he5_ptopen("point.he5",HE5F_ACC_RDONLY)' write(*,*)' Value returned by he5_ptopen ', ptfid write(1,*)' ptfid= he5_ptopen("point.he5",HE5F_ACC_RDONLY)' write(1,*)' Value returned by he5_ptopen ', ptfid endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptattach c write(1,27) write(*,*)'Testing he5_ptattach ' write(*,*)'=====================' write(1,*)'Testing he5_ptattach ' write(1,*)'=====================' ptid = he5_ptattach(ptfid, "FixedBuoy Point") if (ptid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' ptid = he5_ptattach(ptfid, "FixedBuoy Point")' write(*,*)' Value returned by he5_ptattach ', ptid write(1,*)' ptid = he5_ptattach(ptfid, "FixedBuoy Point")' write(1,*)' Value returned by he5_ptattach ', ptid endif write(*,*)' ' write(1,*)' ' fieldgroup = HE5_HDFE_DATAGROUP fieldname = 'Observations' c Test Case -- he5_ptinqdatatype c write(*,*)'Testing he5_ptinqdatatype ' write(*,*)'=========================' write(1,*)'Testing he5_ptinqdatatype ' write(1,*)'=========================' status = he5_ptinqdatatype(ptid,fieldname,null_char_0,fieldgroup, 1datatype,classid,order,size) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptinqdatatype(ptid,fieldname,' write(*,*)' null_char_0,fieldgroup,datatype,classid,' write(*,*)' order,size)' write(*,*)' Value returned by he5_ptinqdatatype ', status write(1,*)' status = he5_ptinqdatatype(ptid,fieldname,' write(1,*)' null_char_0,fieldgroup,datatype,classid,' write(1,*)' order,size)' write(1,*)' Value returned by he5_ptinqdatatype ', status endif write(*,*)' ' write(1,*)' ' fieldgroup = HE5_HDFE_ATTRGROUP attrname = 'GlobalAttribute_int' c Test Case -- he5_ptinqdatatype c write(*,*)'Testing he5_ptinqdatatype ' write(*,*)'=========================' write(1,*)'Testing he5_ptinqdatatype ' write(1,*)'=========================' status = he5_ptinqdatatype(ptid,null_char_0,attrname,fieldgroup, 1datatype,classid,order,size) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptinqdatatype(ptid,null_char_0,' write(*,*)' attrname,fieldgroup,datatype,' write(*,*)' classid,order,size)' write(*,*)' Value returned by he5_ptinqdatatype ', status write(1,*)' status = he5_ptinqdatatype(ptid,null_char_0,' write(1,*)' attrname,fieldgroup,datatype,' write(1,*)' classid,order,size)' write(1,*)' Value returned by he5_ptinqdatatype ', status endif write(*,*)' ' write(1,*)' ' fieldgroup = HE5_HDFE_GRPATTRGROUP attrname = 'GroupAttribute' c Test Case -- he5_ptinqdatatype c write(*,*)'Testing he5_ptinqdatatype ' write(*,*)'=========================' write(1,*)'Testing he5_ptinqdatatype ' write(1,*)'=========================' status = he5_ptinqdatatype(ptid,null_char_0,attrname,fieldgroup, 1datatype,classid,order,size) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptinqdatatype(ptid,null_char_0,' write(*,*)' attrname,fieldgroup,datatype,' write(*,*)' classid,order,size)' write(*,*)' Value returned by he5_ptinqdatatype ', status write(1,*)' status = he5_ptinqdatatype(ptid,null_char_0,' write(1,*)' attrname,fieldgroup,datatype,' write(1,*)' classid,order,size)' write(1,*)' Value returned by he5_ptinqdatatype ', status endif write(*,*)' ' write(1,*)' ' fieldname = 'Observations' fieldgroup = HE5_HDFE_LOCATTRGROUP attrname = 'LocalAttribute' c Test Case -- he5_ptinqdatatype c write(*,*)'Testing he5_ptinqdatatype ' write(*,*)'=========================' write(1,*)'Testing he5_ptinqdatatype ' write(1,*)'=========================' status = he5_ptinqdatatype(ptid,fieldname,attrname,fieldgroup, 1datatype,classid,order,size) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptinqdatatype(ptid,fieldname,' write(*,*)' attrname,fieldgroup,datatype,' write(*,*)' classid,order,size)' write(*,*)' Value returned by he5_ptinqdatatype ', status write(1,*)' status = he5_ptinqdatatype(ptid,fieldname,' write(1,*)' attrname,fieldgroup,datatype,' write(1,*)' classid,order,size)' write(1,*)' Value returned by he5_ptinqdatatype ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptdetach c write(1,27) write(*,*)'Testing he5_ptdetach ' write(*,*)'=====================' write(1,*)'Testing he5_ptdetach ' write(1,*)'=====================' status = he5_ptdetach(ptid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptdetach(ptid)' write(*,*)' Value returned by he5_ptdetach ', status write(1,*)' status = he5_ptdetach(ptid)' write(1,*)' Value returned by he5_ptdetach ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_ptclose c write(*,*)'Testing he5_ptclose ' write(*,*)'=====================' write(1,*)'Testing he5_ptclose ' write(1,*)'=====================' status = he5_ptclose(ptfid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status = he5_ptclose(ptfid)' write(*,*)' Value returned by he5_ptclose ', status write(1,*)' status = he5_ptclose(ptfid)' write(1,*)' Value returned by he5_ptclose ', status endif write(*,*)' ' write(1,*)' ' close(unit=1) 27 format(' ') 230 format('********Error unexpected**********') 240 format('***********Passed Test*********') stop end hdf-eos5-2.0/testdrivers/swath/000077500000000000000000000000001507520047200164735ustar00rootroot00000000000000hdf-eos5-2.0/testdrivers/swath/Makefile.am000066400000000000000000000020771507520047200205350ustar00rootroot00000000000000# testdrivers/swath Makefile.am # Boilerplate definitions include $(top_srcdir)/config/include.am EXTRA_DIST = hdfeos5.inc hdfeos5_64.inc # Link against HDF-EOS5 library AM_CPPFLAGS=-I$(top_srcdir)/include LDADD=$(LIBHDFEOS5) $(LIBGCTP) # Build TestSwath from TestSwath.c check_PROGRAMS = TestSwath if F2CFORTRAN_CONDITIONAL if F2CFORTRAN_32PTR_CONDITIONAL check_PROGRAMS += testswath32 testswath32_SOURCES = testswath32.f else check_PROGRAMS += testswath64 testswath64_SOURCES = testswath64.f endif endif # Run TestSwath when user types 'make check' TEST_SEQUENCES=test_c VERBOSE_TEST_SEQUENCES=test_c_verbose if F2CFORTRAN_CONDITIONAL if F2CFORTRAN_32PTR_CONDITIONAL TEST_SEQUENCES+=test_32f VERBOSE_TEST_SEQUENCES+=test_32f else TEST_SEQUENCES+=test_64f VERBOSE_TEST_SEQUENCES+=test_64f endif endif test_c: $(check_PROGRAMS) ./TestSwath test_c_verbose: $(check_PROGRAMS) ./TestSwath -v h test_32f: $(check_PROGRAMS) ./testswath32 test_64f: $(check_PROGRAMS) ./testswath64 check-local: $(TEST_SEQUENCES) verbose_check: $(VERBOSE_TEST_SEQUENCES) .PHONY: $(TEST_SEQUENCES) hdf-eos5-2.0/testdrivers/swath/Makefile.in000066400000000000000000000512331507520047200205440ustar00rootroot00000000000000# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # testdrivers/swath Makefile.am VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(top_srcdir)/config/include.am $(srcdir)/Makefile.in \ $(srcdir)/Makefile.am $(top_srcdir)/config/depcomp check_PROGRAMS = TestSwath$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2) @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am__append_1 = testswath32 @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am__append_2 = testswath64 @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am__append_3 = test_32f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am__append_4 = test_32f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am__append_5 = test_64f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am__append_6 = test_64f subdir = testdrivers/swath ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/stdlib.m4 $(top_srcdir)/m4/stdinc.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/HE5_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am__EXEEXT_1 = testswath32$(EXEEXT) @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am__EXEEXT_2 = testswath64$(EXEEXT) TestSwath_SOURCES = TestSwath.c TestSwath_OBJECTS = TestSwath.$(OBJEXT) TestSwath_LDADD = $(LDADD) TestSwath_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = am__testswath32_SOURCES_DIST = testswath32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am_testswath32_OBJECTS = testswath32.$(OBJEXT) testswath32_OBJECTS = $(am_testswath32_OBJECTS) testswath32_LDADD = $(LDADD) testswath32_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__testswath64_SOURCES_DIST = testswath64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am_testswath64_OBJECTS = testswath64.$(OBJEXT) testswath64_OBJECTS = $(am_testswath64_OBJECTS) testswath64_LDADD = $(LDADD) testswath64_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = F77COMPILE = $(F77) $(AM_FFLAGS) $(FFLAGS) LTF77COMPILE = $(LIBTOOL) $(AM_V_lt) --tag=F77 $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) AM_V_F77 = $(am__v_F77_@AM_V@) am__v_F77_ = $(am__v_F77_@AM_DEFAULT_V@) am__v_F77_0 = @echo " F77 " $@; am__v_F77_1 = F77LD = $(F77) F77LINK = $(LIBTOOL) $(AM_V_lt) --tag=F77 $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(F77LD) $(AM_FFLAGS) $(FFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_F77LD = $(am__v_F77LD_@AM_V@) am__v_F77LD_ = $(am__v_F77LD_@AM_DEFAULT_V@) am__v_F77LD_0 = @echo " F77LD " $@; am__v_F77LD_1 = SOURCES = TestSwath.c $(testswath32_SOURCES) $(testswath64_SOURCES) DIST_SOURCES = TestSwath.c $(am__testswath32_SOURCES_DIST) \ $(am__testswath64_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FC = @FC@ FCFLAGS = @FCFLAGS@ FFLAGS = @FFLAGS@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ ac_ct_FC = @ac_ct_FC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ LIBHDFEOS5 = $(top_builddir)/src/libhe5_hdfeos.la LIBGCTP = $(top_builddir)/gctp/src/libGctp.la # Boilerplate definitions EXTRA_DIST = hdfeos5.inc hdfeos5_64.inc # Link against HDF-EOS5 library AM_CPPFLAGS = -I$(top_srcdir)/include LDADD = $(LIBHDFEOS5) $(LIBGCTP) @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@testswath32_SOURCES = testswath32.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@testswath64_SOURCES = testswath64.f # Run TestSwath when user types 'make check' TEST_SEQUENCES = test_c $(am__append_3) $(am__append_5) VERBOSE_TEST_SEQUENCES = test_c_verbose $(am__append_4) \ $(am__append_6) all: all-am .SUFFIXES: .SUFFIXES: .c .f .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/include.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign testdrivers/swath/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign testdrivers/swath/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/config/include.am: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list TestSwath$(EXEEXT): $(TestSwath_OBJECTS) $(TestSwath_DEPENDENCIES) $(EXTRA_TestSwath_DEPENDENCIES) @rm -f TestSwath$(EXEEXT) $(AM_V_CCLD)$(LINK) $(TestSwath_OBJECTS) $(TestSwath_LDADD) $(LIBS) testswath32$(EXEEXT): $(testswath32_OBJECTS) $(testswath32_DEPENDENCIES) $(EXTRA_testswath32_DEPENDENCIES) @rm -f testswath32$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(testswath32_OBJECTS) $(testswath32_LDADD) $(LIBS) testswath64$(EXEEXT): $(testswath64_OBJECTS) $(testswath64_DEPENDENCIES) $(EXTRA_testswath64_DEPENDENCIES) @rm -f testswath64$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(testswath64_OBJECTS) $(testswath64_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TestSwath.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< .f.o: $(AM_V_F77)$(F77COMPILE) -c -o $@ $< .f.obj: $(AM_V_F77)$(F77COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .f.lo: $(AM_V_F77)$(LTF77COMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-local check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am check-local clean \ clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \ ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am test_c: $(check_PROGRAMS) ./TestSwath test_c_verbose: $(check_PROGRAMS) ./TestSwath -v h test_32f: $(check_PROGRAMS) ./testswath32 test_64f: $(check_PROGRAMS) ./testswath64 check-local: $(TEST_SEQUENCES) verbose_check: $(VERBOSE_TEST_SEQUENCES) .PHONY: $(TEST_SEQUENCES) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: hdf-eos5-2.0/testdrivers/swath/TestSwath.c000077500000000000000000007077461507520047200206150ustar00rootroot00000000000000/* *********************************************************** * FILENAME: TestSwath.c * * * * PURPOSE: To test HDF-EOS v.3 Swath interface * * * * Author: * * A. Muslimov /Emergent IT Inc. * * Adura Adekunjo /L3 Comm. EER corp * * * * History: * * August 1999 AM Initial version * * 13-Oct-2000 AM Updated * * 02-Dec-2004 AA Updated with testdrivers for * * some new functions (NCR 41197) * * * * * *********************************************************** */ #include #include #define BUFSIZE 256 #define RANK1 1 #define RANK2 2 int HE5_szip_can_encode(void ); int main(int argc, char *argv[]) { FILE *fp; herr_t status = FAIL; int i = 0; int j = 0; int attr3[4] = {100, 200, 300, 400}; int attr3Out[4] = { 0, 0, 0, 0 }; int Verbosity = 4; int comp_level[ 5 ] = { 0, 0, 0, 0, 0 }; int level[ 5 ] = { 0, 0, 0, 0, 0 }; int rank = 1; int AttrVal[ 4 ] = {1,2,3,4}; int GattrVal[ 4 ] = {4,3,2,1}; int AttrValOut[ 4 ] = {0,0,0,0}; int GattrValOut[ 4 ] = {0,0,0,0}; int errcnt = 0; int comp_code = 0; int code = 0; int chunk_rank; int rank2 = 0; int rank3 = 0; int *RankPtr = (int *)NULL; int inarray[10] = {1,2,3,4,5,6,7,8,9,10}; int fieldgroup = FAIL; int return_val = FAIL; hid_t SWid_simple = FAIL; hid_t SWid_index = FAIL; hid_t swfidc_simple = FAIL; hid_t PeriodID = FAIL; hid_t RegionID = FAIL; hid_t OldRegionID = FAIL; hid_t datatype = FAIL; hid_t dtype = FAIL; hid_t dtype1 = FAIL; hid_t ntype[20]; H5T_class_t classid = H5T_NO_CLASS; H5T_order_t order = H5T_ORDER_ERROR; long number = FAIL; long strbufsize = FAIL; long *DimListPtr = (long *)NULL; long *OffsetPtr = (long *)NULL; long *IncremPtr = (long *)NULL; long *IndexMap = (long *)NULL; long IdxMapSize = FAIL; long Indices[2] = {0L, 0L}; long *UpdateIdx_1 = (long *)NULL; size_t *size = (size_t *)NULL; size_t datasize = 0; size_t Size = 0; hssize_t start[ 1 ] = { 0 }; hssize_t tstart[ 2 ] = { 0, 0 }; hsize_t ndims = 0; hsize_t nmaps = 0; hsize_t *SizePtr; hsize_t Dims[8] = {0,0,0,0,0,0,0,0}; hsize_t dims[ 2 ] = { 2, 2 }; hsize_t chunk_dims[ 2 ] = { 0, 0 }; hsize_t chunk_dim[ 8 ] = { 0,0,0,0,0,0,0,0}; hsize_t tedge[ 2 ] = { 1, 1 }; hsize_t edge[ 1 ] = { 1 }; hsize_t stride[ 2 ] = { 1, 1 }; hssize_t inq_start[ 2 ] = { 0, 0 }; hsize_t inq_stride[ 2 ] = { 1, 1 }; hsize_t inq_edge[ 2 ] = { 1, 1 }; hsize_t *CountPtr = (hsize_t *)NULL; hsize_t CurrentSize[1] = { 4 }; hsize_t count[1]; hsize_t *indices[8]; double TempData[10][4] = { { 100., 101., 102., 103. }, { 110., 111., 112., 113. }, { 200., 201., 202., 203. }, { 210., 211., 212., 213. }, { 300., 301., 302., 303. }, { 310., 311., 312., 313. }, { 400., 401., 402., 403. }, { 410., 411., 412., 413. }, { 500., 501., 502., 503. }, { 510., 511., 512., 513. } } ; double LongData[5][4] = { { 100., 102., 104., 106. }, { 100., 102., 104., 106. }, { 100., 102., 104., 106. }, { 100., 102., 104., 106. }, { 100., 102., 104., 106. } } ; double LatData[5][4] = { { 24., 24., 24., 24. }, { 23., 23., 23., 23. }, { 22., 22., 22., 22. }, { 21., 21., 21., 21. }, { 20., 20., 20., 20. } } ; double CondData[10][4] = { { 10., 20., 30., 40. }, { 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. } } ; double Range[2]; double CornerLon[2]; double CornerLat[2]; double *BufferPtr; double StartTime = 0.0; double StopTime = 0.0; double *TimeData; double *TimeDataOut; double TempDataOut[10][4]; double fillvalue2 = -1.11111; double InqDoubleFillValue = -1.1111; float IndexedData[8][8]; float FakeValue = 100.; float IndexedLatData[6][6]; float FakeLat = 60.; float IndexedLonData[6][6]; float FakeLon = 80.; float *BufferFloatPtr; float fillvalue = -1.11111; float InqFloatFillValue = -1.111111; float GfattrVal = 3.14; float GfattrValOut; hvl_t buffer[4]; /* Buffer to write data to the profile */ hvl_t buffer_out[4];/* Buffer to read out data from profile */ char *FieldListPtr; char *DimNamePtr; char *DimMapListPtr; char *ObjNamesPtr; char DimList[200]; char *dimlist; /* ******************************************************************************** * Get comand-line argument (Verbosity) * ******************************************************************************** */ for (i = 1; i < argc; i++) { if ((argc > i + 1) && ((HDstrcmp(argv[i], "-verbose") == 0) || (HDstrcmp(argv[i], "-v") == 0))) { if (argv[i + 1][0] == 'l') Verbosity = 4; else if (argv[i + 1][0] == 'm') Verbosity = 6; else if (argv[i + 1][0] == 'h') Verbosity = 10; else Verbosity = atoi(argv[i + 1]); } } /* ----- Generate Data Arrays ----- */ i = 0; j = 0; while( i < 8 ) { while( j < 8 ) { IndexedData[ i ][ j ] = FakeValue; j++; FakeValue+=0.1; } i++; j = 0; } /* -------------------------------- */ i = 0; j = 0; while( i < 6 ) { while( j < 6 ) { IndexedLatData[ i ][ j ] = FakeLat; IndexedLonData[ i ][ j ] = FakeLon; FakeLon-=0.1; j++; } FakeLat-= 0.1; FakeLon = 80.; i++; j = 0; } IndexMap = (long *)calloc(6, sizeof(long)); IndexMap[0] = 1L; IndexMap[1] = 2L; IndexMap[2] = 3L; IndexMap[3] = 5L; IndexMap[4] = 6L; IndexMap[5] = 7L; /* Allocate memory for and populate data buffer */ datasize = 0; for (i = 0; i < 4; i++) { buffer[i].p = (hvl_t *)malloc( 25 *(i+1)* sizeof(unsigned int)); buffer[i].len = 25 * (i+1); /* calculate the data buffer size (bytes) */ datasize += buffer[i].len * sizeof(unsigned int); for ( j = 0; j < 25 * (i+1); j++) ((unsigned int *)buffer[i].p)[j] = (i+1)*1000 + j; } /* --------------------------------- */ MESSAGE(11,fp=fopen("TestSwath_c.txtout","w");); MESSAGE(4,printf("Testing Swath C interface \n");); MESSAGE(4,printf("=========================\n\n");); MESSAGE(11,fprintf(fp,"Testing Swath C interface \n");); MESSAGE(11,fprintf(fp,"=========================\n\n");); /* ********************************************************************************* * Testing HE5_SWopen * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_SWopen... \n");); MESSAGE(4,printf("\t===================== \n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWopen... \n");); MESSAGE(11,fprintf(fp,"\t===================== \n");); swfidc_simple = HE5_SWopen("SimpleSwath.he5",H5F_ACC_TRUNC); if (swfidc_simple == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\t\t*** Successfully opened the swath file ****\n");); MESSAGE(11,fprintf(fp,"\t\t*** Successfully opened the swath file ****\n");); } /* ********************************************************************************* * Testing HE5_SWcreate * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_SWcreate... \n");); MESSAGE(4,printf("\t======================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWcreate... \n");); MESSAGE(11,fprintf(fp,"\t=======================\n");); MESSAGE(6,printf("\t\tCreating swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\t\tCreating swath SIMPLE \n");); /* Test allowed characters */ SWid_simple = HE5_SWcreate(swfidc_simple,"SIMPLE/error"); if (SWid_simple == FAIL) { MESSAGE(4,printf("\t\t*** Successfully detected invalid character in swath name ****\n");); MESSAGE(11,fprintf(fp,"\t\t*** Successfully detected invalid character in swath name ****\n");); } else { MESSAGE(4,printf("\t\t********Error expected but not given**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error expected but not given**********\n");); errcnt++; } SWid_simple = HE5_SWcreate(swfidc_simple,"SIMPLE,error"); if (SWid_simple == FAIL) { MESSAGE(4,printf("\t\t*** Successfully detected invalid character in swath name ****\n");); MESSAGE(11,fprintf(fp,"\t\t*** Successfully detected invalid character in swath name ****\n");); } else { MESSAGE(4,printf("\t\t********Error expected but not given**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error expected but not given**********\n");); errcnt++; } SWid_simple = HE5_SWcreate(swfidc_simple,"SIMPLE;error"); if (SWid_simple == FAIL) { MESSAGE(4,printf("\t\t*** Successfully detected invalid character in swath name ****\n");); MESSAGE(11,fprintf(fp,"\t\t*** Successfully detected invalid character in swath name ****\n");); } else { MESSAGE(4,printf("\t\t********Error expected but not given**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error expected but not given**********\n");); errcnt++; } SWid_simple = HE5_SWcreate(swfidc_simple,"SIMPLE:noerror"); if (SWid_simple == FAIL) { MESSAGE(4,printf("\t\t********Error ':' not allowed in swath name'**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error ':' not allowed in swath name**********\n");); errcnt++; } else { MESSAGE(4,printf("\t\t*** Successfully tested ':' character in swath name ****\n");); MESSAGE(11,fprintf(fp,"\t\t*** Successfully tested ':' character in swath name ****\n");); } /* Create a valid swath for subsequent tests */ SWid_simple = HE5_SWcreate(swfidc_simple,"SIMPLE"); if (SWid_simple == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\t\t*** Successfully created the swath SIMPLE ****\n");); MESSAGE(11,fprintf(fp,"\t\t*** Successfully created the swath SIMPLE ****\n");); } /* ********************************************************************************* * Testing HE5_SWcreate * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_SWcreate... \n");); MESSAGE(4,printf("\t=======================\n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWcreate... \n");); MESSAGE(11,fprintf(fp,"\t=======================\n");); MESSAGE(6,printf("\t\tCreating swath INDEX \n");); MESSAGE(11,fprintf(fp,"\t\tCreating swath INDEX \n");); SWid_index = HE5_SWcreate(swfidc_simple,"INDEX"); if (SWid_index == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\t\t*** Successfully created the swath INDEX ****\n");); MESSAGE(11,fprintf(fp,"\t\t*** Successfully created the swath INDEX ****\n");); } /* ********************************************************************************* * Testing HE5_SWdefdim * ********************************************************************************* */ MESSAGE(4,printf("\t\n");); MESSAGE(4,printf("\tTesting HE5_SWdefdim... \n");); MESSAGE(4,printf("\t=======================\n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWdefdim... \n");); MESSAGE(11,fprintf(fp,"\t=======================\n");); MESSAGE(4,printf("\t\n");); MESSAGE(6,printf("\t\tSetting up dimensions for swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tSetting up dimensions for swath SIMPLE \n");); /* ------------------------------------- Swath SIMPLE --------------------------------- --------------------- D e f i n i n g d i m e n s i o n DataTrack ---------------- */ MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining dimension DataTrack in swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining dimension DataTrack in swath SIMPLE \n");); status = HE5_SWdefdim(SWid_simple, "DataTrack", 10); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWdefdim(SWid_simple, \"DataTrack\", 10);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWdefdim %d\n", status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdefdim(SWid_simple, \"DataTrack\", 10);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefdim %d\n", status);); } /* --------------------- D e f i n i n g d i m e n s i o n DataXtrack ---------------- */ MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining dimension DataXtrack in swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining dimension DataXtrack in swath SIMPLE \n");); status = HE5_SWdefdim(SWid_simple, "DataXtrack", 4); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWdefdim(SWid_simple, \"DataXtrack\", 4);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWdefdim %d\n", status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdefdim(SWid_simple, \"DataXtrack\", 4);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefdim %d\n", status);); } /* --------------------- D e f i n i n g d i m e n s i o n Geotrack ---------------- */ MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining dimension GeoTrack for swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining dimension GeoTrack for swath SIMPLE \n");); status = HE5_SWdefdim(SWid_simple, "GeoTrack", 5); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWdefdim(SWid_simple, \"GeoTrack\", 5);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWdefdim %d\n", status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdefdim(SWid_simple, \"GeoTrack\", 5);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefdim %d\n", status);); } /* --------------------- D e f i n i n g d i m e n s i o n GeoXtrack ---------------- */ MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining dimension GeoXtrack for swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining dimension GeoXtrack for swath SIMPLE \n");); status = HE5_SWdefdim(SWid_simple, "GeoXtrack", 4); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWdefdim(SWid_simple, \"GeoXtrack\", 4);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWdefdim %d\n", status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdefdim(SWid_simple, \"GeoXtrack\", 4);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefdim %d\n", status);); } /* --------------------- D e f i n i n g d i m e n s i o n "Unlim" ---------------- */ MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining dimension \"Unlim\" in swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining dimension \"Unlim\" in swath SIMPLE \n");); status = HE5_SWdefdim(SWid_simple, "Unlim", H5S_UNLIMITED); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWdefdim(SWid_simple, \"Unlim\", H5S_UNLIMITED);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWdefdim %d\n", status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdefdim(SWid_simple, \"Unlim\", H5S_UNLIMITED);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefdim %d\n", status);); } MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tSetting up dimensions for swath INDEX \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tSetting up dimensions for swath INDEX \n");); /* ---------------------------------- Swath INDEX ------------------------------------- --------------------- D e f i n i n g d i m e n s i o n TrackDim ---------------- */ MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining dimension TrackDim for swath INDEX \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining dimension TrackDim for swath INDEX \n");); status = HE5_SWdefdim(SWid_index, "TrackDim", 8); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWdefdim(SWid_index, \"TrackDim\", 8);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWdefdim %d\n", status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdefdim(SWid_index, \"TrackDim\", 8);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefdim %d\n", status);); } /* --------------------- D e f i n i n g d i m e n s i o n XtrackDim ---------------- */ MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining dimension XtrackDim for swath INDEX \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining dimension TrackDim for swath INDEX \n");); status = HE5_SWdefdim(SWid_index, "XtrackDim", 8); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWdefdim(SWid_index, \"XtrackDim\", 8);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWdefdim %d\n", status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdefdim(SWid_index, \"XtrackDim\", 8);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefdim %d\n", status);); } /* --------------------- D e f i n i n g d i m e n s i o n GeoDim ------------------- */ MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining dimension GeoDim for swath INDEX \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining dimension GeoDim for swath INDEX \n");); status = HE5_SWdefdim(SWid_index, "GeoDim", 6); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWdefdim(SWid_index, \"GeoDim\", 6);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWdefdim %d\n", status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdefdim(SWid_index, \"GeoDim\", 6);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefdim %d\n", status);); } /* --------------------- D e f i n i n g d i m e n s i o n GeoXDim ------------------- */ MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining dimension GeoXDim for swath INDEX \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining dimension GeoXDim for swath INDEX \n");); status = HE5_SWdefdim(SWid_index, "GeoXDim", 6); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWdefdim(SWid_index, \"GeoXDim\", 6);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWdefdim %d\n", status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdefdim(SWid_index, \"GeoXDim\", 6);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefdim %d\n", status);); } /* ********************************************************************************* * Testing HE5_SWdefdimmap * ********************************************************************************* */ MESSAGE(4,printf("\t\n");); MESSAGE(4,printf("\tTesting HE5_SWdefdimmap... \n");); MESSAGE(4,printf("\t==========================\n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWdefdimmap... \n");); MESSAGE(11,fprintf(fp,"\t==========================\n");); MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining dimension maps for swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining dimension maps for swath SIMPLE \n");); /* ---------- D e f i n i n g T r a c k D i m. M a p p i n g ---------- */ MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining track dimension mapping\n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining track dimension mapping\n");); status = HE5_SWdefdimmap(SWid_simple, "GeoTrack", "DataTrack", 0, 2); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWdefdimmap(SWid_simple, \"GeoTrack\",\"DataTrack\", 0, 2);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWdefdimmap %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdefdimmap(SWid_simple,\"GeoTrack\", \"DataTrack\", 0, 2);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefdimmap %d\n",status);); } /* ---- D e f i n i n g C r o s s T r a c k D i m. M a p p i n g ---- */ MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining cross track dimension mapping\n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining cross track dimension mapping\n");); status = HE5_SWdefdimmap(SWid_simple, "GeoXtrack", "DataXtrack", 0, 1); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWdefdimmap(SWid_simple, \"GeoXtrack\",\"DataXtrack\", 0, 1);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWdefdimmap %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdefdimmap(SWid_simple,\"GeoXtrack\", \"DataXtrack\", 0, 1);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefdimmap %d\n",status);); } /* ---- D e f i n i n g G e o T r a c k / G e o X t r a c k D i m. M a p p i n g ---- */ MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining GeoTrack / GeoXtrack dimension mapping\n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining GeoTrack / GeoXtrack dimension mapping\n");); status = HE5_SWdefdimmap(SWid_simple, "GeoTrack", "GeoXtrack", 0, 1); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWdefdimmap(SWid_simple, \"GeoTrack\",\"GeoXtrack\", 0, 1);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWdefdimmap %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdefdimmap(SWid_simple,\"GeoTrack\", \"GeoXtrack\", 0, 1);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefdimmap %d\n",status);); } /* --------- D e f i n i n g G e o T r a c k / G e o T r a c k D i m. M a p p i n g ------- */ MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining Geo track / Geo track dimension mapping\n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining Geo track / Geo track dimension mapping\n");); status = HE5_SWdefdimmap(SWid_simple, "GeoTrack", "GeoTrack", 0, 1); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWdefdimmap(SWid_simple, \"GeoTrack\",\"GeoTrack\", 0, 1);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWdefdimmap %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdefdimmap(SWid_simple,\"GeoTrack\", \"GeoTrack\", 0, 1);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefdimmap %d\n",status);); } /* ********************************************************************************* * Testing HE5_SWdefidxmap * ********************************************************************************* */ MESSAGE(4,printf("\t\n");); MESSAGE(4,printf("\tTesting HE5_SWdefidxmap... \n");); MESSAGE(4,printf("\t=================\n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWdefidxmap... \n");); MESSAGE(11,fprintf(fp,"\t=================\n");); MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining indexed mapping relationships for swath INDEX \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining indexed mapping relationships for swath INDEX \n");); /* ------- D e f i n i n g G e o D i m / T r a c k D i m M a p p i n g ------- */ MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining GeoDim/TrackDim mapping\n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining GeoDim/TrackDim mapping\n");); status = HE5_SWdefidxmap(SWid_index, "GeoDim", "TrackDim", IndexMap); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWdefidxmap(SWid_index, \"GeoDim\",\"TrackDim\", IndexMap);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWdefidxmap %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdefidxmap(SWid_index,\"GeoDim\", \"TrackDim\", IndexMap);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefidxmap %d\n",status);); } /* ------- D e f i n i n g G e o X D i m / X t r a c k D i m M a p p i n g ------- */ MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining GeoXDim/XtrackDim mapping\n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining GeoXDim/XtrackDim mapping\n");); status = HE5_SWdefidxmap(SWid_index, "GeoXDim", "XtrackDim", IndexMap); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWdefidxmap(SWid_index, \"GeoXDim\",\"XtrackDim\", IndexMap);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWdefidxmap %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdefidxmap(SWid_index,\"GeoXDim\", \"XtrackDim\", IndexMap);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefidxmap %d\n",status);); } free(IndexMap); /* ********************************************************************************* * Testing HE5_SWsetfillvalue * ********************************************************************************* */ MESSAGE(4,printf("\t\n");); MESSAGE(4,printf("\tTesting HE5_SWsetfillvalue... \n");); MESSAGE(4,printf("\t=============================\n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWsetfillvalue... \n");); MESSAGE(11,fprintf(fp,"\t=============================\n");); /* --------- S e t t i n g F i l l v a l u e f o r T e m p e r a t u r e -------- */ fillvalue2 = -777.; MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tSetting fill value for field Temperature in swath SIMPLE\n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tSetting fill value for field Temperature in swath SIMPLE\n");); status = HE5_SWsetfillvalue(SWid_simple, "Temperature", H5T_NATIVE_DOUBLE, &fillvalue2); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWsetfillvalue(SWid_simple,\"Temperature\", &fillvalue2);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWsetfillvalue for field Temperature %d\n", status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWsetfillvalue(SWid_simple,\"Temperature\", &fillvalue2);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWsetfillvalue for field Temperature %d\n", status);); } /* ********************************************************************************* * Testing HE5_SWdefdatafield * ********************************************************************************* */ MESSAGE(4,printf("\t\n");); MESSAGE(4,printf("\tTesting HE5_SWdefdatafield... \n");); MESSAGE(4,printf("\t=============================\n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWdefdatafield... \n");); MESSAGE(11,fprintf(fp,"\t=============================\n");); MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining data fields for swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining data fields for swath SIMPLE \n");); /* ---------------------------- Swath SIMPLE --------------------------- --------------- D e f i n i n g T e m p e r a t u r e -------------- */ MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining data field Temperature\n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining data field Temperature\n");); status = HE5_SWdefdatafield(SWid_simple, "Temperature", "DataTrack,DataXtrack", NULL,H5T_NATIVE_DOUBLE , 0); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");) MESSAGE(10,printf("\t\tstatus=HE5_SWdefdatafield(SWid_simple,\"Temperature\",NULL, H5T_NATIVE_DOUBLE ,0);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWdefdatafield %d\n", status);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWdefdatafield(SWid_simple,\"Temperature\",NULL, H5T_NATIVE_DOUBLE ,0);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefdatafield %d\n", status);); } /* ---------------------------------- Defining Appendable field "Count" --------------------- */ MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining appendable data field Count\n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining appendable data field Count\n");); /* -------------------- D e f i n i n g c h u n k i n g --------------------- */ chunk_dims[ 0 ] = 10; MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining chunking for swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining chunking for swath SIMPLE \n");); status = HE5_SWdefchunk(SWid_simple,RANK1,chunk_dims); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_SWdefchunk(SWid_simple,RANK1,chunk_dims);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWdefchunk %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWdefchunk(SWid_simple,RANK1,chunk_dims);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefchunk %d\n",status);); } /* --------------- D e f i n i n g c o m p r e s s i o n s c h e m e -------------- ___________________________________________________________________ | | | HE5_HDFE_COMP_NONE 0 | | HE5_HDFE_COMP_RLE 1 | | HE5_HDFE_COMP_NBIT 2 | | HE5_HDFE_COMP_SKPHUFF 3 | | HE5_HDFE_COMP_DEFLATE 4 | | HE5_HDFE_COMP_SZIP_CHIP 5 | | HE5_HDFE_COMP_SZIP_K13 6 | | HE5_HDFE_COMP_SZIP_EC 7 | | HE5_HDFE_COMP_SZIP_NN 8 | | HE5_HDFE_COMP_SZIP_K13orEC 9 | | HE5_HDFE_COMP_SZIP_K13orNN 10 | | HE5_HDFE_COMP_SHUF_DEFLATE 11 | | HE5_HDFE_COMP_SHUF_SZIP_CHIP 12 | | HE5_HDFE_COMP_SHUF_SZIP_K13 13 | | HE5_HDFE_COMP_SHUF_SZIP_EC 14 | | HE5_HDFE_COMP_SHUF_SZIP_NN 15 | | HE5_HDFE_COMP_SHUF_SZIP_K13orEC 16 | | HE5_HDFE_COMP_SHUF_SZIP_K13orNN 17 | |_________________________________________________________________| */ comp_code = 16; /* --------------- D e f i n i n g c o m p r e s s i o n l e v e l -------------- */ comp_level[ 0 ] = 8; MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining compression parameters for swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining compression parameters for swath SIMPLE \n");); #ifdef H5_HAVE_FILTER_SZIP if(HE5_szip_can_encode() == 1) { status = HE5_SWdefcomp(SWid_simple,comp_code,comp_level); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_SWdefcomp(SWid_simple,comp_code, comp_level);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWdefcomp %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWdefcomp(SWid_simple,comp_code, comp_level);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefcomp %d\n",status);); } } else printf("No szip encoder provided, the szip compression test is be skipped.\n"); #else printf("No szip library available, the szip compression test is be skipped.\n"); #endif /* --------------- D e f i n i n g C o u n t -------------- */ MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tDefining data field Count\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tDefining data field Count\n");); status = HE5_SWdefdatafield(SWid_simple, "Count", "DataTrack","Unlim", H5T_NATIVE_INT, 0); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_SWdefdatafield(SWid_simple, \"Count\",\"DataTrack\",\"Unlim\",H5T_NATIVE_INT,0);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWdefdatafield %d\n", status);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWdefdatafield(SWid_simple,\"Count\",\"DataTrack\",\"Unlim\",H5T_NATIVE_INT,0);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefdatafield %d\n", status);); } /* ***************************************************************************** * Testing HE5_PRdefine * ***************************************************************************** */ MESSAGE(4,printf("\t\n");); MESSAGE(4,printf("\tTesting HE5_PRdefine... \n");); MESSAGE(4,printf("\t=======================\n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PRdefine... \n");); MESSAGE(11,fprintf(fp,"\t=======================\n");); MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining profile for swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining profile for swath SIMPLE \n");); status = HE5_PRdefine(SWid_simple,"Profile-2000", "DataXtrack", NULL, H5T_NATIVE_UINT); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");) MESSAGE(10,printf("\t\tstatus=HE5_PRdefine(SWid_simple,\"Profile-2000\", \"DataXtrack\", NULL, H5T_NATIVE_UINT);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_PRdefine %d\n", status);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_PRdefine(SWid_simple,\"Profile-2000\", \"DataXtrack\", NULL, H5T_NATIVE_UINT);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_PRdefine %d\n", status);); } MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining data fields for swath INDEX \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining data fields for swath INDEX \n");); /* ------------------------------- Swath INDEX --------------------------- */ /* --------- S e t t i n g F i l l v a l u e f o r I n d e x e d D a t a -------- */ fillvalue = -555.; MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tSetting fill value for field Indexed_Data in swath INDEX\n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tSetting fill value for field Indexed_Data in swath INDEX\n");); status = HE5_SWsetfillvalue(SWid_index, "Indexed_Data", H5T_NATIVE_FLOAT, &fillvalue); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWsetfillvalue(SWid_index,\"Indexed_Data\", &fillvalue);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWsetfillvalue for field Indexed_Data%d\n", status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWsetfillvalue(SWid_index,\"Indexed_Data\", &fillvalue);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWsetfillvalue for field Indexed_Data %d\n", status);); } /* --------------- D e f i n i n g I n d e x e d _ D a t a ----------- */ MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining data field Indexed_Data\n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining data field Indexed_Data\n");); status = HE5_SWdefdatafield(SWid_index, "Indexed_Data", "TrackDim,XtrackDim", NULL,H5T_NATIVE_FLOAT, 0); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");) MESSAGE(10,printf("\t\tstatus=HE5_SWdefdatafield(SWid_index,\"Indexed_Data\",NULL, H5T_NATIVE_FLOAT,0);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWdefdatafield %d\n", status);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWdefdatafield(SWid_index,\"Indexed_Data\",NULL, H5T_NATIVE_FLOAT,0);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefdatafield %d\n", status);); } /* ********************************************************************************* * Testing HE5_SWdefcomp * ********************************************************************************* */ MESSAGE(4,printf("\t\n");); MESSAGE(4,printf("\tTesting HE5_SWdefcomp... \n");); MESSAGE(4,printf("\t======================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWdefcomp... \n");); MESSAGE(11,fprintf(fp,"\t======================== \n");); /* -------------------- D e f i n i n g c h u n k i n g --------------------- */ chunk_dims[ 0 ] = 5 ; chunk_dims[ 1 ] = 2 ; MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining chunking for swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining chunking for swath SIMPLE \n");); status = HE5_SWdefchunk(SWid_simple,RANK2,chunk_dims); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_SWdefchunk(SWid_simple,RANK2,chunk_dims);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWdefchunk %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWdefchunk(SWid_simple,RANK2,chunk_dims);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefchunk %d\n",status);); } /* --------------- D e f i n i n g c o m p r e s s i o n s c h e m e -------------- ___________________________________________________________________ | | | HE5_HDFE_COMP_NONE 0 | | HE5_HDFE_COMP_RLE 1 | | HE5_HDFE_COMP_NBIT 2 | | HE5_HDFE_COMP_SKPHUFF 3 | | HE5_HDFE_COMP_DEFLATE 4 | | HE5_HDFE_COMP_SZIP_CHIP 5 | | HE5_HDFE_COMP_SZIP_K13 6 | | HE5_HDFE_COMP_SZIP_EC 7 | | HE5_HDFE_COMP_SZIP_NN 8 | | HE5_HDFE_COMP_SZIP_K13orEC 9 | | HE5_HDFE_COMP_SZIP_K13orNN 10 | | HE5_HDFE_COMP_SHUF_DEFLATE 11 | | HE5_HDFE_COMP_SHUF_SZIP_CHIP 12 | | HE5_HDFE_COMP_SHUF_SZIP_K13 13 | | HE5_HDFE_COMP_SHUF_SZIP_EC 14 | | HE5_HDFE_COMP_SHUF_SZIP_NN 15 | | HE5_HDFE_COMP_SHUF_SZIP_K13orEC 16 | | HE5_HDFE_COMP_SHUF_SZIP_K13orNN 17 | |_________________________________________________________________| */ comp_code = 16; /* --------------- D e f i n i n g c o m p r e s s i o n l e v e l -------------- */ comp_level[ 0 ] = 2; MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining compression parameters for swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining compression parameters for swath SIMPLE \n");); #ifdef H5_HAVE_FILTER_SZIP if(HE5_szip_can_encode() == 1) { status = HE5_SWdefcomp(SWid_simple,comp_code,comp_level); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test (SZIP) **********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_SWdefcomp(SWid_simple,comp_code, comp_level);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWdefcomp %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWdefcomp(SWid_simple,comp_code, comp_level);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefcomp %d\n",status);); } } else printf("No szip encoder provided, the szip compression test is be skipped.\n"); #else printf("No szip library available, the szip compression test is be skipped.\n"); #endif /* --------------- D e f i n i n g C o n d u c t i o n -------------- */ MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tDefining data field Conduction\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tDefining data field Conduction\n");); status = HE5_SWdefdatafield(SWid_simple, "Conduction", "DataTrack,DataXtrack", NULL, H5T_NATIVE_DOUBLE, 0); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_SWdefdatafield(SWid_simple, \"Conduction\",\"DataTrack,DataXtrack\",NULL,H5T_NATIVE_DOUBLE,0);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWdefdatafield %d\n", status);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWdefdatafield(SWid_simple,\"Conduction\",\"DataTrack,DataXtrack\",NULL,H5T_NATIVE_DOUBLE,0);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefdatafield %d\n", status);); } /* ********************************************************************************* * Testing HE5_SWdefgeofield * ********************************************************************************* */ MESSAGE(4,printf("\t\n");); MESSAGE(4,printf("\tTesting HE5_SWdefgeofield... \n");); MESSAGE(4,printf("\t============================ \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWdefgeofield... \n");); MESSAGE(11,fprintf(fp,"\t============================ \n");); /* --------------------------- Swath SIMPLE ------------------------------------- */ MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining geolocation fields for swath SIMPLE\n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining geolocation fields for swath SIMPLE\n");); /* T I M E */ MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining geolocation field Time\n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining geolocation field Time\n");); status = HE5_SWdefgeofield(SWid_simple,"Time","GeoTrack",NULL,H5T_NATIVE_DOUBLE,0); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_SWdefgeofield(SWid_simple,\"Time\",\"GeoTrack\",NULL,H5T_NATIVE_DOUBLE,0);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWdefgeofield %d\n", status);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWdefgeofield(SWid_simple,\"Time\",\"GeoTrack\",NULL,H5T_NATIVE_DOUBLE,0);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefgeofield %d\n",status);); } /* L A T I T U D E */ MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tDefining geolocation field Latitude\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tDefining geolocation field Latitude\n");); status = HE5_SWdefgeofield(SWid_simple, "Latitude", "GeoTrack,GeoXtrack",NULL,H5T_NATIVE_DOUBLE,0); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_SWdefgeofield(SWid_simple,\"Latitude\",\"GeoTrack,GeoXtrack\", NULL, H5T_NATIVE_DOUBLE, 0);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWdefgeofield %d\n", status);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWdefgeofield(SWid_simple,\"Latitude\",\"GeoTrack,GeoXtrack\", NULL, H5T_NATIVE_DOUBLE, 0 );\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefgeofield %d\n",status);); } /* L O N G I T U D E */ MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tDefining geolocation field Longitude\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tDefining geolocation field Longitude\n");); status = HE5_SWdefgeofield(SWid_simple, "Longitude","GeoTrack,GeoXtrack",NULL,H5T_NATIVE_DOUBLE,0 ); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_SWdefgeofield(SWid_simple,\"Longitude\",\"GeoTrack,GeoXtrack\",NULL,H5T_NATIVE_DOUBLE,0);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWdefgeofield %d\n", status);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWdefgeofield(SWid_simple,\"Longitude\",\"GeoTrack,GeoXtrack\",NULL,H5T_NATIVE_DOUBLE,0);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefgeofield %d\n",status);); } /* -------------------------------- Swath INDEX ------------------------------------- */ MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tDefining geolocation fields for swath INDEX\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tDefining geolocation fields for swath INDEX\n");); /* L A T I T U D E */ MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tDefining geolocation field Latitude\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tDefining geolocation field Latitude\n");); status = HE5_SWdefgeofield(SWid_index,"Latitude","GeoDim,GeoXDim",NULL,H5T_NATIVE_FLOAT,0); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_SWdefgeofield(SWid_index,\"Latitude\",\"GeoDim,GeoXDim\",NULL,H5T_NATIVE_FLOAT,0);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWdefgeofield %d\n", status);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWdefgeofield(SWid_index,\"Latitude\",\"GeoDim,GeoXDim\",NULL,H5T_NATIVE_FLOAT,0);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefgeofield %d\n",status);); } /* L O N G I T U D E */ MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tDefining geolocation field Longitude\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tDefining geolocation field Longitude\n");); status = HE5_SWdefgeofield(SWid_index,"Longitude","GeoDim,GeoXDim",NULL,H5T_NATIVE_FLOAT,0); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_SWdefgeofield(SWid_index,\"Longitude\",\"GeoDim,GeoXDim\",NULL,H5T_NATIVE_FLOAT,0);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWdefgeofield %d\n", status);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWdefgeofield(SWid_index,\"Longitude\",\"GeoDim,GeoXDim\",NULL,H5T_NATIVE_FLOAT,0);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWdefgeofield %d\n",status);); } /* ********************************************************************************* * Testing HE5_SWwritefield * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWwritefield... \n");); MESSAGE(4,printf("\t===========================\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWwritefield... \n");); MESSAGE(11,fprintf(fp,"\t===========================\n");); /* -------------------------------- Swath SIMPLE ------------------------- --------- W r i t i n g T i m e i n a s w a t h -------- */ MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tWriting field Time in swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tWriting field Time in swath SIMPLE \n");); TimeData = (double *)calloc( 5, sizeof( double)); for ( i = 0; i < 5; i++ ) { TimeData[ i ] = 5.e7 + 5.e6 * i ; } tstart[ 0 ] = 0; tedge[ 0 ] = 5; status = HE5_SWwritefield(SWid_simple,"Time", tstart, NULL, tedge, TimeData); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWwritefield(SWid_simple,\"Time\", tstart,NULL, tedge, TimeData);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWwritefield %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWwritefield(SWid_simple,\"Time\", tstart,NULL, tedge, TimeData);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWwritefield %d\n",status);); } free( TimeData ); TimeData = NULL; /* --------- W r i t i n g T e m p e r a t u r e i n a s w a t h -------- */ MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tWriting field Temperature in swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tWriting field Temperature in swath SIMPLE \n");); tstart[ 0 ] = 0; tstart[ 1 ] = 0; tedge[ 0 ] = 10; tedge[ 1 ] = 4; status = HE5_SWwritefield(SWid_simple, "Temperature", tstart, NULL, tedge, TempData); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWwritefield(SWid_simple,\"Temperature\", tstart,stride, tedge, TempData);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWwritefield %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWwritefield(SWid_simple,\"Temperature\", tstart, stride, tedge, TempData);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWwritefield %d\n",status);); } /* --------- W r i t i n g C o n d u c t i o n i n a s w a t h -------- */ MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tWriting field Conduction in swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tWriting field Conduction in swath SIMPLE \n");); status = HE5_SWwritefield(SWid_simple, "Conduction", tstart, NULL, tedge, CondData); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWwritefield(SWid_simple, \"Conduction\",tstart, stride, tedge, CondData);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWwritefield for field Conduction in swath SIMPLE %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWwritefield(SWid_simple,\"Conduction\", tstart, stride, tedge, CondData);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWwritefield for field Conduction in swath SIMPLE %d\n",status);); } /* --------- W r i t i n g L o n g i t u d e / L a t i t u d e i n a s w a t h -------- */ MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tWriting field Longitude in swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tWriting field Longitude in swath SIMPLE \n");); tedge[0] = 5; status = HE5_SWwritefield(SWid_simple, "Longitude", tstart, NULL, tedge, LongData); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWwritefield(SWid_simple, \"Longitude\",tstart, NULL, tedge, LongData);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWwritefield for field Longitude in swath SIMPLE %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWwritefield(SWid_simple,\"Longitude\", tstart, NULL, tedge, LongData);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWwritefield for field Conduction in swath SIMPLE %d\n",status);); } MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tWriting field Latitude in swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tWriting field Latitude in swath SIMPLE \n");); status = HE5_SWwritefield(SWid_simple, "Latitude", tstart, NULL, tedge, LatData); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWwritefield(SWid_simple, \"Latitude\",tstart, NULL, tedge, LatData);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWwritefield for field Latitude in swath SIMPLE %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWwritefield(SWid_simple,\"Latitude\", tstart, NULL, tedge, LatData);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWwritefield for field latitude in swath SIMPLE %d\n",status);); } /* --------- W r i t i n g C o u n t i n a s w a t h -------- */ tstart[0] = 0; tedge[0] = 10; MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tWriting field Count in swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tWriting field Count in swath SIMPLE \n");); status = HE5_SWwritefield(SWid_simple, "Count", tstart, NULL, tedge, inarray); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWwritefield(SWid_simple, \"Count\",tstart, NULL, tedge, inarray);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWwritefield for field Count in swath SIMPLE %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWwritefield(SWid_simple,\"Count\", tstart, stride, NULL, inarray);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWwritefield for field Conduction in swath SIMPLE %d\n",status);); } /* ************************************************************************** * Testing HE5_PRwrite * ************************************************************************** */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_PRwrite... \n");); MESSAGE(4,printf("\t======================\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PRwrite... \n");); MESSAGE(11,fprintf(fp,"\t======================\n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tWriting profile \"Profile-2000\" in swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tWriting profile \"Profile-2000\" in swath SIMPLE \n");); edge[ 0 ] = 4; status = HE5_PRwrite(SWid_simple, "Profile-2000", start, NULL, edge, datasize, buffer); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_PRwrite(SWid_simple, \"Profile-2000\", start, NULL, edge, datasize, buffer);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_PRwrite in swath SIMPLE %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_PRwrite(SWid_simple,\"Profile-2000\", start, NULL, edge, datasize, buffer);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_PRwrite in swath SIMPLE %d\n",status);); } /* -------------------------------- Swath INDEX ----------------------------------- ------- W r i t i n g I n d e x e d _ D a t a i n a s w a t h -------- */ tstart[ 0 ] = 0; tstart[ 1 ] = 0; tedge[ 0 ] = 8; tedge[ 1 ] = 4; MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tWriting field Indexed_Data in swath INDEX \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tWriting field Indexed_Data in swath INDEX \n");); status = HE5_SWwritefield(SWid_index, "Indexed_Data", tstart, NULL, tedge, IndexedData); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWwritefield(SWid_index, \"Indexed_Data\",tstart,NULL,tedge,IndexedData);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWwritefield for field Indexed_Data in swath INDEX %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWwritefield(SWid_simple,\"Indexed_Data\",tstart,NULL,tedge,IndexedData);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWwritefield for field Indexed_Data in swath INDEX %d\n",status);); } /* ------- W r i t i n g L a t i t u d e / L o n g i t u d e i n a s w a t h -------- */ tstart[ 0 ] = 0; tstart[ 1 ] = 0; tedge[ 0 ] = 6; tedge[ 1 ] = 6; MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tWriting field Latitude in swath INDEX \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tWriting field Latitude in swath INDEX \n");); status = HE5_SWwritefield(SWid_index, "Latitude", tstart, NULL, tedge, IndexedLatData); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWwritefield(SWid_index, \"Latitude\",tstart,NULL,tedge,IndexedLatData);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWwritefield for field Latitude in swath INDEX %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWwritefield(SWid_simple,\"Latitude\",tstart,NULL,tedge,IndexedLatData);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWwritefield for field Latitude in swath INDEX %d\n",status);); } MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tWriting field Longitude in swath INDEX \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tWriting field Longitude in swath INDEX \n");); status = HE5_SWwritefield(SWid_index, "Longitude", tstart, NULL, tedge, IndexedLonData); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWwritefield(SWid_index, \"Longitude\",tstart,NULL,tedge,IndexedLonData);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_SWwritefield for field Longitude in swath INDEX %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWwritefield(SWid_simple,\"Longitude\",tstart,NULL,tedge,IndexedLonData);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_SWwritefield for field Longitude in swath INDEX %d\n",status);); } /* ********************************************************************************* * Testing HE5_SWwriteattr * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWwriteattr... \n");); MESSAGE(4,printf("\t==========================\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWwriteattr... \n");); MESSAGE(11,fprintf(fp,"\t==========================\n");); /* --------- W r i t i n g " D r i f t " i n a s w a t h -------- */ MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tWriting attribute Drift in swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tWriting attribute Drift in swath SIMPLE \n");); status = HE5_SWwriteattr(SWid_simple,"Drift",H5T_NATIVE_INT,CurrentSize,AttrVal); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWwriteattr(SWid_simple, \"Drift\",H5T_NATIVE_INT, 4, AttrVal);\n");); MESSAGE(8,printf("\t\tValue returned by SWwriteattr for attribute Drift in swath SIMPLE %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWwriteattr(SWid_simple, \"Drift\",H5T_NATIVE_INT, 4, AttrVal);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by SWwriteattr for attribute Drift in swath SIMPLE %d\n",status);); MESSAGE(11,fprintf(fp,"\t\t Attribute element Value to write \n");); MESSAGE(11,printf("\t\t Attribute element Value to write \n");); for( i = 0; i < 4 ; i++ ) { MESSAGE(11,fprintf(fp,"\t\t %d %d \n",i+1,AttrVal[ i ] );); MESSAGE(11,printf("\t\t %d %d \n", i+1,AttrVal[ i ] );); } } /* ********************************************************************************* * Testing HE5_SWwritegrpattr * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWwritegrpattr... \n");); MESSAGE(4,printf("\t==========================\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWwritegrpattr... \n");); MESSAGE(11,fprintf(fp,"\t==========================\n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tWriting attribute GroupAttribute in swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tWriting attribute GroupAttribute in swath SIMPLE \n");); status = HE5_SWwritegrpattr(SWid_simple,"GroupAttribute",H5T_NATIVE_INT,CurrentSize,GattrVal); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWwritegrpattr(SWid_simple, \"GroupAttribute\",H5T_NATIVE_INT, 4,GattrVal);\n");); MESSAGE(8,printf("\t\tValue returned by SWwritegrpattr for attribute GroupAttribute in swath SIMPLE %d \n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWwritegrpattr(SWid_simple, \"GroupAttribute\",H5T_NATIVE_INT, 4, GattrVal);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by SWwritegrpattr for attribute GroupAttribute in swath SIMPLE %d\n",status);); MESSAGE(11,fprintf(fp,"\t\t Attribute element Value to write \n");); MESSAGE(11,printf("\t\t Attribute element Value to write \n");); for( i = 0; i < 4 ; i++ ) { MESSAGE(11,fprintf(fp,"\t\t %d %d \n",i+1,GattrVal[ i ] );); MESSAGE(11,printf("\t\t %d %d \n", i+1,GattrVal[ i ] );); } } /* ********************************************************************************* * Testing HE5_SWwritegeogrpattr * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWwritegeogrpattr... \n");); MESSAGE(4,printf("\t==========================\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWwritegeogrpattr... \n");); MESSAGE(11,fprintf(fp,"\t==========================\n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tWriting attribute ScalarFloat in swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tWriting attribute ScalarFloat in swath SIMPLE \n");); count[0] = 1; status = HE5_SWwritegeogrpattr(SWid_simple,"ScalarFloat",H5T_NATIVE_FLOAT,count,&GfattrVal); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWwritegeogrpattr(SWid_simple, \"ScalarFloat\",H5T_NATIVE_FLOAT, 4,GfattrVal);\n");); MESSAGE(8,printf("\t\tValue returned by SWwritegeogrpattr for attribute ScalarFloat in swath SIMPLE %d \n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWwritegeogrpattr(SWid_simple, \"ScalarFloat\",H5T_NATIVE_FLOAT, 4, GfattrVal);\n");) ; MESSAGE(11,fprintf(fp,"\t\tValue returned by SWwritegeogrpattr for attribute ScalarFloat in swath SIMPLE %d\n",status);); MESSAGE(11,fprintf(fp,"\t\t Attribute element Value to write \n");); MESSAGE(11,printf("\t\t Attribute element Value to write \n");); } /* ********************************************************************************* * Testing HE5_SWdefvrtregion * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWdefvrtregion... \n");); MESSAGE(4,printf("\t=============================\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWdefvrtregion... \n");); MESSAGE(11,fprintf(fp,"\t=============================\n");); Range[ 0 ] = 5.5e7; Range[ 1 ] = 6.5e7; MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tDefining vert region Time \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tDefining vert region Time \n");); RegionID = HE5_SWdefvrtregion(SWid_simple,HE5_HDFE_NOPREVSUB,"Time",Range); if (RegionID == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(8,printf("\t\tRegion ID returned by SWdefvrtregion = %ld\n", (long) RegionID);); MESSAGE(11,fprintf(fp,"\t\tRegion ID returned by SWdefvrtregion = %ld\n", (long) RegionID);); } /* ********************************************************************************* * Testing HE5_SWreadfield * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWreadfield... \n");); MESSAGE(4,printf("\t==========================\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWreadfield... \n");); MESSAGE(11,fprintf(fp,"\t==========================\n");); /* --------- R e a d i n g T i m e f r o m a s w a t h -------- */ tstart[ 0 ] = 0; tedge[ 0 ] = 5; TimeDataOut = (double *)calloc( 5, sizeof( double )); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tReading field Time from swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tReading field Time from swath SIMPLE \n");); status = HE5_SWreadfield(SWid_simple,"Time",tstart,NULL,tedge,TimeDataOut); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_SWreadfield(SWid_simple,\"Time\",tstart,NULL,tedge,TimeDataOut);\n");); MESSAGE(8,printf("\t\tstatus returned by SWreadfield %d\n", status );); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWreadfield(SWid_simple,\"Time\",tstart,NULL,tedge,TimeDataOut);\n");); MESSAGE(11,fprintf(fp,"\t\tstatus returned by SWreadfield %d\n", status );); MESSAGE(8,printf("\t\tFirst five values of \"Time\" field read\n");); MESSAGE(11,fprintf(fp,"\t\tFirst five values of \"Time\" field read\n");); MESSAGE(8,printf("\n");); MESSAGE(11,fprintf(fp,"\n");); for( i = 0; i < 5 ; i++) { MESSAGE(8,printf("\t\t %lf\n", TimeDataOut[i]);); MESSAGE(11,fprintf(fp,"\t\t %lf\n", TimeDataOut[i]);); } } free(TimeDataOut); TimeDataOut = NULL; /* ********************************************************************************* * Testing HE5_PRread * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_PRread... \n");); MESSAGE(4,printf("\t=====================\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_PRread... \n");); MESSAGE(11,fprintf(fp,"\t=====================\n");); start[0] = 0; edge[0] = 4; status = HE5_PRread(SWid_simple, "Profile-2000", start, NULL, edge, buffer_out); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_PRread(SWid_simple, \"Profile-2000\", start, NULL, edge, buffer_out);\n");); MESSAGE(8,printf("\t\tstatus returned by HE5_PRread %d\n", status );); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_PRread(SWid_simple,\"Profile-2000\", start, NULL, edge, buffer_out);\n");); MESSAGE(11,fprintf(fp,"\t\tstatus returned by HE5_PRread %d\n", status );); MESSAGE(8,printf("\t\tThe first two elements of \"Profile-2000\" data read\n");); MESSAGE(11,fprintf(fp,"\t\tThe firdt two elements of \"Profile-2000\" data read\n");); MESSAGE(8,printf("\n");); MESSAGE(11,fprintf(fp,"\n");); } for (i = 0; i < 4; i++) { MESSAGE(8,printf("\t\tThe %d-th element length is %d \n", i, (unsigned)buffer_out[i].len);); MESSAGE(11,fprintf(fp,"\t\tThe %d-th element length is %d \n", i, (unsigned)buffer_out[i].len);); for (j = 0; j < 2; j++) { MESSAGE(8,printf("\t\t %d \n", ((unsigned int *)buffer_out[i].p)[j]);); MESSAGE(11,fprintf(fp,"\t\t %d \n", ((unsigned int *)buffer_out[i].p)[j]);); } } MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tReclaiming the space ... \n");); MESSAGE(4,printf("\t=========================\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\tReclaiming the space ... \n");); MESSAGE(11,fprintf(fp,"\t=========================\n");); status = HE5_PRreclaimspace(SWid_simple, "Profile-2000", buffer_out); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_PRreclaimspace(SWid_simple, \"Profile-2000\", buffer_out);\n");); MESSAGE(8,printf("\t\tstatus returned by HE5_PRreclaimspace %d\n", status );); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_PRreclaimspace(SWid_simple,\"Profile-2000\", buffer_out);\n");); MESSAGE(11,fprintf(fp,"\t\tstatus returned by HE5_PRreclaimspace %d\n", status );); } /* ********************************************************************************* * Testing HE5_SWreadattr * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWreadattr... \n");); MESSAGE(4,printf("\t=========================\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWreadattr... \n");); MESSAGE(11,fprintf(fp,"\t=========================\n");); /* --------- R e a d i n g " D r i f t " a t t r i b u t e -------- */ MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tReading attribute Drift from swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tReading attribute Drift from swath SIMPLE \n");); status = HE5_SWreadattr(SWid_simple,"Drift", AttrValOut); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWreadattr(SWid_simple,\"Drift\", AttrValOut);\n");); MESSAGE(8,printf("\t\tValue returned by SWreadattr for attribute Drift in swath SIMPLE %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWreadattr(SWid_simple,\"Drift\", AttrValOut);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by SWreadattr for attribute Drift in swath SIMPLE %d\n",status);); MESSAGE(11,fprintf(fp,"\t\t Attribute elements read \n");); MESSAGE(8,printf("\t\t Attribute elements read \n");); MESSAGE(8,printf("\n");); MESSAGE(11,fprintf(fp,"\n");); for( i = 0; i < 4 ; i++ ) { MESSAGE(11,fprintf(fp,"\t\t %d \n", AttrValOut[ i ] );); MESSAGE(8,printf("\t\t %d \n", AttrValOut[ i ] );); } } /* ********************************************************************************* * Testing HE5_SWreadgrpattr * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWreadgrpattr... \n");); MESSAGE(4,printf("\t=========================\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWreadgrpattr... \n");); MESSAGE(11,fprintf(fp,"\t=========================\n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tReading attribute GroupAttribute from swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tReading attribute GroupAttribute from swath SIMPLE \n");); status = HE5_SWreadgrpattr(SWid_simple,"GroupAttribute", GattrValOut); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); /* MESSAGE(4,printf("Group attribute values:\n");); for (i = 0; i < 4; i++) MESSAGE(4,printf("\t\t %d \n", GattrValOut[ i ] );); */ MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWreadgrpattr(SWid_simple,\"GroupAttribute\", GattrValOut);\n");); MESSAGE(8,printf("\t\tValue returned by SWreadgrpattr for attribute GroupAttribute in swath SIMPLE %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWreadgrpattr(SWid_simple,\"GroupAttribute\", GattrValOut);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by SWreadgrpattr for attribute GroupAttribute in swath SIMPLE %d\n",status);); MESSAGE(11,fprintf(fp,"\t\t Attribute elements read \n");); MESSAGE(8,printf("\t\t Attribute elements read \n");); MESSAGE(8,printf("\n");); MESSAGE(11,fprintf(fp,"\n");); for( i = 0; i < 4 ; i++ ) { MESSAGE(11,fprintf(fp,"\t\t %d \n", GattrValOut[ i ] );); MESSAGE(8,printf("\t\t %d \n", GattrValOut[ i ] );); } } /* ********************************************************************************* * Testing HE5_SWreadgeogrpattr * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWreadgeogrpattr... \n");); MESSAGE(4,printf("\t=========================\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWreadgeogrpattr... \n");); MESSAGE(11,fprintf(fp,"\t=========================\n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tReading attribute ScalarFloat from swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tReading attribute ScalarFloat from swath SIMPLE \n");); status = HE5_SWreadgeogrpattr(SWid_simple,"ScalarFloat", &GfattrValOut); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); /* MESSAGE(4,printf("Geolocation fields group attribute values:\n");); MESSAGE(4,printf("\t\t %f \n", GfattrValOut );); */ MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWreadgeogrpattr(SWid_simple,\"GroupAttribute\", GattrValOut);\n");); MESSAGE(8,printf("\t\tValue returned by SWreadgeogrpattr for attribute GroupAttribute in swath SIMPLE %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWreadgeogrpattr(SWid_simple,\"GroupAttribute\", GattrValOut);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by SWreadgeogrpattr for attribute GroupAttribute in swath SIMPLE %d\n",status);); MESSAGE(11,fprintf(fp,"\t\t Attribute elements read \n");); MESSAGE(8,printf("\t\t Attribute elements read \n");); MESSAGE(8,printf("\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(8,printf("\t\t %f \n", GfattrValOut);); } /* ********************************************************************************* * Testing HE5_SWnentries * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWnentries... \n");); MESSAGE(4,printf("\t=========================\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWnentries... \n");); MESSAGE(11,fprintf(fp,"\t=========================\n");); /* ----- R e t r i e v e # o f d i m e n s i o n s i n a s w a t h ----- */ MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve number of dimensions in swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve number of dimensions in swath SIMPLE \n");); number = HE5_SWnentries(SWid_simple,0,&strbufsize); if (number == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tnumber=HE5_SWnentries(SWid_simple,0,&strbufsize);\n");); MESSAGE(8,printf("\t\tNumber of dimensions %li\n",number);); MESSAGE(8,printf("\t\tString size of dimension entries: %li (bytes)\n",strbufsize);); MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWnentries(SWid_simple,0,&strbufsize);\n");); MESSAGE(11,fprintf(fp,"\t\tNumber of dimensions %li\n",number);); MESSAGE(11,fprintf(fp,"\t\tString size of dimension entries: %li (bytes)\n",strbufsize);); } /* ********************************************************************************* * Testing HE5_SWinqdims * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWinqdims... \n");); MESSAGE(4,printf("\t======================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWinqdims... \n");); MESSAGE(11,fprintf(fp,"\t======================== \n");); DimNamePtr = (char *)calloc( 1, strbufsize+1); /* ----- R e t r i e v e d i m e n s i o n l i s t f o r a s w a t h ----- */ MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve the dimension information for swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve the dimension information for swath SIMPLE \n");); number = HE5_SWinqdims(SWid_simple,DimNamePtr,Dims); if (number == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(8,printf("\t\tnumber=HE5_SWinqdims(SWid_simple,DimNamePtr,DimListPtr);\n");); MESSAGE(8,printf("\t\tDimension list: \n");); MESSAGE(8,printf("\t\t %s\n",DimNamePtr);); MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWinqdims(SWid_simple,DimNamePtr,DimListPtr);\n");); MESSAGE(11,fprintf(fp,"\t\tDimension list: \n");); MESSAGE(11,fprintf(fp,"\t\t %s\n",DimNamePtr);); MESSAGE(8,printf("\t\tDimension sizes: \n");); MESSAGE(11,fprintf(fp,"\t\tDimension sizes: \n");); for (i = 0; i < number; i++) { MESSAGE(8,printf("\t\t %lu\n",(unsigned long)Dims[i]);); MESSAGE(11,fprintf(fp,"\t\t %lu\n",(unsigned long)Dims[i]);); } } free(DimNamePtr); DimNamePtr = NULL; /* ********************************************************************************* * Testing HE5_SWinqmaps * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWinqmaps... \n");); MESSAGE(4,printf("\t======================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWinqmaps... \n");); MESSAGE(11,fprintf(fp,"\t======================== \n");); /* -- R e t r i e v e d i m e n s i o n m a p p i n g s i n a s w a t h -- */ MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve dimension mappings for swath SIMPLE\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve dimension mappings for swath SIMPLE\n");); number = HE5_SWnentries(SWid_simple,1,&strbufsize); if (number == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tnumber=HE5_SWnentries(SWid_simple,1,&strbufsize);\n");); MESSAGE(8,printf("\t\tNumber of dimension mappings %li\n",number);); MESSAGE(8,printf("\t\tSize of dimension mapping entries %li (bytes)\n",strbufsize);); MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWnentries(SWid_simple,1,&strbufsize);\n");); MESSAGE(11,fprintf(fp,"\t\tNumber of dimension mappings %li\n",number);); MESSAGE(11,fprintf(fp,"\t\tSize of dimension mapping entries %li (bytes)\n",strbufsize);); } /* -- R e t r i e v e g e o l o c a t i o n r e l a t i o n s f o r a s w a t h -- */ OffsetPtr = (long *)calloc(number, sizeof(long)); IncremPtr = (long *)calloc(number, sizeof(long)); DimMapListPtr = (char *)calloc( BUFSIZE, sizeof(char)); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve geolocation relations for swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve geolocation relations for swath SIMPLE \n");); number = HE5_SWinqmaps(SWid_simple,DimMapListPtr,OffsetPtr,IncremPtr); if (number == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tnumber=HE5_SWinqmaps(SWid_simple,DimMapListPtr,OffsetPtr,IncremPtr);\n");); MESSAGE(8,printf("\t\tNumber of maps %li\n", number);); MESSAGE(6,printf("\t\tGeolocation relations: \n");); MESSAGE(6,printf("\t\t %s\n",DimMapListPtr);); MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWinqmaps(SWid_simple,DimMapListPtr,OffsetPtr,IncremPtr);\n");); MESSAGE(11,fprintf(fp,"\t\tNumber of maps %li\n",number);); MESSAGE(11,fprintf(fp,"\t\tGeolocation relations: \n");); MESSAGE(11,fprintf(fp,"\t\t %s\n",DimMapListPtr);); MESSAGE(6,printf("\t\t Offset Increment \n");); MESSAGE(11,fprintf(fp,"\t\t Offset Increment \n");); for (i = 0; i < number; i++) { MESSAGE(6,printf("\t\t %li %li \n",OffsetPtr[i], IncremPtr[i]);); MESSAGE(11,fprintf(fp,"\t\t %li %li \n",OffsetPtr[i], IncremPtr[i]);); } } free(OffsetPtr); free(IncremPtr); free(DimMapListPtr); OffsetPtr = NULL; IncremPtr = NULL; DimMapListPtr = NULL; /* -- R e t r i e v e t h e I n d e x d i m e n s i o n m a p p i n g s -- */ MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve the Index dimension mappings for swath SIMPLE\n");); MESSAGE(11,fprintf(fp,"\n"); ); MESSAGE(11,fprintf(fp,"\t\tRetrieve the Index dimension mappings for swath SIMPLE\n"); ); number = HE5_SWnentries(SWid_simple,2,&strbufsize); if ( number == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tnumber=HE5_SWnentries(SWid_simple,2,&strbufsize);\n");); MESSAGE(8,printf("\t\tNumber of Indexed mappings %li\n",number);); MESSAGE(8,printf("\t\tSize of index mapping entries: %li (bytes)\n",strbufsize);); MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWnentries(SWid_simple,2,&strbufsize);\n");); MESSAGE(11,fprintf(fp,"\t\tNumber of Indexed mappings %li\n",number);); MESSAGE(11,fprintf(fp,"\t\tSize of index mapping entries: %li (bytes)\n",strbufsize);); } /* ********************************************************************************* * Testing HE5_SWinqgeofields * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWinqgeofields... \n");); MESSAGE(4,printf("\t============================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWinqgeofields... \n");); MESSAGE(11,fprintf(fp,"\t============================= \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve information about Geolocation fields in swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve information about Geolocation fields in swath SIMPLE \n");); number = HE5_SWnentries(SWid_simple,3,&strbufsize); if ( number == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tnumber=HE5_SWnentries(SWid_simple,3,&strbufsize);\n");); MESSAGE(8,printf("\t\tValue (number of geo fields) returned by SWnentries %li\n",number);); MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWnentries(SWid_simple,3,&strbufsize);\n");); MESSAGE(11,fprintf(fp,"\t\tValue (number of geo fields) returned by SWnentries %li\n",number);); } /* -- R e t r i e v e g e o l o c a t i o n f i e l d s i n a s w a t h -- */ RankPtr = (int *)calloc( number, sizeof(int)); FieldListPtr = (char *)calloc( BUFSIZE, sizeof(char)); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve more information about Geolocation fields\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve more information about Geolocation fields\n");); number = HE5_SWinqgeofields(SWid_simple,FieldListPtr,RankPtr,ntype); if (number == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tnumber=HE5_SWinqgeofields(SWid_simple,FieldListPtr,RankPtr,ntype);\n");); MESSAGE(8,printf("\t\tList of Geolocation fields:\n");); MESSAGE(8,printf("\t\t %s\n",FieldListPtr);); MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWinqgeofields(SWid_simple,FieldListPtr,RankPtr,ntype);\n");); MESSAGE(11,fprintf(fp,"\t\tList of Geolocation fields:\n");); MESSAGE(11,fprintf(fp,"\t\t %s\n",FieldListPtr);); MESSAGE(8,printf("\t\tRanks: Data types:\n");); MESSAGE(11,fprintf(fp,"\t\tRanks: Data types:\n");); for (i = 0; i < number; i++) { MESSAGE(8,printf("\t\t %d %ld\n", RankPtr[i], (long) ntype[i]);); MESSAGE(11,fprintf(fp,"\t\t %d %ld\n", RankPtr[i], (long) ntype[i]);); } } free(RankPtr); RankPtr = NULL; /* ********************************************************************************* * Testing HE5_SWinqdatafields * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWinqdatafields... \n");); MESSAGE(4,printf("\t============================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWinqdatafields... \n");); MESSAGE(11,fprintf(fp,"\t============================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve information about Data fields in swath SIMPLE\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve information about Data fields in swath SIMPLE\n");); number = HE5_SWnentries(SWid_simple,4,&strbufsize); if (number == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tnumber=HE5_SWnentries(SWid_simple,4,&strbufsize);\n");); MESSAGE(8,printf("\t\tValue (number of data fields) returned by SWnentries %li\n",number);); MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWnentries(SWid_simple,4,&strbufsize);\n");); MESSAGE(11,fprintf(fp,"\t\tValue (number of data fields) returned by SWnentries %li\n",number);); } RankPtr = (int *)calloc(number, sizeof(int)); MESSAGE(6,printf("\t\tRetrieve the Data fields in swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve the Data fields in swath SIMPLE \n");); number = HE5_SWinqdatafields(SWid_simple,FieldListPtr,RankPtr,ntype); if (number == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tnumber=HE5_SWinqdatafields(SWid_simple,FieldListPtr,RankPtr,ntype);\n");); MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWinqdatafields(SWid_simple,FieldListPtr,RankPtr,ntype);\n");); MESSAGE(8,printf("\t\tList of Data fields:\n");); MESSAGE(8,printf("\t\t %s\n",FieldListPtr);); MESSAGE(11,fprintf(fp,"\t\tList of Data fields:\n");); MESSAGE(11,fprintf(fp,"\t\t %s\n",FieldListPtr);); MESSAGE(8,printf("\t\tRanks: Data types:\n");); MESSAGE(11,fprintf(fp,"\t\tRanks: Data types:\n");); for (i = 0; i < number; i++) { MESSAGE(8,printf("\t\t %d %ld\n", RankPtr[i], (long) ntype[i]);); MESSAGE(11,fprintf(fp,"\t\t %d %ld\n", RankPtr[i], (long) ntype[i]);); } } free(RankPtr); free(FieldListPtr); /* ********************************************************************************* * Testing HE5_SWwritelocattr * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_SWwritelocattr... \n");); MESSAGE(4,printf("\t========================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWwritelocattr... \n");); MESSAGE(11,fprintf(fp,"\t========================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tWriting attribute \"LocaAttribute\" to the field \"Count\" \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tWriting attribute \"LocalAttribute\" to the \"Count\" \n");); count[0] = 4; status = HE5_SWwritelocattr(SWid_simple, "Count", "LocalAttribute",H5T_NATIVE_INT, count, attr3); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus =HE5_SWwritelocattr(SWid_simple, \"Count\", \"LocalAttribute\",H5T_NATIVE_INT, count, attr3); \n"); ); MESSAGE(8,printf("\t\tStatus returned by HE5_GDwritelocattr() %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWwritelocattr(SWid_simple, \"Count\", \"LocalAttribute\",H5T_NATIVE_INT, count, attr3);\ n");) MESSAGE(11,fprintf(fp,"\t\tStatus returned by HE5_SWwritelocattr() %d\n",status);); } /* ********************************************************************************* * Testing HE5_SWreadlocattr * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWreadlocattr... \n");); MESSAGE(4,printf("\t=========================\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWreadlocattr... \n");); MESSAGE(11,fprintf(fp,"\t=========================\n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tReading attribute LocalAttribute from Count field \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tReading attribute LocalAttribute from Count field \n");); status = HE5_SWreadlocattr(SWid_simple, "Count", "LocalAttribute", attr3Out); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWreadlocattr(SWid_simple,\"Count\", \"LocalAttribute\", attr3Out);\n");); MESSAGE(8,printf("\t\tValue returned by SWreadlocattr for attribute LocalAttribute in field Count %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWreadlocattr(SWid_simple,\"Count\", \"LocalAttribute\", attr3Out);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by SWreadlocattr for attribute LocalAttribute in field Count %d\n",status);); MESSAGE(11,fprintf(fp,"\t\t Attribute elements read \n");); MESSAGE(8,printf("\t\t Attribute elements read \n");); MESSAGE(8,printf("\n");); MESSAGE(11,fprintf(fp,"\n");); for( i = 0; i < 4 ; i++ ) { MESSAGE(11,fprintf(fp,"\t\t %d \n", attr3Out[ i ] );); MESSAGE(8,printf("\t\t %d \n", attr3Out[ i ] );); } } /* ********************************************************************************* * Testing HE5_SWinqdatatype * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_SWinqdatatype... \n");); MESSAGE(4,printf("\t======================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWinqdatatype... \n");); MESSAGE(11,fprintf(fp,"\t======================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieving information about field data in a grid\n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\t Retrieving information about field data in a grid\n");); fieldgroup = HE5_HDFE_ATTRGROUP; status = HE5_SWinqdatatype(SWid_simple, NULL, "Drift", fieldgroup, &datatype, &classid, &order, &Size); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); /* MESSAGE(4,printf("\tdatatype: %d \n", (int)datatype);); MESSAGE(4,printf("\tclass ID: %d \n", (int)classid);); MESSAGE(4,printf("\torder: %d \n", (int)order);); MESSAGE(4,printf("\tsize: %d \n", (int)Size);); */ } fieldgroup = HE5_HDFE_GRPATTRGROUP; status = HE5_SWinqdatatype(SWid_simple, NULL, "GroupAttribute", fieldgroup, &datatype, &classid, &order, &Size); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); /* MESSAGE(4,printf("\tdatatype: %d \n", (int)datatype);); MESSAGE(4,printf("\tclass ID: %d \n", (int)classid);); MESSAGE(4,printf("\torder: %d \n", (int)order);); MESSAGE(4,printf("\tsize: %d \n", (int)Size);); */ } fieldgroup = HE5_HDFE_LOCATTRGROUP; status = HE5_SWinqdatatype(SWid_simple, "Count", "LocalAttribute", fieldgroup, &datatype, &classid, &order, &Size); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); /* MESSAGE(4,printf("\tdatatype: %d \n", (int)datatype);); MESSAGE(4,printf("\tclass ID: %d \n", (int)classid);); MESSAGE(4,printf("\torder: %d \n", (int)order);); MESSAGE(4,printf("\tsize: %d \n", (int)Size);); */ } /* ********************************************************************************* * Testing HE5_SWdiminfo... * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWdiminfo... \n");); MESSAGE(4,printf("\t======================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWdiminfo... \n");); MESSAGE(11,fprintf(fp,"\t======================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve information about DataXtrack dimension in swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve information about DataXtrack dimension in swath SIMPLE \n");); ndims = HE5_SWdiminfo(SWid_simple,"DataXtrack"); if ( ndims == 0) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tndims=HE5_SWdiminfo(SWid_simple,\"DataXtrack\");\n");); MESSAGE(8,printf("\t\tSize of dimension DataXtrack: %lu \n",(unsigned long)ndims);); MESSAGE(11,fprintf(fp,"\t\tndims=HE5_SWdiminfo(SWid_simple,\"DataXtrack\");\n");); MESSAGE(11,fprintf(fp,"\t\tSize of dimension DataXtrack: %lu \n",(unsigned long)ndims);); } /* ********************************************************************************* * Testing HE5_SWreadfield * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWreadfield... \n");); MESSAGE(4,printf("\t========================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWreadfield... \n");); MESSAGE(11,fprintf(fp,"\t========================== \n");); inq_start[0] = 0; inq_start[1] = 0; inq_stride[0] = 1; inq_stride[1] = 1; inq_edge[0] = 10; inq_edge[1] = 4; MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tReading data from field \"Temperature\" in swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tReading data from field \"Temperature\" in swath SIMPLE\n");); number = HE5_SWreadfield(SWid_simple,"Temperature",inq_start,inq_stride,inq_edge,TempDataOut); if (number == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tnumber=HE5_SWreadfield(SWid_simple,\"Temperature\",inq_start,inq_stride,inq_edge,TempDataOut);\n");); MESSAGE(8,printf("\t\tstatus return from call to SWreadfield %li\n", number );); MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWreadfield(SWid_simple,\"Temperature\",inq_start,inq_stride,inq_edge,TempDataOut);\n");); MESSAGE(11,fprintf(fp,"\t\tstatus return from call to SWreadfield %li\n", number );); MESSAGE(8,printf("\t\tThe values of data field \"Temperature\":\n");); MESSAGE(11,fprintf(fp,"\t\tThe values of data field \"Temperature\":\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(8,printf("\n");); for (i = 0; i < 10; i++) { MESSAGE(8,printf("\t\t %lf %lf %lf %lf \n",TempDataOut[i][0],TempDataOut[i][1],TempDataOut[i][2],TempDataOut[i][3] );); MESSAGE(11,fprintf(fp,"\t\t %lf %lf %lf %lf \n",TempDataOut[i][0],TempDataOut[i][1],TempDataOut[i][2],TempDataOut[i][3] );); } } /* ********************************************************************************* * Testing HE5_SWfieldinfo * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWfieldinfo... \n");); MESSAGE(4,printf("\t========================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWfieldinfo... \n");); MESSAGE(11,fprintf(fp,"\t========================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve information about field \"Temperature\" in swath SIMPLE e\n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve information about field \"Temperature\" in swath SIMPLE \n");); status = HE5_SWfieldinfo(SWid_simple,"Temperature",&rank,dims,&dtype1,DimList,NULL); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_SWfieldinfo(SWid_simple,\"Temperature\",&rank,dims,&dtype1,DimList,NULL);\n");); MESSAGE(8,printf("\t\tstatus returned by SWfieldinfo %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWfieldinfo(SWid_simple,\"Temperature\",&rank,dims,&dtype1,DimList,NULL);\n");); MESSAGE(11,fprintf(fp,"\t\tstatus returned by SWfieldinfo %d\n",status);); MESSAGE(8,printf("\t\tRank: %d Data type: %ld\n",rank, (long) dtype1);); MESSAGE(8,printf("\t\tDimension list: %s\n",DimList);); MESSAGE(11,fprintf(fp,"\t\tRank: %d Data type: %ld\n",rank, (long) dtype1);); MESSAGE(11,fprintf(fp,"\t\tDimension list: %s\n",DimList);); MESSAGE(8,printf("\t\tDimension sizes:\n");); MESSAGE(11,fprintf(fp,"\t\tDimension sizes:\n");); for (i = 0; i < rank; i++) { MESSAGE(8,printf("\t\t %lu\n",(unsigned long)dims[i]);); MESSAGE(11,fprintf(fp,"\t\t %lu\n",(unsigned long)dims[i]);); } } /* ********************************************************************************* * Testing HE5_SWinqmaps * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWinqmaps... \n");); MESSAGE(4,printf("\t======================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWinqmaps... \n");); MESSAGE(11,fprintf(fp,"\t======================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve information about dimension mapping from swath SIMPLE\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve information about dimension mapping from swath SIMPLE\n");); number = HE5_SWnentries(SWid_simple,1,&strbufsize); if (number == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tnumber=HE5_SWnentries(SWid_simple,1,&strbufsize);\n");); MESSAGE(8,printf("\t\tNumber of dimension mappings %li\n",number);); MESSAGE(8,printf("\t\tSize of dimension mapping entries: %li (bytes)\n",strbufsize);); MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWnentries(SWid_simple,1,&strbufsize);\n");); MESSAGE(11,fprintf(fp,"\t\tNumber of dimension mappings %li\n",number);); MESSAGE(11,fprintf(fp,"\t\tSize of dimension mapping entries: %li (bytes)\n",strbufsize);); } OffsetPtr = (long *)calloc(number, sizeof(long)); IncremPtr = (long *)calloc(number, sizeof(long)); DimMapListPtr = (char *)calloc( BUFSIZE, sizeof(char)); MESSAGE(6,printf("\t\tRetrieve the geolocation relations for swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve the geolocation relations for swath SIMPLE \n");); number=HE5_SWinqmaps(SWid_simple,DimMapListPtr,OffsetPtr,IncremPtr); if (number == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tnumber=HE5_SWinqmaps(SWid_simple,DimMapListPtr,OffsetPtr,IncremPtr);\n");); MESSAGE(8,printf("\t\tNumber of mappings in swath SIMPLE %li\n",number);); MESSAGE(6,printf("\t\tGeolocation relations: \n");); MESSAGE(6,printf("\t\t %s\n",DimMapListPtr);); MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWinqmaps(SWid_simple,DimMapListPtr,OffsetPtr,IncremPtr);\n");); MESSAGE(11,fprintf(fp,"\t\tNumber of mappings in swath SIMPLE %li\n",number);); MESSAGE(11,fprintf(fp,"\t\tGeolocation relations: \n");); MESSAGE(11,fprintf(fp,"\t\t %s\n",DimMapListPtr);); MESSAGE(6,printf("\t\t Offset Increment \n");); MESSAGE(11,fprintf(fp,"\t\t Offset Increment \n");); for (i = 0; i < number; i++) { MESSAGE(6,printf("\t\t %li %li \n",OffsetPtr[i], IncremPtr[i]);); MESSAGE(11,fprintf(fp,"\t\t %li %li \n",OffsetPtr[i], IncremPtr[i]);); } } /* ********************************************************************************* * Testing HE5_SWmapinfo * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWmapinfo... \n");); MESSAGE(4,printf("\t======================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWmapinfo... \n");); MESSAGE(11,fprintf(fp,"\t======================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve offset and increment for geolocation mapping\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve offset and increment for geolocation mapping\n");); status = HE5_SWmapinfo(SWid_simple,"GeoTrack","DataTrack",OffsetPtr,IncremPtr); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_SWmapinfo(SWid_simple,\"GeoTrack\",\"DataTrack\",OffsetPtr,IncremPtr);\n");); MESSAGE(8,printf("\t\tstatus returned by SWmapinfo %d\n",status);); MESSAGE(8,printf("\t\tOffset %li, Increment %li\n",*OffsetPtr,*IncremPtr);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWmapinfo(SWid_simple,\"GeoTrack\",\"DataTrack\",OffsetPtr,IncremPtr);\n");); MESSAGE(11,fprintf(fp,"\t\tstatus returned by SWmapinfo %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tOffset %li, Increment %li\n",*OffsetPtr,*IncremPtr);); } free(OffsetPtr); free(IncremPtr); free(DimMapListPtr); OffsetPtr = NULL; IncremPtr = NULL; DimMapListPtr = NULL; /* ********************************************************************************* * Testing HE5_SWgeomapinfo * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWgeomapinfo... \n");); MESSAGE(4,printf("\t=========================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWgeomapinfo... \n");); MESSAGE(11,fprintf(fp,"\t=========================== \n");); /* Swath SIMPLE */ MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieving type of dimension mapping for dimension \"GeoTrack\"\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieving type of dimension mapping for dimension \"GeoTrack\"\n");); MESSAGE(8,printf("\n");); MESSAGE(8,printf("\t\t(NOTE: 2 - indexed mapping, 1 - regular mapping)\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t(NOTE: 2 - indexed mapping, 1 - regular mapping)\n");); status = HE5_SWgeomapinfo(SWid_simple,"GeoTrack"); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_SWgeomapinfo(SWid_simple,\"GeoTrack\",\"DataTrack\");\n");); MESSAGE(8,printf("\t\tValue returned by SWgeomapinfo %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWgeomapinfo(SWid_simple,\"GeoTrack\",\"DataTrack\");\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by SWgeomapinfo %d\n",status);); } /* Swath INDEX */ MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieving type of dimension mapping for dimension \"GeoDim\"\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieving type of dimension mapping for dimension \"GeoDim\"\n");); status = HE5_SWgeomapinfo(SWid_index,"GeoDim"); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_SWgeomapinfo(SWid_index,\"GeoDim\");\n");); MESSAGE(8,printf("\t\tValue returned by SWgeomapinfo %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWmapinfo(SWid_index,\"GeoDim\");\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by SWgeomapinfo %d\n",status);); } /* ********************************************************************************* * Testing HE5_SWgetfillvalue * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWgetfillvalue... \n");); MESSAGE(4,printf("\t============================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWgetfillvalue... \n");); MESSAGE(11,fprintf(fp,"\t============================= \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tGet fill value for the field \"Indexed_Data\" \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tGet fill value for the field \"Indexed_Data\" \n");); status = HE5_SWgetfillvalue(SWid_index,"Indexed_Data",&InqFloatFillValue); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_SWgetfillvalue(SWid_index,\"Indexed_Data\",&InqFloatFillValue);\n");); MESSAGE(8,printf("\t\tstatus returned by SWgetfillvalue %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWgetfillvalue(SWid_index,\"Indexed_Data\", &InqFloatFillValue)\n");); MESSAGE(11,fprintf(fp,"\t\tstatus returned by SWgetfillvalue %d\n",status);); MESSAGE(8,printf("\t\tFill value for field \"Indexed_Data\":\n");); MESSAGE(8,printf("\n");); MESSAGE(8,printf("\t\t \"%f\" \n", InqFloatFillValue);); MESSAGE(11,fprintf(fp,"\t\tFill value for field \"Indexed_Data\":\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t \"%f\" \n",InqFloatFillValue);); } /* ********************************************************************************* * Testing HE5_SWdetach * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWdetach... \n");); MESSAGE(4,printf("\t======================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWdetach... \n");); MESSAGE(11,fprintf(fp,"\t======================= \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tDetaching from swath INDEX \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tDetaching from swath INDEX \n");); status = HE5_SWdetach(SWid_index); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWdetach(SWid_index);\n");); MESSAGE(8,printf("\t\tstatus returned by SWdetach for swath INDEX %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdetach(SWid_index);\n");); MESSAGE(11,fprintf(fp,"\t\tstatus returned by SWdetach for swath INDEX%d\n",status);); } /* ********************************************************************************* * Testing HE5_SWinqattrs * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWinqattrs... \n");); MESSAGE(4,printf("\t========================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWinqattrs... \n");); MESSAGE(11,fprintf(fp,"\t========================= \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve information about attributes defined in swath INDEX \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve information about attributes defined in swath INDEX \n");); number = HE5_SWinqattrs(SWid_simple, NULL, &strbufsize); if (number == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Testst**********\n");); /* MESSAGE(4,printf("\t\tNumber of attributes: %li \n", number);); */ MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tnumber=HE5_SWinqattrs(SWid_simple, NULL, &strbufsize);\n");); MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWinqattrs(SWid_simple, NULL, &strbufsize);\n");); MESSAGE(8,printf("\t\tValue (number of attributes) returned by SWinqattrs %li\n",number);); MESSAGE(11,fprintf(fp,"\t\tValue (number of attributes) returned by SWinqattrs %li\n",number);); MESSAGE(8,printf("\t\tString length of attribute list: %li\n",strbufsize);); MESSAGE(11,fprintf(fp,"\t\tString length of attribute list: %li\n",strbufsize);); } MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve more information about attributes defined in swath INDEX \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve more information about attributes defined in swath INDEX \n");); ObjNamesPtr = (char *)calloc( BUFSIZE, sizeof(char)); number = HE5_SWinqattrs(SWid_simple, ObjNamesPtr, &strbufsize); if (number == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); /* MESSAGE(4,printf("\t\t Attribute list: %s \n", ObjNamesPtr);); */ MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tnumber=HE5_SWinqattrs(SWid_simple, ObjNamesPtr, &strbufsize);\n");); MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWinqattrs(SWid_simple, ObjNamesPtr,&strbufsize);\n");); MESSAGE(8,printf("\t\tNumber of attributes returned by SWinqattr %li\n",number);); MESSAGE(11,fprintf(fp,"\t\tNumber of attributes returned by SWinqattr %li\n",number);); MESSAGE(8,printf("\t\tAttribute list:\n");); MESSAGE(8,printf("\t\t %s\n", ObjNamesPtr);); MESSAGE(11,fprintf(fp,"\t\tAttribute list: \n");); MESSAGE(11,fprintf(fp,"\t\t %s\n", ObjNamesPtr);); MESSAGE(8,printf("\t\tString length of attribute list: %li\n",strbufsize);); MESSAGE(11,fprintf(fp,"\t\tString length of attribute list: %li\n",strbufsize);); } free(ObjNamesPtr); ObjNamesPtr = NULL; /* ********************************************************************************* * Testing HE5_SWinqgrpattrs * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWinqgrpattrs... \n");); MESSAGE(4,printf("\t========================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWinqgrpattrs... \n");); MESSAGE(11,fprintf(fp,"\t========================= \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve information about group attributes defined in swath INDEX \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve information about group attributes defined in swath INDEX \n");) ; number = HE5_SWinqgrpattrs(SWid_simple, NULL, &strbufsize); if (number == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Testst**********\n");); /* MESSAGE(4,printf("\t\tNumber of group attributes: %li \n", number);); */ MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tnumber=HE5_SWinqgrpattrs(SWid_simple, NULL, &strbufsize);\n");); MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWinqgrpattrs(SWid_simple, NULL, &strbufsize);\n");); MESSAGE(8,printf("\t\tValue (number of group attributes) returned by SWingrpqattrs %li\n",number);) ; MESSAGE(11,fprintf(fp,"\t\tValue (number of group attributes) returned by SWinqgrpattrs %li\n",number);) MESSAGE(8,printf("\t\tString length of group attribute list: %li\n",strbufsize);); MESSAGE(11,fprintf(fp,"\t\tString length of group attribute list: %li\n",strbufsize);); } MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve more information about group attributes defined in swath INDEX \n");) ; MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve more information about group attributes defined in swath INDEX \ n");); ObjNamesPtr = (char *)calloc( BUFSIZE, sizeof(char)); number = HE5_SWinqgrpattrs(SWid_simple, ObjNamesPtr, &strbufsize); if (number == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); /* MESSAGE(4,printf("\t\t Group Attribute list: %s \n", ObjNamesPtr);); */ MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tnumber=HE5_SWinqgrpattrs(SWid_simple, ObjNamesPtr, &strbufsize);\n");) ; MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWinqgrpattrs(SWid_simple, ObjNamesPtr,&strbufsize);\n" );); MESSAGE(8,printf("\t\tNumber of attributes returned by SWinqgrpattr %li\n",number);); MESSAGE(11,fprintf(fp,"\t\tNumber of attributes returned by SWinqgrpattr %li\n",number);); MESSAGE(8,printf("\t\tGroup Attribute list:\n");); MESSAGE(8,printf("\t\t %s\n", ObjNamesPtr);); MESSAGE(11,fprintf(fp,"\t\tGroup Attribute list: \n");); MESSAGE(11,fprintf(fp,"\t\t %s\n", ObjNamesPtr);); MESSAGE(8,printf("\t\tString length of Group attribute list: %li\n",strbufsize);); MESSAGE(11,fprintf(fp,"\t\tString length of Group attribute list: %li\n",strbufsize);); } free(ObjNamesPtr); ObjNamesPtr = NULL; /* ********************************************************************************* * Testing HE5_SWinqgeogrpattrs * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWinqgeogrpattrs... \n");); MESSAGE(4,printf("\t========================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWinqgeogrpattrs... \n");); MESSAGE(11,fprintf(fp,"\t========================= \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve information about group attributes defined in swath INDEX \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve information about group attributes defined in swath INDEX \n");); number = HE5_SWinqgeogrpattrs(SWid_simple, NULL, &strbufsize); if (number == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Testst**********\n");); /* MESSAGE(4,printf("\t\tNumber of Geolocation fields group attributes: %li \n", number);); */ MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tnumber=HE5_SWinqgeogrpattrs(SWid_simple, NULL, &strbufsize);\n");); MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWinqgeogrpattrs(SWid_simple, NULL, &strbufsize);\n");); MESSAGE(8,printf("\t\tValue (number of group attributes) returned by SWingeogrpqattrs %li\n",number);); MESSAGE(11,fprintf(fp,"\t\tValue (number of group attributes) returned by SWinqgeogrpattrs %li\n",number);); MESSAGE(8,printf("\t\tString length of group attribute list: %li\n",strbufsize);); MESSAGE(11,fprintf(fp,"\t\tString length of group attribute list: %li\n",strbufsize);); } MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve more information about group attributes defined in swath INDEX \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve more information about group attributes defined in swath INDEX \n");); ObjNamesPtr = (char *)calloc( BUFSIZE, sizeof(char)); number = HE5_SWinqgeogrpattrs(SWid_simple, ObjNamesPtr, &strbufsize); if (number == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); /* MESSAGE(4,printf("\t\t Geolocation field group Attribute list: %s \n", ObjNamesPtr);); */ MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tnumber=HE5_SWinqgeogrpattrs(SWid_simple, ObjNamesPtr, &strbufsize);\n");); MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWinqgeogrpattrs(SWid_simple, ObjNamesPtr,&strbufsize);\n");); MESSAGE(8,printf("\t\tNumber of attributes returned by SWinqgeogrpattr %li\n",number);); MESSAGE(11,fprintf(fp,"\t\tNumber of attributes returned by SWinqgeogrpattr %li\n",number);); MESSAGE(8,printf("\t\tGroup Attribute list:\n");); MESSAGE(8,printf("\t\t %s\n", ObjNamesPtr);); MESSAGE(11,fprintf(fp,"\t\tGroup Attribute list: \n");); MESSAGE(11,fprintf(fp,"\t\t %s\n", ObjNamesPtr);); MESSAGE(8,printf("\t\tString length of Group attribute list: %li\n",strbufsize);); MESSAGE(11,fprintf(fp,"\t\tString length of Group attribute list: %li\n",strbufsize);); } free(ObjNamesPtr); ObjNamesPtr = NULL; /* ********************************************************************************* * Testing HE5_SWattrinfo * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWattrinfo... \n");); MESSAGE(4,printf("\t=========================\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWattrinfo... \n");); MESSAGE(11,fprintf(fp,"\t=========================\n");); CountPtr = (hsize_t *)calloc(1, sizeof(hsize_t)); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve information about attribute \"Drift\" \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve information about attribute \"Drift\" \n");); status=HE5_SWattrinfo(SWid_simple,"Drift",&dtype,CountPtr); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); /* MESSAGE(4,printf("\t\tData type: %d\n", dtype);); MESSAGE(4,printf("\t\t Number of elements: %d \n", (int)*CountPtr);); */ MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_SWattrinfo(SWid_simple,\"Drift\",&dtype,CountPtr);\n");); MESSAGE(8,printf("\t\tstatus returned by SWattrinfo %d\n",status);); MESSAGE(6,printf("\t\tData type Number of attribute elements:\n");); MESSAGE(6,printf("\t\t %ld %d\n", (long) dtype,(int)*CountPtr);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWattrinfo(SWid_simple,\"Drift\",&dtype,CountPtr);\n");); MESSAGE(11,fprintf(fp,"\t\tStaus returned by SWattrinfo %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tData type Number of attribute elements:\n");); MESSAGE(11,fprintf(fp,"\t\t %ld %d\n", (long) dtype,(int)*CountPtr);); } free(CountPtr); /* ********************************************************************************* * Testing HE5_SWcompinfo * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWcompinfo... \n");); MESSAGE(4,printf("\t========================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWcompinfo... \n");); MESSAGE(11,fprintf(fp,"\t========================= \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve Compression information for field \"Temperature\"\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve Compression information for field \"Temperature\"\n");); status = HE5_SWcompinfo(SWid_simple,"Temperature",&code,level); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); /* MESSAGE(4,printf("\t\t Compression scheme Compression level\n");); MESSAGE(4,printf("\t\t %d, %d\n", code, level[0]);); */ MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(8,printf("\t\tCompression scheme Compression level\n");); MESSAGE(8,printf("\t\t %d, %d\n", code, level[0]);); MESSAGE(11,fprintf(fp,"\t\tCompression scheme Compression level\n");); MESSAGE(11,fprintf(fp,"\t\t %d, %d\n", code, level[0]);); } code = - 8; level[ 0 ] = - 8; MESSAGE(4,printf("\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(6,printf("\t\tRetrieve Compression information for field \"Conduction\"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve Compression information for field \"Conduction\"\n");); status = HE5_SWcompinfo(SWid_simple,"Conduction",&code,level); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(8,printf("\t\tCompression scheme Compression level\n");); MESSAGE(8,printf("\t\t %d, %d\n", code, level[0]);); MESSAGE(11,fprintf(fp,"\t\tCompression scheme Compression level\n");); MESSAGE(11,fprintf(fp,"\t\t %d, %d\n", code, level[0]);); } /* ********************************************************************************* * Testing HE5_SWchunkinfo * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWchunkinfo.... \n");); MESSAGE(4,printf("\t============================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWchunkinfo... \n");); MESSAGE(11,fprintf(fp,"\t========================= \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve Chunking information for field \"Count\"\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve Compression information for field \"Count\"\n");); status = HE5_SWchunkinfo(SWid_simple,"Count",&chunk_rank,chunk_dim); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); /* MESSAGE(4,printf("\t\t Count chunk rank: %d\n", chunk_rank);); */ MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(8,printf("\t\t Count chunk rank: %d\n", chunk_rank);); MESSAGE(11,fprintf(fp,"\t\t Count chunk rank: %d\n", chunk_rank );); } /* ********************************************************************************* * Testing HE5_SWgrpattrinfo * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWgrpattrinfo... \n");); MESSAGE(4,printf("\t=========================\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWgrpattrinfo... \n");); MESSAGE(11,fprintf(fp,"\t=========================\n");); CountPtr = (hsize_t *)calloc(1, sizeof(hsize_t)); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve information about attribute \"GroupAttribute\" \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve information about attribute \"GroupAttribute\" \n");); status=HE5_SWgrpattrinfo(SWid_simple,"GroupAttribute",&dtype,CountPtr); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); /* MESSAGE(4,printf("\t\tData type: %d\n", dtype);); MESSAGE(4,printf("\t\t Number of elements: %d \n", (int)*CountPtr);); */ MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_SWgrpattrinfo(SWid_simple,\"GroupAttribute\",&dtype,CountPtr);\n");); MESSAGE(8,printf("\t\tstatus returned by SWgrpattrinfo %d\n",status);); MESSAGE(6,printf("\t\tData type Number of attribute elements:\n");); MESSAGE(6,printf("\t\t %ld %d\n", (long) dtype,(int)*CountPtr);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWgrpattrinfo(SWid_simple,\"GroupAttribute\",&dtype,CountPtr);\n");); MESSAGE(11,fprintf(fp,"\t\tStaus returned by SWgrpattrinfo %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tData type Number of attribute elements:\n");); MESSAGE(11,fprintf(fp,"\t\t %ld %d\n", (long) dtype,(int)*CountPtr);); } free(CountPtr); /* ******************************************************************************** * Testing HE5_SWgeogrpattrinfo * ******************************************************************************** */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWgeogrpattrinfo... \n");); MESSAGE(4,printf("\t=========================\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWgeogrpattrinfo... \n");); MESSAGE(11,fprintf(fp,"\t=========================\n");); CountPtr = (hsize_t *)calloc(1, sizeof(hsize_t)); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve information about attribute \"ScalarFloat\" \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve information about attribute \"ScalarFloat\" \n");); status=HE5_SWgeogrpattrinfo(SWid_simple,"ScalarFloat",&dtype,CountPtr); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); /* MESSAGE(4,printf("\t\tData type: %d\n", dtype);); MESSAGE(4,printf("\t\t Number of elements: %d \n", (int)*CountPtr);); */ MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_SWgeogrpattrinfo(SWid_simple,\"ScalarFloat\",&dtype,CountPtr);\n");); MESSAGE(8,printf("\t\tstatus returned by SWgeogrpattrinfo %d\n",status);); MESSAGE(6,printf("\t\tData type Number of attribute elements:\n");); MESSAGE(6,printf("\t\t %ld %d\n", (long) dtype,(int)*CountPtr);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWgeogrpattrinfo(SWid_simple,\"ScalarFloat\",&dtype,CountPtr);\n");); MESSAGE(11,fprintf(fp,"\t\tStaus returned by SWgeogrpattrinfo %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tData type Number of attribute elements:\n");); MESSAGE(11,fprintf(fp,"\t\t %ld %d\n", (long) dtype,(int)*CountPtr);); } free(CountPtr); /* ********************************************************************************* * Testing HE5_SWgetfillvalue * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWgetfillvalue... \n");); MESSAGE(4,printf("\t============================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWgetfillvalue... \n");); MESSAGE(11,fprintf(fp,"\t============================= \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tGet fill value for field \"Temperature\"\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tGet fill value for field \"Temperature\"\n");); status = HE5_SWgetfillvalue(SWid_simple,"Temperature",&InqDoubleFillValue); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_SWgetfillvalue(SWid_simple,\"Temperature\",&InqDoubleFillValue);\n");); MESSAGE(8,printf("\t\tstatus returned by SWgetfillvalue %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWgetfillvalue(SWid_simple,\"Temperature\", &InqDoubleFillValue)\n");); MESSAGE(11,fprintf(fp,"\t\tstatus returned by SWgetfillvalue %d\n",status);); MESSAGE(8,printf("\t\tFill value for field \"Temperature\":\n");); MESSAGE(8,printf("\n");); MESSAGE(8,printf("\t\t \"%lf\" \n", InqDoubleFillValue);); MESSAGE(11,fprintf(fp,"\t\tFill value for field \"Temperature\":\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t \"%lf\" \n",InqDoubleFillValue);); } /* ********************************************************************************* * Testing HE5_SWdetach * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWdetach... \n");); MESSAGE(4,printf("\t======================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWdetach... \n");); MESSAGE(11,fprintf(fp,"\t======================= \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tDetaching from swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tDetaching from swath SIMPLE \n");); status = HE5_SWdetach(SWid_simple); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWdetach(SWid_simple);\n");); MESSAGE(8,printf("\t\tstatus returned by SWdetach() %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdetach(SWid_simple);\n");); MESSAGE(11,fprintf(fp,"\t\tstatus returned by SWdetach() %d\n",status);); } /* ********************************************************************************* * Testing HE5_SWattach * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWattach... \n");); MESSAGE(4,printf("\t=======================\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWattach... \n");); MESSAGE(11,fprintf(fp,"\t=======================\n");); SWid_simple = HE5_SWattach(swfidc_simple,"SIMPLE"); if (SWid_simple == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\t\t*** Successfully attached to the swath SIMPLE ****\n");); MESSAGE(11,fprintf(fp,"\t\t*** Successfully attached to the swath SIMPLE ****\n");); } /* ********************************************************************************* * Testing Appending data to the field * ********************************************************************************* */ tstart[0] = 30; tedge[0] = 10; MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tWriting extended data to the field Count in swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tWriting extended data to the field Count in swath SIMPLE \n");); status = HE5_SWwritefield(SWid_simple, "Count", tstart, NULL, tedge, inarray); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWwritefield(SWid_simple, \"Count\",tstart, NULL, tedge, inarray);\n");); MESSAGE(8,printf("\t\tValue returned by SWwritefield for field Count in swath SIMPLE %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWwritefield(SWid_simple,\"Count\", tstart, stride, NULL, inarray);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by SWwritefield for field Conduction in swath SIMPLE %d\n",status);); } /* ********************************************************************************* * Testing HE5_SWdeftimeperiod * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWdeftimeperiod... \n");); MESSAGE(4,printf("\t============================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWdeftimeperiod... \n");); MESSAGE(11,fprintf(fp,"\t============================== \n");); StartTime = 55000000.; StopTime = 65000000.; MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tDefining time period for extraction\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tDefining time period for extraction\n");); PeriodID = HE5_SWdeftimeperiod(SWid_simple,StartTime,StopTime,HE5_HDFE_MIDPOINT); if (PeriodID == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tPeriodID=HE5_SWdeftimeperiod(SWid_simple,StartTime,StopTime,HE5_HDFE_MIDPOINT);\n");); MESSAGE(8,printf("\t\tPeriod ID returned by SWdeftimeperiod() %ld\n", (long) PeriodID);); MESSAGE(11,fprintf(fp,"\t\tPeriodID=HE5_SWdeftimeperiod(SWid_simple,StartTime,StopTime,HE5_HDFE_MIDPOINT);\n");); MESSAGE(11,fprintf(fp,"\t\tPeriod ID returned by SWdeftimeperiod() %ld\n", (long) PeriodID);); } /* ********************************************************************************* * Testing HE5_SWperiodinfo * ********************************************************************************* */ RankPtr = (int *)calloc(1, sizeof(int)); size = (size_t *)calloc(1, sizeof(size_t)); MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWperiodinfo... \n");); MESSAGE(4,printf("\t=========================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWperiodinfo... \n");); MESSAGE(11,fprintf(fp,"\t=========================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve information about the subsetted period\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve information about the subsetted period\n");); status = HE5_SWperiodinfo(SWid_simple,PeriodID,"Time",&dtype1,RankPtr,dims,size); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_SWperiodinfo(SWid_simple,PeriodID,\"Time\",&dtype1,RankPtr,dims,size);\n");); MESSAGE(8,printf("\t\tstatus returned by SWperiodinfo %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWperiodinfo(SWid_simple,PeriodID,\"Time\",&dtype1,RankPtr,dims,size);\n");); MESSAGE(11,fprintf(fp,"\t\tstatus returned by SWperiodinfo %d\n",status);); MESSAGE(6,printf("\t\tData type Rank \n");); MESSAGE(6,printf("\t\t %ld %d \n", (long) dtype1,*RankPtr);); MESSAGE(11,fprintf(fp,"\t\tData type Rank \n");); MESSAGE(11,fprintf(fp,"\t\t %ld %d \n", (long) dtype1,*RankPtr);); MESSAGE(6,printf("\t\tSize of subset period: %lu (bytes)\n",(unsigned long)*size);); MESSAGE(11,fprintf(fp,"\t\tSize of subset period: %lu (bytes)\n",(unsigned long)*size);); MESSAGE(6,printf("\t\tDimensions of subset period:\n");); MESSAGE(11,fprintf(fp,"\t\tDimensions of subset period:\n");); for (i = 0; i < *RankPtr; i++) { MESSAGE(6,printf("\t\t %d\n",(int)dims[i]);); MESSAGE(11,fprintf(fp,"\t\t %d\n",(int)dims[i]);); } } /* ********************************************************************************* * Testing HE5_SWextractperiod * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWextractperiod... \n");); MESSAGE(4,printf("\t============================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWextractperiod... \n");); MESSAGE(11,fprintf(fp,"\t============================== \n");); BufferPtr = ( double *)malloc( *size ); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRead data from the subsetted time period\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRead data from the subsetted time period\n");); status = HE5_SWextractperiod(SWid_simple,PeriodID,"Time",HE5_HDFE_INTERNAL,BufferPtr); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_SWextractperiod(SWid_simple,PeriodID,\"Time\",HE5_HDFE_INTERNAL,BufferPtr);\n");); MESSAGE(8,printf("\t\tstatus returned by SWextractperiod %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWextractperiod(SWid_simple,PeriodID,\"Time\",HE5_HDFE_INTERNAL,BufferPtr);\n");); MESSAGE(11,fprintf(fp,"\t\tstatus returned by SWextractperiod %d\n", status);); MESSAGE(8,printf("\t\n");); MESSAGE(8,printf("\t\tThe extracted values of \"Time\" field are: \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tThe extracted values of \"Time\" field are: \n");); for( i = 0; i < ( *size / sizeof(double) ); i++ ) { MESSAGE(8,printf("\t\t\t %lf\n", BufferPtr[i]);); MESSAGE(11,fprintf(fp,"\t\t\t %lf\n", BufferPtr[i]);); } } free(RankPtr); free(BufferPtr); RankPtr = NULL; BufferPtr = NULL; free(size); /* ********************************************************************************* * Testing HE5_SWattach * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWattach... \n");); MESSAGE(4,printf("\t=======================\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWattach... \n");); MESSAGE(11,fprintf(fp,"\t=======================\n");); SWid_index = HE5_SWattach(swfidc_simple,"INDEX"); if (SWid_index == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\t\t*** Successfully attached to the swath INDEX ****\n");); MESSAGE(11,fprintf(fp,"\t\t*** Successfully attached to the swath INDEX ****\n");); } /* ********************************************************************************* * Testing HE5_SWlocattrinfo * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWlocattrinfo... \n");); MESSAGE(4,printf("\t=========================\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWlocattrinfo... \n");); MESSAGE(11,fprintf(fp,"\t=========================\n");); CountPtr = (hsize_t *)calloc(1, sizeof(hsize_t)); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve information about attribute \"LocalAttribute\" \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve information about attribute \"LocalAttribute\" \n");); status=HE5_SWlocattrinfo(SWid_simple,"Count", "LocalAttribute",&dtype,CountPtr); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_SWlocattrinfo(SWid_Simple, \"Count\", \"LocalAttribute\", &dtype,CountPtr);\n");); MESSAGE(8,printf("\t\tstatus returned by GDlocattrinfo %d\n",status);); MESSAGE(6,printf("\t\tData type Number of attribute elements:\n");); MESSAGE(6,printf("\t\t %ld %d\n", (long) dtype,(int)*CountPtr);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWlocattrinfo(SWid_simple, \"Count\", \"LocalAttribute\",&dtype,CountPtr);\n");); MESSAGE(11,fprintf(fp,"\t\tStatus returned by SWlocattrinfo %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tData type Number of attribute elements:\n");); MESSAGE(11,fprintf(fp,"\t\t %ld %d\n", (long) dtype,(int)*CountPtr);); } free(CountPtr); /* ********************************************************************************* * Testing HE5_SWnentries * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWnentries... \n");); MESSAGE(4,printf("\t=========================\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWnentries... \n");); MESSAGE(11,fprintf(fp,"\t=========================\n");); /* -- R e t r i e v e t h e I n d e x d i m e n s i o n m a p p i n g s -- */ MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve information about index dimension mapping in swath INDEX\n");); MESSAGE(11,fprintf(fp,"\n"); ); MESSAGE(11,fprintf(fp,"\t\tRetrieve information about index dimension mapping in swath INDEX\n"); ); number = HE5_SWnentries(SWid_index,2,&strbufsize); if ( number == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tnumber=HE5_SWnentries(SWid_index,2,&strbufsize);\n");); MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWnentries(SWid_index,2,&strbufsize);\n");); MESSAGE(11,fprintf(fp,"\t\tNumber of index mappings: %li\n",number);); MESSAGE(8,printf("\t\tNumber of index mappings: %li\n",number);); MESSAGE(8,printf("\t\tString length of mapping list: %li\n",strbufsize);); MESSAGE(11,fprintf(fp,"\t\tString length of mapping list: %li\n",strbufsize);); } /* ********************************************************************************* * Testing HE5_SWinqidxmaps... * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWinqidxmaps... \n");); MESSAGE(4,printf("\t===========================\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWinqidxmaps... \n");); MESSAGE(11,fprintf(fp,"\t===========================\n");); SizePtr = (hsize_t *)calloc(number, sizeof(hsize_t)); DimMapListPtr = (char *)calloc( BUFSIZE, sizeof(char)); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve indexed mapping relations for swath INDEX \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve indexed mapping relations for swath INDEX \n");); number = HE5_SWinqidxmaps(SWid_index,DimMapListPtr,SizePtr); if (number == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tnumber=HE5_SWinqidxmaps(SWid_index,DimMapListPtr,SizePtr);\n");); MESSAGE(8,printf("\t\tNumber of maps: %li\n", number);); MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWinqidxmaps(SWid_index,DimMapListPtr,SizePtr);\n");); MESSAGE(11,fprintf(fp,"\t\tNumber of maps: %li\n",number);); MESSAGE(6,printf("\t\tIndexed mapping list: \n");); MESSAGE(6,printf("\t\t %s\n",DimMapListPtr);); MESSAGE(11,fprintf(fp,"\t\tIndexed mapping list: \n");); MESSAGE(11,fprintf(fp,"\t\t %s\n",DimMapListPtr);); } free(SizePtr); free(DimMapListPtr); /* ********************************************************************************* * Testing HE5_SWinqlocattrs * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWinqlocattrs... \n");); MESSAGE(4,printf("\t========================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWinqlocattrs... \n");); MESSAGE(11,fprintf(fp,"\t========================= \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve information about attributes defined in Count field \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve information about attributes defined in Count \n");); number = HE5_SWinqlocattrs(SWid_simple, "Count", NULL, &strbufsize); if (number == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tnumber=HE5_SWinqlocattrs(SWid_simple, \"Count\", NULL, &strbufsize);\n");); MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWinqlocattrs(SWid_simple, \"Count\", NULL, &strbufsize);\n");); MESSAGE(8,printf("\t\tValue (number of attributes) returned by SWinqlocattrs %li\n",number);); MESSAGE(11,fprintf(fp,"\t\tValue (number of attributes) returned by SWinqlocattrs %li\n",number);); MESSAGE(8,printf("\t\tString length of attribute list: %li\n",strbufsize);); MESSAGE(11,fprintf(fp,"\t\tString length of attribute list: %li\n",strbufsize);); } MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve more information about attributes defined in Count field \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve more information about attributes defined in Count field \n");); ObjNamesPtr = (char *)calloc( BUFSIZE, sizeof(char)); number = HE5_SWinqlocattrs(SWid_simple, "Count", ObjNamesPtr, &strbufsize); if (number == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tnumber=HE5_SWinqlocattrs(SWid_simple, Count, ObjNamesPtr, &strbufsize);\n");); MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_SWinqlocattrs(SWid_simple, Count, ObjNamesPtr,&strbufsize);\n");); MESSAGE(8,printf("\t\tNumber of attributes returned by SWinqlocattrs %li\n",number);); MESSAGE(11,fprintf(fp,"\t\tNumber of attributes returned by SWinqlocattr %li\n",number);); MESSAGE(8,printf("\t\tAttribute list:\n");); MESSAGE(8,printf("\t\t %s\n", ObjNamesPtr);); MESSAGE(11,fprintf(fp,"\t\tAttribute list: \n");); MESSAGE(11,fprintf(fp,"\t\t %s\n", ObjNamesPtr);); MESSAGE(8,printf("\t\tString length of attribute list: %li\n",strbufsize);); MESSAGE(11,fprintf(fp,"\t\tString length of attribute list: %li\n",strbufsize);); } free(ObjNamesPtr); ObjNamesPtr = NULL; /* ********************************************************************************* * Testing HE5_SWdiminfo... * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWdiminfo... \n");); MESSAGE(4,printf("\t======================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWdiminfo... \n");); MESSAGE(11,fprintf(fp,"\t======================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve size of dimension \"GeoDim\" in swath INDEX \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve size of dimension \"GeoDim\" in swath INDEX \n");); ndims = HE5_SWdiminfo(SWid_index,"GeoDim"); if ( ndims == 0) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tndims=HE5_SWdiminfo(SWid_index,\"GeoDim\");\n");); MESSAGE(8,printf("\t\tSize of dimension \"GeoDim\": %lu \n",(unsigned long)ndims);); MESSAGE(11,fprintf(fp,"\t\tndims=HE5_SWdiminfo(SWid_index,\"GeoDim\");\n");); MESSAGE(11,fprintf(fp,"\t\tSize of dimension \"GeoDim\": %lu\n",(unsigned long)ndims);); } /* ********************************************************************************* * Testing HE5_SWidxmapinfo * ********************************************************************************* */ OffsetPtr = (long *)calloc(100, sizeof(long)); MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWidxmapinfo... \n");); MESSAGE(4,printf("\t=========================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWidxmapinfo... \n");); MESSAGE(11,fprintf(fp,"\t=========================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve indexed array of \"GeoDim/TrackDim\" mapping\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve indexed array of \"GeoDim/TrackDim\" mapping\n");); nmaps = HE5_SWidxmapinfo(SWid_index,"GeoDim","TrackDim",OffsetPtr); if (nmaps == 0) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tnmaps=HE5_SWidxmapinfo(SWid_index,\"GeoDim\",\"TrackDim\",OffsetPtr);\n");); MESSAGE(8,printf("\t\tSize of indexed array: %lu \n",(unsigned long)nmaps);); MESSAGE(11,fprintf(fp,"\t\tnmaps=HE5_SWidxmapinfo(SWid_index,\"GeoDim\",\"TrackDim\",OffsetPtr);\n");); MESSAGE(11,fprintf(fp,"\t\tSize of indexed array: %lu \n",(unsigned long)nmaps);); MESSAGE(8,printf("\t\tEntry # Mapping offset\n");); MESSAGE(11,fprintf(fp,"\t\tEntry # Mapping offset\n");); for ( i = 0; i < nmaps; i++) { MESSAGE(8,printf("\t\t %d %li \n", i+1, OffsetPtr[i]);); MESSAGE(11,fprintf(fp,"\t\t %d %li \n", i+1, OffsetPtr[i]);); } } MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve indexed array of \"GeoDim/XtrackDim\" mapping\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve indexed array of \"GeoDim/XtrackDim\" mapping\n");); nmaps = HE5_SWidxmapinfo(SWid_index,"GeoXDim","XtrackDim",OffsetPtr); if (nmaps == 0) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tnmaps=HE5_SWidxmapinfo(SWid_index,\"GeoXDim\",\"XtrackDim\",OffsetPtr);\n");); MESSAGE(8,printf("\t\tSize of indexed array: %lu \n",(unsigned long)nmaps);); MESSAGE(11,fprintf(fp,"\t\tnmaps=HE5_SWidxmapinfo(SWid_index,\"GeoXDim\",\"XtrackDim\",OffsetPtr);\n");); MESSAGE(11,fprintf(fp,"\t\tSize of indexed array: %lu\n",(unsigned long)nmaps);); MESSAGE(8,printf("\t\tEntry # Mapping offset\n");); MESSAGE(11,fprintf(fp,"\t\tEntry # Mapping offset\n");); for ( i = 0; i < nmaps; i++) { MESSAGE(8,printf("\t\t %d %li \n", i+1, OffsetPtr[i]);); MESSAGE(11,fprintf(fp,"\t\t %d %li \n", i+1, OffsetPtr[i]);); } } /* ********************************************************************************* * Testing HE5_SWindexinfo * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWindexinfo... \n");); MESSAGE(4,printf("\t=========================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWindexinfo... \n");); MESSAGE(11,fprintf(fp,"\t=========================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve indices information about \"Longitude\" field\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve indicesinformation about \"Longitude\" field\n");); dimlist = (char *)calloc( BUFSIZE, sizeof(char)); for ( i = 0; i < 8; i++) { indices[i] = (hsize_t *) malloc(2*sizeof(hsize_t)); } status = HE5_SWindexinfo(RegionID, "Longitude", &rank3, dimlist, indices); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(4,printf("\n");); /* MESSAGE(4,printf("rank = %d\n", rank);); MESSAGE(4,printf("dimlist = %s\n", dimlist);); for ( i = 0; i < rank; i++) { for ( j = 0; j < 2; j++) { MESSAGE(4,printf("i = %d, j = %d, indices[i][j] = %lu\n", i, j, (unsigned long)indices[i][j]);); } } */ MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_SWindexinfo(RegionID, \"Longitude\", &rank3, dimlist, indices);\n");); MESSAGE(8,printf("\t\tstatus returned by SWindexinfo %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWindexinfo(RegionID, \"Longitude\", &rank3, dimlist, indices);\n");); MESSAGE(11,fprintf(fp,"\t\tstatus returned by SWindexinfo %d\n",status);); MESSAGE(8,printf("rank = %d\n", rank);); MESSAGE(8,printf("dimlist = %s\n", dimlist);); MESSAGE(11,fprintf(fp,"\t\tRank: %d\n", rank);); MESSAGE(11,fprintf(fp,"\t\tDimension list: %s\n",dimlist);); for ( i = 0; i < rank; i++) { for ( j = 0; j < 2; j++) { MESSAGE(8,printf("i = %d, j = %d, indices[i][j] = %lu\n", i, j, (unsigned long)indices[i][j]);); MESSAGE(11,fprintf(fp,"\t\ti = %d, j = %d, indices[i][j] = %lu\n", i, j, (unsigned long)indices[i][j]);); } } } free(dimlist); dimlist = NULL; for (i = 0; i < 8; i++) { free(indices[i]); indices[i] = NULL; } /* ********************************************************************************* * Testing HE5_SWdetach * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWdetach... \n");); MESSAGE(4,printf("\t======================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWdetach... \n");); MESSAGE(11,fprintf(fp,"\t======================= \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tDetaching from swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tDetaching from swath SIMPLE \n");); status = HE5_SWdetach(SWid_simple); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWdetach(SWid_simple);\n");); MESSAGE(8,printf("\t\tstatus returned by SWdetach for swath SIMPLE %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdetach(SWid_simple);\n");); MESSAGE(11,fprintf(fp,"\t\tstatus returned by SWdetach for swath SIMPLE %d\n",status);); } /* ********************************************************************************* * Testing REGION SUBSETTING for swath INDEX * ********************************************************************************* */ CornerLon[ 0 ] = 79.7e0; CornerLat[ 0 ] = 59.5e0; CornerLon[ 1 ] = 80.e0; CornerLat[ 1 ] = 60.e0; MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWdefboxregion... \n");); MESSAGE(4,printf("\t============================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWdefboxregion... \n");); MESSAGE(11,fprintf(fp,"\t============================= \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tDefining region to extract\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tDefining region to extract\n");); RegionID = HE5_SWdefboxregion(SWid_index,CornerLon,CornerLat,HE5_HDFE_MIDPOINT); if (RegionID == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tRegionID=HE5_SWdefboxregion(SWid_index,CornerLon,CornerLat,mode);\n");); MESSAGE(8,printf("\t\tRegion ID returned by SWdefboxregion %ld\n", (long) RegionID);); MESSAGE(11,fprintf(fp,"\t\tRegionID=HE5_SWdefboxregion(SWid_index,CornerLon,CornerLat,mode);\n");); MESSAGE(11,fprintf(fp,"\t\tRegion ID returned by SWdefboxregion %ld\n", (long) RegionID);); } /* ********************************************************************************* * Testing HE5_SWregioninfo for swath INDEX * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWregioninfo... \n");); MESSAGE(4,printf("\t=========================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWregioninfo... \n");); MESSAGE(11,fprintf(fp,"\t=========================== \n");); size = (size_t *)calloc(1, sizeof(size_t)); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieving information about defined region\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieving information about defined region\n");); status = HE5_SWregioninfo(SWid_index,RegionID,"Indexed_Data",&dtype1,&rank2,dims,size); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_SWregioninfo(SWid_index,RegionID,\"Indexed_Data\",&dtype1,RankPtr,dims,size);\n");); MESSAGE(8,printf("\t\tstatus returned by SWregioninfo %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWregioninfo(SWid_index,RegionID,\"Indexed_Data\",&dtype1,RankPtr,dims,size);\n");); MESSAGE(11,fprintf(fp,"\t\tstatus returned by SWregioninfo %d\n",status);); MESSAGE(6,printf("\t\tData type: Rank:\n");); MESSAGE(6,printf("\t\t %ld %d\n", (long) dtype1, rank2);); MESSAGE(11,fprintf(fp,"\t\tData type: Rank:\n");); MESSAGE(11,fprintf(fp,"\t\t %ld %d\n", (long) dtype1, rank2);); MESSAGE(6,printf("\t\tSize of region: %lu (bytes)\n",(unsigned long)*size);); MESSAGE(11,fprintf(fp,"\t\tSize of region: %lu (bytes)\n",(unsigned long)*size);); MESSAGE(6,printf("\t\tDimensions of subset region:\n");); MESSAGE(11,fprintf(fp,"\t\tDimensions of subset region:\n");); for (i = 0; i < rank2; i++) { MESSAGE(6,printf("\t\t %d\n",(int)dims[i]);); MESSAGE(11,fprintf(fp,"\t\t %d\n",(int)dims[i]);); } } /* ********************************************************************************* * Testing HE5_SWextractregion for swath INDEX * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWextractregion... \n");); MESSAGE(4,printf("\t============================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWextractregion... \n");); MESSAGE(11,fprintf(fp,"\t============================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tExtracting data from subset region\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tExtracting data from subset region\n");); BufferFloatPtr = (float *)malloc( *size ); status = HE5_SWextractregion(SWid_index,RegionID,"Indexed_Data",HE5_HDFE_INTERNAL,BufferFloatPtr); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_SWextractregion(SWid_index,RegionID,\"Indexed_Data\",HE5_HDFE_INTERNAL,BufferFloatPtr);\n");); MESSAGE(8,printf("\t\tstatus returned by SWextractregion %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWextractregion(SWid_simple,OldRegionID,\"Indexed_Data\",HE5_HDFE_INTERNAL,BufferFloatPtr);\n");); MESSAGE(11,fprintf(fp,"\t\tstatus returned by SWextractregion %d\n",status);); MESSAGE(10,printf("\t\t Extracted first 5 values:\n");); MESSAGE(11,fprintf(fp,"\t\t Extracted first 5 values:\n");); for (i = 0; i < 5; i++) { MESSAGE(10,printf("\t\t\t %f\n", BufferFloatPtr[i]);); MESSAGE(11,fprintf(fp,"\t\t\t %f\n", BufferFloatPtr[i]);); } } free(BufferFloatPtr); free(size); /* ********************************************************************************* * Testing HE5_SWupdateidxmap * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWupdateidxmap... \n");); MESSAGE(4,printf("\t============================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWupdateidxmap... \n");); MESSAGE(11,fprintf(fp,"\t============================= \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieving indexed array for a specified region\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieving indexed array for a specified region\n");); IdxMapSize = HE5_SWupdateidxmap(SWid_index,RegionID,OffsetPtr,NULL,Indices); if (IdxMapSize == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tIdxMapSize=HE5_SWupdateidxmap(SWid_index,RegionID,OffsetPtr,NULL,Indices);\n");); MESSAGE(8,printf("\t\tSize of updated indexed array: %li\n",IdxMapSize);); MESSAGE(11,fprintf(fp,"\t\tIdxMapSize=HE5_SWupdateidxmap(SWid_index,RegionID,OffsetPtr,NULL,Indices);\n");); MESSAGE(11,fprintf(fp,"\t\tSize of updated indexed array: %li\n",IdxMapSize);); } UpdateIdx_1 = (long *)calloc(IdxMapSize, sizeof(long)); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tContinue ...\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tContinue ...\n");); IdxMapSize = HE5_SWupdateidxmap(SWid_index,RegionID,OffsetPtr,UpdateIdx_1,Indices); if (IdxMapSize == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tIdxMapSize=HE5_SWupdateidxmap(SWid_index,RegionID,OffsetPtr,UpdateIdx_1,Indices);\n");); MESSAGE(8,printf("\t\tSize of updated indexed array: %li\n",IdxMapSize);); MESSAGE(11,fprintf(fp,"\t\tIdxMapSize=HE5_SWupdateidxmap(SWid_index,RegionID,OffsetPtr,UpdateIdx_1,Indices);\n");); MESSAGE(11,fprintf(fp,"\t\tSize of updated indexed array: %li\n",IdxMapSize);); MESSAGE(8,printf("\t\tArray of indices of the data dimension to which each geolocation corresponds:\n");); MESSAGE(11,fprintf(fp,"\t\tArray of indices of the data dimension to which each geolocation corresponds:\n");); for (i = 0; i < IdxMapSize; i++) { MESSAGE(8,printf("\t\t %li\n", OffsetPtr[i]);); MESSAGE(11,fprintf(fp,"\t\t %li\n", OffsetPtr[i]);); } MESSAGE(8,printf("\t\t Array of indices of the data dimension to which each geolocation corresponds: \n");); MESSAGE(11,fprintf(fp,"\t\t Array of indices of the data dimension to which each geolocation corresponds: \n");); for (i = 0; i < IdxMapSize; i++) { MESSAGE(8,printf("\t\t %li \n", UpdateIdx_1[i]);); MESSAGE(11,fprintf(fp,"\t\t %li \n", UpdateIdx_1[i]);); } } free(OffsetPtr); free(UpdateIdx_1); /* ********************************************************************************* * Testing HE5_SWdetach * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWdetach... \n");); MESSAGE(4,printf("\t======================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWdetach... \n");); MESSAGE(11,fprintf(fp,"\t======================= \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tDetaching from swath INDEX \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tDetaching from swath INDEX \n");); status = HE5_SWdetach(SWid_index); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWdetach(SWid_index);\n");); MESSAGE(8,printf("\t\tstatus returned by SWdetach for swath INDEX %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdetach(SWid_index);\n");); MESSAGE(11,fprintf(fp,"\t\tstatus returned by SWdetach for swath INDEX %d\n",status);); } /* ********************************************************************************* * Testing HE5_SWattach * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWattach... \n");); MESSAGE(4,printf("\t=======================\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWattach... \n");); MESSAGE(11,fprintf(fp,"\t=======================\n");); SWid_simple = HE5_SWattach(swfidc_simple,"SIMPLE"); if (SWid_simple == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\t\t*** Successfully attached to the swath SIMPLE ****\n");); MESSAGE(11,fprintf(fp,"\t\t*** Successfully attached to the swath SIMPLE ****\n");); } /* ********************************************************************************* * Testing REGION SUBSETTING for swath SIMPLE * ********************************************************************************* */ CornerLon[ 0 ] = 100.e0; CornerLat[ 0 ] = 20.e0; CornerLon[ 1 ] = 106.e0; CornerLat[ 1 ] = 24.e0; MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWdefboxregion... \n");); MESSAGE(4,printf("\t============================= \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWdefboxregion... \n");); MESSAGE(11,fprintf(fp,"\t============================= \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tDefining region to extract\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tDefining region to extract\n");); OldRegionID = HE5_SWdefboxregion(SWid_simple,CornerLon,CornerLat,HE5_HDFE_MIDPOINT); if (OldRegionID == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tOldRegionID=HE5_SWdefboxregion(SWid_simple,CornerLon,CornerLat,mode);\n");); MESSAGE(8,printf("\t\tRegion ID returned by SWdefboxregion() %ld\n", (long) OldRegionID);); MESSAGE(11,fprintf(fp,"\t\tOldRegionID=HE5_SWdefboxregion(SWid_simple,CornerLon,CornerLat,mode);\n");); MESSAGE(11,fprintf(fp,"\t\tRegion ID returned by SWdefboxregion() %ld\n", (long) OldRegionID);); } /* ********************************************************************************* * Testing HE5_SWregioninfo for swath SIMPLE * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWregioninfo... \n");); MESSAGE(4,printf("\t=========================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWregioninfo... \n");); MESSAGE(11,fprintf(fp,"\t=========================== \n");); RankPtr = (int *)calloc(1, sizeof(int)); size = (size_t *)calloc(1, sizeof(size_t)); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieving information about defined region\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieving information about defined region\n");); status = HE5_SWregioninfo(SWid_simple,OldRegionID,"Temperature",&dtype1,RankPtr,dims,size); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_SWregioninfo(SWid_simple,OldRegionID,\"Temperature\", &dtype1, RankPtr,dims,size);\n");); MESSAGE(8,printf("\t\tstatus returned by SWregioninfo %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWregioninfo(SWid_simple,OldRegionID,\"Temperature\", &dtype1,RankPtr,dims,size);\n");); MESSAGE(11,fprintf(fp,"\t\tstatus returned by SWregioninfo %d\n",status);); MESSAGE(6,printf("\t\tData type Rank\n");); MESSAGE(6,printf("\t\t %ld %d \n", (long) dtype1, *RankPtr);); MESSAGE(6,printf("\t\tSize of region: %lu (bytes)\n", (unsigned long)*size);); MESSAGE(11,fprintf(fp,"\t\tSize of region: %lu (bytes)\n", (unsigned long)*size);); MESSAGE(6,printf("\t\tDimensions of subset region:\n");); MESSAGE(11,fprintf(fp,"\t\tDimensions of subset region:\n");); for (i = 0; i < *RankPtr; i++) { MESSAGE(6,printf("\t\t %d\n",(int)dims[i]);); MESSAGE(11,fprintf(fp,"\t\t %d\n",(int)dims[i]);); } } /* ********************************************************************************* * Testing HE5_SWextractregion for swath SIMPLE * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWextractregion... \n");); MESSAGE(4,printf("\t============================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWextractregion... \n");); MESSAGE(11,fprintf(fp,"\t============================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tExtracting data from subset region\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tExtracting data from subset region\n");); BufferPtr = (double *)malloc( *size ); status = HE5_SWextractregion(SWid_simple,OldRegionID,"Temperature",HE5_HDFE_INTERNAL,BufferPtr); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_SWextractregion(SWid_simple,OldRegionID,\"Temperature\",HE5_HDFE_INTERNAL,BufferPtr);\n");); MESSAGE(8,printf("\t\tstatus returned by SWextractregion() %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWextractregion(SWid_simple,OldRegionID,\"Temperature\",HE5_HDFE_INTERNAL,BufferPtr);\n");); MESSAGE(11,fprintf(fp,"\t\tstatus returned by SWextractregion() %d\n",status);); MESSAGE(10,printf("\t\t Extracted values:\n");); MESSAGE(11,fprintf(fp,"\t\t Extracted values:\n");); for (i = 0; i < *size/ sizeof(double); i++) { MESSAGE(10,printf("\t\t\t %lf\n", BufferPtr[i]);); MESSAGE(11,fprintf(fp,"\t\t\t %lf\n", BufferPtr[i]);); } } free(RankPtr); free(BufferPtr); free(size); RankPtr = NULL; BufferPtr = NULL; /* ********************************************************************************* * Testing HE5_SWdupregion for swath SIMPLE * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWdupregion... \n");); MESSAGE(4,printf("\t========================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWdupregion... \n");); MESSAGE(11,fprintf(fp,"\t========================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tDuplicate region id %ld\n", (long) OldRegionID);); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tDuplicate region id %ld\n", (long) OldRegionID);); RegionID = HE5_SWdupregion(OldRegionID); if (RegionID == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tRegionID = HE5_SWdupregion(OldRegionID);\n");); MESSAGE(8,printf("\t\tRegion ID returned from call to SWdupregion %ld\n", (long) RegionID);); MESSAGE(11,fprintf(fp,"\t\tRegionID = HE5_SWdupregion(OldRegionID);\n");); MESSAGE(11,fprintf(fp,"\t\tRegion ID returned from call to SWdupregion %ld\n", (long) RegionID);); } /* ********************************************************************************* * Testing HE5_SWfieldinfo * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWfieldinfo... \n");); MESSAGE(4,printf("\t========================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWfieldinfo... \n");); MESSAGE(11,fprintf(fp,"\t========================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve information about field \"Count\" in swath SIMPLE e\n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve information about field \"Count\" in swath SIMPLE \n");); status = HE5_SWfieldinfo(SWid_simple,"Count",&rank,dims, &dtype1,NULL,DimList); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_SWfieldinfo(SWid_simple,\"Count\",&rank,dims,&dtype1,NULL,DimList);\n");); MESSAGE(8,printf("\t\tstatus returned by SWfieldinfo %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_SWfieldinfo(SWid_simple,\"Count\",&rank,dims, &dtype1,NULL,DimList);\n");); MESSAGE(11,fprintf(fp,"\t\tstatus returned by SWfieldinfo %d\n",status);); MESSAGE(8,printf("\t\tRank: %d Data type: %ld\n",rank, (long) dtype1);); MESSAGE(8,printf("\t\tMaximum Dimension list: %s\n",DimList);); MESSAGE(11,fprintf(fp,"\t\tRank: %d Data type: %ld\n",rank, (long) dtype1);); MESSAGE(11,fprintf(fp,"\t\tMaximum Dimension list: %s\n",DimList);); MESSAGE(8,printf("\t\tDimension sizes:\n");); MESSAGE(11,fprintf(fp,"\t\tDimension sizes:\n");); for (i = 0; i < rank; i++) { MESSAGE(8,printf("\t\t %lu\n",(unsigned long)dims[i]);); MESSAGE(11,fprintf(fp,"\t\t %lu\n",(unsigned long)dims[i]);); } } /* ********************************************************************************* * Testing HE5_SWdetach * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWdetach... \n");); MESSAGE(4,printf("\t======================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWdetach... \n");); MESSAGE(11,fprintf(fp,"\t======================= \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tDetaching from swath SIMPLE \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tDetaching from swath SIMPLE \n");); status = HE5_SWdetach(SWid_simple); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_SWdetach(SWid_simple);\n");); MESSAGE(8,printf("\t\tstatus returned by SWdetach for swath SIMPLE %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_SWdetach(SWid_simple);\n");); MESSAGE(11,fprintf(fp,"\t\tstatus returned by SWdetach for swath SIMPLE%d\n",status);); } /* ********************************************************************************* * Testing HE5_SWclose * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_SWclose... \n");); MESSAGE(4,printf("\t====================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_SWclose... \n");); MESSAGE(11,fprintf(fp,"\t====================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tClosing the file SimpleSwath.he5\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tClosing the file SimpleSwath.he5\n");); status = HE5_SWclose(swfidc_simple); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\t\t*** Successfully clossed the SimpleSwath.he5 file ****\n");); MESSAGE(11,fprintf(fp,"\t\t*** Successfully clossed the SimpleSwath.he5 file ****\n");); } /* ********************************************************************************* * Testing SWopen * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting SWopen... \n");); MESSAGE(4,printf("\t=================\n");); MESSAGE(11,fprintf(fp,"\tTesting SWopen... \n");); MESSAGE(11,fprintf(fp,"\t=================\n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tOpening the file SimpleSwath.he5\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tOpening the file SimpleSwath.he5\n");); swfidc_simple = HE5_SWopen("SimpleSwath.he5",H5F_ACC_RDWR); if (swfidc_simple == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\t\t*** Successfully opened the swath file ****\n");); MESSAGE(11,fprintf(fp,"\t\t*** Successfully opened the swath file ****\n");); } /* ********************************************************************************* * Testing SWinqswath * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting SWinqswath... \n");); MESSAGE(4,printf("\t=================\n");); MESSAGE(11,fprintf(fp,"\tTesting SWinqswath... \n");); MESSAGE(11,fprintf(fp,"\t=================\n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieving general information about objects within the file\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieving general information about objects within the file\n");); number = HE5_SWinqswath("SimpleSwath.he5",NULL,&strbufsize); if (number == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tnumber = HE5_SWinqswath(\"SimpleSwath.he5\",NULL,&strbufsize);\n");); MESSAGE(8,printf("\t\tValue returned by SWinqswath %li\n", number);); MESSAGE(8,printf("\t\tString length returned by SWinqswath %li\n", strbufsize);); MESSAGE(11,fprintf(fp,"\t\tnumber = HE5_SWinqswath(\"SimpleSwath.he5\",NULL,&strbufsize);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by SWinqswath %li\n", number);); MESSAGE(11,fprintf(fp,"\t\tStringlength returned by SWinqswath %li\n", strbufsize);); } MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tContinue ...\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tContinue ...\n");); ObjNamesPtr = (char *)calloc(strbufsize+1, sizeof(char ) ); number = HE5_SWinqswath("SimpleSwath.he5",ObjNamesPtr,&strbufsize); if (number == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tnumber = HE5_SWinqswath(\"SimpleSwath.he5\",ObjNamesPtr,&strbufsize);\n");); MESSAGE(8,printf("\t\tNumber of swath objects: %li\n", number);); MESSAGE(8,printf("\t\tList of swath objects: %s\n", ObjNamesPtr);); MESSAGE(11,fprintf(fp,"\t\tnumber = HE5_SWinqswath(\"SimpleSwath.he5\",ObjNamesPtr,&strbufsize);\n");); MESSAGE(11,fprintf(fp,"\t\tNumber of swath objecys: %li\n", number);); MESSAGE(11,fprintf(fp,"\t\tList of swath objects: %s\n", ObjNamesPtr);); } free(ObjNamesPtr); /* ********************************************************************************* * Testing SWclose * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting SWclose... \n");); MESSAGE(4,printf("\t====================== \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\tTesting SWclose... \n");); MESSAGE(11,fprintf(fp,"\t====================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tClosing the file SimpleSwath.he5\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tClosing the file SimpleSwath.he5\n");); status = HE5_SWclose(swfidc_simple); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\t\tSuccessfully clossed the SimpleSwath.he5 file \n");); MESSAGE(11,fprintf(fp,"\t\tSuccessfully clossed the SimpleSwath.he5 file \n");); MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t ........... End of Testing. \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t ............. End of Testing. \n");); } if (errcnt == 0) { MESSAGE(11,printf("\n");); MESSAGE(11,printf("\n");); MESSAGE(11,printf("\t\t A L L T E S T S P A S S E D \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t A L L T E S T S P A S S E D \n");); return_val = 0; } else { MESSAGE(11,printf("\n");); MESSAGE(11,printf("\n");); MESSAGE(11,printf("\t\t%d T E S T S F A I L E D \n",errcnt);); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t%d T E S T S F A I L E D \n",errcnt);); return_val = 1; } MESSAGE(11,fclose(fp);); return return_val; }hdf-eos5-2.0/testdrivers/swath/hdfeos5.inc000066400000000000000000000351131507520047200205260ustar00rootroot00000000000000! * ========================================================== ! * File: hdfeos5.inc ! * Author: A. Muslimov, Emergent Technology Services, Inc. ! * Date: March 11, 2002 ! * Purpose: Fortran header file for HDFEOS5 routines ! * ========================================================== ! * Contents: ! * HDFEOS5 data type tags ! * HDFEOS5 logical constants ! * HDFEOS5 file access tags ! * HDFEOS5/GCTP library codes ! * ! * =========================================================== ! HDFEOS5 DATA TYPE TAGS ! ======================= integer HE5T_NATIVE_INT integer HE5T_NATIVE_UINT integer HE5T_NATIVE_SHORT integer HE5T_NATIVE_USHORT integer HE5T_NATIVE_SCHAR integer HE5T_NATIVE_UCHAR integer HE5T_NATIVE_LONG integer HE5T_NATIVE_ULONG integer HE5T_NATIVE_LLONG integer HE5T_NATIVE_ULLONG integer HE5T_NATIVE_FLOAT integer HE5T_NATIVE_REAL integer HE5T_NATIVE_DOUBLE integer HE5T_NATIVE_LDOUBLE integer HE5T_NATIVE_INT8 integer HE5T_NATIVE_UINT8 integer HE5T_NATIVE_INT16 integer HE5T_NATIVE_UINT16 integer HE5T_NATIVE_INT32 integer HE5T_NATIVE_UINT32 integer HE5T_NATIVE_INT64 integer HE5T_NATIVE_UINT64 integer HE5T_NATIVE_B8 integer HE5T_NATIVE_B16 integer HE5T_NATIVE_B32 integer HE5T_NATIVE_B64 integer HE5T_NATIVE_HSIZE integer HE5T_NATIVE_HERR integer HE5T_NATIVE_HBOOL integer HE5T_STD_I8BE integer HE5T_STD_I8LE integer HE5T_STD_I16BE integer HE5T_STD_I16LE integer HE5T_STD_I32BE integer HE5T_STD_I32LE integer HE5T_STD_I64BE integer HE5T_STD_I64LE integer HE5T_STD_U8BE integer HE5T_STD_U8LE integer HE5T_STD_U16BE integer HE5T_STD_U16LE integer HE5T_STD_U32BE integer HE5T_STD_U32LE integer HE5T_STD_U64BE integer HE5T_STD_U64LE integer HE5T_STD_B8BE integer HE5T_STD_B8LE integer HE5T_STD_B16BE integer HE5T_STD_B16LE integer HE5T_STD_B32BE integer HE5T_STD_B32LE integer HE5T_STD_B64BE integer HE5T_STD_B64LE integer HE5T_IEEE_F32BE integer HE5T_IEEE_F32LE integer HE5T_IEEE_F64BE integer HE5T_IEEE_F64LE integer HE5T_NATIVE_CHAR integer HE5T_CHARSTRING parameter(HE5T_NATIVE_INT = 0) parameter(HE5T_NATIVE_UINT = 1) parameter(HE5T_NATIVE_SHORT = 2) parameter(HE5T_NATIVE_USHORT = 3) parameter(HE5T_NATIVE_SCHAR = 4) parameter(HE5T_NATIVE_UCHAR = 5) parameter(HE5T_NATIVE_LONG = 6) parameter(HE5T_NATIVE_ULONG = 7) parameter(HE5T_NATIVE_LLONG = 8) parameter(HE5T_NATIVE_ULLONG = 9) parameter(HE5T_NATIVE_FLOAT =10) parameter(HE5T_NATIVE_REAL =10) parameter(HE5T_NATIVE_DOUBLE =11) parameter(HE5T_NATIVE_LDOUBLE =12) parameter(HE5T_NATIVE_INT8 =13) parameter(HE5T_NATIVE_UINT8 =14) parameter(HE5T_NATIVE_INT16 =15) parameter(HE5T_NATIVE_UINT16 =16) parameter(HE5T_NATIVE_INT32 =17) parameter(HE5T_NATIVE_UINT32 =18) parameter(HE5T_NATIVE_INT64 =19) parameter(HE5T_NATIVE_UINT64 =20) parameter(HE5T_NATIVE_B8 =21) parameter(HE5T_NATIVE_B16 =22) parameter(HE5T_NATIVE_B32 =23) parameter(HE5T_NATIVE_B64 =24) parameter(HE5T_NATIVE_HSIZE =25) parameter(HE5T_NATIVE_HERR =26) parameter(HE5T_NATIVE_HBOOL =27) parameter(HE5T_STD_I8BE =28) parameter(HE5T_STD_I8LE =29) parameter(HE5T_STD_I16BE =30) parameter(HE5T_STD_I16LE =31) parameter(HE5T_STD_I32BE =32) parameter(HE5T_STD_I32LE =33) parameter(HE5T_STD_I64BE =34) parameter(HE5T_STD_I64LE =35) parameter(HE5T_STD_U8BE =36) parameter(HE5T_STD_U8LE =37) parameter(HE5T_STD_U16BE =38) parameter(HE5T_STD_U16LE =39) parameter(HE5T_STD_U32BE =40) parameter(HE5T_STD_U32LE =41) parameter(HE5T_STD_U64BE =42) parameter(HE5T_STD_U64LE =43) parameter(HE5T_STD_B8BE =44) parameter(HE5T_STD_B8LE =45) parameter(HE5T_STD_B16BE =46) parameter(HE5T_STD_B16LE =47) parameter(HE5T_STD_B32BE =48) parameter(HE5T_STD_B32LE =49) parameter(HE5T_STD_B64BE =50) parameter(HE5T_STD_B64LE =51) parameter(HE5T_IEEE_F32BE =52) parameter(HE5T_IEEE_F32LE =53) parameter(HE5T_IEEE_F64BE =54) parameter(HE5T_IEEE_F64LE =55) parameter(HE5T_NATIVE_CHAR =56) parameter(HE5T_CHARSTRING =57) integer HE5S_UNLIMITED_F parameter(HE5S_UNLIMITED_F = -1) ! HDFEOS5 FILE ACCESS TAGS ! ======================== integer HE5F_ACC_RDWR integer HE5F_ACC_RDONLY integer HE5F_ACC_TRUNC parameter(HE5F_ACC_RDWR = 100) parameter(HE5F_ACC_RDONLY = 101) parameter(HE5F_ACC_TRUNC = 102) ! TOOLKIT FILE ACCESS TAGS ! ======================== integer HDF4_ACC_RDONLY integer HDF4_ACC_RDWR integer HDF4_ACC_CREATE integer HDF5_ACC_RDONLY integer HDF5_ACC_RDWR integer HDF5_ACC_CREATE parameter(HDF4_ACC_RDONLY = 1) parameter(HDF4_ACC_RDWR = 3) parameter(HDF4_ACC_CREATE = 4) parameter(HDF5_ACC_RDONLY = 11) parameter(HDF5_ACC_RDWR = 13) parameter(HDF5_ACC_CREATE = 14) ! HDFEOS5 MERGE CODES ! ==================== integer HE5_HDFE_NOMERGE integer HE5_HDFE_AUTOMERGE parameter(HE5_HDFE_NOMERGE =0) parameter(HE5_HDFE_AUTOMERGE =1) ! HDFEOS5 XXentries CODES ! ======================= integer HE5_HDFE_NENTDIM integer HE5_HDFE_NENTMAP integer HE5_HDFE_NENTIMAP integer HE5_HDFE_NENTGFLD integer HE5_HDFE_NENTDFLD parameter(HE5_HDFE_NENTDIM =0) parameter(HE5_HDFE_NENTMAP =1) parameter(HE5_HDFE_NENTIMAP =2) parameter(HE5_HDFE_NENTGFLD =3) parameter(HE5_HDFE_NENTDFLD =4) ! HDFEOS5 ANGLE CONVERSION CODES ! ============================== integer HE5_HDFE_RAD_DEG integer HE5_HDFE_DEG_RAD integer HE5_HDFE_DMS_DEG integer HE5_HDFE_DEG_DMS integer HE5_HDFE_RAD_DMS integer HE5_HDFE_DMS_RAD parameter(HE5_HDFE_RAD_DEG =0) parameter(HE5_HDFE_DEG_RAD =1) parameter(HE5_HDFE_DMS_DEG =2) parameter(HE5_HDFE_DEG_DMS =3) parameter(HE5_HDFE_RAD_DMS =4) parameter(HE5_HDFE_DMS_RAD =5) ! HDFEOS5 SWATH SUBSET CODES ! ========================== integer HE5_HDFE_MIDPOINT integer HE5_HDFE_ENDPOINT integer HE5_HDFE_ANYPOINT integer HE5_HDFE_INTERNAL integer HE5_HDFE_EXTERNAL integer HE5_HDFE_NOPREVSUB parameter(HE5_HDFE_MIDPOINT =0) parameter(HE5_HDFE_ENDPOINT =1) parameter(HE5_HDFE_ANYPOINT =2) parameter(HE5_HDFE_INTERNAL =0) parameter(HE5_HDFE_EXTERNAL =1) parameter(HE5_HDFE_NOPREVSUB =-1) ! HDFEOS5 GRID ORIGIN CODES ! ========================= integer HE5_HDFE_GD_UL integer HE5_HDFE_GD_UR integer HE5_HDFE_GD_LL integer HE5_HDFE_GD_LR parameter(HE5_HDFE_GD_UL =0) parameter(HE5_HDFE_GD_UR =1) parameter(HE5_HDFE_GD_LL =2) parameter(HE5_HDFE_GD_LR =3) ! HDFEOS5 PIXEL REGISTRATION CODES ! ================================ integer HE5_HDFE_CENTER integer HE5_HDFE_CORNER parameter(HE5_HDFE_CENTER =0) parameter(HE5_HDFE_CORNER =1) ! HDFEOS5 GCTP PROJECTION CODES ! ============================= integer HE5_GCTP_GEO integer HE5_GCTP_UTM integer HE5_GCTP_SPCS integer HE5_GCTP_ALBERS integer HE5_GCTP_LAMCC integer HE5_GCTP_MERCAT integer HE5_GCTP_PS integer HE5_GCTP_POLYC integer HE5_GCTP_EQUIDC integer HE5_GCTP_TM integer HE5_GCTP_STEREO integer HE5_GCTP_LAMAZ integer HE5_GCTP_AZMEQD integer HE5_GCTP_GNOMON integer HE5_GCTP_ORTHO integer HE5_GCTP_GVNSP integer HE5_GCTP_SNSOID integer HE5_GCTP_EQRECT integer HE5_GCTP_MILLER integer HE5_GCTP_VGRINT integer HE5_GCTP_HOM integer HE5_GCTP_ROBIN integer HE5_GCTP_SOM integer HE5_GCTP_ALASKA integer HE5_GCTP_GOOD integer HE5_GCTP_MOLL integer HE5_GCTP_IMOLL integer HE5_GCTP_HAMMER integer HE5_GCTP_WAGIV integer HE5_GCTP_WAGVII integer HE5_GCTP_OBLEQA integer HE5_GCTP_ISINUS parameter(HE5_GCTP_GEO =0) parameter(HE5_GCTP_UTM =1) parameter(HE5_GCTP_SPCS =2) parameter(HE5_GCTP_ALBERS =3) parameter(HE5_GCTP_LAMCC =4) parameter(HE5_GCTP_MERCAT =5) parameter(HE5_GCTP_PS =6) parameter(HE5_GCTP_POLYC =7) parameter(HE5_GCTP_EQUIDC =8) parameter(HE5_GCTP_TM =9) parameter(HE5_GCTP_STEREO =10) parameter(HE5_GCTP_LAMAZ =11) parameter(HE5_GCTP_AZMEQD =12) parameter(HE5_GCTP_GNOMON =13) parameter(HE5_GCTP_ORTHO =14) parameter(HE5_GCTP_GVNSP =15) parameter(HE5_GCTP_SNSOID =16) parameter(HE5_GCTP_EQRECT =17) parameter(HE5_GCTP_MILLER =18) parameter(HE5_GCTP_VGRINT =19) parameter(HE5_GCTP_HOM =20) parameter(HE5_GCTP_ROBIN =21) parameter(HE5_GCTP_SOM =22) parameter(HE5_GCTP_ALASKA =23) parameter(HE5_GCTP_GOOD =24) parameter(HE5_GCTP_MOLL =25) parameter(HE5_GCTP_IMOLL =26) parameter(HE5_GCTP_HAMMER =27) parameter(HE5_GCTP_WAGIV =28) parameter(HE5_GCTP_WAGVII =29) parameter(HE5_GCTP_OBLEQA =30) parameter(HE5_GCTP_ISINUS =99) ! HDFEOS5 TILIND/COMPRESSION CODES ! ================================ integer HE5_HDFE_NOTILE integer HE5_HDFE_TILE integer HE5_HDFE_COMP_NONE integer HE5_HDFE_COMP_RLE integer HE5_HDFE_COMP_NBIT integer HE5_HDFE_COMP_SKPHUFF integer HE5_HDFE_COMP_DEFLATE integer HE5_HDFE_COMP_SZIP_CHIP integer HE5_HDFE_COMP_SZIP_K13 integer HE5_HDFE_COMP_SZIP_EC integer HE5_HDFE_COMP_SZIP_NN integer HE5_HDFE_COMP_SZIP_K13orEC integer HE5_HDFE_COMP_SZIP_K13orNN integer HE5_HDFE_COMP_SHUF_DEFLATE integer HE5_HDFE_COMP_SHUF_SZIP_CHIP integer HE5_HDFE_COMP_SHUF_SZIP_K13 integer HE5_HDFE_COMP_SHUF_SZIP_EC integer HE5_HDFE_COMP_SHUF_SZIP_NN integer HE5_HDFE_COMP_SHUF_SZIP_K13orEC integer HE5_HDFE_COMP_SHUF_SZIP_K13orNN parameter(HE5_HDFE_NOTILE =0) parameter(HE5_HDFE_TILE =1) parameter(HE5_HDFE_COMP_NONE =0) parameter(HE5_HDFE_COMP_RLE =1) parameter(HE5_HDFE_COMP_NBIT =2) parameter(HE5_HDFE_COMP_SKPHUFF =3) parameter(HE5_HDFE_COMP_DEFLATE =4) parameter(HE5_HDFE_COMP_SZIP_CHIP =5) parameter(HE5_HDFE_COMP_SZIP_K13 =6) parameter(HE5_HDFE_COMP_SZIP_EC =7) parameter(HE5_HDFE_COMP_SZIP_NN =8) parameter(HE5_HDFE_COMP_SZIP_K13orEC =9) parameter(HE5_HDFE_COMP_SZIP_K13orNN =10) parameter(HE5_HDFE_COMP_SHUF_DEFLATE =11) parameter(HE5_HDFE_COMP_SHUF_SZIP_CHIP =12) parameter(HE5_HDFE_COMP_SHUF_SZIP_K13 =13) parameter(HE5_HDFE_COMP_SHUF_SZIP_EC =14) parameter(HE5_HDFE_COMP_SHUF_SZIP_NN =15) parameter(HE5_HDFE_COMP_SHUF_SZIP_K13orEC =16) parameter(HE5_HDFE_COMP_SHUF_SZIP_K13orNN =17) ! HDFEOS5 GROUP CODES ! =================== integer HE5_HDFE_GEOGROUP integer HE5_HDFE_DATAGROUP integer HE5_HDFE_ATTRGROUP integer HE5_HDFE_GRPATTRGROUP integer HE5_HDFE_LOCATTRGROUP integer HE5_HDFE_PROFGROUP integer HE5_HDFE_PROFGRPATTRGROUP integer HE5_HDFE_GEOGRPATTRGROUP parameter(HE5_HDFE_GEOGROUP =0) parameter(HE5_HDFE_DATAGROUP =1) parameter(HE5_HDFE_ATTRGROUP =2) parameter(HE5_HDFE_GRPATTRGROUP =3) parameter(HE5_HDFE_LOCATTRGROUP =4) parameter(HE5_HDFE_PROFGROUP =5) parameter(HE5_HDFE_PROFGRPATTRGROUP =6) parameter(HE5_HDFE_GEOGRPATTRGROUP =7) hdf-eos5-2.0/testdrivers/swath/hdfeos5_64.inc000066400000000000000000000010151507520047200210310ustar00rootroot00000000000000! * ========================================================== ! * File: hdfeos5_64.inc ! * Author: A. Muslimov, Emergent Technology Services, Inc. ! * Date: March 19, 2002 ! * Purpose: Fortran header file for HDFEOS5 routines on 64 ! * bit platforms ! * ========================================================== ! * Contents: ! * ! * ! * =========================================================== integer*8 HE5S_UNLIMITED_F_64 parameter(HE5S_UNLIMITED_F_64 = -1) hdf-eos5-2.0/testdrivers/swath/testswath32.f000077500000000000000000002426431507520047200210530ustar00rootroot00000000000000c---------------------------------------------------------------------------- c Copyright (C) 2000 Emergent IT Inc. and Raytheon Systems Company | c---------------------------------------------------------------------------- c testswath32.f | c In this program we create, define and write a simple swath hdfeos file | c using the swath interface | c---------------------------------------------------------------------------- program testswath32 implicit none include 'hdfeos5.inc' integer index1, index2, status integer rank, n, dtype, classid, order integer rdattr(4), global_attr(4) integer compparm(5), cnkrank integer rdcompparm(5), compcode integer he5_swopen, he5_swcreate integer swfid, swid, swid2 integer he5_swdefdim, he5_swdetach integer he5_swdefgfld, he5_swdefdfld integer he5_swdefmap, he5_swclose, he5_swdefimap integer he5_swsetfill, he5_swwrlattr, he5_swwrattr integer he5_swwrfld, he5_swwrgattr, he5_swdefvrtreg integer he5_swgmapinfo, he5_swrdfld, he5_swfldinfo integer he5_swmapinfo, he5_swattrinfo, he5_swrdattr integer he5_swgattrinfo, he5_swrdgattr, he5_swrdlattr integer he5_swreginfo, he5_swextreg, he5_swregidx integer he5_swperinfo, he5_swextper integer he5_swlattrinfo, he5_swgetfill, he5_swidtype integer he5_swdefchunk, he5_swdefcomp, he5_swcompinfo integer regionid, regionid2, regionid3, he5_swupimap integer rnkd(4), ntyped(4), rnk(3), ntype(3), nt integer he5_swattach integer he5_swdefboxreg, he5_swdeftmeper, he5_swdupreg integer*4 he5_swinqswath, he5_swnentries, he5_swinqmaps integer*4 he5_swinqimaps, he5_swinqdims, he5_swdiminfo integer*4 he5_swimapinfo, he5_swinqattrs, he5_swinqgattrs integer*4 he5_swinqlattrs, he5_swinqgflds, he5_swinqdflds integer*4 size, strbufsize, ndims, chunkdims(1) integer*4 start(2), stride(2), dataedge(2), geoedge(2) integer*4 geostart(2),istart(2),iedge(2),dedge(2) integer*4 sd_start(2), sd_stride(2), sd_edge(2) integer*4 rd_start(2), rd_stride(2), rd_edge(2) integer*4 indexmap(30), dimsize integer*4 nattr, nswath, idxsz, nmaps integer*4 tstart(1),tstride(1),tedge(1) integer*4 strbufsz2, nflds, idxrange(2) integer*4 count(1), offset, inc, zero, status4 integer*4 ndxmap(2), dims(5),latdims(2) integer*4 idxmap(50), upidxmap(50) integer*4 dim1, dim2, dim3, dim4 real grpattr(3), locattr(3), rdgnlattr(3) real ray1(100,40), ray2(40,100) real lat(40,50), lon(40,50), ray4(40,100) real ray3(40,40), temp(40,100) real idxlat(30,30), idxlon(30,30) real latcnt, loncnt, raycnt, idxlatcnt, idxloncnt real fillvalue, rdfilval, tempbuf(4200) real*8 cornerlon(2),cornerlat(2) real*8 twodtime(40,50) real*8 onedtime(40) real*8 range(2) real*8 tmcnt, starttime, endtime character*(256) geodim character*(256) idxdimmap character*(256) dimmap, dimname, fieldlist character*(256) attrlist, swathlist character*(256) dimens, maxdims dim1 = 30 dim2 = 40 dim3 = 50 dim4 = 100 count(1) = 3 compparm(1) = 6 compparm(2) = 0 compparm(3) = 0 compparm(4) = 0 compparm(5) = 0 cnkrank = 1 chunkdims(1) = 10 rdcompparm(1) = 1 rdcompparm(2) = 1 rdcompparm(3) = 1 rdcompparm(4) = 1 rdcompparm(5) = 1 compcode = -1 raycnt = -799.0 tmcnt = 46353400.0d0 starttime = 46353450.0d0 endtime = 46500000.0d0 range(1) = 46353450.0d0 range(2) = 46500000.0d0 latcnt = 39.8 loncnt = 78.0 global_attr(1)= 11 global_attr(2)= 33 global_attr(3)= 66 global_attr(4)= 99 grpattr(1) = 21.7 grpattr(2) = 24.3 grpattr(3) = 26.3 locattr(3) = 21.7 locattr(2) = 24.3 locattr(1) = 26.3 start(1) = 10 start(2) = 10 tstart(1) = 0 tstride(1) = 1 tedge(1) = 40 geostart(1) = 0 geostart(2) = 0 stride(1) = 1 stride(2) = 1 sd_start(1) = 0 sd_start(2) = 0 sd_stride(1) = 1 sd_stride(2) = 1 sd_edge(1) = 100 sd_edge(2) = 40 rd_start(1) = 0 rd_start(2) = 0 rd_stride(1) = 1 rd_stride(2) = 1 rd_edge(1) = 40 rd_edge(2) = 100 dataedge(1) = 20 dataedge(2) = 50 geoedge(1) = 40 geoedge(2) = 50 idxlatcnt = 39.8 idxloncnt = 78.0 istart(1) = 0 istart(2) = 0 iedge(1) = 30 iedge(2) = 30 dedge(1) = 40 dedge(2) = 40 rank = 2 fillvalue = 16.0 cornerlon(1) = 75.0 cornerlon(2) = 78.0 cornerlat(1) = 38.0 cornerlat(2) = 39.8 indexmap(1) = 1 indexmap(2) = 2 indexmap(3) = 3 indexmap(4) = 4 indexmap(5) = 6 indexmap(6) = 7 indexmap(7) = 8 indexmap(8) = 9 indexmap(9) = 11 indexmap(10) = 12 indexmap(11) = 13 indexmap(12) = 14 indexmap(13) = 16 indexmap(14) = 17 indexmap(15) = 18 indexmap(16) = 19 indexmap(17) = 21 indexmap(18) = 22 indexmap(19) = 23 indexmap(20) = 24 indexmap(21) = 26 indexmap(22) = 27 indexmap(23) = 28 indexmap(24) = 29 indexmap(25) = 31 indexmap(26) = 32 indexmap(27) = 33 indexmap(28) = 34 indexmap(29) = 36 indexmap(30) = 37 zero = 0 c c This section of the program just fills some arrays with data that will be c used later in the program c do 110 index1=1,100 do 100 index2=1,40 ray1(index1, index2)=raycnt ray2(index2, index1)=raycnt + 1.0 ray4(index2,index1) = raycnt raycnt = raycnt +1. 100 continue 110 continue do 130 index1=1,40 do 120 index2=1,50 lat(index1, index2)=latcnt lon(index1, index2)=loncnt twodtime(index1,index2)=tmcnt loncnt=loncnt-.1 tmcnt=tmcnt+5.0 120 continue onedtime(index1)=tmcnt latcnt=latcnt-0.1 loncnt = 78.0 130 continue do 150 index1=1,30 do 140 index2=1,30 idxlat(index1, index2)=idxlatcnt idxlon(index1, index2)=idxloncnt idxloncnt=idxloncnt-.1 140 continue idxlatcnt=idxlatcnt-.1 idxloncnt=78.0 150 continue do 170 index1=1,40 do 160 index2=1,40 ray3(index1, index2)=raycnt raycnt = raycnt+1.25 160 continue 170 continue do 987 index1=1,50 idxmap(index1)=zero upidxmap(index1)=zero 987 continue 230 format('********Error unexpected**********') 240 format('***********Passed Test*********') open(unit=1, file="testswath32_f.txtout", status = "UNKNOWN") write(*,*)'Testing he5_swath FORTRAN 77 interface' write(*,*)'======================================' write(1,*)'Testing he5_swath FORTRAN 77 interface' write(1,*)'======================================' write(*,*)' ' write(1,*)' ' c Test Case -- he5_swopen c write(*,*)'Testing he5_swopen ' write(*,*)'=====================' write(1,*)'Testing he5_swopen ' write(1,*)'=====================' swfid=he5_swopen('swath.he5',HE5F_ACC_TRUNC) if (swfid .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'swfid= he5_swopen("swath.he5",HE5F_ACC_TRUNC)' write(*,*)'Value returned by he5_swopen ', swfid write(1,*)'swfid= he5_swopen("swath.he5",HE5F_ACC_TRUNC)' write(1,*)'Value returned by he5_swopen ', swfid endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swcreate c write(1,27) write(*,*)'Testing he5_swcreate ' write(*,*)'=====================' write(1,*)'Testing he5_swcreate ' write(1,*)'=====================' swid=he5_swcreate(swfid,'Simplef') if (swid .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'swid=he5_swcreate(swfid, "Simplef")' write(*,*)'Value returned by he5_swcreate ', swid write(1,*)'swid= he5_swcreate(swfid, "Simplef")' write(1,*)'Value returned by he5_swcreate ', swid endif write(*,*)' ' write(1,*)' ' swid2=he5_swcreate(swfid,'Indexedf') if (swid2 .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' swid2= he5_swcreate(swfid, "Indexedf")' write(*,*)' Value returned by he5_swcreate ', swid2 write(1,*)' swid2= he5_swcreate(swfid, "Indexedf")' write(1,*)' Value returned by he5_swcreate ', swid2 endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swdefdim c write(1,27) write(*,*)'Testing he5_swdefdim ' write(*,*)'=====================' write(1,*)'Testing he5_swdefdim ' write(1,*)'=====================' status=he5_swdefdim(swid,'DataTrack',dim4) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status= he5_swdefdim(swid, "DataTrack", 100)' write(*,*)' Value returned by he5_swdefdim ',status write(1,*)' status= he5_swdefdim(swid, "DataTrack", 100)' write(1,*)' Value returned by he5_swdefdim ',status endif write(*,*)' ' write(1,*)' ' status=he5_swdefdim(swid,'DataXtrack',dim2) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status= he5_swdefdim(swid, "DataXtrack", 40)' write(*,*)' Value returned by he5_swdefdim ',status write(1,*)' status= he5_swdefdim(swid, "DataXtrack", 40)' write(1,*)' Value returned by he5_swdefdim ',status endif write(*,*)' ' write(1,*)' ' status=he5_swdefdim(swid,'GeoTrack',dim3) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status= he5_swdefdim(swid, "GeoTrack", 50)' write(*,*)' Value returned by he5_swdefdim ',status write(1,*)' status= he5_swdefdim(swid, "GeoTrack", 50)' write(1,*)' Value returned by he5_swdefdim ',status endif write(*,*)' ' write(1,*)' ' status=he5_swdefdim(swid,'GeoXtrack',dim2) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status= he5_swdefdim(swid, "GeoXtrack", 40)' write(*,*)' Value returned by he5_swdefdim ',status write(1,*)' status= he5_swdefdim(swid, "GeoXtrack", 40)' write(1,*)' Value returned by he5_swdefdim ',status endif write(*,*)' ' write(1,*)' ' status=he5_swdefdim(swid2,'DataTrack',dim2) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status= he5_swdefdim(swid2, "DataTrack", 40)' write(*,*)' Value returned by he5_swdefdim ', status write(1,*)' status= he5_swdefdim(swid2, "DataTrack", 40)' write(1,*)' Value returned by he5_swdefdim ', status endif write(*,*)' ' write(1,*)' ' status=he5_swdefdim(swid2,'DataXtrack',dim2) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status= he5_swdefdim(swid2, "DataXtrack", 40)' write(*,*)' Value returned by he5_swdefdim ', status write(1,*)' status= he5_swdefdim(swid2, "DataXtrack", 40)' write(1,*)' Value returned by he5_swdefdim ', status endif write(*,*)' ' write(1,*)' ' status=he5_swdefdim(swid2,'GeoTrack',dim1) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status= he5_swdefdim(swid2, "GeoTrack", 30)' write(*,*)' Value returned by he5_swdefdim ', status write(1,*)' status= he5_swdefdim(swid2, "GeoTrack", 30)' write(1,*)' Value returned by he5_swdefdim ', status endif write(*,*)' ' write(1,*)' ' status=he5_swdefdim(swid2,'GeoXtrack',dim1) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status= he5_swdefdim(swid2, "GeoXtrack", 30)' write(*,*)' Value returned by he5_swdefdim ', status write(1,*)' status= he5_swdefdim(swid2, "GeoXtrack", 30)' write(1,*)' Value returned by he5_swdefdim ', status endif write(*,*)' ' write(1,*)' ' status=he5_swdefdim(swid2,'Timedim',dim2) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Define dimension Timedim ' write(*,*)' Value returned by he5_swdefdim ', status write(1,*)'Define dimension Timedim ' write(1,*)' Value returned by he5_swdefdim ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swdefgfld c write(1,27) write(*,*)'Testing he5_swdefgfld ' write(*,*)'=====================' write(1,*)'Testing he5_swdefgfld ' write(1,*)'=====================' status=he5_swdefgfld(swid,'Latitude','GeoXtrack,GeoTrack', 1' ',HE5T_NATIVE_FLOAT,0) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swdefgfld(swid,"Latitude", 1"GeoXtrack,GeoTrack"," ", HE5T_NATIVE_FLOAT, 0)' write(1,*)'status= he5_swdefgfld(swid,"Latitude", 1"GeoXtrack,GeoTrack"," ", HE5T_NATIVE_FLOAT, 0)' write(1,*)'Value returned by he5_swdefgfld ',status write(*,*)'Value returned by he5_swdefgfld ',status endif write(*,*)' ' write(1,*)' ' status=he5_swdefgfld(swid,'Longitude','GeoXtrack,GeoTrack', 1' ',HE5T_NATIVE_FLOAT, 0) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Value returned by he5_swdefgfld ',status write(1,*)'Value returned by he5_swdefgfld ',status endif write(*,*)' ' write(1,*)' ' status=he5_swdefgfld(swid2,'Latitude','GeoXtrack,GeoTrack', 1' ',HE5T_NATIVE_FLOAT, 0) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Value returned by he5_swdefgfld ', status write(1,*)'Value returned by he5_swdefgfld ', status endif write(*,*)' ' write(1,*)' ' status=he5_swdefgfld(swid2,'Longitude','GeoXtrack,GeoTrack', 1' ',HE5T_NATIVE_FLOAT, 0) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Value returned by he5_swdefgfld ', status write(1,*)'Value returned by he5_swdefgfld ', status endif write(*,*)' ' write(1,*)' ' status=he5_swdefgfld(swid2,'Time','Timedim',' ', 1HE5T_NATIVE_DOUBLE, 0) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Define field Time for swath Indexedf ' write(*,*)'Status returned from call to he5_swdefgfld ',status write(1,*)'Define field Time for swath Indexedf ' write(1,*)'Status returned from call to he5_swdefgfld ',status endif write(*,*)' ' write(1,*)' ' status=he5_swdefgfld(swid,'Time','GeoXtrack,GeoTrack', 1' ', HE5T_NATIVE_DOUBLE, 0) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swdefgfld(swid, "Time","GeoXtrack,GeoTrack", 1"",HE5T_NATIVE_DOUBLE, 0)' write(*,*)'Value returned by he5_swdefgfld ',status write(1,*)'status= he5_swdefgfld(swid, "Time","GeoXtrack,GeoTrack", 1"",HE5T_NATIVE_DOUBLE, 0)' write(1,*)'Value returned by he5_swdefgfld ',status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swdefdfld c write(1,27) write(*,*)'Testing he5_swdefdfld ' write(*,*)'=====================' write(1,*)'Testing he5_swdefdfld ' write(1,*)'=====================' status=he5_swdefdfld(swid,'SideA','DataXtrack,DataTrack', 1' ', HE5T_NATIVE_FLOAT, 0) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Define data field SideA ' write(*,*)'Value returned by he5_swdefdfld ',status write(1,*)'Define data field SideA ' write(1,*)'Value returned by he5_swdefdfld ',status write(*,*)' ' write(1,*)' ' endif c Test Case -- he5_swsetfill c write(1,27) write(*,*)'Testing he5_swsetfill ' write(*,*)'=====================' write(1,*)'Testing he5_swsetfill ' write(1,*)'=====================' status= he5_swsetfill(swid,'Temperature', 1HE5T_NATIVE_FLOAT, fillvalue) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swsetfill(swid,"Temperature", 1HE5T_NATIVE_FLOAT, fillvalue)' write(*,*)'Value returned by he5_swsetfill ',status write(1,*)'status=he5_swsetfill(swid,"Temperature", 1HE5T_NATIVE_FLOAT, fillvalue)' write(1,*)'Value returned by he5_swsetfill ',status endif write(*,*)' ' write(1,*)' ' status=he5_swdefdfld(swid,'Temperature', 1'DataXtrack,DataTrack',' ',HE5T_NATIVE_FLOAT, 0) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Define data field Temperature ' write(*,*)'Value returned by he5_swdefdfld ',status write(1,*)'Define data field Temperature ' write(1,*)'Value returned by he5_swdefdfld ',status write(*,*)' ' write(1,*)' ' endif status= he5_swsetfill(swid,'Conduction', 1HE5T_NATIVE_FLOAT,fillvalue) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swsetfill(swid,"Conduction", 1HE5T_NATIVE_FLOAT,fillvalue)' write(*,*)'Value returned by he5_swsetfill ',status write(1,*)'status=he5_swsetfill(swid,"Conduction", 1HE5T_NATIVE_FLOAT,fillvalue)' write(1,*)'Value returned by he5_swsetfill ',status endif write(*,*)' ' write(1,*)' ' status=he5_swdefdfld(swid,'Conduction', 1'DataXtrack,DataTrack',' ',HE5T_NATIVE_FLOAT,0) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swdefdfld(swid,"Conduction", 1"DataXtrack,DataTrack","",HE5T_NATIVE_FLOAT, 0)' write(*,*)'Value returned by he5_swdefdfld ',status write(1,*)'status= he5_swdefdfld(swid,"Conduction", 1"DataXtrack,DataTrack","",HE5T_NATIVE_FLOAT, 0)' write(1,*)'Value returned by he5_swdefdfld ',status endif write(*,*)' ' write(1,*)' ' status=he5_swdefdfld(swid2,'Sensor1', 1'DataXtrack,DataTrack',' ',HE5T_NATIVE_FLOAT, 0) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swdefdfld(swid2, "Sensor1", 1"DataTrack,DataXtrack","",HE5T_NATIVE_FLOAT, 0)' write(*,*)'Value returned by he5_swdefdfld ',status write(1,*)'status= he5_swdefdfld(swid2, "Sensor1", 1"DataTrack,DataXtrack","",HE5T_NATIVE_FLOAT, 0)' write(1,*)'Value returned by he5_swdefdfld ',status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swdefchunk c write(1,27) write(*,*)'Testing he5_swdefchunk' write(*,*)'======================' write(1,*)'Testing he5_swdefchunk' write(1,*)'======================' status=he5_swdefchunk(swid,cnkrank,chunkdims) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swdefchunk(swid, cnkrank, chunkdims)' write(*,*)'Value returned by he5_swdefchunk ',status write(1,*)'status= he5_swdefchunk(swid, cnkrank, chunkdims)' write(1,*)'Value returned by he5_swdefchunk ',status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swdefcomp c write(1,27) write(*,*)'Testing he5_swdefcomp' write(*,*)'=====================' write(1,*)'Testing he5_swdefcomp' write(1,*)'=====================' status=he5_swdefcomp(swid,HE5_HDFE_COMP_DEFLATE,compparm) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swdefcomp(swid,HE5_HDFE_COMP_DEFLATE, 1compparm)' write(*,*)'Value returned by he5_swdefcomp ',status write(1,*)'status= he5_swdefcomp(swid,HE5_HDFE_COMP_DEFLATE, 1compparm)' write(1,*)'Value returned by he5_swdefcomp ',status endif write(*,*)' ' write(1,*)' ' status=he5_swdefdfld(swid,'CompChunk','GeoTrack', 1' ',HE5T_NATIVE_FLOAT, 0) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Define data field CompChunk ' write(*,*)'Value returned by he5_swdefdfld ',status write(1,*)'Define data field CompChunk ' write(1,*)'Value returned by he5_swdefdfld ',status write(*,*)' ' write(1,*)' ' endif c Test Case -- he5_swdetach c write(1,27) write(*,*)'Testing he5_swdetach ' write(*,*)'=====================' write(1,*)'Testing he5_swdetach ' write(1,*)'=====================' status=he5_swdetach(swid) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swdetach(swid)' write(*,*)'Value returned by he5_swdetach ',status write(1,*)'status= he5_swdetach(swid)' write(1,*)'Value returned by he5_swdetach ',status endif write(*,*)' ' write(1,*)' ' status=he5_swdetach(swid2) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swdetach(swid2)' write(*,*)'Value returned by he5_swdetach ',status write(1,*)'status= he5_swdetach(swid2)' write(1,*)'Value returned by he5_swdetach ',status endif write(*,*)' ' write(1,*)' ' swid=he5_swattach(swfid,'Simplef') if (swid .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'swid= he5_swattach(swfid, "Simplef")' write(*,*)'Value returned by he5_swattach ',swid write(1,*)'swid= he5_swattach(swfid, "Simplef")' write(1,*)'Value returned by he5_swattach ',swid endif write(*,*)' ' write(1,*)' ' swid2=he5_swattach(swfid,'Indexedf') if (swid2 .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'swid2= he5_swattach(swfid, "Indexedf")' write(*,*)'Value returned by he5_swattach ',swid2 write(1,*)'swid2= he5_swattach(swfid, "Indexedf")' write(1,*)'Value returned by he5_swattach ',swid2 endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swdefmap c write(1,27) write(*,*)'Testing he5_swdefmap ' write(*,*)'=====================' write(1,*)'Testing he5_swdefmap ' write(1,*)'=====================' offset = 0 inc = 2 status=he5_swdefmap(swid,'GeoTrack','DataTrack',offset,inc) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swdefmap(swid,"GeoTrack", 1"DataTrack", offset, inc)' write(*,*)'Value returned by he5_swdefmap ',status write(1,*)'status= he5_swdefmap(swid,"GeoTrack", 1"DataTrack", offset, inc)' write(1,*)'Value returned by he5_swdefmap ',status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swdefimap c write(1,27) write(*,*)'Testing he5_swdefimap ' write(*,*)'=====================' write(1,*)'Testing he5_swdefimap ' write(1,*)'=====================' status=he5_swdefimap(swid2,'GeoTrack','DataTrack',indexmap) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swdefimap(swid2, "GeoTrack", 1"DataTrack",indexmap)' write(*,*)'Value returned by he5_swdefimap ',status write(1,*)'status= he5_swdefimap(swid2, "GeoTrack", 1"DataTrack",indexmap)' write(1,*)'Value returned by he5_swdefimap ',status endif write(*,*)' ' write(1,*)' ' status=he5_swdefimap(swid2,'GeoXtrack','DataXtrack', 1indexmap) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swdefimap(swid2, "GeoXtrack", 1"DataXtrack",indexmap)' write(*,*)'Value returned by he5_swdefimap ',status write(1,*)'status=he5_swdefimap(swid2, "GeoXtrack", 1"DataXtrack",indexmap)' write(1,*)'Value returned by he5_swdefimap ',status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swdetach c write(1,27) write(*,*)'Testing he5_swdetach ' write(*,*)'=====================' write(1,*)'Testing he5_swdetach ' write(1,*)'=====================' status= he5_swdetach(swid) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swdetach(swid)' write(*,*)'Value returned by he5_swdetach ',status write(1,*)'status= he5_swdetach(swid)' write(1,*)'Value returned by he5_swdetach ',status endif write(*,*)' ' write(1,*)' ' status= he5_swdetach(swid2) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swdetach(swid2)' write(*,*)'Value returned by he5_swdetach ',status write(1,*)'status= he5_swdetach(swid2)' write(1,*)'Value returned by he5_swdetach ',status endif write(*,*)' ' write(1,*)' ' status=he5_swclose(swfid) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swclose(swfid)' write(*,*)'Value returned by he5_swclose ',status write(1,*)'status= he5_swclose(swfid)' write(1,*)'Value returned by he5_swclose ',status endif write(*,*)' ' write(1,*)' ' swfid=he5_swopen('swath.he5',HE5F_ACC_RDWR) if (swfid .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'swfid=he5_swopen("swath.he5",HE5F_ACC_RDWR)' write(*,*)'Value returned by he5_swopen ',swfid write(1,*)'swfid=he5_swopen("swath.he5",HE5F_ACC_RDWR)' write(1,*)'Value returned by he5_swopen ',swfid endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swattach c write(1,27) write(*,*)'Testing he5_swattach ' write(*,*)'=====================' write(1,*)'Testing he5_swattach ' write(1,*)'=====================' swid=he5_swattach(swfid,'Simplef') if (swid .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'swid= he5_swattach(swfid, "Simplef")' write(*,*)'Value returned by he5_swattach ',swid write(1,*)'swid= he5_swattach(swfid, "Simplef")' write(1,*)'Value returned by he5_swattach ',swid endif write(*,*)' ' write(1,*)' ' swid2=he5_swattach(swfid,'Indexedf') if (swid2 .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'swid2= he5_swattach(swfid, "Indexedf")' write(*,*)'Value returned by he5_swattach ',swid2 write(1,*)'swid2= he5_swattach(swfid, "Indexedf")' write(1,*)'Value returned by he5_swattach ',swid2 endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swwrfld c write(1,27) write(*,*)'Testing he5_swwrfld ' write(*,*)'===================' write(1,*)'Testing he5_swwrfld ' write(1,*)'===================' status=he5_swwrfld(swid,'SideA',sd_start,stride, 1rd_edge, ray4) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Write data field SideA ' write(*,*)'Value returned by he5_swwrfld ',status write(1,*)'Write data field SideA ' write(1,*)'Value returned by he5_swwrfld ',status endif write(*,*)' ' write(1,*)' ' status=he5_swwrfld(swid,'Temperature',start,stride, 1dataedge, ray4) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swwrfld(swid,"Temperature",start, 1stride,dataedge, ray1)' write(*,*)'Value returned by he5_swwrfld ',status write(1,*)'status=he5_swwrfld(swid,"Temperature",start, 1stride,dataedge, ray1)' write(1,*)'Value returned by he5_swwrfld ',status endif write(*,*)' ' write(1,*)' ' status=he5_swwrfld(swid,'Conduction',start,stride, 1dataedge, ray2) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swwrfld(swid,"Conduction",start, 1stride,dataedge, ray2)' write(*,*)'Value returned by he5_swwrfld ',status write(1,*)'status=he5_swwrfld(swid,"Conduction",start, 1stride,dataedge, ray2)' write(1,*)'Value returned by he5_swwrfld ',status endif write(*,*)' ' write(1,*)' ' status=he5_swwrfld(swid,'Latitude',geostart,stride, 1geoedge,lat) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swwrfld(swid, "Latitude", geostart, 1stride, geoedge, lat)' write(*,*)'Value returned by he5_swwrfld ',status write(1,*)'status= he5_swwrfld(swid, "Latitude", geostart, 1stride, geoedge, lat)' write(1,*)'Value returned by he5_swwrfld ',status endif write(*,*)' ' write(1,*)' ' status=he5_swwrfld(swid,'Longitude',geostart,stride, 1geoedge,lon) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swwrfld(swid,"Longitude",geostart, 1stride,geoedge, lon)' write(*,*)'Value returned by he5_swwrfld ',status write(1,*)'status= he5_swwrfld(swid,"Longitude",geostart, 1stride,geoedge, lon)' write(1,*)'Value returned by he5_swwrfld ',status endif write(*,*)' ' write(1,*)' ' status=he5_swwrfld(swid,'Time',geostart,stride,geoedge, 1twodtime) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swwrfld(swid,"Time",geostart,stride, 1geoedge, twodtime)' write(*,*)'Value returned by he5_swwrfld for Time ',status write(1,*)'status= he5_swwrfld(swid, "Time", geostart, stride, 1geoedge, twodtime)' write(1,*)'Value returned by he5_swwrfld for Time ',status endif write(*,*)' ' write(1,*)' ' status=he5_swwrfld(swid2,'Latitude',istart,stride, 1iedge,idxlat) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swwrfld(swid2,"Latitude", 1istart,stride,iedge,idxlat)' write(*,*)'Value returned by he5_swwrfld ',status write(1,*)'status= he5_swwrfld(swid2,"Latitude", 1istart,stride,iedge,lat)' write(1,*)'Value returned by he5_swwrfld ',status endif write(*,*)' ' write(1,*)' ' status=he5_swwrfld(swid2,'Longitude',istart,stride, 1iedge,idxlon) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swwrfld(swid2,"Longitude", 1istart,stride,iedge,idxlon)' write(*,*)'Value returned by he5_swwrfld ',status write(1,*)'status= he5_swwrfld(swid2,"Longitude", 1istart,stride,iedge,idxlon)' write(1,*)'Value returned by he5_swwrfld ',status endif write(*,*)' ' write(1,*)' ' status=he5_swwrfld(swid2,'Time',tstart,tstride, 1tedge,onedtime) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Write field Time ' write(*,*)'Status returned by he5_swwrfld ',status write(1,*)'Write field Time ' write(1,*)'Status returned by he5_swwrfld ',status write(*,*)' ' write(1,*)' ' endif iedge(1)=40 iedge(2)=40 status=he5_swwrfld(swid2,'Sensor1',istart,stride, 1iedge,ray3) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swwrfld(swid2, "Sensor1", 1istart, stride, iedge, ray3)' write(*,*)'Value returned by he5_swwrfld ',status write(1,*)'status= he5_swwrfld(swid2, "Sensor1", 1istart, stride, iedge, ray3)' write(1,*)'Value returned by he5_swwrfld ',status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swwrlattr c write(1,27) write(*,*)'Testing he5_swwrlattr, Local Attribute ' write(*,*)'================================== ' write(1,*)'Testing he5_swwrlattr, Local Attribute ' write(1,*)'================================== ' status=he5_swwrlattr(swid2,'Sensor1','local', 1HE5T_NATIVE_FLOAT,count,locattr) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swwrlattr(swid2,"Sensor1","local", 1HE5T_NATIVE_FLOAT,count,locattr)' write(*,*)'Value returned by he5_swwrlattr ',status write(1,*)'status=he5_swwrlattr(swid2,"Sensor1", "local", 1HE5T_NATIVE_FLOAT,count,locattr)' write(1,*)'Value returned by he5_swwrlattr ',status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swwrattr c count(1) = 4 write(1,27) write(*,*)'Testing he5_swwrattr, Global Attribute ' write(*,*)'====================================== ' write(1,*)'Testing he5_swwrattr, Global Attribute ' write(1,*)'======================================= ' status=he5_swwrattr(swid,'Drift',HE5T_NATIVE_INT,count, 1global_attr) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swwrattr(swid, "Drift", 1HE5T_NATIVE_INT, count, global_attr)' write(*,*)'Value returned by he5_swwrattr ',status write(1,*)'status=he5_swwrattr(swid, "Drift", 1HE5T_NATIVE_INT, count, global_attr)' write(1,*)'Value returned by he5_swwrattr ',status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swwrgattr c count(1) = 3 write(1,27) write(*,*)'Testing he5_swwrgattr, Group Attribute ' write(*,*)'====================================== ' write(1,*)'Testing he5_swwrgattr, Group Attribute ' write(1,*)'====================================== ' status=he5_swwrgattr(swid,'group',HE5T_NATIVE_FLOAT, 1count,grpattr) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swwrgattr(swid, "group", 1HE5T_NATIVE_FLOAT,count,grpgattr)' write(*,*)'Value returned by he5_swwrgattr ',status write(1,*)'status=he5_swwrgattr(swid, "group", 1HE5T_NATIVE_FLOAT,count,grpattr)' write(1,*)'Value returned by he5_swwrgattr ',status endif write(*,*)' ' write(1,*)' ' status= he5_swdetach(swid) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swdetach(swid)' write(*,*)'Value returned by he5_swdetach ',status write(1,*)'status= he5_swdetach(swid)' write(1,*)'Value returned by he5_swdetach ',status endif write(*,*)' ' write(1,*)' ' status= he5_swdetach(swid2) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swdetach(swid2)' write(*,*)'Value returned by he5_swdetach ',status write(1,*)'status= he5_swdetach(swid2)' write(1,*)'Value returned by he5_swdetach ',status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swclose c write(1,27) write(*,*)'Testing he5_swclose ' write(*,*)'===================' write(1,*)'Testing he5_swclose ' write(1,*)'===================' status= he5_swclose(swfid) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Value returned by he5_swclose ',status write(1,*)'status= he5_swclose(swfid)' write(1,*)'Value returned by he5_swclose ',status endif write(*,*)' ' write(1,*)' ' swfid= he5_swopen('swath.he5',HE5F_ACC_RDWR) if (swfid .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'swfid= he5_swopen("swath.he5",HE5F_ACC_RDWR)' write(*,*)'Value returned by he5_swopen ', swfid write(1,*)'swfid= he5_swopen("swath.he5",HE5F_ACC_RDWR)' write(1,*)'Value returned by he5_swopen ', swfid endif write(*,*)' ' write(1,*)' ' swid= he5_swattach(swfid,'Simplef') if (swid .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'swid= he5_swattach(swfid, "Simplef")' write(*,*)'Value returned by he5_swattach ',swid write(1,*)'swid= he5_swattach(swfid, "Simplef")' write(1,*)'Value returned by he5_swattach ',swid endif write(*,*)' ' write(1,*)' ' status= he5_swdetach(swid) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swdetach(swid)' write(*,*)'Value returned by he5_swdetach ',status write(1,*)'status= he5_swdetach(swid)' write(1,*)'Value returned by he5_swdetach ',status endif write(*,*)' ' write(1,*)' ' status= he5_swclose(swfid) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swclose(swfid)' write(*,*)'Value returned by he5_swclose ',status write(1,*)'status= he5_swclose(swfid)' write(1,*)'Value returned by he5_swclose ',status endif write(*,*)' ' write(1,*)' ' swfid= he5_swopen('swath.he5',HE5F_ACC_RDWR) if (swfid .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'swfid= he5_swopen("swath.he5",HE5F_ACC_RDWR)' write(*,*)'Value returned by he5_swopen ',swfid write(1,*)'swfid= he5_swopen("swath.he5",HE5F_ACC_RDWR)' write(1,*)'Value returned by he5_swopen ',swfid endif write(*,*)' ' write(1,*)' ' swid=he5_swattach(swfid,'Simplef') if (swid .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'swid= he5_swattach(swfid, "Simplef")' write(*,*)'Value returned by he5_swattach ',swid write(1,*)'swid= he5_swattach(swfid, "Simplef")' write(1,*)'Value returned by he5_swattach ',swid endif write(*,*)' ' write(1,*)' ' swid2=he5_swattach(swfid,'Indexedf') if (swid2 .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'swid2= he5_swattach(swfid, "Indexedf")' write(*,*)'Value returned by he5_swattach ',swid2 write(1,*)'swid2= he5_swattach(swfid, "Indexedf")' write(1,*)'Value returned by he5_swattach ',swid2 endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swdefvrtreg c write(1,27) write(*,*)'Testing he5_swdefvrtreg' write(*,*)'=======================' write(1,*)'Testing he5_swdefvrtreg' write(1,*)'=======================' regionid=he5_swdefvrtreg(swid2,HE5_HDFE_NOPREVSUB,'Time',range) if (regionid .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Define region id for field Time ' write(*,*)'Region id returned by he5_swdefvrtreg ', 1regionid write(1,*)'Define region id for field Time ' write(1,*)'Region id returned by he5_swdefvrtreg ', 1regionid endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swnentries c write(1,27) write(*,*)'Testing he5_swnentries ' write(*,*)'=====================' write(1,*)'Testing he5_swnentries ' write(1,*)'=====================' nmaps=he5_swnentries(swid,1,strbufsize) if (nmaps .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'nmaps= he5_swnentries(swid, 1, strbufsize)' write(*,*)'Number of dimension mappings ',nmaps write(*,*)'Size of strbufsize ',strbufsize write(1,*)'nmaps= he5_swnentries(swid, 1, strbufsize)' write(1,*)'Number of dimension mappings ',nmaps write(1,*)'Size of strbufsize ',strbufsize endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swinqmaps c write(1,27) write(*,*)'Testing he5_swinqmaps ' write(*,*)'=====================' write(1,*)'Testing he5_swinqmaps ' write(1,*)'=====================' nmaps=he5_swinqmaps(swid, dimmap, offset, inc) if (nmaps .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'nmaps=he5_swinqmaps(swid,dimmap,offset,inc)' write(*,*)'Dimension mappings ',dimmap write(*,*)'offset ',offset write(*,*)'increment ',inc write(1,*)'nmaps=he5_swinqmaps(swid,dimmap,offset,inc)' write(1,*)'Dimension mappings ',dimmap write(1,*)'offset ',offset write(1,*)'increment ',inc endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swgmapinfo c write(1,27) write(*,*)'Testing he5_swgmapinfo ' write(*,*)'======================' write(1,*)'Testing he5_swgmapinfo ' write(1,*)'======================' status = he5_swgmapinfo(swid2,'GeoTrack') if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status = he5_swgmapinfo(swid2, "GeoTrack")' write(1,*)'status = he5_swgmapinfo(swid2, "GeoTrack")' write(*,*)'Status returned by he5_swgmapinfo ',status write(1,*)'Status returned by he5_swgmapinfo ',status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swinqimaps c write(1,27) write(*,*)'Testing he5_swinqimaps ' write(*,*)'=====================' write(1,*)'Testing he5_swinqimaps ' write(1,*)'=====================' nmaps=he5_swinqimaps(swid2, idxdimmap, ndxmap) if (nmaps .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'nmaps=he5_swinqimaps(swid2,idxdimmap,ndxmap)' write(*,*)'Number of indexed mappings ',nmaps write(*,*)'Indexed Dimension mappings ',idxdimmap write(*,*)'Index size ',ndxmap write(1,*)'nmaps=he5_swinqimaps(swid2,idxdimmap,ndxmap)' write(1,*)'Number of indexed mappings ',nmaps write(1,*)'Indexed Dimension mappings ',idxdimmap write(1,*)'Index size ',ndxmap endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swinqdims c write(1,27) write(*,*)'Testing he5_swinqdims ' write(*,*)'=====================' write(1,*)'Testing he5_swinqdims ' write(1,*)'=====================' ndims=he5_swinqdims(swid,dimname,dims) if (ndims .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'ndims= he5_swinqdims(swid, dimname, dims)' write(*,*)'Number of dimesions ',ndims write(*,*)'Names of dimensions ',dimname write(*,*)'Size of dimensions ',dims write(1,*)'ndims= he5_swinqdims(swid, dimname, dims)' write(1,*)'Number of dimesions ',ndims write(1,*)'Names of dimensions ',dimname write(1,*)'Size of dimensions ',dims endif write(*,*)' ' write(1,*)' ' ndims= he5_swinqdims(swid2, dimname, dims) if (ndims .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'ndims=he5_swinqdims(swid2,dimname,dims)' write(*,*)'Number of dimesions ',ndims write(*,*)'Names of dimensions ',dimname write(*,*)'Size of dimensions ',dims write(1,*)'ndims=he5_swinqdims(swid2,dimname,dims)' write(1,*)'Number of dimesions ',ndims write(1,*)'Names of dimensions ',dimname write(1,*)'Size of dimensions ',dims endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swinqgflds c write(1,27) write(*,*)'Testing he5_swinqgflds ' write(*,*)'======================' write(1,*)'Testing he5_swinqgflds ' write(1,*)'======================' nflds= he5_swinqgflds(swid,fieldlist,rnk,ntype) if (nflds .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'nflds=he5_swinqgflds(swid,fieldlist,rnk,ntype)' write(*,*)'Number of geolocation fields in swath ',nflds write(*,*)'Names of geolocation fields ',fieldlist write(*,*)'Rank of fields ',rnk write(*,*)'Number type of fields ',ntype write(1,*)'nflds=he5_swinqgflds(swid,fieldlist,rnk,ntype)' write(1,*)'Number of geolocation fields in swath ',nflds write(1,*)'Names of geolocation fields ',fieldlist write(1,*)'Rank of fields ',rnk write(1,*)'Number type of fields ',ntype endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swinqdflds c write(1,27) write(*,*)'Testing he5_swinqdflds ' write(*,*)'======================' write(1,*)'Testing he5_swinqdflds ' write(1,*)'======================' nflds=he5_swinqdflds(swid,fieldlist,rnkd,ntyped) if (nflds .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'nflds=he5_swinqdflds(swid,fieldlist,rnkd,ntyped)' write(*,*)'Number of data fields in swath ',nflds write(*,*)'Names of data fields ',fieldlist write(*,*)'Rank of fields ',rnkd write(*,*)'Number type of fields ',ntyped write(1,*)'nflds=he5_swinqdflds(swid,fieldlist,rnkd,ntyped)' write(1,*)'Number of data fields in swath ',nflds write(1,*)'Names of data fields ',fieldlist write(1,*)'Rank of fields ',rnkd write(1,*)'Number type of fields ',ntyped endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swdiminfo c write(1,27) write(*,*)'Testing he5_swdiminfo ' write(*,*)'=====================' write(1,*)'Testing he5_swdiminfo ' write(1,*)'=====================' dimsize= he5_swdiminfo(swid,'DataTrack') if (dimsize .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'dimsize= he5_swdiminfo(swid, "DataTrack")' write(*,*)'Size of dimension DataTrack ',dimsize write(1,*)'dimsize= he5_swdiminfo(swid, "DataTrack")' write(1,*)'Size of dimension DataTrack ',dimsize write(*,*)' ' write(1,*)' ' endif c Test Case -- he5_swrdfld c write(1,27) write(*,*)'Testing he5_swrdfld ' write(*,*)'===================' write(1,*)'Testing he5_swrdfld ' write(1,*)'===================' rd_start(1)=0 rd_start(2)=0 rd_stride(1)=1 rd_stride(2)=1 rd_edge(1)=40 rd_edge(2)=100 status= he5_swrdfld(swid,'Conduction',rd_start, 1rd_stride,rd_edge,temp) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Value returned by he5_swrdfld ',status write(*,*)'status= he5_swrdfld(swid, "Conduction", 1rd_start,rd_stride, rd_edge, temp)' write(1,*)'status= he5_swrdfld(swid, "Conduction", 1rd_start,rd_stride, rd_edge, temp)' write(1,*)'Value returned by he5_swrdfld ',status do 190 index1=10,15 do 180 index2=10,15 write(*,*)'value of conduction ',temp(index1,index2) write(1,*)'value of conduction ',temp(index1,index2) 180 continue 190 continue endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swfldinfo c write(1,27) write(*,*)'Testing he5_swfldinfo ' write(*,*)'=====================' write(1,*)'Testing he5_swfldinfo ' write(1,*)'=====================' status=he5_swfldinfo(swid,'Latitude',rank,latdims,nt, 1dimens,maxdims) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swfldinfo(swid, "Latitude", 1rank, latdims, nt, dimens, maxdims)' write(*,*)'Value returned by he5_swfldinfo ',status write(*,*)'Rank of field latitude ',rank write(*,*)'dimension list of field latitude ',dimens write(*,*)'Size of latitude dimensions ',latdims write(*,*)'number type of field latitude ',nt write(1,*)'status= he5_swfldinfo(swid, "Latitude", 1rank, latdims, nt, dimens, maxdims)' write(1,*)'Value returned by he5_swfldinfo ',status write(1,*)'Rank of field latitude ',rank write(1,*)'dimension list of field latitude ',dimens write(1,*)'Size of latitude dimensions ',latdims write(1,*)'number type of field latitude ',nt endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swmapinfo c write(1,27) write(*,*)'Testing he5_swmapinfo ' write(*,*)'=====================' write(1,*)'Testing he5_swmapinfo ' write(1,*)'=====================' status=he5_swmapinfo(swid,'GeoTrack','DataTrack',offset,inc) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swmapinfo(swid,"GeoTrack","DataTrack", 1offset,inc)' write(*,*)'Value returned by he5_swmapinfo ',status write(*,*)'Offset ',offset,' Increment ',inc write(1,*)'status=he5_swmapinfo(swid,"GeoTrack","DataTrack", 1offset,inc)' write(1,*)'Value returned by he5_swmapinfo ',status write(1,*)'Offset ',offset,' Increment ',inc endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swimapinfo c write(1,27) write(*,*)'Testing he5_swimapinfo ' write(*,*)'======================' write(1,*)'Testing he5_swimapinfo ' write(1,*)'======================' status4=he5_swimapinfo(swid2,'GeoXtrack','DataXtrack',idxmap) if (status4 .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status4= he5_swimapinfo(swid2,"GeoXtrack", 1"DataXtrack", idxmap)' write(*,*)'Value returned by he5_swimapinfo ',status4 do 980 index1=1,30 write(*,*)' Value of index array ',idxmap(index1) write(1,*)' Value of index array ',idxmap(index1) 980 continue write(1,*)'status4= he5_swimapinfo(swid2, "GeoXtrack", 1"DataXtrack",idxmap)' write(1,*)'Value returned by he5_swimapinfo ',status4 write(1,*)'Indexed map values ',idxmap endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swinqattrs c write(1,27) write(*,*)'Testing he5_swinqattrs Global attributes ' write(*,*)'==================================== ' write(1,*)'Testing he5_swinqattrs Global attributes ' write(1,*)'==================================== ' nattr = he5_swinqattrs(swid,attrlist,strbufsz2) if (nattr .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Number of global attributes in swath ',nattr write(*,*)'Attribute list of swath ',attrlist write(1,*)'Number of global attributes in swath ',nattr write(1,*)'Attribute list of swath ',attrlist write(*,*)' ' write(1,*)' ' endif c Test Case -- he5_swattrinfo c write(1,27) write(*,*)'Testing he5_swattrinfo Global attribute' write(*,*)'=======================================' write(1,*)'Testing he5_swattrinfo Global attribute' write(1,*)'=======================================' status= he5_swattrinfo(swid, attrlist, n, size) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swattrinfo(swid,attrlist,n,size)' write(*,*)'Value returned by he5_swattrinfo ',status write(*,*)'Number type of attributes ',n,' Size ',size write(1,*)'status=he5_swattrinfo(swid,attrlist,n,size)' write(1,*)'Value returned by he5_swattrinfo ',status write(1,*)'Number type of attributes ',n,' Size ',size endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swrdattr c write(1,27) write(*,*)'Testing he5_swrdattr, Global attribute ' write(*,*)'======================================' write(1,*)'Testing he5_swrdattr, Global attribute ' write(1,*)'======================================' status= he5_swrdattr(swid, attrlist, rdattr) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swrdattr(swid,attrlist,rdattr)' write(*,*)'Value returned by he5_swrdattr ',status write(*,*)'attribute ',rdattr write(1,*)'status=he5_swrdattr(swid,attrlist,rdattr)' write(1,*)'Value returned by he5_swrdattr ',status write(1,*)'attribute ',rdattr endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swinqgattrs c write(1,27) write(*,*)'Testing he5_swinqgattrs Group attributes ' write(*,*)'==================================== ' write(1,*)'Testing he5_swinqgattrs Group attributes ' write(1,*)'==================================== ' nattr = he5_swinqgattrs(swid,attrlist,strbufsz2) if (nattr .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Number of group attributes in swath ',nattr write(*,*)'Attribute list of swath ',attrlist write(1,*)'Number of group attributes in swath ',nattr write(1,*)'Attribute list of swath ',attrlist write(*,*)' ' write(1,*)' ' endif c Test Case -- he5_swgattrinfo c write(1,27) write(*,*)'Testing he5_swgattrinfo Group attribute' write(*,*)'=======================================' write(1,*)'Testing he5_swgattrinfo Group attribute' write(1,*)'=======================================' status= he5_swgattrinfo(swid, attrlist, n, size) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swgattrinfo(swid,attrlist,n,size)' write(*,*)'Value returned by he5_swgattrinfo ',status write(*,*)'Number type of attributes ',n,' Size ',size write(1,*)'status=he5_swgattrinfo(swid,attrlist,n,size)' write(1,*)'Value returned by he5_swgattrinfo ',status write(1,*)'Number type of attributes ',n,' Size ',size endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swrdgattr c write(1,27) write(*,*)'Testing he5_swrdgattr, Group attribute ' write(*,*)'======================================' write(1,*)'Testing he5_swrdgattr, Group attribute ' write(1,*)'======================================' status= he5_swrdgattr(swid,'group',rdgnlattr) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swrdgattr(swid,attrlist,rdgnlattr)' write(*,*)'Value returned by he5_swrdgattr ',status write(*,*)'attribute ',rdgnlattr write(1,*)'status=he5_swrdgattr(swid,attrlist,rdgnlattr)' write(1,*)'Value returned by he5_swrdgattr ',status write(1,*)'attribute ',rdgnlattr endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swinqlattrs c write(1,27) write(*,*)'Testing he5_swinqlattrs Local attributes ' write(*,*)'==================================== ' write(1,*)'Testing he5_swinqlattrs Local attributes ' write(1,*)'==================================== ' nattr=he5_swinqlattrs(swid2,'Sensor1',attrlist,strbufsz2) if (nattr .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'swinqlattrs(... "Sensor1" ...)' write(*,*)'Number of local attributes in field',nattr write(*,*)'Attribute list of field ',attrlist write(1,*)'swinqlattrs(... "Sensor1" ...)' write(1,*)'Number of local attributes in field',nattr write(1,*)'Attribute list of field ',attrlist write(*,*)' ' write(1,*)' ' endif c Test Case -- he5_swlattrinfo c write(1,27) write(*,*)'Testing he5_swlattrinfo Local attribute' write(*,*)'=======================================' write(1,*)'Testing he5_swlattrinfo Local attribute' write(1,*)'=======================================' status=he5_swlattrinfo(swid2,'Sensor1','local',n,size) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'swlattrinfo(... "Sensor1" ...)' write(*,*)'Value returned by he5_swlattrinfo ',status write(*,*)'Number type of attributes ',n,' Size ',size write(1,*)'swlattrinfo(... "Sensor1" ...)' write(1,*)'Value returned by he5_swlattrinfo ',status write(1,*)'Number type of attributes ',n,' Size ',size endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swidtype c write(1,27) write(*,*)'Testing he5_swidtype, Inquire Datatype ' write(*,*)'=======================================' write(1,*)'Testing he5_swidtype, Inquire Datatype ' write(1,*)'=======================================' status= he5_swidtype(swid2,'Sensor1','local', 1HE5_HDFE_LOCATTRGROUP,dtype,classid, order, size) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swidtype(swid2,"Sensor1","local", 1HE5_HDFE_LOCATTRGROUP,dtype, classid, order, size)' write(*,*)'Value returned by he5_swidtype ',status write(*,*)'Datatype of local attribute ',dtype write(*,*)'Class id and order ',classid, order write(*,*)'Size of attribute ',size write(1,*)'status= he5_swidtype(swid2,"Sensor1","local", 1HE5_HDFE_LOCATTRGROUP,dtype, classid, order, size)' write(1,*)'Value returned by he5_swidtype ',status write(1,*)'Datatype of local attribute ',dtype write(1,*)'Class id and order ',classid, order write(1,*)'Size of attribute ',size endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swrdlattr c write(1,27) write(*,*)'Testing he5_swrdlattr, Local attribute ' write(*,*)'======================================' write(1,*)'Testing he5_swrdlattr, Local attribute ' write(1,*)'======================================' status=he5_swrdlattr(swid2,'Sensor1','local',rdgnlattr) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swrdlattr(swid2,"Sensor1","local", 1rdgnlattr)' write(*,*)'Value returned by he5_swrdlattr ',status write(*,*)'attribute ',rdgnlattr write(1,*)'status=he5_swrdlattr(swid2,"Sensor1","local", 1rdgnlattr)' write(1,*)'Value returned by he5_swrdlattr ',status write(1,*)'attribute ',rdgnlattr endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swgetfill c write(1,27) write(*,*)'Testing he5_swgetfill ' write(*,*)'=====================' write(1,*)'Testing he5_swgetfill ' write(1,*)'=====================' status= he5_swgetfill(swid,'Conduction', rdfilval) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swgetfill(swid,"Conduction",rdfilval)' write(*,*)'Value returned by he5_swgetfill ',status write(*,*)'Value of fill ',rdfilval write(1,*)'status=he5_swgetfill(swid,"Conduction",rdfilval)' write(1,*)'Value returned by he5_swgetfill ',status write(1,*)'Value of fill ',rdfilval endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swdefboxreg c write(1,27) write(*,*)'Testing he5_swdefboxreg ' write(*,*)'=======================' write(1,*)'Testing he5_swdefboxreg ' write(1,*)'=======================' regionid= he5_swdefboxreg(swid, cornerlon, cornerlat, 1HE5_HDFE_ENDPOINT) if (regionid .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'regionid= he5_swdefboxreg(swid,cornerlon, 1cornerlat, HE5_HDFE_ENDPOINT)' write(*,*)'Value returned by he5_swdefboxreg ',regionid write(1,*)'regionid= he5_swdefboxreg(swid, cornerlon, 1cornerlat, HE5_HDFE_ENDPOINT)' write(1,*)'Value returned by he5_swdefboxreg ',regionid endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swregidx c write(1,27) write(*,*)'Testing he5_swregidx ' write(*,*)'====================' write(1,*)'Testing he5_swregidx ' write(1,*)'====================' idxrange(1)=0 idxrange(2)=0 regionid3=he5_swregidx(swid,cornerlon,cornerlat, 1HE5_HDFE_ENDPOINT,geodim,idxrange) if (regionid3 .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'regionid3=he5_swregidx(swid,cornerlon, 1cornerlat,HE5_HDFE_ENDPOINT,geodim,idxrange)' write(*,*)'Region ID returned by he5_swregdex ',regionid3 write(*,*)'Geodim of region ',geodim write(*,*)'indicies of region ',idxrange(1),idxrange(2) write(1,*)'regionid3=he5_swregidx(swid, cornerlon, 1cornerlat, HE5_HDFE_ENDPOINT, geodim, idxrange)' write(1,*)'Region ID returned by he5_swregdex ',regionid3 write(1,*)'Geodim of region ',geodim write(1,*)'indicies of region ',idxrange(1),idxrange(2) endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swdupreg c write(1,27) write(*,*)'Testing he5_swdupreg ' write(*,*)'=====================' write(1,*)'Testing he5_swdupreg ' write(1,*)'=====================' regionid2= he5_swdupreg(regionid) if (regionid2 .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Duplicate region id information ' write(*,*)'Region ID returned by he5_swdupreg ',regionid2 write(1,*)'Duplicate region id information ' write(1,*)'Region ID returned by he5_swdupreg ',regionid2 write(*,*)' ' write(1,*)' ' endif c Test Case -- he5_swreginfo c write(1,27) write(*,*)'Testing he5_swreginfo ' write(*,*)'=====================' write(1,*)'Testing he5_swreginfo ' write(1,*)'=====================' status=he5_swreginfo(swid,regionid,'Temperature',nt,rank, 1dims,size) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swreginfo(swid,regionid,"Temperature", 1nt, rank, dims, size)' write(*,*)'Value returned by he5_swreginfo ',status write(*,*)'Number type of region ',nt,' Rank of region ',rank write(*,*)'Dimensions of region ',dims(1),' ',dims(2) write(*,*)'Value of size ',size write(1,*)'status=he5_swreginfo(swid,regionid,"Temperature", 1nt, rank, dims, size)' write(1,*)'Value returned by he5_swreginfo ',status write(1,*)'Number type of region ',nt,' Rank of region ',rank write(1,*)'Value of size ',size write(1,*)'Dimensions of region ',dims(1),' ',dims(2) endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swextreg c write(1,27) write(*,*)'Testing he5_swextreg ' write(*,*)'=====================' write(1,*)'Testing he5_swextreg ' write(1,*)'=====================' status=he5_swextreg(swid,regionid,'Temperature', 1HE5_HDFE_INTERNAL, tempbuf) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status = he5_swextreg(swid, regionid, 1"Temperature", HE5_HDFE_INTERNAL, tempbuf)' write(*,*)'Value returned by he5_swextreg ', status write(1,*)'status = he5_swextreg(swid, regionid, 1"Temperature", HE5_HDFE_INTERNAL,tempbuf)' write(1,*)'Value returned by he5_swextreg ', status do 210 index1=100,115 write(*,*)'region value at position ',tempbuf(index1) write(1,*)'region value at position ',tempbuf(index1) 210 continue endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swdeftmeper c write(1,27) write(*,*)'Testing he5_swdeftmeper ' write(*,*)'=====================' write(1,*)'Testing he5_swdeftmeper ' write(1,*)'=====================' regionid = he5_swdeftmeper(swid, starttime, endtime, 1HE5_HDFE_ENDPOINT) if (regionid .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'regionid= he5_swdeftmeper(swid, starttime, 1endtime, HE5_HDFE_ENDPOINT)' write(*,*)'Value returned by he5_swdeftmeper ',regionid write(1,*)'regionid= he5_swdeftmeper(swid, starttime, 1endtime, HE5_HDFE_ENDPOINT)' write(1,*)'Value returned by he5_swdeftmeper ',regionid endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swperinfo c write(1,27) write(*,*)'Testing he5_swperinfo ' write(*,*)'=====================' write(1,*)'Testing he5_swperinfo ' write(1,*)'=====================' status = he5_swperinfo(swid,regionid,'Temperature',nt,rank, 1dims,size) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status = he5_swperinfo(swid, regionid, 1"Temperature",nt, rank, dims, size)' write(*,*)'Value returned by he5_swperinfo ',status write(*,*)'Rank of field ',rank,' Number type of region ',nt write(*,*)'Dimensions of region ',dims(1),' ',dims(2) write(*,*)'Value of size ',size write(1,*)'status = he5_swperinfo(swid, regionid, 1"Temperature",nt, rank, dims, size)' write(1,*)'Value returned by he5_swperinfo ',status write(1,*)'Rank of field ',rank,' Number type of region ',nt write(1,*)'Dimensions of region ',dims(1),' ',dims(2) write(1,*)'Value of size ',size endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swextper c write(1,27) write(*,*)'Testing he5_swextper ' write(*,*)'====================' write(1,*)'Testing he5_swextper ' write(1,*)'====================' status= he5_swextper(swid,regionid,'Temperature', 1HE5_HDFE_INTERNAL,tempbuf) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swextper(swid, regionid, 1"Temperature", HE5_HDFE_INTERNAL, tempbuf)' write(*,*)'Value returned by he5_swextper swath ',status write(1,*)'status= he5_swextper(swid, regionid, 1"Temperature", HE5_HDFE_INTERNAL, tempbuf) ' write(1,*)'Value returned by he5_swextper swath ',status do 220 index1=1000,1015 write(*,*)'region value at position ',tempbuf(index1) write(1,*)'region value at position ',tempbuf(index1) 220 continue endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swupimap c write(1,27) write(*,*)'Testing he5_swupimap ' write(*,*)'=====================' write(1,*)'Testing he5_swupimap ' write(1,*)'=====================' idxsz=he5_swupimap(swid2,regionid,idxmap,upidxmap,ndxmap) if (idxsz .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Size of index array in region ',idxsz write(1,*)'Size of index array in region ',idxsz write(*,*)'Indicies of updated index ',ndxmap(1),ndxmap(2) write(1,*)'Indicies of updated index ',ndxmap(1),ndxmap(2) do 380 index1=1,idxsz write(*,*)' Value of index array ',upidxmap(index1) write(1,*)' Value of index array ',upidxmap(index1) 380 continue endif c Test Case -- he5_swcompinfo c write(1,27) write(*,*)'Testing he5_swcompinfo ' write(*,*)'=======================' write(1,*)'Testing he5_swcompinfo ' write(1,*)'=======================' status=he5_swcompinfo(swid,'CompChunk',compcode,rdcompparm) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swcompinfo(swid,"CompChunk",compcode, 1rdcompparm)' write(*,*)'Status returned by he5_swcompinfo ',status write(*,*)'Compression code ',compcode write(*,*)'Compression parameter ',rdcompparm(1) write(1,*)'status=he5_swcompinfo(swid,"CompChunk",compcode, 1rdcompparm)' write(1,*)'Status returned by he5_swcompinfo ',status write(1,*)'Compression code ',compcode write(1,*)'Compression parameter ',rdcompparm(1) endif write(*,*)' ' write(1,*)' ' status= he5_swdetach(swid) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swdetach(swid)' write(*,*)'Value returned by he5_swdetach ',status write(1,*)'status= he5_swdetach(swid)' write(1,*)'Value returned by he5_swdetach ',status endif write(*,*)' ' write(1,*)' ' status= he5_swdetach(swid2) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swdetach(swid2)' write(*,*)'Value returned by he5_swdetach ',status write(1,*)'status= he5_swdetach(swid2)' write(1,*)'Value returned by he5_swdetach ',status endif write(*,*)' ' write(1,*)' ' status= he5_swclose(swfid) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swclose(swfid)' write(*,*)'Value returned by he5_swclose ',status write(1,*)'status= he5_swclose(swfid)' write(1,*)'Value returned by he5_swclose ',status endif write(*,*)' ' write(1,*)' ' swfid=he5_swopen('swath.he5',HE5F_ACC_RDWR) if (swfid .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'swfid=he5_swopen("swath.he5",HE5F_ACC_RDWR)' write(*,*)'Value returned by he5_swopen ',swfid write(1,*)'swfid=he5_swopen("swath.he5",HE5F_ACC_RDWR)' write(1,*)'Value returned by he5_swopen ',swfid endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swinqswath c write(1,27) write(*,*)'Testing he5_swinqswath ' write(*,*)'======================' write(1,*)'Testing he5_swinqswath ' write(1,*)'======================' nswath=he5_swinqswath('swath.he5',swathlist,strbufsz2) if (nswath .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Retrieve information on swaths in 1file swath.he5' write(*,*)'Number of swaths in file ', nswath write(*,*)'List of swaths ',swathlist write(1,*)'Retrieve information on swaths in 1file swath.he5' write(1,*)'Number of swaths in file ', nswath write(1,*)'List of swaths ',swathlist endif write(*,*)' ' write(1,*)' ' status=he5_swclose(swfid) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swclose(swfid)' write(*,*)'Value returned by he5_swclose ',status write(1,*)'status= he5_swclose(swfid)' write(1,*)'Value returned by he5_swclose ',status endif write(*,*)' ' write(1,*)' ' close(unit=1) 27 format(' ') stop end hdf-eos5-2.0/testdrivers/swath/testswath64.f000077500000000000000000002463441507520047200210620ustar00rootroot00000000000000c---------------------------------------------------------------------------- c Copyright (C) 2000 Emergent IT Inc. and Raytheon Systems Company | c---------------------------------------------------------------------------- c testswath64.f | c In this program we create, define and write a simple swath hdfeos file | c using the swath interface | c---------------------------------------------------------------------------- program testswath64 implicit none include 'hdfeos5.inc' integer status integer index1 integer index2 integer swfid integer swid integer swid2 integer rank integer n, nt integer dtype integer classid integer order integer rdattr(4) integer global_attr(4) integer compparm(5) integer cnkrank integer rdcompparm(5) integer compcode integer regionid integer regionid2 integer regionid3 integer ntype(5) integer rnk(5) integer ntyped(5) integer rnkd(5) integer he5_swopen integer he5_swcreate integer he5_swattach integer he5_swdefdim integer he5_swdefgfld integer he5_swdefdfld integer he5_swdefmap integer he5_swdefchunk integer he5_swdefcomp integer he5_swsetfill integer he5_swwrattr integer he5_swdefimap integer he5_swwrlattr integer he5_swwrfld integer he5_swrdfld integer he5_swwrgattr integer he5_swrdattr integer he5_swrdgattr integer he5_swrdlattr integer he5_swdefvrtreg integer he5_swdefboxreg integer he5_swdeftmeper integer he5_swgmapinfo integer he5_swfldinfo integer he5_swcompinfo integer he5_swmapinfo integer he5_swattrinfo integer he5_swgattrinfo integer he5_swreginfo integer he5_swextreg integer he5_swregidx integer he5_swperinfo integer he5_swextper integer he5_swlattrinfo integer he5_swgetfill integer he5_swidtype integer he5_swdupreg integer he5_swdetach integer he5_swclose integer*8 he5_swupimap integer*8 he5_swinqswath integer*8 he5_swnentries integer*8 he5_swinqmaps integer*8 he5_swinqimaps integer*8 he5_swinqdims integer*8 he5_swdiminfo integer*8 he5_swimapinfo integer*8 he5_swinqattrs integer*8 he5_swinqgattrs integer*8 he5_swinqlattrs integer*8 he5_swinqgflds integer*8 he5_swinqdflds integer*8 size integer*8 strbufsize integer*8 ndims integer*8 chunkdims(1) integer*8 start(2) integer*8 stride(2) integer*8 dataedge(2) integer*8 geoedge(2) integer*8 geostart(2) integer*8 istart(2) integer*8 iedge(2) integer*8 dedge(2) integer*8 sd_start(2) integer*8 sd_stride(2) integer*8 sd_edge(2) integer*8 rd_start(2) integer*8 rd_stride(2) integer*8 rd_edge(2) integer*8 indexmap(30) integer*8 dimsize integer*8 nattr integer*8 nswath integer*8 idxsz integer*8 nmaps integer*8 tstart(1) integer*8 tstride(1) integer*8 tedge(1) integer*8 strbufsz2 integer*8 nflds integer*8 idxrange(2) integer*8 count(1) integer*8 offset integer*8 inc integer*8 status4 integer*8 zero integer*8 ndxmap(2) integer*8 dims(5) integer*8 latdims(2) integer*8 upidxmap(50) integer*8 idxmap(50) integer*8 dim1 integer*8 dim2 integer*8 dim3 integer*8 dim4 real grpattr(3) real locattr(3) real rdgnlattr(3) real ray1(100,40) real ray2(40,100) real lat(40,50) real lon(40,50) real ray4(40,100) real ray3(40,40) real temp(40,100) real idxlat(30,30) real idxlon(30,30) real latcnt real loncnt real raycnt real idxlatcnt real idxloncnt real fillvalue real rdfilval real tempbuf(4200) real*8 cornerlon(2) real*8 cornerlat(2) real*8 twodtime(40,50) real*8 onedtime(40) real*8 range(2) real*8 tmcnt real*8 starttime real*8 endtime character*(256) geodim character*(256) idxdimmap character*(256) dimmap character*(256) dimname character*(256) fieldlist character*(256) attrlist character*(256) swathlist character*(256) dimens character*(256) maxdims dim1 = 30 dim2 = 40 dim3 = 50 dim4 = 100 count(1) = 3 compparm(1) = 6 compparm(2) = 0 compparm(3) = 0 compparm(4) = 0 compparm(5) = 0 cnkrank = 1 chunkdims(1) = 10 rdcompparm(1) = 1 rdcompparm(2) = 1 rdcompparm(3) = 1 rdcompparm(4) = 1 rdcompparm(5) = 1 compcode = -1 raycnt = -799.0 tmcnt = 46353400.0d0 starttime = 46353450.0d0 endtime = 46500000.0d0 range(1) = 46353450.0d0 range(2) = 46500000.0d0 latcnt = 39.8 loncnt = 78.0 global_attr(1)= 11 global_attr(2)= 33 global_attr(3)= 66 global_attr(4)= 99 grpattr(1) = 21.7 grpattr(2) = 24.3 grpattr(3) = 26.3 locattr(3) = 21.7 locattr(2) = 24.3 locattr(1) = 26.3 start(1) = 10 start(2) = 10 tstart(1) = 0 tstride(1) = 1 tedge(1) = 40 geostart(1) = 0 geostart(2) = 0 stride(1) = 1 stride(2) = 1 sd_start(1) = 0 sd_start(2) = 0 sd_stride(1) = 1 sd_stride(2) = 1 sd_edge(1) = 100 sd_edge(2) = 40 rd_start(1) = 0 rd_start(2) = 0 rd_stride(1) = 1 rd_stride(2) = 1 rd_edge(1) = 40 rd_edge(2) = 100 dataedge(1) = 20 dataedge(2) = 50 geoedge(1) = 40 geoedge(2) = 50 idxlatcnt = 39.8 idxloncnt = 78.0 istart(1) = 0 istart(2) = 0 iedge(1) = 30 iedge(2) = 30 dedge(1) = 40 dedge(2) = 40 rank = 2 fillvalue = 16.0 cornerlon(1) = 75.0 cornerlon(2) = 78.0 cornerlat(1) = 38.0 cornerlat(2) = 39.8 indexmap(1) = 1 indexmap(2) = 2 indexmap(3) = 3 indexmap(4) = 4 indexmap(5) = 6 indexmap(6) = 7 indexmap(7) = 8 indexmap(8) = 9 indexmap(9) = 11 indexmap(10) = 12 indexmap(11) = 13 indexmap(12) = 14 indexmap(13) = 16 indexmap(14) = 17 indexmap(15) = 18 indexmap(16) = 19 indexmap(17) = 21 indexmap(18) = 22 indexmap(19) = 23 indexmap(20) = 24 indexmap(21) = 26 indexmap(22) = 27 indexmap(23) = 28 indexmap(24) = 29 indexmap(25) = 31 indexmap(26) = 32 indexmap(27) = 33 indexmap(28) = 34 indexmap(29) = 36 indexmap(30) = 37 zero = 0 c c This section of the program just fills some arrays with data that will be c used later in the program c do 110 index1=1,100 do 100 index2=1,40 ray1(index1, index2)=raycnt ray2(index2, index1)=raycnt + 1.0 ray4(index2,index1) = raycnt raycnt = raycnt +1. 100 continue 110 continue do 130 index1=1,40 do 120 index2=1,50 lat(index1, index2)=latcnt lon(index1, index2)=loncnt twodtime(index1,index2)=tmcnt loncnt=loncnt-.1 tmcnt=tmcnt+5.0 120 continue onedtime(index1)=tmcnt latcnt=latcnt-0.1 loncnt = 78.0 130 continue do 150 index1=1,30 do 140 index2=1,30 idxlat(index1, index2)=idxlatcnt idxlon(index1, index2)=idxloncnt idxloncnt=idxloncnt-.1 140 continue idxlatcnt=idxlatcnt-.1 idxloncnt=78.0 150 continue do 170 index1=1,40 do 160 index2=1,40 ray3(index1, index2)=raycnt raycnt = raycnt+1.25 160 continue 170 continue do 987 index1=1,50 idxmap(index1)=zero upidxmap(index1)=zero 987 continue 230 format('********Error unexpected**********') 240 format('***********Passed Test*********') open(unit=1, file="testswath64_f.txtout", status = "UNKNOWN") write(*,*)'Testing he5_swath FORTRAN 77 interface' write(*,*)'======================================' write(1,*)'Testing he5_swath FORTRAN 77 interface' write(1,*)'======================================' write(*,*)' ' write(1,*)' ' c Test Case -- he5_swopen c write(*,*)'Testing he5_swopen ' write(*,*)'=====================' write(1,*)'Testing he5_swopen ' write(1,*)'=====================' swfid=he5_swopen('swath.he5',HE5F_ACC_TRUNC) if (swfid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' swfid= he5_swopen("swath.he5",HE5F_ACC_TRUNC)' write(*,*)' Value returned by he5_swopen ', swfid write(1,*)' swfid= he5_swopen("swath.he5",HE5F_ACC_TRUNC)' write(1,*)' Value returned by he5_swopen ', swfid endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swcreate c write(1,27) write(*,*)'Testing he5_swcreate ' write(*,*)'=====================' write(1,*)'Testing he5_swcreate ' write(1,*)'=====================' swid=he5_swcreate(swfid,'Simplef') if (swid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'swid=he5_swcreate(swfid, "Simplef")' write(*,*)'Value returned by he5_swcreate ', swid write(1,*)'swid= he5_swcreate(swfid, "Simplef")' write(1,*)'Value returned by he5_swcreate ', swid endif write(*,*)' ' write(1,*)' ' swid2=he5_swcreate(swfid,'Indexedf') if (swid2 .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'swid2= he5_swcreate(swfid, "Indexedf")' write(*,*)'Value returned by he5_swcreate ', swid2 write(1,*)'swid2= he5_swcreate(swfid, "Indexedf")' write(1,*)'Value returned by he5_swcreate ', swid2 endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swdefdim c write(1,27) write(*,*)'Testing he5_swdefdim ' write(*,*)'=====================' write(1,*)'Testing he5_swdefdim ' write(1,*)'=====================' status=he5_swdefdim(swid,'DataTrack',dim4) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status= he5_swdefdim(swid, "DataTrack", 100)' write(*,*)' Value returned by he5_swdefdim ',status write(1,*)' status= he5_swdefdim(swid, "DataTrack", 100)' write(1,*)' Value returned by he5_swdefdim ',status endif write(*,*)' ' write(1,*)' ' status=he5_swdefdim(swid,'DataXtrack',dim2) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status= he5_swdefdim(swid, "DataXtrack", 40)' write(*,*)' Value returned by he5_swdefdim ',status write(1,*)' status= he5_swdefdim(swid, "DataXtrack", 40)' write(1,*)' Value returned by he5_swdefdim ',status endif write(*,*)' ' write(1,*)' ' status=he5_swdefdim(swid,'GeoTrack',dim3) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status= he5_swdefdim(swid, "GeoTrack", 50)' write(*,*)' Value returned by he5_swdefdim ',status write(1,*)' status= he5_swdefdim(swid, "GeoTrack", 50)' write(1,*)' Value returned by he5_swdefdim ',status endif write(*,*)' ' write(1,*)' ' status=he5_swdefdim(swid,'GeoXtrack',dim2) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status= he5_swdefdim(swid, "GeoXtrack", 40)' write(*,*)' Value returned by he5_swdefdim ',status write(1,*)' status= he5_swdefdim(swid, "GeoXtrack", 40)' write(1,*)' Value returned by he5_swdefdim ',status endif write(*,*)' ' write(1,*)' ' status=he5_swdefdim(swid2,'DataTrack',dim2) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status= he5_swdefdim(swid2, "DataTrack", 40)' write(*,*)' Value returned by he5_swdefdim ', status write(1,*)' status= he5_swdefdim(swid2, "DataTrack", 40)' write(1,*)' Value returned by he5_swdefdim ', status endif write(*,*)' ' write(1,*)' ' status=he5_swdefdim(swid2,'DataXtrack',dim2) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status= he5_swdefdim(swid2, "DataXtrack", 40)' write(*,*)' Value returned by he5_swdefdim ', status write(1,*)' status= he5_swdefdim(swid2, "DataXtrack", 40)' write(1,*)' Value returned by he5_swdefdim ', status endif write(*,*)' ' write(1,*)' ' status=he5_swdefdim(swid2,'GeoTrack',dim1) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status= he5_swdefdim(swid2, "GeoTrack", 30)' write(*,*)' Value returned by he5_swdefdim ', status write(1,*)' status= he5_swdefdim(swid2, "GeoTrack", 30)' write(1,*)' Value returned by he5_swdefdim ', status endif write(*,*)' ' write(1,*)' ' status=he5_swdefdim(swid2,'GeoXtrack',dim1) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status= he5_swdefdim(swid2, "GeoXtrack", 30)' write(*,*)' Value returned by he5_swdefdim ', status write(1,*)' status= he5_swdefdim(swid2, "GeoXtrack", 30)' write(1,*)' Value returned by he5_swdefdim ', status endif write(*,*)' ' write(1,*)' ' status=he5_swdefdim(swid2,'Timedim',dim2) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Define dimension Timedim ' write(*,*)' Value returned by he5_swdefdim ', status write(1,*)'Define dimension Timedim ' write(1,*)' Value returned by he5_swdefdim ', status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swdefgfld c write(1,27) write(*,*)'Testing he5_swdefgfld ' write(*,*)'=====================' write(1,*)'Testing he5_swdefgfld ' write(1,*)'=====================' status=he5_swdefgfld(swid,'Latitude','GeoXtrack,GeoTrack', 1' ',HE5T_NATIVE_FLOAT,0) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swdefgfld(swid,"Latitude", 1"GeoXtrack,GeoTrack"," ", HE5T_NATIVE_FLOAT, 0)' write(1,*)'status= he5_swdefgfld(swid,"Latitude", 1"GeoXtrack,GeoTrack"," ", HE5T_NATIVE_FLOAT, 0)' write(1,*)'Value returned by he5_swdefgfld ',status write(*,*)'Value returned by he5_swdefgfld ',status endif write(*,*)' ' write(1,*)' ' status=he5_swdefgfld(swid,'Longitude','GeoXtrack,GeoTrack', 1' ',HE5T_NATIVE_FLOAT, 0) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Value returned by he5_swdefgfld ',status write(1,*)'Value returned by he5_swdefgfld ',status endif write(*,*)' ' write(1,*)' ' status=he5_swdefgfld(swid2,'Latitude','GeoXtrack,GeoTrack', 1' ',HE5T_NATIVE_FLOAT, 0) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Value returned by he5_swdefgfld ', status write(1,*)'Value returned by he5_swdefgfld ', status endif write(*,*)' ' write(1,*)' ' status=he5_swdefgfld(swid2,'Longitude','GeoXtrack,GeoTrack', 1' ',HE5T_NATIVE_FLOAT, 0) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Value returned by he5_swdefgfld ', status write(1,*)'Value returned by he5_swdefgfld ', status endif write(*,*)' ' write(1,*)' ' status=he5_swdefgfld(swid2,'Time','Timedim',' ', 1HE5T_NATIVE_DOUBLE, 0) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Define field Time for swath Indexedf ' write(*,*)'Status returned from call to he5_swdefgfld ',status write(1,*)'Define field Time for swath Indexedf ' write(1,*)'Status returned from call to he5_swdefgfld ',status endif write(*,*)' ' write(1,*)' ' status=he5_swdefgfld(swid,'Time','GeoXtrack,GeoTrack', 1' ', HE5T_NATIVE_DOUBLE, 0) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swdefgfld(swid, "Time","GeoXtrack,GeoTrack", 1"",HE5T_NATIVE_DOUBLE, 0)' write(*,*)'Value returned by he5_swdefgfld ',status write(1,*)'status= he5_swdefgfld(swid, "Time","GeoXtrack,GeoTrack", 1"",HE5T_NATIVE_DOUBLE, 0)' write(1,*)'Value returned by he5_swdefgfld ',status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swdefdfld c write(1,27) write(*,*)'Testing he5_swdefdfld ' write(*,*)'=====================' write(1,*)'Testing he5_swdefdfld ' write(1,*)'=====================' status=he5_swdefdfld(swid,'SideA','DataXtrack,DataTrack', 1' ', HE5T_NATIVE_FLOAT, 0) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Define data field SideA ' write(*,*)'Value returned by he5_swdefdfld ',status write(1,*)'Define data field SideA ' write(1,*)'Value returned by he5_swdefdfld ',status write(*,*)' ' write(1,*)' ' endif c Test Case -- he5_swsetfill c write(1,27) write(*,*)'Testing he5_swsetfill ' write(*,*)'=====================' write(1,*)'Testing he5_swsetfill ' write(1,*)'=====================' status= he5_swsetfill(swid,'Temperature', 1HE5T_NATIVE_FLOAT, fillvalue) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swsetfill(swid,"Temperature", 1HE5T_NATIVE_FLOAT, fillvalue)' write(*,*)'Value returned by he5_swsetfill ',status write(1,*)'status=he5_swsetfill(swid,"Temperature", 1HE5T_NATIVE_FLOAT, fillvalue)' write(1,*)'Value returned by he5_swsetfill ',status endif write(*,*)' ' write(1,*)' ' status=he5_swdefdfld(swid,'Temperature', 1'DataXtrack,DataTrack',' ',HE5T_NATIVE_FLOAT, 0) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Define data field Temperature ' write(*,*)'Value returned by he5_swdefdfld ',status write(1,*)'Define data field Temperature ' write(1,*)'Value returned by he5_swdefdfld ',status write(*,*)' ' write(1,*)' ' endif status= he5_swsetfill(swid,'Conduction', 1HE5T_NATIVE_FLOAT,fillvalue) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swsetfill(swid,"Conduction", 1HE5T_NATIVE_FLOAT,fillvalue)' write(*,*)'Value returned by he5_swsetfill ',status write(1,*)'status=he5_swsetfill(swid,"Conduction", 1HE5T_NATIVE_FLOAT,fillvalue)' write(1,*)'Value returned by he5_swsetfill ',status endif write(*,*)' ' write(1,*)' ' status=he5_swdefdfld(swid,'Conduction', 1'DataXtrack,DataTrack',' ',HE5T_NATIVE_FLOAT,0) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swdefdfld(swid,"Conduction", 1"DataXtrack,DataTrack","",HE5T_NATIVE_FLOAT, 0)' write(*,*)'Value returned by he5_swdefdfld ',status write(1,*)'status= he5_swdefdfld(swid,"Conduction", 1"DataXtrack,DataTrack","",HE5T_NATIVE_FLOAT, 0)' write(1,*)'Value returned by he5_swdefdfld ',status endif write(*,*)' ' write(1,*)' ' status=he5_swdefdfld(swid2,'Sensor1', 1'DataXtrack,DataTrack',' ',HE5T_NATIVE_FLOAT, 0) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swdefdfld(swid2, "Sensor1", 1"DataTrack,DataXtrack","",HE5T_NATIVE_FLOAT, 0)' write(*,*)'Value returned by he5_swdefdfld ',status write(1,*)'status= he5_swdefdfld(swid2, "Sensor1", 1"DataTrack,DataXtrack","",HE5T_NATIVE_FLOAT, 0)' write(1,*)'Value returned by he5_swdefdfld ',status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swdefchunk c write(1,27) write(*,*)'Testing he5_swdefchunk' write(*,*)'======================' write(1,*)'Testing he5_swdefchunk' write(1,*)'======================' status=he5_swdefchunk(swid,cnkrank,chunkdims) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swdefchunk(swid, cnkrank, chunkdims)' write(*,*)'Value returned by he5_swdefchunk ',status write(1,*)'status= he5_swdefchunk(swid, cnkrank, chunkdims)' write(1,*)'Value returned by he5_swdefchunk ',status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swdefcomp c write(1,27) write(*,*)'Testing he5_swdefcomp' write(*,*)'=====================' write(1,*)'Testing he5_swdefcomp' write(1,*)'=====================' status=he5_swdefcomp(swid,HE5_HDFE_COMP_DEFLATE,compparm) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swdefcomp(swid,HE5_HDFE_COMP_DEFLATE, 1compparm)' write(*,*)'Value returned by he5_swdefcomp ',status write(1,*)'status= he5_swdefcomp(swid,HE5_HDFE_COMP_DEFLATE, 1compparm)' write(1,*)'Value returned by he5_swdefcomp ',status endif write(*,*)' ' write(1,*)' ' status=he5_swdefdfld(swid,'CompChunk','GeoTrack', 1' ',HE5T_NATIVE_FLOAT, 0) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Define data field CompChunk ' write(*,*)'Value returned by he5_swdefdfld ',status write(1,*)'Define data field CompChunk ' write(1,*)'Value returned by he5_swdefdfld ',status write(*,*)' ' write(1,*)' ' endif c Test Case -- he5_swdetach c write(1,27) write(*,*)'Testing he5_swdetach ' write(*,*)'=====================' write(1,*)'Testing he5_swdetach ' write(1,*)'=====================' status=he5_swdetach(swid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swdetach(swid)' write(*,*)'Value returned by he5_swdetach ',status write(1,*)'status= he5_swdetach(swid)' write(1,*)'Value returned by he5_swdetach ',status endif write(*,*)' ' write(1,*)' ' status=he5_swdetach(swid2) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swdetach(swid2)' write(*,*)'Value returned by he5_swdetach ',status write(1,*)'status= he5_swdetach(swid2)' write(1,*)'Value returned by he5_swdetach ',status endif write(*,*)' ' write(1,*)' ' swid=he5_swattach(swfid,'Simplef') if (swid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'swid= he5_swattach(swfid, "Simplef")' write(*,*)'Value returned by he5_swattach ',swid write(1,*)'swid= he5_swattach(swfid, "Simplef")' write(1,*)'Value returned by he5_swattach ',swid endif write(*,*)' ' write(1,*)' ' swid2=he5_swattach(swfid,'Indexedf') if (swid2 .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'swid2= he5_swattach(swfid, "Indexedf")' write(*,*)'Value returned by he5_swattach ',swid2 write(1,*)'swid2= he5_swattach(swfid, "Indexedf")' write(1,*)'Value returned by he5_swattach ',swid2 endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swdefmap c write(1,27) write(*,*)'Testing he5_swdefmap ' write(*,*)'=====================' write(1,*)'Testing he5_swdefmap ' write(1,*)'=====================' offset = 0 inc = 2 status=he5_swdefmap(swid,'GeoTrack','DataTrack', 1offset,inc) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swdefmap(swid,"GeoTrack", 1"DataTrack", offset, inc)' write(*,*)'Value returned by he5_swdefmap ',status write(1,*)'status= he5_swdefmap(swid,"GeoTrack", 1"DataTrack", offset, inc)' write(1,*)'Value returned by he5_swdefmap ',status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swdefimap c write(1,27) write(*,*)'Testing he5_swdefimap ' write(*,*)'=====================' write(1,*)'Testing he5_swdefimap ' write(1,*)'=====================' status=he5_swdefimap(swid2,'GeoTrack','DataTrack',indexmap) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swdefimap(swid2, "GeoTrack", 1"DataTrack",indexmap)' write(*,*)'Value returned by he5_swdefimap ',status write(1,*)'status= he5_swdefimap(swid2, "GeoTrack", 1"DataTrack",indexmap)' write(1,*)'Value returned by he5_swdefimap ',status endif write(*,*)' ' write(1,*)' ' status=he5_swdefimap(swid2,'GeoXtrack','DataXtrack', 1indexmap) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swdefimap(swid2, "GeoXtrack", 1"DataXtrack",indexmap)' write(*,*)'Value returned by he5_swdefimap ',status write(1,*)'status=he5_swdefimap(swid2, "GeoXtrack", 1"DataXtrack",indexmap)' write(1,*)'Value returned by he5_swdefimap ',status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swdetach c write(1,27) write(*,*)'Testing he5_swdetach ' write(*,*)'=====================' write(1,*)'Testing he5_swdetach ' write(1,*)'=====================' status= he5_swdetach(swid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swdetach(swid)' write(*,*)'Value returned by he5_swdetach ',status write(1,*)'status= he5_swdetach(swid)' write(1,*)'Value returned by he5_swdetach ',status endif write(*,*)' ' write(1,*)' ' status= he5_swdetach(swid2) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swdetach(swid2)' write(*,*)'Value returned by he5_swdetach ',status write(1,*)'status= he5_swdetach(swid2)' write(1,*)'Value returned by he5_swdetach ',status endif write(*,*)' ' write(1,*)' ' status= he5_swclose(swfid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swclose(swfid)' write(*,*)'Value returned by he5_swclose ',status write(1,*)'status= he5_swclose(swfid)' write(1,*)'Value returned by he5_swclose ',status endif write(*,*)' ' write(1,*)' ' swfid=he5_swopen('swath.he5',HE5F_ACC_RDWR) if (swfid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'swfid=he5_swopen("swath.he5",HE5F_ACC_RDWR)' write(*,*)'Value returned by he5_swopen ',swfid write(1,*)'swfid=he5_swopen("swath.he5",HE5F_ACC_RDWR)' write(1,*)'Value returned by he5_swopen ',swfid endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swattach c write(1,27) write(*,*)'Testing he5_swattach ' write(*,*)'=====================' write(1,*)'Testing he5_swattach ' write(1,*)'=====================' swid=he5_swattach(swfid,'Simplef') if (swid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'swid= he5_swattach(swfid, "Simplef")' write(*,*)'Value returned by he5_swattach ',swid write(1,*)'swid= he5_swattach(swfid, "Simplef")' write(1,*)'Value returned by he5_swattach ',swid endif write(*,*)' ' write(1,*)' ' swid2=he5_swattach(swfid,'Indexedf') if (swid2 .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'swid2= he5_swattach(swfid, "Indexedf")' write(*,*)'Value returned by he5_swattach ',swid2 write(1,*)'swid2= he5_swattach(swfid, "Indexedf")' write(1,*)'Value returned by he5_swattach ',swid2 endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swwrfld c write(1,27) write(*,*)'Testing he5_swwrfld ' write(*,*)'===================' write(1,*)'Testing he5_swwrfld ' write(1,*)'===================' status=he5_swwrfld(swid,'SideA',sd_start,stride, 1rd_edge, ray4) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Write data field SideA ' write(*,*)'Value returned by he5_swwrfld ',status write(1,*)'Write data field SideA ' write(1,*)'Value returned by he5_swwrfld ',status endif write(*,*)' ' write(1,*)' ' status=he5_swwrfld(swid,'Temperature',start,stride, 1dataedge, ray4) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swwrfld(swid,"Temperature",start, 1stride,dataedge, ray1)' write(*,*)'Value returned by he5_swwrfld ',status write(1,*)'status=he5_swwrfld(swid,"Temperature",start, 1stride,dataedge, ray1)' write(1,*)'Value returned by he5_swwrfld ',status endif write(*,*)' ' write(1,*)' ' status=he5_swwrfld(swid,'Conduction',start,stride, 1dataedge, ray2) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swwrfld(swid,"Conduction",start, 1stride,dataedge, ray2)' write(*,*)'Value returned by he5_swwrfld ',status write(1,*)'status=he5_swwrfld(swid,"Conduction",start, 1stride,dataedge, ray2)' write(1,*)'Value returned by he5_swwrfld ',status endif write(*,*)' ' write(1,*)' ' status=he5_swwrfld(swid,'Latitude',geostart,stride, 1geoedge,lat) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swwrfld(swid, "Latitude", geostart, 1stride, geoedge, lat)' write(*,*)'Value returned by he5_swwrfld ',status write(1,*)'status= he5_swwrfld(swid, "Latitude", geostart, 1stride, geoedge, lat)' write(1,*)'Value returned by he5_swwrfld ',status endif write(*,*)' ' write(1,*)' ' status=he5_swwrfld(swid,'Longitude',geostart,stride, 1geoedge,lon) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swwrfld(swid,"Longitude",geostart, 1stride,geoedge, lon)' write(*,*)'Value returned by he5_swwrfld ',status write(1,*)'status= he5_swwrfld(swid,"Longitude",geostart, 1stride,geoedge, lon)' write(1,*)'Value returned by he5_swwrfld ',status endif write(*,*)' ' write(1,*)' ' status=he5_swwrfld(swid,'Time',geostart,stride,geoedge, 1twodtime) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swwrfld(swid,"Time",geostart,stride, 1geoedge, twodtime)' write(*,*)'Value returned by he5_swwrfld for Time ',status write(1,*)'status= he5_swwrfld(swid, "Time", geostart, stride, 1geoedge, twodtime)' write(1,*)'Value returned by he5_swwrfld for Time ',status endif write(*,*)' ' write(1,*)' ' status=he5_swwrfld(swid2,'Latitude',istart,stride, 1iedge,idxlat) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swwrfld(swid2,"Latitude", 1istart,stride,iedge,idxlat)' write(*,*)'Value returned by he5_swwrfld ',status write(1,*)'status= he5_swwrfld(swid2,"Latitude", 1istart,stride,iedge,lat)' write(1,*)'Value returned by he5_swwrfld ',status endif write(*,*)' ' write(1,*)' ' status=he5_swwrfld(swid2,'Longitude',istart,stride, 1iedge,idxlon) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swwrfld(swid2,"Longitude", 1istart,stride,iedge,idxlon)' write(*,*)'Value returned by he5_swwrfld ',status write(1,*)'status= he5_swwrfld(swid2,"Longitude", 1istart,stride,iedge,idxlon)' write(1,*)'Value returned by he5_swwrfld ',status endif write(*,*)' ' write(1,*)' ' status=he5_swwrfld(swid2,'Time',tstart,tstride, 1tedge,onedtime) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Write field Time ' write(*,*)'Status returned by he5_swwrfld ',status write(1,*)'Write field Time ' write(1,*)'Status returned by he5_swwrfld ',status write(*,*)' ' write(1,*)' ' endif iedge(1)=40 iedge(2)=40 status=he5_swwrfld(swid2,'Sensor1',istart,stride, 1iedge,ray3) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swwrfld(swid2, "Sensor1", 1istart, stride, iedge, ray3)' write(*,*)'Value returned by he5_swwrfld ',status write(1,*)'status= he5_swwrfld(swid2, "Sensor1", 1istart, stride, iedge, ray3)' write(1,*)'Value returned by he5_swwrfld ',status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swwrlattr c write(1,27) write(*,*)'Testing he5_swwrlattr, Local Attribute ' write(*,*)'================================== ' write(1,*)'Testing he5_swwrlattr, Local Attribute ' write(1,*)'================================== ' status=he5_swwrlattr(swid2,'Sensor1','local', 1HE5T_NATIVE_FLOAT,count,locattr) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swwrlattr(swid2,"Sensor1","local", 1HE5T_NATIVE_FLOAT,count,locattr)' write(*,*)'Value returned by he5_swwrlattr ',status write(1,*)'status=he5_swwrlattr(swid2,"Sensor1", "local", 1HE5T_NATIVE_FLOAT,count,locattr)' write(1,*)'Value returned by he5_swwrlattr ',status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swwrattr c count(1) = 4 write(1,27) write(*,*)'Testing he5_swwrattr, Global Attribute ' write(*,*)'====================================== ' write(1,*)'Testing he5_swwrattr, Global Attribute ' write(1,*)'======================================= ' status=he5_swwrattr(swid,'Drift',HE5T_NATIVE_INT,count, 1global_attr) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swwrattr(swid, "Drift", 1HE5T_NATIVE_INT, count, global_attr)' write(*,*)'Value returned by he5_swwrattr ',status write(1,*)'status=he5_swwrattr(swid, "Drift", 1HE5T_NATIVE_INT, count, global_attr)' write(1,*)'Value returned by he5_swwrattr ',status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swwrgattr c count(1) = 3 write(1,27) write(*,*)'Testing he5_swwrgattr, Group Attribute ' write(*,*)'====================================== ' write(1,*)'Testing he5_swwrgattr, Group Attribute ' write(1,*)'====================================== ' status=he5_swwrgattr(swid,'group',HE5T_NATIVE_FLOAT, 1count,grpattr) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swwrgattr(swid, "group", 1HE5T_NATIVE_FLOAT,count,grpgattr)' write(*,*)'Value returned by he5_swwrgattr ',status write(1,*)'status=he5_swwrgattr(swid, "group", 1HE5T_NATIVE_FLOAT,count,grpattr)' write(1,*)'Value returned by he5_swwrgattr ',status endif write(*,*)' ' write(1,*)' ' status= he5_swdetach(swid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swdetach(swid)' write(*,*)'Value returned by he5_swdetach ',status write(1,*)'status= he5_swdetach(swid)' write(1,*)'Value returned by he5_swdetach ',status endif write(*,*)' ' write(1,*)' ' status= he5_swdetach(swid2) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swdetach(swid2)' write(*,*)'Value returned by he5_swdetach ',status write(1,*)'status= he5_swdetach(swid2)' write(1,*)'Value returned by he5_swdetach ',status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swclose c write(1,27) write(*,*)'Testing he5_swclose ' write(*,*)'===================' write(1,*)'Testing he5_swclose ' write(1,*)'===================' status= he5_swclose(swfid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Value returned by he5_swclose ',status write(1,*)'status= he5_swclose(swfid)' write(1,*)'Value returned by he5_swclose ',status endif write(*,*)' ' write(1,*)' ' swfid= he5_swopen('swath.he5',HE5F_ACC_RDWR) if (swfid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'swfid= he5_swopen("swath.he5",HE5F_ACC_RDWR)' write(*,*)'Value returned by he5_swopen ', swfid write(1,*)'swfid= he5_swopen("swath.he5",HE5F_ACC_RDWR)' write(1,*)'Value returned by he5_swopen ', swfid endif write(*,*)' ' write(1,*)' ' swid= he5_swattach(swfid,'Simplef') if (swid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'swid= he5_swattach(swfid, "Simplef")' write(*,*)'Value returned by he5_swattach ',swid write(1,*)'swid= he5_swattach(swfid, "Simplef")' write(1,*)'Value returned by he5_swattach ',swid endif write(*,*)' ' write(1,*)' ' status= he5_swdetach(swid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swdetach(swid)' write(*,*)'Value returned by he5_swdetach ',status write(1,*)'status= he5_swdetach(swid)' write(1,*)'Value returned by he5_swdetach ',status endif write(*,*)' ' write(1,*)' ' status= he5_swclose(swfid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swclose(swfid)' write(*,*)'Value returned by he5_swclose ',status write(1,*)'status= he5_swclose(swfid)' write(1,*)'Value returned by he5_swclose ',status endif write(*,*)' ' write(1,*)' ' swfid= he5_swopen('swath.he5',HE5F_ACC_RDWR) if (swfid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'swfid= he5_swopen("swath.he5",HE5F_ACC_RDWR)' write(*,*)'Value returned by he5_swopen ',swfid write(1,*)'swfid= he5_swopen("swath.he5",HE5F_ACC_RDWR)' write(1,*)'Value returned by he5_swopen ',swfid endif write(*,*)' ' write(1,*)' ' swid=he5_swattach(swfid,'Simplef') if (swid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'swid= he5_swattach(swfid, "Simplef")' write(*,*)'Value returned by he5_swattach ',swid write(1,*)'swid= he5_swattach(swfid, "Simplef")' write(1,*)'Value returned by he5_swattach ',swid endif write(*,*)' ' write(1,*)' ' swid2=he5_swattach(swfid,'Indexedf') if (swid2 .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'swid2= he5_swattach(swfid, "Indexedf")' write(*,*)'Value returned by he5_swattach ',swid2 write(1,*)'swid2= he5_swattach(swfid, "Indexedf")' write(1,*)'Value returned by he5_swattach ',swid2 endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swdefvrtreg c write(1,27) write(*,*)'Testing he5_swdefvrtreg' write(*,*)'=======================' write(1,*)'Testing he5_swdefvrtreg' write(1,*)'=======================' regionid=he5_swdefvrtreg(swid2,HE5_HDFE_NOPREVSUB,'Time',range) if (regionid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Define region id for field Time ' write(*,*)'Region id returned by he5_swdefvrtreg ', 1regionid write(1,*)'Define region id for field Time ' write(1,*)'Region id returned by he5_swdefvrtreg ', 1regionid endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swnentries c write(1,27) write(*,*)'Testing he5_swnentries ' write(*,*)'=====================' write(1,*)'Testing he5_swnentries ' write(1,*)'=====================' nmaps=he5_swnentries(swid,1,strbufsize) if (nmaps .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'nmaps= he5_swnentries(swid, 1, strbufsize)' write(*,*)'Number of dimension mappings ',nmaps write(*,*)'Size of strbufsize ',strbufsize write(1,*)'nmaps= he5_swnentries(swid, 1, strbufsize)' write(1,*)'Number of dimension mappings ',nmaps write(1,*)'Size of strbufsize ',strbufsize endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swinqmaps c write(1,27) write(*,*)'Testing he5_swinqmaps ' write(*,*)'=====================' write(1,*)'Testing he5_swinqmaps ' write(1,*)'=====================' offset = -1 inc = -1 nmaps=he5_swinqmaps(swid, dimmap, offset, inc) if (nmaps .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'nmaps=he5_swinqmaps(swid,dimmap,offset,inc)' write(*,*)'Dimension mappings ',dimmap write(*,*)'offset ',offset write(*,*)'increment ',inc write(1,*)'nmaps=he5_swinqmaps(swid,dimmap,offset,inc)' write(1,*)'Dimension mappings ',dimmap write(1,*)'offset ',offset write(1,*)'increment ',inc endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swgmapinfo c write(1,27) write(*,*)'Testing he5_swgmapinfo ' write(*,*)'======================' write(1,*)'Testing he5_swgmapinfo ' write(1,*)'======================' status = he5_swgmapinfo(swid2,'GeoTrack') if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status = he5_swgmapinfo(swid2, "GeoTrack")' write(1,*)'status = he5_swgmapinfo(swid2, "GeoTrack")' write(*,*)'Status returned by he5_swgmapinfo ',status write(1,*)'Status returned by he5_swgmapinfo ',status endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swinqimaps c write(1,27) write(*,*)'Testing he5_swinqimaps ' write(*,*)'=====================' write(1,*)'Testing he5_swinqimaps ' write(1,*)'=====================' nmaps=he5_swinqimaps(swid2, idxdimmap, ndxmap) if (nmaps .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'nmaps=he5_swinqimaps(swid2,idxdimmap,ndxmap)' write(*,*)'Number of indexed mappings ',nmaps write(*,*)'Indexed Dimension mappings ',idxdimmap write(*,*)'Index size ',ndxmap write(1,*)'nmaps=he5_swinqimaps(swid2,idxdimmap,ndxmap)' write(1,*)'Number of indexed mappings ',nmaps write(1,*)'Indexed Dimension mappings ',idxdimmap write(1,*)'Index size ',ndxmap endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swinqdims c write(1,27) write(*,*)'Testing he5_swinqdims ' write(*,*)'=====================' write(1,*)'Testing he5_swinqdims ' write(1,*)'=====================' ndims=he5_swinqdims(swid,dimname,dims) if (ndims .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'ndims= he5_swinqdims(swid, dimname, dims)' write(*,*)'Number of dimesions ',ndims write(*,*)'Names of dimensions ',dimname write(*,*)'Size of dimensions ',dims write(1,*)'ndims= he5_swinqdims(swid, dimname, dims)' write(1,*)'Number of dimesions ',ndims write(1,*)'Names of dimensions ',dimname write(1,*)'Size of dimensions ',dims endif write(*,*)' ' write(1,*)' ' ndims= he5_swinqdims(swid2, dimname, dims) if (ndims .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'ndims=he5_swinqdims(swid2,dimname,dims)' write(*,*)'Number of dimesions ',ndims write(*,*)'Names of dimensions ',dimname write(*,*)'Size of dimensions ',dims write(1,*)'ndims=he5_swinqdims(swid2,dimname,dims)' write(1,*)'Number of dimesions ',ndims write(1,*)'Names of dimensions ',dimname write(1,*)'Size of dimensions ',dims endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swinqgflds c write(1,27) write(*,*)'Testing he5_swinqgflds ' write(*,*)'======================' write(1,*)'Testing he5_swinqgflds ' write(1,*)'======================' nflds= he5_swinqgflds(swid,fieldlist,rnk,ntype) if (nflds .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'nflds=he5_swinqgflds(swid,fieldlist,rnk,ntype)' write(*,*)'Number of geolocation fields in swath ',nflds write(*,*)'Names of geolocation fields ',fieldlist write(*,*)'Rank of fields ',rnk write(*,*)'Number type of fields ',ntype write(1,*)'nflds=he5_swinqgflds(swid,fieldlist,rnk,ntype)' write(1,*)'Number of geolocation fields in swath ',nflds write(1,*)'Names of geolocation fields ',fieldlist write(1,*)'Rank of fields ',rnk write(1,*)'Number type of fields ',ntype endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swinqdflds c write(1,27) write(*,*)'Testing he5_swinqdflds ' write(*,*)'======================' write(1,*)'Testing he5_swinqdflds ' write(1,*)'======================' nflds=he5_swinqdflds(swid,fieldlist,rnkd,ntyped) if (nflds .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'nflds=he5_swinqdflds(swid,fieldlist,rnkd,ntyped)' write(*,*)'Number of data fields in swath ',nflds write(*,*)'Names of data fields ',fieldlist write(*,*)'Rank of fields ',rnkd write(*,*)'Number type of fields ',ntyped write(1,*)'nflds=he5_swinqdflds(swid,fieldlist,rnkd,ntyped)' write(1,*)'Number of data fields in swath ',nflds write(1,*)'Names of data fields ',fieldlist write(1,*)'Rank of fields ',rnkd write(1,*)'Number type of fields ',ntyped endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swdiminfo c write(1,27) write(*,*)'Testing he5_swdiminfo ' write(*,*)'=====================' write(1,*)'Testing he5_swdiminfo ' write(1,*)'=====================' dimsize= he5_swdiminfo(swid,'DataTrack') if (dimsize .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'dimsize= he5_swdiminfo(swid, "DataTrack")' write(*,*)'Size of dimension DataTrack ',dimsize write(1,*)'dimsize= he5_swdiminfo(swid, "DataTrack")' write(1,*)'Size of dimension DataTrack ',dimsize write(*,*)' ' write(1,*)' ' endif c Test Case -- he5_swrdfld c write(1,27) write(*,*)'Testing he5_swrdfld ' write(*,*)'===================' write(1,*)'Testing he5_swrdfld ' write(1,*)'===================' rd_start(1)=0 rd_start(2)=0 rd_stride(1)=1 rd_stride(2)=1 rd_edge(1)=40 rd_edge(2)=100 status= he5_swrdfld(swid,'Conduction',rd_start, 1rd_stride,rd_edge,temp) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Value returned by he5_swrdfld ',status write(*,*)'status= he5_swrdfld(swid, "Conduction", 1rd_start,rd_stride, rd_edge, temp)' write(1,*)'status= he5_swrdfld(swid, "Conduction", 1rd_start,rd_stride, rd_edge, temp)' write(1,*)'Value returned by he5_swrdfld ',status do 190 index1=10,15 do 180 index2=10,15 write(*,*)'value of conduction ',temp(index1,index2) write(1,*)'value of conduction ',temp(index1,index2) 180 continue 190 continue endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swfldinfo c write(1,27) write(*,*)'Testing he5_swfldinfo ' write(*,*)'=====================' write(1,*)'Testing he5_swfldinfo ' write(1,*)'=====================' status=he5_swfldinfo(swid,'Latitude',rank,latdims,nt, 1dimens,maxdims) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swfldinfo(swid, "Latitude", 1rank, latdims, nt, dimens, maxdims)' write(*,*)'Value returned by he5_swfldinfo ',status write(*,*)'Rank of field latitude ',rank write(*,*)'dimension list of field latitude ',dimens write(*,*)'Size of latitude dimensions ',latdims write(*,*)'number type of field latitude ',nt write(1,*)'status= he5_swfldinfo(swid, "Latitude", 1rank, latdims, nt, dimens, maxdims)' write(1,*)'Value returned by he5_swfldinfo ',status write(1,*)'Rank of field latitude ',rank write(1,*)'dimension list of field latitude ',dimens write(1,*)'Size of latitude dimensions ',latdims write(1,*)'number type of field latitude ',nt endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swmapinfo c write(1,27) write(*,*)'Testing he5_swmapinfo ' write(*,*)'=====================' write(1,*)'Testing he5_swmapinfo ' write(1,*)'=====================' status=he5_swmapinfo(swid,'GeoTrack','DataTrack',offset,inc) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swmapinfo(swid,"GeoTrack","DataTrack", 1offset,inc)' write(*,*)'Value returned by he5_swmapinfo ',status write(*,*)'Offset ',offset,' Increment ',inc write(1,*)'status=he5_swmapinfo(swid,"GeoTrack","DataTrack", 1offset,inc)' write(1,*)'Value returned by he5_swmapinfo ',status write(1,*)'Offset ',offset,' Increment ',inc endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swimapinfo c write(1,27) write(*,*)'Testing he5_swimapinfo ' write(*,*)'======================' write(1,*)'Testing he5_swimapinfo ' write(1,*)'======================' status4=he5_swimapinfo(swid2,'GeoXtrack','DataXtrack',idxmap) if (status4 .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status4= he5_swimapinfo(swid2,"GeoXtrack", 1"DataXtrack", idxmap)' write(*,*)'Value returned by he5_swimapinfo ',status4 do 980 index1=1,30 write(*,*)' Value of index array ',idxmap(index1) write(1,*)' Value of index array ',idxmap(index1) 980 continue write(1,*)'status4= he5_swimapinfo(swid2, "GeoXtrack", 1"DataXtrack",idxmap)' write(1,*)'Value returned by he5_swimapinfo ',status4 write(1,*)'Indexed map values ',idxmap endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swinqattrs c write(1,27) write(*,*)'Testing he5_swinqattrs Global attributes ' write(*,*)'==================================== ' write(1,*)'Testing he5_swinqattrs Global attributes ' write(1,*)'==================================== ' nattr = he5_swinqattrs(swid,attrlist,strbufsz2) if (nattr .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Number of global attributes in swath ',nattr write(*,*)'Attribute list of swath ',attrlist write(1,*)'Number of global attributes in swath ',nattr write(1,*)'Attribute list of swath ',attrlist write(*,*)' ' write(1,*)' ' endif c Test Case -- he5_swattrinfo c write(1,27) write(*,*)'Testing he5_swattrinfo Global attribute' write(*,*)'=======================================' write(1,*)'Testing he5_swattrinfo Global attribute' write(1,*)'=======================================' status= he5_swattrinfo(swid, attrlist, n, size) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swattrinfo(swid,attrlist,n,size)' write(*,*)'Value returned by he5_swattrinfo ',status write(*,*)'Number type of attributes ',n,' Size ',size write(1,*)'status=he5_swattrinfo(swid,attrlist,n,size)' write(1,*)'Value returned by he5_swattrinfo ',status write(1,*)'Number type of attributes ',n,' Size ',size endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swrdattr c write(1,27) write(*,*)'Testing he5_swrdattr, Global attribute ' write(*,*)'======================================' write(1,*)'Testing he5_swrdattr, Global attribute ' write(1,*)'======================================' status= he5_swrdattr(swid, attrlist, rdattr) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swrdattr(swid,attrlist,rdattr)' write(*,*)'Value returned by he5_swrdattr ',status write(*,*)'attribute ',rdattr write(1,*)'status=he5_swrdattr(swid,attrlist,rdattr)' write(1,*)'Value returned by he5_swrdattr ',status write(1,*)'attribute ',rdattr endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swinqgattrs c write(1,27) write(*,*)'Testing he5_swinqgattrs Group attributes ' write(*,*)'==================================== ' write(1,*)'Testing he5_swinqgattrs Group attributes ' write(1,*)'==================================== ' nattr = he5_swinqgattrs(swid,attrlist,strbufsz2) if (nattr .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Number of group attributes in swath ',nattr write(*,*)'Attribute list of swath ',attrlist write(1,*)'Number of group attributes in swath ',nattr write(1,*)'Attribute list of swath ',attrlist write(*,*)' ' write(1,*)' ' endif c Test Case -- he5_swgattrinfo c write(1,27) write(*,*)'Testing he5_swgattrinfo Group attribute' write(*,*)'=======================================' write(1,*)'Testing he5_swgattrinfo Group attribute' write(1,*)'=======================================' status= he5_swgattrinfo(swid, attrlist, n, size) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swgattrinfo(swid,attrlist,n,size)' write(*,*)'Value returned by he5_swgattrinfo ',status write(*,*)'Number type of attributes ',n,' Size ',size write(1,*)'status=he5_swgattrinfo(swid,attrlist,n,size)' write(1,*)'Value returned by he5_swgattrinfo ',status write(1,*)'Number type of attributes ',n,' Size ',size endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swrdgattr c write(1,27) write(*,*)'Testing he5_swrdgattr, Group attribute ' write(*,*)'======================================' write(1,*)'Testing he5_swrdgattr, Group attribute ' write(1,*)'======================================' status= he5_swrdgattr(swid,'group',rdgnlattr) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swrdgattr(swid,attrlist,rdgnlattr)' write(*,*)'Value returned by he5_swrdgattr ',status write(*,*)'attribute ',rdgnlattr write(1,*)'status=he5_swrdgattr(swid,attrlist,rdgnlattr)' write(1,*)'Value returned by he5_swrdgattr ',status write(1,*)'attribute ',rdgnlattr endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swinqlattrs c write(1,27) write(*,*)'Testing he5_swinqlattrs Local attributes ' write(*,*)'==================================== ' write(1,*)'Testing he5_swinqlattrs Local attributes ' write(1,*)'==================================== ' nattr=he5_swinqlattrs(swid2,'Sensor1',attrlist,strbufsz2) if (nattr .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'swinqlattrs(... "Sensor1" ...)' write(*,*)'Number of local attributes in field',nattr write(*,*)'Attribute list of field ',attrlist write(1,*)'swinqlattrs(... "Sensor1" ...)' write(1,*)'Number of local attributes in field',nattr write(1,*)'Attribute list of field ',attrlist write(*,*)' ' write(1,*)' ' endif c Test Case -- he5_swlattrinfo c write(1,27) write(*,*)'Testing he5_swlattrinfo Local attribute' write(*,*)'=======================================' write(1,*)'Testing he5_swlattrinfo Local attribute' write(1,*)'=======================================' status=he5_swlattrinfo(swid2,'Sensor1','local',n,size) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'swlattrinfo(... "Sensor1" ...)' write(*,*)'Value returned by he5_swlattrinfo ',status write(*,*)'Number type of attributes ',n,' Size ',size write(1,*)'swlattrinfo(... "Sensor1" ...)' write(1,*)'Value returned by he5_swlattrinfo ',status write(1,*)'Number type of attributes ',n,' Size ',size endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swidtype c write(1,27) write(*,*)'Testing he5_swidtype, Inquire Datatype ' write(*,*)'=======================================' write(1,*)'Testing he5_swidtype, Inquire Datatype ' write(1,*)'=======================================' status= he5_swidtype(swid2,'Sensor1','local', 1HE5_HDFE_LOCATTRGROUP,dtype,classid, order, size) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swidtype(swid2,"Sensor1","local", 1HE5_HDFE_LOCATTRGROUP,dtype, classid, order, size)' write(*,*)'Value returned by he5_swidtype ',status write(*,*)'Datatype of local attribute ',dtype write(*,*)'Class id and order ',classid, order write(*,*)'Size of attribute ',size write(1,*)'status= he5_swidtype(swid2,"Sensor1","local", 1HE5_HDFE_LOCATTRGROUP,dtype, classid, order, size)' write(1,*)'Value returned by he5_swidtype ',status write(1,*)'Datatype of local attribute ',dtype write(1,*)'Class id and order ',classid, order write(1,*)'Size of attribute ',size endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swrdlattr c write(1,27) write(*,*)'Testing he5_swrdlattr, Local attribute ' write(*,*)'======================================' write(1,*)'Testing he5_swrdlattr, Local attribute ' write(1,*)'======================================' status=he5_swrdlattr(swid2,'Sensor1','local',rdgnlattr) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swrdlattr(swid2,"Sensor1","local", 1rdgnlattr)' write(*,*)'Value returned by he5_swrdlattr ',status write(*,*)'attribute ',rdgnlattr write(1,*)'status=he5_swrdlattr(swid2,"Sensor1","local", 1rdgnlattr)' write(1,*)'Value returned by he5_swrdlattr ',status write(1,*)'attribute ',rdgnlattr endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swgetfill c write(1,27) write(*,*)'Testing he5_swgetfill ' write(*,*)'=====================' write(1,*)'Testing he5_swgetfill ' write(1,*)'=====================' status= he5_swgetfill(swid,'Conduction', rdfilval) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swgetfill(swid,"Conduction",rdfilval)' write(*,*)'Value returned by he5_swgetfill ',status write(*,*)'Value of fill ',rdfilval write(1,*)'status=he5_swgetfill(swid,"Conduction",rdfilval)' write(1,*)'Value returned by he5_swgetfill ',status write(1,*)'Value of fill ',rdfilval endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swdefboxreg c write(1,27) write(*,*)'Testing he5_swdefboxreg ' write(*,*)'=======================' write(1,*)'Testing he5_swdefboxreg ' write(1,*)'=======================' regionid= he5_swdefboxreg(swid, cornerlon, cornerlat, 1HE5_HDFE_ENDPOINT) if (regionid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'regionid= he5_swdefboxreg(swid,cornerlon, 1cornerlat, HE5_HDFE_ENDPOINT)' write(*,*)'Value returned by he5_swdefboxreg ',regionid write(1,*)'regionid= he5_swdefboxreg(swid, cornerlon, 1cornerlat, HE5_HDFE_ENDPOINT)' write(1,*)'Value returned by he5_swdefboxreg ',regionid endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swregidx c write(1,27) write(*,*)'Testing he5_swregidx ' write(*,*)'====================' write(1,*)'Testing he5_swregidx ' write(1,*)'====================' regionid3=he5_swregidx(swid, cornerlon, cornerlat, 1HE5_HDFE_ENDPOINT, geodim, idxrange) if (regionid3 .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'regionid3= he5_swregidx(swid, cornerlon, 1cornerlat, HE5_HDFE_ENDPOINT, geodim, idxrange)' write(*,*)'Region ID returned by he5_swregdex ',regionid3 write(*,*)'Geodim of region ',geodim write(*,*)'indicies of region ',idxrange(1),idxrange(2) write(1,*)'regionid3= he5_swregidx(swid, cornerlon, 1cornerlat, HE5_HDFE_ENDPOINT, geodim, idxrange)' write(1,*)'Region ID returned by he5_swregdex ',regionid3 write(1,*)'Geodim of region ',geodim write(1,*)'indicies of region ',idxrange(1),idxrange(2) endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swdupreg c write(1,27) write(*,*)'Testing he5_swdupreg ' write(*,*)'=====================' write(1,*)'Testing he5_swdupreg ' write(1,*)'=====================' regionid2= he5_swdupreg(regionid) if (regionid2 .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Duplicate region id information ' write(*,*)'Region ID returned by he5_swdupreg ',regionid2 write(1,*)'Duplicate region id information ' write(1,*)'Region ID returned by he5_swdupreg ',regionid2 write(*,*)' ' write(1,*)' ' endif c Test Case -- he5_swreginfo c write(1,27) write(*,*)'Testing he5_swreginfo ' write(*,*)'=====================' write(1,*)'Testing he5_swreginfo ' write(1,*)'=====================' status=he5_swreginfo(swid,regionid,'Temperature',nt,rank, 1dims,size) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swreginfo(swid,regionid,"Temperature", 1nt, rank, dims, size)' write(*,*)'Value returned by he5_swreginfo ',status write(*,*)'Number type of region ',nt,' Rank of region ',rank write(*,*)'Dimensions of region ',dims(1),' ',dims(2) write(*,*)'Value of size ',size write(1,*)'status=he5_swreginfo(swid,regionid,"Temperature", 1nt, rank, dims, size)' write(1,*)'Value returned by he5_swreginfo ',status write(1,*)'Number type of region ',nt,' Rank of region ',rank write(1,*)'Value of size ',size write(1,*)'Dimensions of region ',dims(1),' ',dims(2) endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swextreg c write(1,27) write(*,*)'Testing he5_swextreg ' write(*,*)'=====================' write(1,*)'Testing he5_swextreg ' write(1,*)'=====================' status=he5_swextreg(swid,regionid,'Temperature', 1HE5_HDFE_INTERNAL, tempbuf) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status = he5_swextreg(swid, regionid, 1"Temperature", HE5_HDFE_INTERNAL, tempbuf)' write(*,*)'Value returned by he5_swextreg ', status write(1,*)'status = he5_swextreg(swid, regionid, 1"Temperature", HE5_HDFE_INTERNAL,tempbuf)' write(1,*)'Value returned by he5_swextreg ', status do 210 index1=100,115 write(*,*)'region value at position ',tempbuf(index1) write(1,*)'region value at position ',tempbuf(index1) 210 continue endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swdeftmeper c write(1,27) write(*,*)'Testing he5_swdeftmeper ' write(*,*)'=====================' write(1,*)'Testing he5_swdeftmeper ' write(1,*)'=====================' regionid = he5_swdeftmeper(swid, starttime, endtime, 1HE5_HDFE_ENDPOINT) if (regionid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'regionid= he5_swdeftmeper(swid, starttime, 1endtime, HE5_HDFE_ENDPOINT)' write(*,*)'Value returned by he5_swdeftmeper ',regionid write(1,*)'regionid= he5_swdeftmeper(swid, starttime, 1endtime, HE5_HDFE_ENDPOINT)' write(1,*)'Value returned by he5_swdeftmeper ',regionid endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swperinfo c write(1,27) write(*,*)'Testing he5_swperinfo ' write(*,*)'=====================' write(1,*)'Testing he5_swperinfo ' write(1,*)'=====================' status = he5_swperinfo(swid,regionid,'Temperature',nt,rank, 1dims,size) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status = he5_swperinfo(swid, regionid, 1"Temperature",nt, rank, dims, size)' write(*,*)'Value returned by he5_swperinfo ',status write(*,*)'Rank of field ',rank,' Number type of region ',nt write(*,*)'Dimensions of region ',dims(1),' ',dims(2) write(*,*)'Value of size ',size write(1,*)'status = he5_swperinfo(swid, regionid, 1"Temperature",nt, rank, dims, size)' write(1,*)'Value returned by he5_swperinfo ',status write(1,*)'Rank of field ',rank,' Number type of region ',nt write(1,*)'Dimensions of region ',dims(1),' ',dims(2) write(1,*)'Value of size ',size endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swextper c write(1,27) write(*,*)'Testing he5_swextper ' write(*,*)'====================' write(1,*)'Testing he5_swextper ' write(1,*)'====================' status= he5_swextper(swid,regionid,'Temperature', 1HE5_HDFE_INTERNAL,tempbuf) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swextper(swid, regionid, 1"Temperature", HE5_HDFE_INTERNAL, tempbuf)' write(*,*)'Value returned by he5_swextper swath ',status write(1,*)'status= he5_swextper(swid, regionid, 1"Temperature", HE5_HDFE_INTERNAL, tempbuf) ' write(1,*)'Value returned by he5_swextper swath ',status do 220 index1=1000,1015 write(*,*)'region value at position ',tempbuf(index1) write(1,*)'region value at position ',tempbuf(index1) 220 continue endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swupimap c write(1,27) write(*,*)'Testing he5_swupimap ' write(*,*)'=====================' write(1,*)'Testing he5_swupimap ' write(1,*)'=====================' idxsz=he5_swupimap(swid2,regionid,idxmap,upidxmap,ndxmap) if (idxsz .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Size of index array in region ',idxsz write(1,*)'Size of index array in region ',idxsz write(*,*)'Indicies of updated index ',ndxmap(1),ndxmap(2) write(1,*)'Indicies of updated index ',ndxmap(1),ndxmap(2) do 380 index1=1,idxsz write(*,*)' Value of index array ',upidxmap(index1) write(1,*)' Value of index array ',upidxmap(index1) 380 continue endif c Test Case -- he5_swcompinfo c write(1,27) write(*,*)'Testing he5_swcompinfo ' write(*,*)'=======================' write(1,*)'Testing he5_swcompinfo ' write(1,*)'=======================' status=he5_swcompinfo(swid,'CompChunk',compcode,rdcompparm) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_swcompinfo(swid,"CompChunk",compcode, 1rdcompparm)' write(*,*)'Status returned by he5_swcompinfo ',status write(*,*)'Compression code ',compcode write(*,*)'Compression parameter ',rdcompparm(1) write(1,*)'status=he5_swcompinfo(swid,"CompChunk",compcode, 1rdcompparm)' write(1,*)'Status returned by he5_swcompinfo ',status write(1,*)'Compression code ',compcode write(1,*)'Compression parameter ',rdcompparm(1) endif write(*,*)' ' write(1,*)' ' status= he5_swdetach(swid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swdetach(swid)' write(*,*)'Value returned by he5_swdetach ',status write(1,*)'status= he5_swdetach(swid)' write(1,*)'Value returned by he5_swdetach ',status endif write(*,*)' ' write(1,*)' ' status= he5_swdetach(swid2) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swdetach(swid2)' write(*,*)'Value returned by he5_swdetach ',status write(1,*)'status= he5_swdetach(swid2)' write(1,*)'Value returned by he5_swdetach ',status endif write(*,*)' ' write(1,*)' ' status= he5_swclose(swfid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swclose(swfid)' write(*,*)'Value returned by he5_swclose ',status write(1,*)'status= he5_swclose(swfid)' write(1,*)'Value returned by he5_swclose ',status endif write(*,*)' ' write(1,*)' ' swfid= he5_swopen('swath.he5',HE5F_ACC_RDWR) if (swfid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'swfid= he5_swopen("swath.he5",HE5F_ACC_RDWR)' write(*,*)'Value returned by he5_swopen ',swfid write(1,*)'swfid= he5_swopen("swath.he5",HE5F_ACC_RDWR)' write(1,*)'Value returned by he5_swopen ',swfid endif write(*,*)' ' write(1,*)' ' c Test Case -- he5_swinqswath c write(1,27) write(*,*)'Testing he5_swinqswath ' write(*,*)'======================' write(1,*)'Testing he5_swinqswath ' write(1,*)'======================' nswath=he5_swinqswath('swath.he5',swathlist,strbufsz2) if (nswath .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Retrieve information on swaths in 1file swath.he5' write(*,*)'Number of swaths in file ', nswath write(*,*)'List of swaths ',swathlist write(1,*)'Retrieve information on swaths in 1file swath.he5' write(1,*)'Number of swaths in file ', nswath write(1,*)'List of swaths ',swathlist endif write(*,*)' ' write(1,*)' ' status= he5_swclose(swfid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_swclose(swfid)' write(*,*)'Value returned by he5_swclose ',status write(1,*)'status= he5_swclose(swfid)' write(1,*)'Value returned by he5_swclose ',status endif write(*,*)' ' write(1,*)' ' close(unit=1) 27 format(' ') stop end hdf-eos5-2.0/testdrivers/threads/000077500000000000000000000000001507520047200167775ustar00rootroot00000000000000hdf-eos5-2.0/testdrivers/threads/Makefile.am000066400000000000000000000012371507520047200210360ustar00rootroot00000000000000# testdrivers/threads Makefile.am # Boilerplate definitions include $(top_srcdir)/config/include.am # Link against HDF-EOS5, libGCTP, and the pthread library. ## This directory shouldn't be built unless configure detects that the ## pthread library is present. AM_CPPFLAGS=-I$(top_srcdir)/include LDADD=$(LIBHDFEOS5) $(LIBGCTP) pthread # Programs to build when user types 'make check'. # Each of these is build from a single *.c file. check_PROGRAMS = he5_gd_threads-1 he5_gd_threads-2 he5_pt_threads-1 \ he5_pt_threads-2 he5_sw_threads-1 he5_sw_threads-2 # Run all programs above as tests when the user types 'make check' TESTS = $(check_PROGRAMS) hdf-eos5-2.0/testdrivers/threads/Makefile.in000066400000000000000000001070551507520047200210540ustar00rootroot00000000000000# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # testdrivers/threads Makefile.am VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(top_srcdir)/config/include.am $(srcdir)/Makefile.in \ $(srcdir)/Makefile.am $(top_srcdir)/config/depcomp \ $(top_srcdir)/config/test-driver check_PROGRAMS = he5_gd_threads-1$(EXEEXT) he5_gd_threads-2$(EXEEXT) \ he5_pt_threads-1$(EXEEXT) he5_pt_threads-2$(EXEEXT) \ he5_sw_threads-1$(EXEEXT) he5_sw_threads-2$(EXEEXT) subdir = testdrivers/threads ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/stdlib.m4 $(top_srcdir)/m4/stdinc.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/HE5_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = he5_gd_threads_1_SOURCES = he5_gd_threads-1.c he5_gd_threads_1_OBJECTS = he5_gd_threads-1.$(OBJEXT) he5_gd_threads_1_LDADD = $(LDADD) he5_gd_threads_1_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) pthread AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = he5_gd_threads_2_SOURCES = he5_gd_threads-2.c he5_gd_threads_2_OBJECTS = he5_gd_threads-2.$(OBJEXT) he5_gd_threads_2_LDADD = $(LDADD) he5_gd_threads_2_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) pthread he5_pt_threads_1_SOURCES = he5_pt_threads-1.c he5_pt_threads_1_OBJECTS = he5_pt_threads-1.$(OBJEXT) he5_pt_threads_1_LDADD = $(LDADD) he5_pt_threads_1_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) pthread he5_pt_threads_2_SOURCES = he5_pt_threads-2.c he5_pt_threads_2_OBJECTS = he5_pt_threads-2.$(OBJEXT) he5_pt_threads_2_LDADD = $(LDADD) he5_pt_threads_2_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) pthread he5_sw_threads_1_SOURCES = he5_sw_threads-1.c he5_sw_threads_1_OBJECTS = he5_sw_threads-1.$(OBJEXT) he5_sw_threads_1_LDADD = $(LDADD) he5_sw_threads_1_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) pthread he5_sw_threads_2_SOURCES = he5_sw_threads-2.c he5_sw_threads_2_OBJECTS = he5_sw_threads-2.$(OBJEXT) he5_sw_threads_2_LDADD = $(LDADD) he5_sw_threads_2_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) pthread AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = he5_gd_threads-1.c he5_gd_threads-2.c he5_pt_threads-1.c \ he5_pt_threads-2.c he5_sw_threads-1.c he5_sw_threads-2.c DIST_SOURCES = he5_gd_threads-1.c he5_gd_threads-2.c \ he5_pt_threads-1.c he5_pt_threads-2.c he5_sw_threads-1.c \ he5_sw_threads-2.c am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no am__tty_colors = { \ $(am__tty_colors_dummy); \ if test "X$(AM_COLOR_TESTS)" = Xno; then \ am__color_tests=no; \ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ am__color_tests=yes; \ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ am__color_tests=yes; \ fi; \ if test $$am__color_tests = yes; then \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ mgn=''; \ brg=''; \ std=''; \ fi; \ } am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__recheck_rx = ^[ ]*:recheck:[ ]* am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* # A command that, given a newline-separated list of test names on the # standard input, print the name of the tests that are to be re-run # upon "make recheck". am__list_recheck_tests = $(AWK) '{ \ recheck = 1; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ { \ if ((getline line2 < ($$0 ".log")) < 0) \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ { \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ { \ break; \ } \ }; \ if (recheck) \ print $$0; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # A command that, given a newline-separated list of test names on the # standard input, create the global log from their .trs and .log files. am__create_global_log = $(AWK) ' \ function fatal(msg) \ { \ print "fatal: making $@: " msg | "cat >&2"; \ exit 1; \ } \ function rst_section(header) \ { \ print header; \ len = length(header); \ for (i = 1; i <= len; i = i + 1) \ printf "="; \ printf "\n\n"; \ } \ { \ copy_in_global_log = 1; \ global_test_result = "RUN"; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".trs"); \ if (line ~ /$(am__global_test_result_rx)/) \ { \ sub("$(am__global_test_result_rx)", "", line); \ sub("[ ]*$$", "", line); \ global_test_result = line; \ } \ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ copy_in_global_log = 0; \ }; \ if (copy_in_global_log) \ { \ rst_section(global_test_result ": " $$0); \ while ((rc = (getline line < ($$0 ".log"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".log"); \ print line; \ }; \ printf "\n"; \ }; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # Restructured Text title. am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } # Solaris 10 'make', and several other traditional 'make' implementations, # pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it # by disabling -e (using the XSI extension "set +e") if it's set. am__sh_e_setup = case $$- in *e*) set +e;; esac # Default flags passed to test drivers. am__common_driver_flags = \ --color-tests "$$am__color_tests" \ --enable-hard-errors "$$am__enable_hard_errors" \ --expect-failure "$$am__expect_failure" # To be inserted before the command running the test. Creates the # directory for the log if needed. Stores in $dir the directory # containing $f, in $tst the test, in $log the log. Executes the # developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and # passes TESTS_ENVIRONMENT. Set up options for the wrapper that # will run the test scripts (or their associated LOG_COMPILER, if # thy have one). am__check_pre = \ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ $(am__tty_colors); \ srcdir=$(srcdir); export srcdir; \ case "$@" in \ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ *) am__odir=.;; \ esac; \ test "x$$am__odir" = x"." || test -d "$$am__odir" \ || $(MKDIR_P) "$$am__odir" || exit $$?; \ if test -f "./$$f"; then dir=./; \ elif test -f "$$f"; then dir=; \ else dir="$(srcdir)/"; fi; \ tst=$$dir$$f; log='$@'; \ if test -n '$(DISABLE_HARD_ERRORS)'; then \ am__enable_hard_errors=no; \ else \ am__enable_hard_errors=yes; \ fi; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ am__expect_failure=yes;; \ *) \ am__expect_failure=no;; \ esac; \ $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) # A shell command to get the names of the tests scripts with any registered # extension removed (i.e., equivalently, the names of the test logs, with # the '.log' extension removed). The result is saved in the shell variable # '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, # we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", # since that might cause problem with VPATH rewrites for suffix-less tests. # See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck TEST_SUITE_LOG = test-suite.log TEST_EXTENSIONS = @EXEEXT@ .test LOG_DRIVER = $(SHELL) $(top_srcdir)/config/test-driver LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) am__set_b = \ case '$@' in \ */*) \ case '$*' in \ */*) b='$*';; \ *) b=`echo '$@' | sed 's/\.log$$//'`; \ esac;; \ *) \ b='$*';; \ esac am__test_logs1 = $(TESTS:=.log) am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) TEST_LOGS = $(am__test_logs2:.test.log=.log) TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/config/test-driver TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ $(TEST_LOG_FLAGS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FC = @FC@ FCFLAGS = @FCFLAGS@ FFLAGS = @FFLAGS@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ ac_ct_FC = @ac_ct_FC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ LIBHDFEOS5 = $(top_builddir)/src/libhe5_hdfeos.la LIBGCTP = $(top_builddir)/gctp/src/libGctp.la # Boilerplate definitions # Link against HDF-EOS5, libGCTP, and the pthread library. AM_CPPFLAGS = -I$(top_srcdir)/include LDADD = $(LIBHDFEOS5) $(LIBGCTP) pthread # Run all programs above as tests when the user types 'make check' TESTS = $(check_PROGRAMS) all: all-am .SUFFIXES: .SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/include.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign testdrivers/threads/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign testdrivers/threads/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/config/include.am: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list he5_gd_threads-1$(EXEEXT): $(he5_gd_threads_1_OBJECTS) $(he5_gd_threads_1_DEPENDENCIES) $(EXTRA_he5_gd_threads_1_DEPENDENCIES) @rm -f he5_gd_threads-1$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_gd_threads_1_OBJECTS) $(he5_gd_threads_1_LDADD) $(LIBS) he5_gd_threads-2$(EXEEXT): $(he5_gd_threads_2_OBJECTS) $(he5_gd_threads_2_DEPENDENCIES) $(EXTRA_he5_gd_threads_2_DEPENDENCIES) @rm -f he5_gd_threads-2$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_gd_threads_2_OBJECTS) $(he5_gd_threads_2_LDADD) $(LIBS) he5_pt_threads-1$(EXEEXT): $(he5_pt_threads_1_OBJECTS) $(he5_pt_threads_1_DEPENDENCIES) $(EXTRA_he5_pt_threads_1_DEPENDENCIES) @rm -f he5_pt_threads-1$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_pt_threads_1_OBJECTS) $(he5_pt_threads_1_LDADD) $(LIBS) he5_pt_threads-2$(EXEEXT): $(he5_pt_threads_2_OBJECTS) $(he5_pt_threads_2_DEPENDENCIES) $(EXTRA_he5_pt_threads_2_DEPENDENCIES) @rm -f he5_pt_threads-2$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_pt_threads_2_OBJECTS) $(he5_pt_threads_2_LDADD) $(LIBS) he5_sw_threads-1$(EXEEXT): $(he5_sw_threads_1_OBJECTS) $(he5_sw_threads_1_DEPENDENCIES) $(EXTRA_he5_sw_threads_1_DEPENDENCIES) @rm -f he5_sw_threads-1$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_sw_threads_1_OBJECTS) $(he5_sw_threads_1_LDADD) $(LIBS) he5_sw_threads-2$(EXEEXT): $(he5_sw_threads_2_OBJECTS) $(he5_sw_threads_2_DEPENDENCIES) $(EXTRA_he5_sw_threads_2_DEPENDENCIES) @rm -f he5_sw_threads-2$(EXEEXT) $(AM_V_CCLD)$(LINK) $(he5_sw_threads_2_OBJECTS) $(he5_sw_threads_2_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_gd_threads-1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_gd_threads-2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_pt_threads-1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_pt_threads-2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_sw_threads-1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/he5_sw_threads-2.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags # Recover from deleted '.trs' file; this should ensure that # "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create # both 'foo.log' and 'foo.trs'. Break the recipe in two subshells # to avoid problems with "make -n". .log.trs: rm -f $< $@ $(MAKE) $(AM_MAKEFLAGS) $< # Leading 'am--fnord' is there to ensure the list of targets does not # expand to empty, as could happen e.g. with make check TESTS=''. am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) am--force-recheck: @: $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__set_TESTS_bases); \ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ redo_bases=`for i in $$bases; do \ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ done`; \ if test -n "$$redo_bases"; then \ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ if $(am__make_dryrun); then :; else \ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ fi; \ fi; \ if test -n "$$am__remaking_logs"; then \ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ "recursion detected" >&2; \ else \ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ fi; \ if $(am__make_dryrun); then :; else \ st=0; \ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ for i in $$redo_bases; do \ test -f $$i.trs && test -r $$i.trs \ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ test -f $$i.log && test -r $$i.log \ || { echo "$$errmsg $$i.log" >&2; st=1; }; \ done; \ test $$st -eq 0 || exit 1; \ fi @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ ws='[ ]'; \ results=`for b in $$bases; do echo $$b.trs; done`; \ test -n "$$results" || results=/dev/null; \ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ if test `expr $$fail + $$xpass + $$error` -eq 0; then \ success=true; \ else \ success=false; \ fi; \ br='==================='; br=$$br$$br$$br$$br; \ result_count () \ { \ if test x"$$1" = x"--maybe-color"; then \ maybe_colorize=yes; \ elif test x"$$1" = x"--no-color"; then \ maybe_colorize=no; \ else \ echo "$@: invalid 'result_count' usage" >&2; exit 4; \ fi; \ shift; \ desc=$$1 count=$$2; \ if test $$maybe_colorize = yes && test $$count -gt 0; then \ color_start=$$3 color_end=$$std; \ else \ color_start= color_end=; \ fi; \ echo "$${color_start}# $$desc $$count$${color_end}"; \ }; \ create_testsuite_report () \ { \ result_count $$1 "TOTAL:" $$all "$$brg"; \ result_count $$1 "PASS: " $$pass "$$grn"; \ result_count $$1 "SKIP: " $$skip "$$blu"; \ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ result_count $$1 "FAIL: " $$fail "$$red"; \ result_count $$1 "XPASS:" $$xpass "$$red"; \ result_count $$1 "ERROR:" $$error "$$mgn"; \ }; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ create_testsuite_report --no-color; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ for b in $$bases; do echo $$b; done \ | $(am__create_global_log); \ } >$(TEST_SUITE_LOG).tmp || exit 1; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ if $$success; then \ col="$$grn"; \ else \ col="$$red"; \ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ if $$success; then :; else \ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ if test -n "$(PACKAGE_BUGREPORT)"; then \ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ fi; \ echo "$$col$$br$$std"; \ fi; \ $$success || exit 1 check-TESTS: @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ log_list=`for i in $$bases; do echo $$i.log; done`; \ trs_list=`for i in $$bases; do echo $$i.trs; done`; \ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ exit $$?; recheck: all $(check_PROGRAMS) @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ bases=`for i in $$bases; do echo $$i; done \ | $(am__list_recheck_tests)` || exit 1; \ log_list=`for i in $$bases; do echo $$i.log; done`; \ log_list=`echo $$log_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ am__force_recheck=am--force-recheck \ TEST_LOGS="$$log_list"; \ exit $$? he5_gd_threads-1.log: he5_gd_threads-1$(EXEEXT) @p='he5_gd_threads-1$(EXEEXT)'; \ b='he5_gd_threads-1'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) he5_gd_threads-2.log: he5_gd_threads-2$(EXEEXT) @p='he5_gd_threads-2$(EXEEXT)'; \ b='he5_gd_threads-2'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) he5_pt_threads-1.log: he5_pt_threads-1$(EXEEXT) @p='he5_pt_threads-1$(EXEEXT)'; \ b='he5_pt_threads-1'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) he5_pt_threads-2.log: he5_pt_threads-2$(EXEEXT) @p='he5_pt_threads-2$(EXEEXT)'; \ b='he5_pt_threads-2'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) he5_sw_threads-1.log: he5_sw_threads-1$(EXEEXT) @p='he5_sw_threads-1$(EXEEXT)'; \ b='he5_sw_threads-1'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) he5_sw_threads-2.log: he5_sw_threads-2$(EXEEXT) @p='he5_sw_threads-2$(EXEEXT)'; \ b='he5_sw_threads-2'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) .test.log: @p='$<'; \ $(am__set_b); \ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) @am__EXEEXT_TRUE@.test$(EXEEXT).log: @am__EXEEXT_TRUE@ @p='$<'; \ @am__EXEEXT_TRUE@ $(am__set_b); \ @am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \ clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \ ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ recheck tags tags-am uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: hdf-eos5-2.0/testdrivers/threads/he5_gd_threads-1.c000077500000000000000000000126411507520047200221550ustar00rootroot00000000000000/* ********************************************************* * FILE: he5_gd_threads-1.c * * PURPOSE: To test thread-safe version of * * HDF-EOS5 Grid library * * Author: A. Muslimov, Emergent IT Inc. * * Date: Sep, 2001 * * Updated: Nov, 2001 * ********************************************************* */ #include #define NUM_THREADS 30 typedef struct ThreadInfo_tag { int threadNum; hid_t fid; hid_t gdid; char gridName[81]; int zonecode; int projcode; int spherecode; long xdim; long ydim; double uplft[2]; double lowrgt[2]; double projparm[16]; } ThreadInfo_t; void *HE5_GridTest(void *arg); int main() { herr_t ret = SUCCEED; hid_t fid = FAIL; int loopCount; int status = FAIL; ThreadInfo_t threadInfo[NUM_THREADS]; pthread_t threadArray[NUM_THREADS]; pthread_attr_t threadAttr; /* Open HDF-EOS Grid file */ /* ---------------------- */ fid = HE5_GDopen("grid.h5",H5F_ACC_TRUNC); if (fid == FAIL) { printf( "*ERROR: unable to open \"grid.h5\" file. \n"); return (FAIL); } /* Execute the loop to the NUM_THREADS times */ /* to assign one function to each thread afterwards */ /* ------------------------------------------------ */ for (loopCount = 0; loopCount < NUM_THREADS; loopCount++) { threadInfo[loopCount].threadNum = loopCount+1; threadInfo[loopCount].fid = fid; threadInfo[loopCount].gdid = FAIL; sprintf(threadInfo[loopCount].gridName,"UTMGrid_%d",loopCount); threadInfo[loopCount].zonecode = 40; threadInfo[loopCount].spherecode = 0; threadInfo[loopCount].uplft[0] = 210584.50041; threadInfo[loopCount].uplft[1] = 3322395.95445; threadInfo[loopCount].lowrgt[0] = 813931.10959; threadInfo[loopCount].lowrgt[1] = 2214162.53278; threadInfo[loopCount].xdim = 120; threadInfo[loopCount].ydim = 200; sleep(1); pthread_attr_init(&threadAttr); pthread_attr_setscope(&threadAttr,PTHREAD_SCOPE_SYSTEM); status = pthread_create(&threadArray[loopCount],&threadAttr,HE5_GridTest,&threadInfo[loopCount]); if (status != 0) { printf("\nERROR: problem starting thread %d, error val: %d\n",loopCount,status); ret = FAIL; } pthread_join(threadArray[loopCount],NULL); } ret = HE5_GDclose(fid); if (ret == FAIL) { printf( "*ERROR: unable to close file. \n"); return (FAIL); } printf( "... successfully created %d grids within \"grid.h5\" file. \n",loopCount); return(ret); } void *HE5_GridTest(void *arg) { herr_t status = FAIL; int i; float *veg; float *veg_out; hssize_t start[3]; hsize_t edge[3]; ThreadInfo_t *tag = (ThreadInfo_t *) arg; veg = (float *)calloc(24000,sizeof(float)); if (veg == NULL) { printf( "*ERROR: unable to allocate memory. \n"); return (void *)NULL; } for (i = 0; i < 24000; i++) veg[i] = (float)i; tag->gdid = HE5_GDcreate(tag->fid,tag->gridName,tag->xdim,tag->ydim,tag->uplft,tag->lowrgt); if (tag->gdid == FAIL) { printf( "*ERROR: unable to create %s grid. \n",tag->gridName); return (void *)NULL; } status = HE5_GDdefproj(tag->gdid, HE5_GCTP_UTM, tag->zonecode, tag->spherecode, tag->projparm); if (status == FAIL) { printf( "*ERROR calling HE5_GDdefproj(). \n"); return (void *)NULL; } status = HE5_GDdefdim(tag->gdid, "Time", 10); if (status == FAIL) { printf( "*ERROR calling HE5_GDdefdim(). \n"); return (void *)NULL; } status = HE5_GDdefdim(tag->gdid, "Unlim", H5S_UNLIMITED); if (status == FAIL) { printf( "*ERROR calling HE5_GDdefdim(). \n"); return (void *)NULL; } status = HE5_GDdeffield(tag->gdid, "Vegetation", "YDim,XDim", NULL, H5T_NATIVE_FLOAT, 0); if (status == FAIL) { printf( "*ERROR calling HE5_GDdeffield(\"Vegetation\"). \n"); return (void *)NULL; } start[0] = 0; start[1] = 0; edge[0] = 200; edge[1] = 120; status = HE5_GDwritefield(tag->gdid, "Vegetation", start, NULL, edge, veg); if (status == FAIL) { printf( "*ERROR calling HE5_GDwritefield(\"Vegetation\"). \n"); return (void *)NULL; } free(veg); status = HE5_GDdetach(tag->gdid); if (status == FAIL) { printf( "*ERROR: unable to detach from %s grid. \n",tag->gridName); return (void *)NULL; } tag->gdid = HE5_GDattach(tag->fid,tag->gridName); if (tag->gdid == FAIL) { printf( "*ERROR: unable to attach to %s grid. \n",tag->gridName); return (void *)NULL; } veg_out = (float *)calloc(24000,sizeof(float)); if (veg_out == NULL) { printf( "*ERROR: unable to allocate memory. \n"); return (void *)NULL; } start[0] = 0; start[1] = 0; edge[0] = 200; edge[1] = 100; status = HE5_GDreadfield(tag->gdid,"Vegetation",start,NULL,edge,veg_out); if (status == FAIL) { printf( "*ERROR calling HE5_GDreadfield(\"Vegetation\"). \n"); return (void *)NULL; } free(veg_out); status = HE5_GDdetach(tag->gdid); if (status == FAIL) { printf( "*ERROR: unable to detach from %s grid. \n",tag->gridName); return (void *)NULL; } return 0; } hdf-eos5-2.0/testdrivers/threads/he5_gd_threads-2.c000077500000000000000000000101241507520047200221500ustar00rootroot00000000000000/* ********************************************************* * FILE: he5_gd_threads-2.c * * PURPOSE: To test thread-safe version of * * HDF-EOS5 Grid library * * Author: A. Muslimov, Emergent IT Inc. * * Date: Sep, 2001 * * Updated: Nov, 2001 * ********************************************************* */ #include #define NUM_THREADS 30 typedef struct ThreadInfo_tag { int threadNum; hid_t fid; hid_t gdid; char gridName[81]; } ThreadInfo_t; void *HE5_GridTest(void *arg); int main() { herr_t ret = SUCCEED; hid_t fid = FAIL; int loopCount; int status = FAIL; ThreadInfo_t threadInfo[NUM_THREADS]; pthread_t threadArray[NUM_THREADS]; pthread_attr_t threadAttr; /* Open HDF-EOS Grid file */ /* ---------------------- */ fid = HE5_GDopen("grid.h5",H5F_ACC_RDWR); if (fid == FAIL) { printf( "*ERROR: unable to open \"grid.h5\" file. \n"); return (FAIL); } /* Execute the loop to the NUM_THREADS times */ /* to assign one function to each thread afterwards */ /* ------------------------------------------------ */ for (loopCount = 0; loopCount < NUM_THREADS; loopCount++) { threadInfo[loopCount].threadNum = loopCount+1; threadInfo[loopCount].fid = fid; threadInfo[loopCount].gdid = FAIL; sprintf(threadInfo[loopCount].gridName,"UTMGrid_%d",loopCount); sleep(1); pthread_attr_init(&threadAttr); pthread_attr_setscope(&threadAttr,PTHREAD_SCOPE_SYSTEM); status = pthread_create(&threadArray[loopCount],&threadAttr,HE5_GridTest,&threadInfo[loopCount]); if (status != 0) { printf("\nERROR: problem starting thread %d, error val: %d\n",loopCount,status); ret = FAIL; } pthread_join(threadArray[loopCount],NULL); } ret = HE5_GDclose(fid); if (ret == FAIL) { printf( "*ERROR: unable to close file. \n"); return (FAIL); } return(ret); } void *HE5_GridTest(void *arg) { herr_t status = FAIL; int i; float *veg; float *veg_out; hssize_t start[3]; hsize_t edge[3]; ThreadInfo_t *tag = (ThreadInfo_t *) arg; veg = (float *)calloc(24000,sizeof(float)); if (veg == NULL) { printf( "*ERROR: unable to allocate memory. \n"); return (void *)NULL; } for (i = 0; i < 24000; i++) veg[i] = (float)i; printf(" \n"); printf("Starting thread %d\n",tag->threadNum); printf(" \n"); tag->gdid = HE5_GDattach(tag->fid,tag->gridName); if (tag->gdid == FAIL) { printf( "*ERROR: unable to attach to %s grid. \n",tag->gridName); return (void *)NULL; } start[0] = 0; start[1] = 0; edge[0] = 200; edge[1] = 120; status = HE5_GDwritefield(tag->gdid, "Vegetation", start, NULL, edge, veg); if (status == FAIL) { printf( "*ERROR calling HE5_GDwritefield(\"Vegetation\"). \n"); return (void *)NULL; } free(veg); status = HE5_GDdetach(tag->gdid); if (status == FAIL) { printf( "*ERROR: unable to detach from %s grid. \n",tag->gridName); return (void *)NULL; } tag->gdid = HE5_GDattach(tag->fid,tag->gridName); if (tag->gdid == FAIL) { printf( "*ERROR: unable to attach to %s grid. \n",tag->gridName); return (void *)NULL; } veg_out = (float *)calloc(24000,sizeof(float)); if (veg_out == NULL) { printf( "*ERROR: unable to allocate memory. \n"); return (void *)NULL; } start[0] = 0; start[1] = 0; edge[0] = 200; edge[1] = 100; status = HE5_GDreadfield(tag->gdid,"Vegetation",start,NULL,edge,veg_out); if (status == FAIL) { printf( "*ERROR calling HE5_GDreadfield(\"Vegetation\"). \n"); return (void *)NULL; } free(veg_out); status = HE5_GDdetach(tag->gdid); if (status == FAIL) { printf( "*ERROR: unable to detach from %s grid. \n",tag->gridName); return (void *)NULL; } return 0; } hdf-eos5-2.0/testdrivers/threads/he5_pt_threads-1.c000077500000000000000000000124051507520047200222040ustar00rootroot00000000000000/* ********************************************************* * FILE: he5_pt_threads-1.c * * PURPOSE: To test thread-safe version of * * HDF-EOS5 Point library * * Author: A. Muslimov, Emergent IT Inc. * * Date: Sep, 2001 * * Updated: Nov, 2001 * ********************************************************* */ #include #define NUM_THREADS 30 typedef struct ThreadInfo_tag { int threadNum; hid_t fid; hid_t ptid; char pointName[81]; } ThreadInfo_t; void *HE5_PointTest(void *arg); int main() { herr_t ret = SUCCEED; hid_t fid = FAIL; int loopCount; int status = FAIL; ThreadInfo_t threadInfo[NUM_THREADS]; pthread_t threadArray[NUM_THREADS]; pthread_attr_t threadAttr; /* Open HDF-EOS Point file */ /* ----------------------- */ fid = HE5_PTopen("point.h5",H5F_ACC_TRUNC); if (fid == FAIL) { printf( "*ERROR: unable to open \"point.h5\" file. \n"); return (FAIL); } /* Execute the loop to the NUM_THREADS times */ /* to assign one function to each thread afterwards */ /* ------------------------------------------------ */ for (loopCount = 0; loopCount < NUM_THREADS; loopCount++) { threadInfo[loopCount].threadNum = loopCount+1; threadInfo[loopCount].fid = fid; threadInfo[loopCount].ptid = FAIL; sprintf(threadInfo[loopCount].pointName,"POINT_%d",loopCount); sleep(1); pthread_attr_init(&threadAttr); pthread_attr_setscope(&threadAttr,PTHREAD_SCOPE_SYSTEM); status = pthread_create(&threadArray[loopCount],&threadAttr,HE5_PointTest,&threadInfo[loopCount]); if (status != 0) { printf("\nERROR: problem starting thread %d, error val: %d\n",loopCount,status); ret = FAIL; } pthread_join(threadArray[loopCount],NULL); } ret = HE5_PTclose(fid); if (ret == FAIL) { printf( "*ERROR: unable to close file. \n"); return (FAIL); } printf( "... successfully created %d points within \"point.h5\" file. \n",loopCount); return(ret); } void *HE5_PointTest(void *arg) { herr_t status = FAIL; FILE *fp; int i; int n; hsize_t count[1]; size_t datasize = 0; double time; float conc[4]; char spc[8]; HE5_CmpDTSinfo *dtsinfo; typedef struct { double time; float concentr[4]; char spec[8]; } InputData1; typedef struct { double Time; float Conc[4]; char Spc[8]; } CmpData_1; CmpData_1 datbuf_1[20]; ThreadInfo_t *tag = (ThreadInfo_t *) arg; tag->ptid = HE5_PTcreate(tag->fid,tag->pointName); if (tag->ptid == FAIL) { printf( "*ERROR: unable to create %s point. \n",tag->pointName); return (void *)NULL; } dtsinfo = (HE5_CmpDTSinfo *)calloc(1, sizeof(HE5_CmpDTSinfo)); dtsinfo->nfields = 3; dtsinfo->rank[0] = 1; dtsinfo->rank[1] = 1; dtsinfo->rank[2] = 1; dtsinfo->offset[0] = HOFFSET(InputData1, time); dtsinfo->offset[1] = HOFFSET(InputData1, concentr); dtsinfo->offset[2] = HOFFSET(InputData1, spec); dtsinfo->dtype[0] = H5T_NATIVE_DOUBLE; dtsinfo->dtype[1] = H5T_NATIVE_FLOAT; dtsinfo->dtype[2] = H5T_NATIVE_CHAR; dtsinfo->array[0] = 0; dtsinfo->array[1] = 1; dtsinfo->array[2] = 1; for (i = 0; i < 3; i++) dtsinfo->fieldname[i] = (char *)calloc(64, sizeof(char)); strcpy(dtsinfo->fieldname[0],"Time"); strcpy(dtsinfo->fieldname[1],"Concentration"); strcpy(dtsinfo->fieldname[2],"Species"); dtsinfo->dims[0][0] = 1; dtsinfo->dims[1][0] = 4; dtsinfo->dims[2][0] = 8; dtsinfo->datasize = (size_t)sizeof(InputData1); status = HE5_PTdeflevel(tag->ptid, "Sensor", dtsinfo); for (i = 0; i < 3; i++) { free(dtsinfo->fieldname[i]); dtsinfo->fieldname[i] = NULL; } free(dtsinfo); fp = fopen("simple.txt", "r"); n = 0; while(fscanf(fp, "%lf %f %f %f %f %s", &time, &conc[0], &conc[1], &conc[2], &conc[3], spc) != -1) { datbuf_1[n].Time = time; datbuf_1[n].Conc[0] = conc[0]; datbuf_1[n].Conc[1] = conc[1]; datbuf_1[n].Conc[2] = conc[2]; datbuf_1[n].Conc[3] = conc[3]; memmove(datbuf_1[n].Spc, spc, sizeof(char)*strlen(spc)); datbuf_1[n].Spc[strlen(spc)] = 0; n++; } fclose(fp); datasize = (size_t)sizeof(CmpData_1); count[0] = n; status = HE5_PTwritelevel(tag->ptid, 0, count, &datasize, datbuf_1); if (status == FAIL) { printf( "*ERROR: unable to write data to level. \n"); return (void *)NULL; } status = HE5_PTdetach(tag->ptid); if (status == FAIL) { printf( "*ERROR: unable to detach from %s point. \n",tag->pointName); return (void *)NULL; } tag->ptid = HE5_PTattach(tag->fid,tag->pointName); if (tag->ptid == FAIL) { printf( "*ERROR: unable to attach to %s point. \n",tag->pointName); return (void *)NULL; } status = HE5_PTdetach(tag->ptid); if (status == FAIL) { printf( "*ERROR: unable to detach from %s point. \n",tag->pointName); return (void *)NULL; } return 0; } hdf-eos5-2.0/testdrivers/threads/he5_pt_threads-2.c000077500000000000000000000130751507520047200222110ustar00rootroot00000000000000/* ********************************************************* * FILE: he5_pt_threads-2.c * * PURPOSE: To test thread-safe version of * * HDF-EOS5 Point library * * Author: A. Muslimov, Emergent IT Inc. * * Date: Sep, 2001 * * Updated: Nov, 2001 * ********************************************************* */ #include #define NUM_THREADS 30 typedef struct ThreadInfo_tag { int threadNum; hid_t fid; hid_t ptid; char pointName[81]; } ThreadInfo_t; void *HE5_PointTest(void *arg); int main() { herr_t ret = SUCCEED; hid_t fid = FAIL; int loopCount; int status = FAIL; ThreadInfo_t threadInfo[NUM_THREADS]; pthread_t threadArray[NUM_THREADS]; pthread_attr_t threadAttr; /* Open HDF-EOS Point file */ /* ----------------------- */ fid = HE5_PTopen("point.h5",H5F_ACC_RDWR); if (fid == FAIL) { printf( "*ERROR: unable to open \"point.h5\" file. \n"); return (FAIL); } /* Execute the loop to the NUM_THREADS times */ /* to assign one function to each thread afterwards */ /* ------------------------------------------------ */ for (loopCount = 0; loopCount < NUM_THREADS; loopCount++) { threadInfo[loopCount].threadNum = loopCount+1; threadInfo[loopCount].fid = fid; threadInfo[loopCount].ptid = FAIL; sprintf(threadInfo[loopCount].pointName,"POINT_%d",loopCount); sleep(1); pthread_attr_init(&threadAttr); pthread_attr_setscope(&threadAttr,PTHREAD_SCOPE_SYSTEM); status = pthread_create(&threadArray[loopCount],&threadAttr,HE5_PointTest,&threadInfo[loopCount]); if (status != 0) { printf("\nERROR: problem starting thread %d, error val: %d\n",loopCount,status); ret = FAIL; } pthread_join(threadArray[loopCount],NULL); } ret = HE5_PTclose(fid); if (ret == FAIL) { printf( "*ERROR: unable to close file. \n"); return (FAIL); } return(ret); } void *HE5_PointTest(void *arg) { herr_t status = FAIL; FILE *fp; int i; int n; int nflds = FAIL; hsize_t count[1]; size_t datasize = 0; double time; float conc[4]; char spc[8]; typedef struct { double Time; float Conc[4]; char Spc[8]; } CmpData_1; typedef struct { double time; float con[4]; char spec[8]; } Sensor; Sensor s[50]; HE5_CmpDTSinfo level; HE5_CmpDTSinfo inInfo; CmpData_1 datbuf_1[20]; ThreadInfo_t *tag = (ThreadInfo_t *) arg; printf(" \n"); printf("Starting thread %d\n",tag->threadNum); printf(" \n"); tag->ptid = HE5_PTattach(tag->fid,tag->pointName); if (tag->ptid == FAIL) { printf( "*ERROR: unable to attach to %s point. \n",tag->pointName); return (void *)NULL; } fp = fopen("simple.txt", "r"); n = 0; while(fscanf(fp, "%lf %f %f %f %f %s", &time, &conc[0], &conc[1], &conc[2], &conc[3], spc) != -1) { datbuf_1[n].Time = time; datbuf_1[n].Conc[0] = conc[0]; datbuf_1[n].Conc[1] = conc[1]; datbuf_1[n].Conc[2] = conc[2]; datbuf_1[n].Conc[3] = conc[3]; memmove(datbuf_1[n].Spc, spc, sizeof(char)*strlen(spc)); datbuf_1[n].Spc[strlen(spc)] = 0; n++; } fclose(fp); datasize = (size_t)sizeof(CmpData_1); count[0] = n; status = HE5_PTwritelevel(tag->ptid, 0, count, &datasize, datbuf_1); if (status == FAIL) { printf( "*ERROR: unable to write data to level. \n"); return (void *)NULL; } status = HE5_PTdetach(tag->ptid); if (status == FAIL) { printf( "*ERROR: unable to detach from %s point. \n",tag->pointName); return (void *)NULL; } tag->ptid = HE5_PTattach(tag->fid,tag->pointName); if (tag->ptid == FAIL) { printf( "*ERROR: unable to attach to %s point. \n",tag->pointName); return (void *)NULL; } status = HE5_PTlevelinfo(tag->ptid, 0, &level); if (status == FAIL) { printf( "*ERROR: unable to get level info. \n"); return (void *)NULL; } nflds = level.nfields; datasize = (size_t)sizeof(Sensor); inInfo.nfields = nflds; inInfo.datasize = (size_t)sizeof(Sensor); inInfo.rank[0] = 1; inInfo.rank[1] = 1; inInfo.rank[2] = 1; inInfo.offset[0] = HOFFSET(Sensor, time); inInfo.offset[1] = HOFFSET(Sensor, con); inInfo.offset[2] = HOFFSET(Sensor, spec); inInfo.dtype[0] = H5T_NATIVE_DOUBLE; inInfo.dtype[1] = H5T_NATIVE_FLOAT; inInfo.dtype[2] = H5T_NATIVE_CHAR; inInfo.dclass[0] = H5T_NO_CLASS; inInfo.dclass[1] = H5T_NO_CLASS; inInfo.dclass[2] = H5T_NO_CLASS; inInfo.dims[0][0] = 1; inInfo.dims[1][0] = 4; inInfo.dims[2][0] = 8; inInfo.array[0] = 0; inInfo.array[1] = 1; inInfo.array[2] = 1; for( i = 0; i < nflds; i++) { inInfo.fieldname[i] = (char *)calloc(64, sizeof(char)); strcpy(inInfo.fieldname[i], level.fieldname[i]); } status = HE5_PTreadlevel(tag->ptid, 0, &inInfo, &datasize, s); if (status == FAIL) { printf( "*ERROR: unable to read data from level. \n"); return (void *)NULL; } for (i = 0; i < nflds; i++) if (inInfo.fieldname[i] != NULL) free(inInfo.fieldname[i]); status = HE5_PTdetach(tag->ptid); if (status == FAIL) { printf( "*ERROR: unable to detach from %s point. \n",tag->pointName); return (void *)NULL; } return 0; } hdf-eos5-2.0/testdrivers/threads/he5_sw_threads-1.c000077500000000000000000000126361507520047200222200ustar00rootroot00000000000000/* ********************************************************* * FILE: he5_sw_threads-1.c * * PURPOSE: To test thread-safe version of * * HDF-EOS5 Swath library * * Author: A. Muslimov, Emergent IT Inc. * * Date: Sep, 2001 * * Updated: Nov, 2001 * ********************************************************* */ #include #define NUM_THREADS 30 typedef struct ThreadInfo_tag { int threadNum; hid_t fid; hid_t swid; char swathName[81]; } ThreadInfo_t; void *HE5_SwathTest(void *arg); int main() { herr_t ret = SUCCEED; hid_t fid = FAIL; int loopCount; int status = FAIL; ThreadInfo_t threadInfo[NUM_THREADS]; pthread_t threadArray[NUM_THREADS]; pthread_attr_t threadAttr; /* Open HDF-EOS Swath file */ /* ----------------------- */ fid = HE5_SWopen("swath.h5",H5F_ACC_TRUNC); if (fid == FAIL) { printf( "*ERROR: unable to open \"swath.h5\" file. \n"); return (FAIL); } /* Execute the loop to the NUM_THREADS times */ /* to assign one function to each thread afterwards */ /* ------------------------------------------------ */ for (loopCount = 0; loopCount < NUM_THREADS; loopCount++) { threadInfo[loopCount].threadNum = loopCount+1; threadInfo[loopCount].fid = fid; threadInfo[loopCount].swid = FAIL; sprintf(threadInfo[loopCount].swathName,"SWATH_%d",loopCount); sleep(1); pthread_attr_init(&threadAttr); pthread_attr_setscope(&threadAttr,PTHREAD_SCOPE_SYSTEM); status = pthread_create(&threadArray[loopCount],&threadAttr,HE5_SwathTest,&threadInfo[loopCount]); if (status != 0) { printf("\nERROR: problem starting thread %d, error val: %d\n",loopCount,status); ret = FAIL; } pthread_join(threadArray[loopCount],NULL); } ret = HE5_SWclose(fid); if (ret == FAIL) { printf( "*ERROR: unable to close file. \n"); return (FAIL); } printf( "... successfully created %d swaths within \"swath.h5\" file. \n",loopCount); return(ret); } void *HE5_SwathTest(void *arg) { int j; herr_t status = FAIL; hssize_t start[3]; hsize_t count[3]; double *plane; double *outbuf; ThreadInfo_t *tag = (ThreadInfo_t *) arg; tag->swid = HE5_SWcreate(tag->fid,tag->swathName); if (tag->swid == FAIL) { printf( "*ERROR: unable to create %s swath. \n",tag->swathName); return (void *)NULL; } status = HE5_SWdefdim(tag->swid, "GeoTrack", 20); if (status == FAIL) { printf( "*ERROR: unable to define dimension for %s swath. \n",tag->swathName); return (void *)NULL; } status = HE5_SWdefdim(tag->swid, "GeoXtrack", 10); if (status == FAIL) { printf( "*ERROR: unable to define dimension for %s swath. \n",tag->swathName); return (void *)NULL; } status = HE5_SWdefdim(tag->swid, "Res2tr", 40); if (status == FAIL) { printf( "*ERROR: unable to define dimension for %s swath. \n",tag->swathName); return (void *)NULL; } status = HE5_SWdefdim(tag->swid, "Res2xtr", 20); if (status == FAIL) { printf( "*ERROR: unable to define dimension for %s swath. \n",tag->swathName); return (void *)NULL; } status = HE5_SWdefdim(tag->swid, "Bands", 15); if (status == FAIL) { printf( "*ERROR: unable to define dimension for %s swath. \n",tag->swathName); return (void *)NULL; } status = HE5_SWdefdatafield(tag->swid, "Spectra", "Bands,Res2tr,Res2xtr", NULL, H5T_NATIVE_DOUBLE, 0); if (status == FAIL) { printf( "*ERROR: unable to define data field for %s swath. \n",tag->swathName); return (void *)NULL; } plane = (double *)calloc(12000,sizeof(double)); if (plane == NULL) { printf( "*ERROR: unable to allocate memory. \n"); return (void *)NULL; } for (j = 0; j < 12000; j++) plane[j] = (double)j; start[0] = 0; count[0] = 15; start[1] = 0; count[1] = 40; start[2] = 0; count[2] = 20; status = HE5_SWwritefield(tag->swid, "Spectra", start, NULL, count, plane); if (status == FAIL) { printf( "*ERROR: unable to write data for \"Spectra\" field in %s swath. \n",tag->swathName); return (void *)NULL; } free(plane); status = HE5_SWdetach(tag->swid); if (status == FAIL) { printf( "*ERROR: unable to detach from %s swath. \n",tag->swathName); return (void *)NULL; } tag->swid = HE5_SWattach(tag->fid,tag->swathName); if (tag->swid == FAIL) { printf( "*ERROR: unable to attach to %s swath. \n",tag->swathName); return (void *)NULL; } start[0] = 0; count[0] = 15; start[1] = 0; count[1] = 40; start[2] = 0; count[2] = 20; outbuf = (double *)calloc(12000, sizeof(double)); if (outbuf == NULL) { printf( "*ERROR: unable to allocate memory. \n"); return (void *)NULL; } status = HE5_SWreadfield(tag->swid, "Spectra", start, NULL, count, outbuf); if (status == FAIL) { printf( "*ERROR: unable to read data from \"Spectra\" field in %s swath. \n",tag->swathName); return (void *)NULL; } free(outbuf); status = HE5_SWdetach(tag->swid); if (status == FAIL) { printf( "*ERROR: unable to detach from %s swath. \n",tag->swathName); return (void *)NULL; } return 0; } hdf-eos5-2.0/testdrivers/threads/he5_sw_threads-2.c000077500000000000000000000103611507520047200222120ustar00rootroot00000000000000/* ********************************************************* * FILE: he5_sw_threads-2.c * * PURPOSE: To test thread-safe version of * * HDF-EOS5 Swath library * * Author: A. Muslimov, Emergent IT Inc. * * Date: Sep, 2001 * * Updated: Nov, 2001 * ********************************************************* */ #include #define NUM_THREADS 30 typedef struct ThreadInfo_tag { int threadNum; hid_t fid; hid_t swid; char swathName[81]; } ThreadInfo_t; void *HE5_SwathTest(void *arg); int main() { herr_t ret = SUCCEED; hid_t fid = FAIL; int loopCount; int status = FAIL; ThreadInfo_t threadInfo[NUM_THREADS]; pthread_t threadArray[NUM_THREADS]; pthread_attr_t threadAttr; /* Open HDF-EOS Swath file */ /* ----------------------- */ fid = HE5_SWopen("swath.h5",H5F_ACC_RDWR); if (fid == FAIL) { printf( "*ERROR: unable to open \"swath.h5\" file. \n"); return (FAIL); } /* Execute the loop to the NUM_THREADS times */ /* to assign one function to each thread afterwards */ /* ------------------------------------------------ */ for (loopCount = 0; loopCount < NUM_THREADS; loopCount++) { threadInfo[loopCount].threadNum = loopCount+1; threadInfo[loopCount].fid = fid; threadInfo[loopCount].swid = FAIL; sprintf(threadInfo[loopCount].swathName,"SWATH_%d",loopCount); sleep(1); pthread_attr_init(&threadAttr); pthread_attr_setscope(&threadAttr,PTHREAD_SCOPE_SYSTEM); status = pthread_create(&threadArray[loopCount],&threadAttr,HE5_SwathTest,&threadInfo[loopCount]); if (status != 0) { printf("\nERROR: problem starting thread %d, error val: %d\n",loopCount,status); ret = FAIL; } pthread_join(threadArray[loopCount],NULL); } ret = HE5_SWclose(fid); if (ret == FAIL) { printf( "*ERROR: unable to close file. \n"); return (FAIL); } return(ret); } void *HE5_SwathTest(void *arg) { int j; herr_t status = FAIL; hssize_t start[3]; hsize_t count[3]; double *plane; double *outbuf; ThreadInfo_t *tag = (ThreadInfo_t *) arg; printf("Starting thread %d\n",tag->threadNum); tag->swid = HE5_SWattach(tag->fid,tag->swathName); if (tag->swid == FAIL) { printf( "*ERROR: unable to attach to %s swath. \n",tag->swathName); return (void *)NULL; } plane = (double *)calloc(12000, sizeof(double)); if (plane == NULL) { printf( "*ERROR: unable to allocate memory. \n"); return (void *)NULL; } for (j = 0; j < 12000; j++) plane[j] = (double)j; start[0] = 0; count[0] = 15; start[1] = 0; count[1] = 40; start[2] = 0; count[2] = 20; status = HE5_SWwritefield(tag->swid, "Spectra", start, NULL, count, plane); if (status == FAIL) { printf( "*ERROR: unable to write data for \"Spectra\" field in %s swath. \n",tag->swathName); return (void *)NULL; } free(plane); status = HE5_SWdetach(tag->swid); if (status == FAIL) { printf( "*ERROR: unable to detach from %s swath. \n",tag->swathName); return (void *)NULL; } tag->swid = HE5_SWattach(tag->fid,tag->swathName); if (tag->swid == FAIL) { printf( "*ERROR: unable to attach to %s swath. \n",tag->swathName); return (void *)NULL; } outbuf = (double *)calloc(12000, sizeof(double)); if (outbuf == NULL) { printf( "*ERROR: unable to allocate memory. \n"); return (void *)NULL; } start[0] = 0; count[0] = 15; start[1] = 0; count[1] = 40; start[2] = 0; count[2] = 20; status = HE5_SWreadfield(tag->swid, "Spectra", start, NULL, count, outbuf); if (status == FAIL) { printf( "*ERROR: unable to read data from \"Spectra\" field in %s swath. \n",tag->swathName); return (void *)NULL; } free(outbuf); status = HE5_SWdetach(tag->swid); if (status == FAIL) { printf( "*ERROR: unable to detach from %s swath. \n",tag->swathName); return (void *)NULL; } return 0; } hdf-eos5-2.0/testdrivers/za/000077500000000000000000000000001507520047200157575ustar00rootroot00000000000000hdf-eos5-2.0/testdrivers/za/Makefile.am000066400000000000000000000016341507520047200200170ustar00rootroot00000000000000# testdrivers/za Makefile.am # Boilerplate definitions include $(top_srcdir)/config/include.am EXTRA_DIST = hdfeos5.inc hdfeos5_64.inc # Link against HDF-EOS5 and libGCTP libraries AM_CPPFLAGS=-I$(top_srcdir)/include LDADD=$(LIBHDFEOS5) $(LIBGCTP) # Programs to build when user types 'make check' check_PROGRAMS = TestZa TestAlias if F2CFORTRAN_CONDITIONAL if F2CFORTRAN_32PTR_CONDITIONAL check_PROGRAMS += testza32 testza32_SOURCES = testza32.f else check_PROGRAMS += testza64 testza64_SOURCES = testza64.f endif endif # When user types 'make check', run programs above as tests. TEST_SEQUENCES=test_c if F2CFORTRAN_CONDITIONAL if F2CFORTRAN_32PTR_CONDITIONAL TEST_SEQUENCES+=test_32f else TEST_SEQUENCES+=test_64f endif endif test_c: $(check_PROGRAMS) ./TestZa ./TestAlias test_32f: $(check_PROGRAMS) ./testza32 test_64f: $(check_PROGRAMS) ./testza64 check-local: $(TEST_SEQUENCES) .PHONY: $(TEST_SEQUENCES) hdf-eos5-2.0/testdrivers/za/Makefile.in000066400000000000000000000511701507520047200200300ustar00rootroot00000000000000# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # testdrivers/za Makefile.am VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(top_srcdir)/config/include.am $(srcdir)/Makefile.in \ $(srcdir)/Makefile.am $(top_srcdir)/config/depcomp check_PROGRAMS = TestZa$(EXEEXT) TestAlias$(EXEEXT) $(am__EXEEXT_1) \ $(am__EXEEXT_2) @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am__append_1 = testza32 @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am__append_2 = testza64 @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am__append_3 = test_32f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am__append_4 = test_64f subdir = testdrivers/za ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/stdlib.m4 $(top_srcdir)/m4/stdinc.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/HE5_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am__EXEEXT_1 = testza32$(EXEEXT) @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am__EXEEXT_2 = testza64$(EXEEXT) TestAlias_SOURCES = TestAlias.c TestAlias_OBJECTS = TestAlias.$(OBJEXT) TestAlias_LDADD = $(LDADD) TestAlias_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = TestZa_SOURCES = TestZa.c TestZa_OBJECTS = TestZa.$(OBJEXT) TestZa_LDADD = $(LDADD) TestZa_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__testza32_SOURCES_DIST = testza32.f @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@am_testza32_OBJECTS = testza32.$(OBJEXT) testza32_OBJECTS = $(am_testza32_OBJECTS) testza32_LDADD = $(LDADD) testza32_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) am__testza64_SOURCES_DIST = testza64.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@am_testza64_OBJECTS = testza64.$(OBJEXT) testza64_OBJECTS = $(am_testza64_OBJECTS) testza64_LDADD = $(LDADD) testza64_DEPENDENCIES = $(LIBHDFEOS5) $(LIBGCTP) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = F77COMPILE = $(F77) $(AM_FFLAGS) $(FFLAGS) LTF77COMPILE = $(LIBTOOL) $(AM_V_lt) --tag=F77 $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) AM_V_F77 = $(am__v_F77_@AM_V@) am__v_F77_ = $(am__v_F77_@AM_DEFAULT_V@) am__v_F77_0 = @echo " F77 " $@; am__v_F77_1 = F77LD = $(F77) F77LINK = $(LIBTOOL) $(AM_V_lt) --tag=F77 $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(F77LD) $(AM_FFLAGS) $(FFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_F77LD = $(am__v_F77LD_@AM_V@) am__v_F77LD_ = $(am__v_F77LD_@AM_DEFAULT_V@) am__v_F77LD_0 = @echo " F77LD " $@; am__v_F77LD_1 = SOURCES = TestAlias.c TestZa.c $(testza32_SOURCES) $(testza64_SOURCES) DIST_SOURCES = TestAlias.c TestZa.c $(am__testza32_SOURCES_DIST) \ $(am__testza64_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FC = @FC@ FCFLAGS = @FCFLAGS@ FFLAGS = @FFLAGS@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_F77 = @ac_ct_F77@ ac_ct_FC = @ac_ct_FC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ LIBHDFEOS5 = $(top_builddir)/src/libhe5_hdfeos.la LIBGCTP = $(top_builddir)/gctp/src/libGctp.la # Boilerplate definitions EXTRA_DIST = hdfeos5.inc hdfeos5_64.inc # Link against HDF-EOS5 and libGCTP libraries AM_CPPFLAGS = -I$(top_srcdir)/include LDADD = $(LIBHDFEOS5) $(LIBGCTP) @F2CFORTRAN_32PTR_CONDITIONAL_TRUE@@F2CFORTRAN_CONDITIONAL_TRUE@testza32_SOURCES = testza32.f @F2CFORTRAN_32PTR_CONDITIONAL_FALSE@@F2CFORTRAN_CONDITIONAL_TRUE@testza64_SOURCES = testza64.f # When user types 'make check', run programs above as tests. TEST_SEQUENCES = test_c $(am__append_3) $(am__append_4) all: all-am .SUFFIXES: .SUFFIXES: .c .f .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/include.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign testdrivers/za/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign testdrivers/za/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/config/include.am: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list TestAlias$(EXEEXT): $(TestAlias_OBJECTS) $(TestAlias_DEPENDENCIES) $(EXTRA_TestAlias_DEPENDENCIES) @rm -f TestAlias$(EXEEXT) $(AM_V_CCLD)$(LINK) $(TestAlias_OBJECTS) $(TestAlias_LDADD) $(LIBS) TestZa$(EXEEXT): $(TestZa_OBJECTS) $(TestZa_DEPENDENCIES) $(EXTRA_TestZa_DEPENDENCIES) @rm -f TestZa$(EXEEXT) $(AM_V_CCLD)$(LINK) $(TestZa_OBJECTS) $(TestZa_LDADD) $(LIBS) testza32$(EXEEXT): $(testza32_OBJECTS) $(testza32_DEPENDENCIES) $(EXTRA_testza32_DEPENDENCIES) @rm -f testza32$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(testza32_OBJECTS) $(testza32_LDADD) $(LIBS) testza64$(EXEEXT): $(testza64_OBJECTS) $(testza64_DEPENDENCIES) $(EXTRA_testza64_DEPENDENCIES) @rm -f testza64$(EXEEXT) $(AM_V_F77LD)$(F77LINK) $(testza64_OBJECTS) $(testza64_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TestAlias.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TestZa.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< .f.o: $(AM_V_F77)$(F77COMPILE) -c -o $@ $< .f.obj: $(AM_V_F77)$(F77COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .f.lo: $(AM_V_F77)$(LTF77COMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-local check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am check-local clean \ clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \ ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am test_c: $(check_PROGRAMS) ./TestZa ./TestAlias test_32f: $(check_PROGRAMS) ./testza32 test_64f: $(check_PROGRAMS) ./testza64 check-local: $(TEST_SEQUENCES) .PHONY: $(TEST_SEQUENCES) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: hdf-eos5-2.0/testdrivers/za/TestAlias.c000077500000000000000000000236741507520047200200330ustar00rootroot00000000000000/* ****************************************************************** * File: TestAlias.c * * * * Date: Aug 2002 * * Purpose: Testing ZA interfacing routines * ****************************************************************** */ #include #define FILENAME "Alias.he5" #define RANK 2 int main() { herr_t status = FAIL; int i, j; int rank = FAIL; int length = 0; int attr[1] = {2000}; int fieldgroup = FAIL; int comp_level[5] = { 0,0,0,0,0 }; int comp_code; int level[5] = {0,0,0,00}, code = 0; int *fldrank = (int *)NULL; int return_val = FAIL; H5T_class_t dtype = H5T_NO_CLASS; hid_t dtype1 = FAIL; H5T_order_t order = H5T_ORDER_ERROR; hid_t ntype[3] = {FAIL, FAIL, FAIL}; long nattr = FAIL; long nfldalias = FAIL; long strbufsize = FAIL; long nflds = FAIL; long nalias = FAIL; hid_t ZAid = FAIL, zafid = FAIL; hid_t datatype = FAIL; float data[ 20 ][ 10 ]; float out_buffer[ 20 ][ 10 ]; float fillvalue = -777.777; float out_fillvalue = -1.; size_t size = 0; hssize_t start[ 2 ] = { 0, 0 }; hsize_t count[ 2 ] = { 5, 5}; hsize_t nelem = 0; hsize_t dims[8] = {0, 0, 0, 0, 0, 0, 0, 0}; hsize_t chunk_dims[ 2 ]; char dimlist[80]; char maxdimlist[80]; char *namebuf, attrlist[80]; char fldlist[80]; char fldalias[80]; char aliaslist[80]; /* ***************************************************************************** * Open/Create the ZA "Test_1" * ***************************************************************************** */ zafid = HE5_ZAopen(FILENAME, H5F_ACC_TRUNC); printf("ZA file ID = %d\n", zafid); ZAid = HE5_ZAcreate(zafid,"Test_1"); printf("ZA ID = %d\n", ZAid); /* ***************************************************************************** * Define Dimensions * ***************************************************************************** */ status = HE5_ZAdefdim(ZAid,"DataTrack", 20); printf("status returned by HE5_ZAdefdim = %d\n", status); status = HE5_ZAdefdim(ZAid,"DataXtrack", 10); printf("status returned by HE5_ZAdefdim = %d\n", status); chunk_dims[ 0 ] = 10; chunk_dims[ 1 ] = 5; comp_code = 4; comp_level[0] = 6; status = HE5_ZAdefcomchunk(ZAid, comp_code, comp_level, RANK, chunk_dims); printf("status returned by HE5_ZAdefcomchunk = %d\n", status); status = HE5_ZAsetfillvalue(ZAid, "Temperature", H5T_NATIVE_FLOAT, &fillvalue); printf("status returned by HE5_ZAsetfillvalue = %d\n", status); status = HE5_ZAdefine(ZAid,"Temperature", "DataTrack,DataXtrack", NULL, H5T_NATIVE_FLOAT); printf("status returned by HE5_ZAdefine = %d\n", status); /* ***************************************************************************** * Write data to the field "Temperature" * ***************************************************************************** */ for ( i = 0; i < 20; i++ ) for( j = 0; j < 10; j++ ) data[ i ][ j ] = 1.e0 + i + 5.e-2 * j ; status = HE5_ZAwrite(ZAid,"Temperature", start, NULL, count, data ); printf("status returned by HE5_ZAwrite = %d\n", status); /* Set aliases for field "Temperature" */ /* ----------------------------------- */ status = HE5_ZAsetalias(ZAid,"Temperature","T,Tmp,Temp,L2gpValue"); printf("status returned by HE5_ZAsetalias = %d\n", status); strcpy(fldalias,""); nfldalias = HE5_ZAinqfldalias(ZAid, fldalias, &strbufsize); printf("Number of fields & aliases is: %li\n", nfldalias); printf("Fields & aliases list: %s \n", fldalias); printf("Length of fields & aliases list: %li \n", strbufsize); strcpy(aliaslist,""); nalias = HE5_ZAgetaliaslist(ZAid, HE5_HDFE_DATAGROUP, aliaslist, &strbufsize); printf("Number of aliases is: %li\n", nalias); printf("Aliases list: %s \n", aliaslist); printf("Length of aliases list: %li \n", strbufsize); /* Get information about alias "Temp" */ /* ---------------------------------- */ status = HE5_ZAaliasinfo(ZAid, HE5_HDFE_DATAGROUP, "Temp", &length, NULL); if (status == SUCCEED) printf("Name length: %d \n", length); namebuf = (char *)calloc(length, sizeof(char)); /* Get the actual name of the field "Temp" */ /* --------------------------------------- */ status = HE5_ZAaliasinfo(ZAid, HE5_HDFE_DATAGROUP, "Temp", &length, namebuf); if (status == SUCCEED) printf("Original field name: %s \n", namebuf); free(namebuf); /* Remove alias "Tmp" from the alias list */ /* -------------------------------------- */ status = HE5_ZAdropalias(ZAid, HE5_HDFE_DATAGROUP, "Tmp"); printf("status returned by HE5_ZAdropalias = %d\n", status); /* Remove alias "Temp" from the alias list */ /* --------------------------------------- */ status = HE5_ZAdropalias(ZAid, HE5_HDFE_DATAGROUP, "Temp"); printf("status returned by HE5_ZAdropalias = %d\n", status); /* Get information about alias "L2gpValue" */ /* ---------------------------------------- */ status = HE5_ZAaliasinfo(ZAid, HE5_HDFE_DATAGROUP, "L2gpValue", &length, NULL); if (status == SUCCEED) printf("Name length: %d \n", length); namebuf = (char *)calloc(length, sizeof(char)); /* Get the actual name of the field "L2gpValue" */ /* -------------------------------------------- */ status = HE5_ZAaliasinfo(ZAid, HE5_HDFE_DATAGROUP, "L2gpValue", &length, namebuf); if (status == SUCCEED) printf("Original field name: %s \n", namebuf); free(namebuf); count[0] = 20; count[1] = 10; /* Read the data from the field calling it by alias */ /* ------------------------------------------------ */ status = HE5_ZAread(ZAid,"L2gpValue", start, NULL, count, out_buffer); printf("status returned by HE5_ZAread = %d\n", status); printf("Data from \"L2gpValue\" field: \n"); for ( i = 0; i < 20; i++ ) for( j = 0; j < 10; j++ ) printf("%f \n", out_buffer[ i ][ j ]); /* Write local attribute to "L2gpValue" */ /* ------------------------------------ */ count[0] = 1; status = HE5_ZAwritelocattr(ZAid, "L2gpValue", "LocalAttribute", H5T_NATIVE_INT, count, attr); printf("status returned by HE5_ZAwritelocattr = %d\n", status); status = HE5_ZAdetach(ZAid); printf("status returned by HE5_ZAdetach = %d\n", status); ZAid = HE5_ZAattach(zafid,"Test_1"); printf("ZA ID returned by HE5_ZAattach = %d\n", ZAid); printf("Local Attributes:\n"); nattr = HE5_ZAinqlocattrs(ZAid, "L2gpValue", NULL, &strbufsize); printf("Number of attributes: %li \n", nattr); printf("Length of attribute list: %li \n", strbufsize); strcpy(attrlist,""); nattr = HE5_ZAinqlocattrs(ZAid, "L2gpValue", attrlist, &strbufsize); printf("Attribute list: %s \n", attrlist); printf("Local Attribute:\n"); status = HE5_ZAlocattrinfo(ZAid,"T", "LocalAttribute",&dtype1, &nelem); printf("Data type: %d\n", dtype1); printf("Number of elements: %lu \n", (unsigned long)nelem); status = HE5_ZAinfo(ZAid, "L2gpValue", &rank, dims, &dtype1, dimlist, maxdimlist); if (status != FAIL) { printf("Field rank: %d \n", rank); printf("Dimension Sizes: \n"); for ( i = 0; i < rank; i++) { printf(" %lu \n", (unsigned long)dims[i]); } printf("Data type ID: %d \n", dtype1); printf("DimList string: %s \n", dimlist); printf("MaxdimList string: %s \n", maxdimlist); } fieldgroup = HE5_HDFE_DATAGROUP; status = HE5_ZAinqdatatype(ZAid, "T", NULL, fieldgroup, &datatype, &dtype, &order, &size); printf("status returned by HE5_ZAinqdatatype = %d \n", status); if (status != FAIL) { printf("Data type ID: %d \n", datatype); printf("Data type class ID: %d \n", dtype); printf("Byte order: %d \n", order); printf("Data size (bytes): %d \n", (int)size); } status = HE5_ZAcompinfo(ZAid,"L2gpValue", &code, level); printf("status returned by HE5_ZAcompinfo = %d\n", status); if (status != FAIL) { printf("Compression Information: \n"); printf("Compression code: %d \n", code); printf("Compression level: %d \n", level[0]); } status = HE5_ZAgetfillvalue(ZAid,"L2gpValue",&out_fillvalue); printf("status returned by HE5_ZAgetfillvalue = %d\n", status); printf("The fill value: %f\n", out_fillvalue); status = HE5_ZAdetach(ZAid); printf("status returned by HE5_ZAdetach = %d\n", status); ZAid = HE5_ZAattach(zafid,"Test_1"); printf("ZA ID returned by HE5_ZAattach = %d\n", ZAid); nflds = HE5_ZAnentries(ZAid,4,&strbufsize); printf("Value returned by HE5_ZAnentries = %li\n", nflds); if (nflds != FAIL) { fldrank = (int *)calloc(nflds, sizeof(int)); nflds = FAIL; nflds = HE5_ZAinquire(ZAid,fldlist,fldrank,ntype); printf("Value returned by HE5_ZAinquire = %li \n", nflds); if (nflds != FAIL) { printf("List of fields: %s \n", fldlist); for (i = 0; i < nflds; i++) printf("Field rank, class ID: %d, %d \n",fldrank[i],ntype[i]); } free(fldrank); } status = HE5_ZAdetach(ZAid); printf("status returned by HE5_ZAdetach = %d\n", status); status = HE5_ZAclose(zafid); printf("status returned by HE5_ZAclose = %d\n", status); return 0; } hdf-eos5-2.0/testdrivers/za/TestZa.c000077500000000000000000002334641507520047200173540ustar00rootroot00000000000000#include #include #define BUFSIZE 256 #define RANK1 1 #define RANK2 2 int main(int argc, char *argv[]) { FILE *fp; herr_t status = FAIL; int i = 0; int Verbosity = 4; int comp_level[ 5 ] = { 0, 0, 0, 0, 0 }; int level[ 5 ] = { 0, 0, 0, 0, 0 }; int rank = 1; int AttrVal[ 4 ] = {1,2,3,4}; int AttrValOut[ 4 ] = {0,0,0,0}; int errcnt = 0; int comp_code = 0; int code = 0; int *RankPtr = (int *)NULL; int inarray[10] = {1,2,3,4,5,6,7,8,9,10}; int return_val = FAIL; hid_t ZAid_simple = FAIL; hid_t ZAid_index = FAIL; hid_t zafidc_simple = FAIL; hid_t dtype = FAIL; hid_t ntype[20]; long number = FAIL; long strbufsize = FAIL; long *DimListPtr = (long *)NULL; hssize_t tstart[ 2 ] = { 0, 0 }; hsize_t ndims = 0; hsize_t Dims[8] = {0,0,0,0,0,0,0,0}; hsize_t dims[ 2 ] = { 2, 2 }; hsize_t chunk_dims[ 2 ] = { 0, 0 }; hsize_t tedge[ 2 ] = { 1, 1 }; hsize_t stride[ 2 ] = { 1, 1 }; hssize_t inq_start[ 2 ] = { 0, 0 }; hsize_t inq_stride[ 2 ] = { 1, 1 }; hsize_t inq_edge[ 2 ] = { 1, 1 }; hsize_t *CountPtr = (hsize_t *)NULL; hsize_t CurrentSize[1] = { 4 }; double TempData[10][4] = { { 100., 101., 102., 103. }, { 110., 111., 112., 113. }, { 200., 201., 202., 203. }, { 210., 211., 212., 213. }, { 300., 301., 302., 303. }, { 310., 311., 312., 313. }, { 400., 401., 402., 403. }, { 410., 411., 412., 413. }, { 500., 501., 502., 503. }, { 510., 511., 512., 513. } } ; double CondData[10][4] = { { 10., 20., 30., 40. }, { 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. } } ; double TempDataOut[10][4]; double fillvalue2 = -1.11111; double InqDoubleFillValue = -1.1111; char *FieldListPtr; char *DimNamePtr; char *ObjNamesPtr; char DimList[200]; /* ******************************************************************************** * Get comand-line argument (Verbosity) * ******************************************************************************** */ for (i = 1; i < argc; i++) { if ((argc > i + 1) && ((HDstrcmp(argv[i], "-verbose") == 0) || (HDstrcmp(argv[i], "-v") == 0))) { if (argv[i + 1][0] == 'l') Verbosity = 4; else if (argv[i + 1][0] == 'm') Verbosity = 6; else if (argv[i + 1][0] == 'h') Verbosity = 10; else Verbosity = atoi(argv[i + 1]); } } /* --------------------------------- */ MESSAGE(11,fp=fopen("TestZa_c.txtout","w");); MESSAGE(4,printf("Testing ZA C interface \n");); MESSAGE(4,printf("=========================\n\n");); MESSAGE(11,fprintf(fp,"Testing ZA C interface \n");); MESSAGE(11,fprintf(fp,"=========================\n\n");); /* ********************************************************************************* * Testing HE5_ZAopen * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_ZAopen... \n");); MESSAGE(4,printf("\t===================== \n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAopen... \n");); MESSAGE(11,fprintf(fp,"\t===================== \n");); zafidc_simple = HE5_ZAopen("SimpleZa.he5",H5F_ACC_TRUNC); if (zafidc_simple == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\t\t*** Successfully opened the za file ****\n");); MESSAGE(11,fprintf(fp,"\t\t*** Successfully opened the za file ****\n");); } /* ********************************************************************************* * Testing HE5_ZAcreate * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_ZAcreate... \n");); MESSAGE(4,printf("\t======================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAcreate... \n");); MESSAGE(11,fprintf(fp,"\t=======================\n");); MESSAGE(6,printf("\t\tCreating za SIMPLE \n");); MESSAGE(11,fprintf(fp,"\t\tCreating za SIMPLE \n");); ZAid_simple = HE5_ZAcreate(zafidc_simple,"SIMPLE"); if (ZAid_simple == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\t\t*** Successfully created the za SIMPLE ****\n");); MESSAGE(11,fprintf(fp,"\t\t*** Successfully created the za SIMPLE ****\n");); } /* ********************************************************************************* * Testing HE5_ZAcreate * ********************************************************************************* */ MESSAGE(4,printf("\tTesting HE5_ZAcreate... \n");); MESSAGE(4,printf("\t=======================\n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAcreate... \n");); MESSAGE(11,fprintf(fp,"\t=======================\n");); MESSAGE(6,printf("\t\tCreating za INDEX \n");); MESSAGE(11,fprintf(fp,"\t\tCreating za INDEX \n");); ZAid_index = HE5_ZAcreate(zafidc_simple,"INDEX"); if (ZAid_index == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\t\t*** Successfully created the za INDEX ****\n");); MESSAGE(11,fprintf(fp,"\t\t*** Successfully created the za INDEX ****\n");); } /* ********************************************************************************* * Testing HE5_ZAdefdim * ********************************************************************************* */ MESSAGE(4,printf("\t\n");); MESSAGE(4,printf("\tTesting HE5_ZAdefdim... \n");); MESSAGE(4,printf("\t=======================\n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAdefdim... \n");); MESSAGE(11,fprintf(fp,"\t=======================\n");); MESSAGE(4,printf("\t\n");); MESSAGE(6,printf("\t\tSetting up dimensions for za SIMPLE \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tSetting up dimensions for za SIMPLE \n");); /* ------------------------------------- ZA SIMPLE --------------------------------- --------------------- D e f i n i n g d i m e n s i o n DataTrack ---------------- */ MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining dimension DataTrack in za SIMPLE \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining dimension DataTrack in za SIMPLE \n");); status = HE5_ZAdefdim(ZAid_simple, "DataTrack", 10); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_ZAdefdim(ZAid_simple, \"DataTrack\", 10);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_ZAdefdim %d\n", status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_ZAdefdim(ZAid_simple, \"DataTrack\", 10);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_ZAdefdim %d\n", status);); } /* --------------------- D e f i n i n g d i m e n s i o n DataXtrack ---------------- */ MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining dimension DataXtrack in za SIMPLE \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining dimension DataXtrack in za SIMPLE \n");); status = HE5_ZAdefdim(ZAid_simple, "DataXtrack", 4); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_ZAdefdim(ZAid_simple, \"DataXtrack\", 4);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_ZAdefdim %d\n", status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_ZAdefdim(ZAid_simple, \"DataXtrack\", 4);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_ZAdefdim %d\n", status);); } /* --------------------- D e f i n i n g d i m e n s i o n "Unlim" ---------------- */ MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining dimension \"Unlim\" in za SIMPLE \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining dimension \"Unlim\" in za SIMPLE \n");); status = HE5_ZAdefdim(ZAid_simple, "Unlim", H5S_UNLIMITED); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_ZAdefdim(ZAid_simple, \"Unlim\", H5S_UNLIMITED);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_ZAdefdim %d\n", status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_ZAdefdim(ZAid_simple, \"Unlim\", H5S_UNLIMITED);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_ZAdefdim %d\n", status);); } MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tSetting up dimensions for za INDEX \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tSetting up dimensions for za INDEX \n");); /* ---------------------------------- ZA INDEX ------------------------------------- --------------------- D e f i n i n g d i m e n s i o n TrackDim ---------------- */ MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining dimension TrackDim for za INDEX \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining dimension TrackDim for za INDEX \n");); status = HE5_ZAdefdim(ZAid_index, "TrackDim", 8); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_ZAdefdim(ZAid_index, \"TrackDim\", 8);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_ZAdefdim %d\n", status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_ZAdefdim(ZAid_index, \"TrackDim\", 8);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_ZAdefdim %d\n", status);); } /* --------------------- D e f i n i n g d i m e n s i o n XtrackDim ---------------- */ MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining dimension XtrackDim for za INDEX \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining dimension TrackDim for za INDEX \n");); status = HE5_ZAdefdim(ZAid_index, "XtrackDim", 8); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_ZAdefdim(ZAid_index, \"XtrackDim\", 8);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_ZAdefdim %d\n", status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_ZAdefdim(ZAid_index, \"XtrackDim\", 8);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_ZAdefdim %d\n", status);); } /* ********************************************************************************* * Testing HE5_ZAsetfillvalue * ********************************************************************************* */ MESSAGE(4,printf("\t\n");); MESSAGE(4,printf("\tTesting HE5_ZAsetfillvalue... \n");); MESSAGE(4,printf("\t=============================\n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAsetfillvalue... \n");); MESSAGE(11,fprintf(fp,"\t=============================\n");); /* --------- S e t t i n g F i l l v a l u e f o r T e m p e r a t u r e -------- */ fillvalue2 = -777.; MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tSetting fill value for field Temperature in za SIMPLE\n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tSetting fill value for field Temperature in za SIMPLE\n");); status = HE5_ZAsetfillvalue(ZAid_simple, "Temperature", H5T_NATIVE_DOUBLE, &fillvalue2); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_ZAsetfillvalue(ZAid_simple,\"Temperature\", &fillvalue2);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_ZAsetfillvalue for field Temperature %d\n", status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_ZAsetfillvalue(ZAid_simple,\"Temperature\", &fillvalue2);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_ZAsetfillvalue for field Temperature %d\n", status);); } /* ********************************************************************************* * Testing HE5_ZAdefine * ********************************************************************************* */ MESSAGE(4,printf("\t\n");); MESSAGE(4,printf("\tTesting HE5_ZAdefine... \n");); MESSAGE(4,printf("\t======================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAdefine... \n");); MESSAGE(11,fprintf(fp,"\t======================= \n");); MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining data fields for za SIMPLE \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining data fields for za SIMPLE \n");); /* ---------------------------- ZA SIMPLE --------------------------- --------------- D e f i n i n g T e m p e r a t u r e -------------- */ MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining data field Temperature\n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining data field Temperature\n");); status = HE5_ZAdefine(ZAid_simple, "Temperature", "DataTrack,DataXtrack", NULL,H5T_NATIVE_DOUBLE); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");) MESSAGE(10,printf("\t\tstatus=HE5_ZAdefine(ZAid_simple,\"Temperature\",NULL, H5T_NATIVE_DOUBLE ,0);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_ZAdefine %d\n", status);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_ZAdefine(ZAid_simple,\"Temperature\",NULL, H5T_NATIVE_DOUBLE ,0);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_ZAdefine %d\n", status);); } /* ---------------------------------- Defining Appendable field "Count" --------------------- */ MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining appendable data field Count\n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining appendable data field Count\n");); /* -------------------- D e f i n i n g c h u n k i n g --------------------- */ chunk_dims[ 0 ] = 10; MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining chunking for za SIMPLE \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining chunking for za SIMPLE \n");); status = HE5_ZAdefchunk(ZAid_simple,RANK1,chunk_dims); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_ZAdefchunk(ZAid_simple,RANK1,chunk_dims);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_ZAdefchunk %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_ZAdefchunk(ZAid_simple,RANK1,chunk_dims);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_ZAdefchunk %d\n",status);); } /* --------------- D e f i n i n g c o m p r e s s i o n s c h e m e -------------- ___________________________________________________________________ | | | HE5_HDFE_COMP_NONE 0 | | HE5_HDFE_COMP_RLE 1 | | HE5_HDFE_COMP_NBIT 2 | | HE5_HDFE_COMP_SKPHUFF 3 | | HE5_HDFE_COMP_DEFLATE 4 | | HE5_HDFE_COMP_SZIP_CHIP 5 | | HE5_HDFE_COMP_SZIP_K13 6 | | HE5_HDFE_COMP_SZIP_EC 7 | | HE5_HDFE_COMP_SZIP_NN 8 | | HE5_HDFE_COMP_SZIP_K13orEC 9 | | HE5_HDFE_COMP_SZIP_K13orNN 10 | | HE5_HDFE_COMP_SHUF_DEFLATE 11 | | HE5_HDFE_COMP_SHUF_SZIP_CHIP 12 | | HE5_HDFE_COMP_SHUF_SZIP_K13 13 | | HE5_HDFE_COMP_SHUF_SZIP_EC 14 | | HE5_HDFE_COMP_SHUF_SZIP_NN 15 | | HE5_HDFE_COMP_SHUF_SZIP_K13orEC 16 | | HE5_HDFE_COMP_SHUF_SZIP_K13orNN 17 | |_________________________________________________________________| */ comp_code = 4; /* --------------- D e f i n i n g c o m p r e s s i o n l e v e l -------------- */ comp_level[ 0 ] = 6; MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining compression parameters for za SIMPLE \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining compression parameters for za SIMPLE \n");); status = HE5_ZAdefcomp(ZAid_simple,comp_code,comp_level); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_ZAdefcomp(ZAid_simple,comp_code, comp_level);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_ZAdefcomp %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_ZAdefcomp(ZAid_simple,comp_code, comp_level);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_ZAdefcomp %d\n",status);); } /* --------------- D e f i n i n g C o u n t -------------- */ MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tDefining data field Count\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tDefining data field Count\n");); status = HE5_ZAdefine(ZAid_simple, "Count", "DataTrack","Unlim", H5T_NATIVE_INT); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_ZAdefine(ZAid_simple, \"Count\",\"DataTrack\",\"Unlim\",H5T_NATIVE_INT,0);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_ZAdefine %d\n", status);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_ZAdefine(ZAid_simple,\"Count\",\"DataTrack\",\"Unlim\",H5T_NATIVE_INT,0);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_ZAdefine %d\n", status);); } /* ********************************************************************************* * Testing HE5_ZAdefcomp * ********************************************************************************* */ MESSAGE(4,printf("\t\n");); MESSAGE(4,printf("\tTesting HE5_ZAdefcomp... \n");); MESSAGE(4,printf("\t======================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAdefcomp... \n");); MESSAGE(11,fprintf(fp,"\t======================== \n");); /* -------------------- D e f i n i n g c h u n k i n g --------------------- */ chunk_dims[ 0 ] = 5 ; chunk_dims[ 1 ] = 2 ; MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining chunking for za SIMPLE \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining chunking for za SIMPLE \n");); status = HE5_ZAdefchunk(ZAid_simple,RANK2,chunk_dims); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_ZAdefchunk(ZAid_simple,RANK2,chunk_dims);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_ZAdefchunk %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_ZAdefchunk(ZAid_simple,RANK2,chunk_dims);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_ZAdefchunk %d\n",status);); } /* --------------- D e f i n i n g c o m p r e s s i o n s c h e m e -------------- ___________________________________________________________________ | | | HE5_HDFE_COMP_NONE 0 | | HE5_HDFE_COMP_RLE 1 | | HE5_HDFE_COMP_NBIT 2 | | HE5_HDFE_COMP_SKPHUFF 3 | | HE5_HDFE_COMP_DEFLATE 4 | | HE5_HDFE_COMP_SZIP_CHIP 5 | | HE5_HDFE_COMP_SZIP_K13 6 | | HE5_HDFE_COMP_SZIP_EC 7 | | HE5_HDFE_COMP_SZIP_NN 8 | | HE5_HDFE_COMP_SZIP_K13orEC 9 | | HE5_HDFE_COMP_SZIP_K13orNN 10 | | HE5_HDFE_COMP_SHUF_DEFLATE 11 | | HE5_HDFE_COMP_SHUF_SZIP_CHIP 12 | | HE5_HDFE_COMP_SHUF_SZIP_K13 13 | | HE5_HDFE_COMP_SHUF_SZIP_EC 14 | | HE5_HDFE_COMP_SHUF_SZIP_NN 15 | | HE5_HDFE_COMP_SHUF_SZIP_K13orEC 16 | | HE5_HDFE_COMP_SHUF_SZIP_K13orNN 17 | |_________________________________________________________________| */ comp_code = 4; /* --------------- D e f i n i n g c o m p r e s s i o n l e v e l -------------- */ comp_level[ 0 ] = 6; MESSAGE(6,printf("\t\n");); MESSAGE(6,printf("\t\tDefining compression parameters for za SIMPLE \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tDefining compression parameters for za SIMPLE \n");); status = HE5_ZAdefcomp(ZAid_simple,comp_code,comp_level); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_ZAdefcomp(ZAid_simple,comp_code, comp_level);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_ZAdefcomp %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_ZAdefcomp(ZAid_simple,comp_code, comp_level);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_ZAdefcomp %d\n",status);); } /* --------------- D e f i n i n g C o n d u c t i o n -------------- */ MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tDefining data field Conduction\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tDefining data field Conduction\n");); status = HE5_ZAdefine(ZAid_simple, "Conduction", "DataTrack,DataXtrack", NULL, H5T_NATIVE_DOUBLE); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_ZAdefine(ZAid_simple, \"Conduction\",\"DataTrack,DataXtrack\",NULL,H5T_NATIVE_DOUBLE,0);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_ZAdefine %d\n", status);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_ZAdefine(ZAid_simple,\"Conduction\",\"DataTrack,DataXtrack\",NULL,H5T_NATIVE_DOUBLE,0);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_ZAdefine %d\n", status);); } /* ********************************************************************************* * Testing HE5_ZAwrite * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_ZAwrite... \n");); MESSAGE(4,printf("\t====================== \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAwrite... \n");); MESSAGE(11,fprintf(fp,"\t====================== \n");); /* -------------------------------- ZA SIMPLE ------------------------- --------- W r i t i n g T e m p e r a t u r e i n a z a -------- */ MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tWriting field Temperature in za SIMPLE \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tWriting field Temperature in za SIMPLE \n");); tstart[ 0 ] = 0; tstart[ 1 ] = 0; tedge[ 0 ] = 10; tedge[ 1 ] = 4; status = HE5_ZAwrite(ZAid_simple, "Temperature", tstart, NULL, tedge, TempData); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_ZAwrite(ZAid_simple,\"Temperature\", tstart,stride, tedge, TempData);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_ZAwrite %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_ZAwrite(ZAid_simple,\"Temperature\", tstart, stride, tedge, TempData);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_ZAwrite %d\n",status);); } /* --------- W r i t i n g C o n d u c t i o n i n a z a -------- */ MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tWriting field Conduction in za SIMPLE \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tWriting field Conduction in za SIMPLE \n");); status = HE5_ZAwrite(ZAid_simple, "Conduction", tstart, NULL, tedge, CondData); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_ZAwrite(ZAid_simple, \"Conduction\",tstart, stride, tedge, CondData);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_ZAwrite for field Conduction in za SIMPLE %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_ZAwrite(ZAid_simple,\"Conduction\", tstart, stride, tedge, CondData);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_ZAwrite for field Conduction in za SIMPLE %d\n",status);); } /* --------- W r i t i n g C o u n t i n a z a -------- */ tstart[0] = 0; tedge[0] = 40; MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tWriting field Count in za SIMPLE \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tWriting field Count in za SIMPLE \n");); status = HE5_ZAwrite(ZAid_simple, "Count", tstart, NULL, tedge, inarray); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_ZAwrite(ZAid_simple, \"Count\",tstart, NULL, tedge, inarray);\n");); MESSAGE(8,printf("\t\tValue returned by HE5_ZAwrite for field Count in za SIMPLE %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_ZAwrite(ZAid_simple,\"Count\", tstart, stride, NULL, inarray);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by HE5_ZAwrite for field Conduction in za SIMPLE %d\n",status);); } /* ********************************************************************************* * Testing HE5_ZAwriteattr * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_ZAwriteattr... \n");); MESSAGE(4,printf("\t==========================\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAwriteattr... \n");); MESSAGE(11,fprintf(fp,"\t==========================\n");); /* --------- W r i t i n g " D r i f t " i n a z a -------- */ MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tWriting attribute Drift in za SIMPLE \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tWriting attribute Drift in za SIMPLE \n");); status = HE5_ZAwriteattr(ZAid_simple,"Drift",H5T_NATIVE_INT,CurrentSize,AttrVal); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_ZAwriteattr(ZAid_simple, \"Drift\",H5T_NATIVE_INT, 4, AttrVal);\n");); MESSAGE(8,printf("\t\tValue returned by ZAwriteattr for attribute Drift in za SIMPLE %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_ZAwriteattr(ZAid_simple, \"Drift\",H5T_NATIVE_INT, 4, AttrVal);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by ZAwriteattr for attribute Drift in za SIMPLE %d\n",status);); MESSAGE(11,fprintf(fp,"\t\t Attribute element Value to write \n");); MESSAGE(11,printf("\t\t Attribute element Value to write \n");); for( i = 0; i < 4 ; i++ ) { MESSAGE(11,fprintf(fp,"\t\t %d %d \n",i+1,AttrVal[ i ] );); MESSAGE(11,printf("\t\t %d %d \n", i+1,AttrVal[ i ] );); } } /* ********************************************************************************* * Testing HE5_ZAreadattr * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_ZAreadattr... \n");); MESSAGE(4,printf("\t=========================\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAreadattr... \n");); MESSAGE(11,fprintf(fp,"\t=========================\n");); /* --------- R e a d i n g " D r i f t " a t t r i b u t e -------- */ MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tReading attribute Drift from za SIMPLE \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tReading attribute Drift from za SIMPLE \n");); status = HE5_ZAreadattr(ZAid_simple,"Drift", AttrValOut); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_ZAreadattr(ZAid_simple,\"Drift\", AttrValOut);\n");); MESSAGE(8,printf("\t\tValue returned by ZAreadattr for attribute Drift in za SIMPLE %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_ZAreadattr(ZAid_simple,\"Drift\", AttrValOut);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by ZAreadattr for attribute Drift in za SIMPLE %d\n",status);); MESSAGE(11,fprintf(fp,"\t\t Attribute elements read \n");); MESSAGE(8,printf("\t\t Attribute elements read \n");); MESSAGE(8,printf("\n");); MESSAGE(11,fprintf(fp,"\n");); for( i = 0; i < 4 ; i++ ) { MESSAGE(11,fprintf(fp,"\t\t %d \n", AttrValOut[ i ] );); MESSAGE(8,printf("\t\t %d \n", AttrValOut[ i ] );); } } /* ********************************************************************************* * Testing HE5_ZAnentries * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_ZAnentries... \n");); MESSAGE(4,printf("\t=========================\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAnentries... \n");); MESSAGE(11,fprintf(fp,"\t=========================\n");); /* ----- R e t r i e v e # o f d i m e n s i o n s i n a z a ----- */ MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve number of dimensions in za SIMPLE \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve number of dimensions in za SIMPLE \n");); number = HE5_ZAnentries(ZAid_simple,0,&strbufsize); if (number == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tnumber=HE5_ZAnentries(ZAid_simple,0,&strbufsize);\n");); MESSAGE(8,printf("\t\tNumber of dimensions %li\n",number);); MESSAGE(8,printf("\t\tString size of dimension entries: %li (bytes)\n",strbufsize);); MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_ZAnentries(ZAid_simple,0,&strbufsize);\n");); MESSAGE(11,fprintf(fp,"\t\tNumber of dimensions %li\n",number);); MESSAGE(11,fprintf(fp,"\t\tString size of dimension entries: %li (bytes)\n",strbufsize);); } /* ********************************************************************************* * Testing HE5_ZAinqdims * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_ZAinqdims... \n");); MESSAGE(4,printf("\t======================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAinqdims... \n");); MESSAGE(11,fprintf(fp,"\t======================== \n");); DimNamePtr = (char *)calloc( 1, strbufsize+1); /* ----- R e t r i e v e d i m e n s i o n l i s t f o r a z a ----- */ MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve the dimension information for za SIMPLE \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve the dimension information for za SIMPLE \n");); number = HE5_ZAinqdims(ZAid_simple,DimNamePtr,Dims); if (number == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(8,printf("\t\tnumber=HE5_ZAinqdims(ZAid_simple,DimNamePtr,DimListPtr);\n");); MESSAGE(8,printf("\t\tDimension list: \n");); MESSAGE(8,printf("\t\t %s\n",DimNamePtr);); MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_ZAinqdims(ZAid_simple,DimNamePtr,DimListPtr);\n");); MESSAGE(11,fprintf(fp,"\t\tDimension list: \n");); MESSAGE(11,fprintf(fp,"\t\t %s\n",DimNamePtr);); MESSAGE(8,printf("\t\tDimension sizes: \n");); MESSAGE(11,fprintf(fp,"\t\tDimension sizes: \n");); for (i = 0; i < number; i++) { MESSAGE(8,printf("\t\t %lu\n",(unsigned long)Dims[i]);); MESSAGE(11,fprintf(fp,"\t\t %lu\n",(unsigned long)Dims[i]);); } } free(DimNamePtr); DimNamePtr = NULL; /* ********************************************************************************* * Testing HE5_ZAinquire * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_ZAinquire... \n");); MESSAGE(4,printf("\t======================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAinquire... \n");); MESSAGE(11,fprintf(fp,"\t======================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve information about Data fields in za SIMPLE\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve information about Data fields in za SIMPLE\n");); number = HE5_ZAnentries(ZAid_simple,4,&strbufsize); if (number == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tnumber=HE5_ZAnentries(ZAid_simple,4,&strbufsize);\n");); MESSAGE(8,printf("\t\tValue (number of data fields) returned by ZAnentries %li\n",number);); MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_ZAnentries(ZAid_simple,4,&strbufsize);\n");); MESSAGE(11,fprintf(fp,"\t\tValue (number of data fields) returned by ZAnentries %li\n",number);); } RankPtr = (int *)calloc(number, sizeof(int)); FieldListPtr = (char *)calloc( BUFSIZE, sizeof(char)); MESSAGE(6,printf("\t\tRetrieve the Data fields in za SIMPLE \n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve the Data fields in za SIMPLE \n");); number = HE5_ZAinquire(ZAid_simple,FieldListPtr,RankPtr,ntype); if (number == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tnumber=HE5_ZAinquire(ZAid_simple,FieldListPtr,RankPtr,ntype);\n");); MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_ZAinquire(ZAid_simple,FieldListPtr,RankPtr,ntype);\n");); MESSAGE(8,printf("\t\tList of Data fields:\n");); MESSAGE(8,printf("\t\t %s\n",FieldListPtr);); MESSAGE(11,fprintf(fp,"\t\tList of Data fields:\n");); MESSAGE(11,fprintf(fp,"\t\t %s\n",FieldListPtr);); MESSAGE(8,printf("\t\tRanks: Data types:\n");); MESSAGE(11,fprintf(fp,"\t\tRanks: Data types:\n");); for (i = 0; i < number; i++) { MESSAGE(8,printf("\t\t %d %d\n", RankPtr[i], ntype[i]);); MESSAGE(11,fprintf(fp,"\t\t %d %d\n", RankPtr[i], ntype[i]);); } } free(RankPtr); free(FieldListPtr); /* ********************************************************************************* * Testing HE5_ZAdiminfo... * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_ZAdiminfo... \n");); MESSAGE(4,printf("\t======================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAdiminfo... \n");); MESSAGE(11,fprintf(fp,"\t======================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve information about DataXtrack dimension in za SIMPLE \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve information about DataXtrack dimension in za SIMPLE \n");); ndims = HE5_ZAdiminfo(ZAid_simple,"DataXtrack"); if ( ndims == 0) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tndims=HE5_ZAdiminfo(ZAid_simple,\"DataXtrack\");\n");); MESSAGE(8,printf("\t\tSize of dimension DataXtrack: %lu \n",(unsigned long)ndims);); MESSAGE(11,fprintf(fp,"\t\tndims=HE5_ZAdiminfo(ZAid_simple,\"DataXtrack\");\n");); MESSAGE(11,fprintf(fp,"\t\tSize of dimension DataXtrack: %lu \n",(unsigned long)ndims);); } /* ********************************************************************************* * Testing HE5_ZAread * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_ZAread... \n");); MESSAGE(4,printf("\t===================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAread... \n");); MESSAGE(11,fprintf(fp,"\t===================== \n");); inq_start[0] = 0; inq_start[1] = 0; inq_stride[0] = 1; inq_stride[1] = 1; inq_edge[0] = 10; inq_edge[1] = 4; MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tReading data from field \"Temperature\" in za SIMPLE \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tReading data from field \"Temperature\" in za SIMPLE\n");); number = HE5_ZAread(ZAid_simple,"Temperature",inq_start,inq_stride,inq_edge,TempDataOut); if (number == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tnumber=HE5_ZAread(ZAid_simple,\"Temperature\",inq_start,inq_stride,inq_edge,TempDataOut);\n");); MESSAGE(8,printf("\t\tstatus return from call to ZAread %li\n", number );); MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_ZAread(ZAid_simple,\"Temperature\",inq_start,inq_stride,inq_edge,TempDataOut);\n");); MESSAGE(11,fprintf(fp,"\t\tstatus return from call to ZAread %li\n", number );); MESSAGE(8,printf("\t\tThe values of data field \"Temperature\":\n");); MESSAGE(11,fprintf(fp,"\t\tThe values of data field \"Temperature\":\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(8,printf("\n");); for (i = 0; i < 10; i++) { MESSAGE(8,printf("\t\t %lf %lf %lf %lf \n",TempDataOut[i][0],TempDataOut[i][1],TempDataOut[i][2],TempDataOut[i][3] );); MESSAGE(11,fprintf(fp,"\t\t %lf %lf %lf %lf \n",TempDataOut[i][0],TempDataOut[i][1],TempDataOut[i][2],TempDataOut[i][3] );); } } /* ********************************************************************************* * Testing HE5_ZAinfo * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_ZAinfo... \n");); MESSAGE(4,printf("\t===================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAinfo... \n");); MESSAGE(11,fprintf(fp,"\t===================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve information about field \"Temperature\" in za SIMPLE e\n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve information about field \"Temperature\" in za SIMPLE \n");); status = HE5_ZAinfo(ZAid_simple,"Temperature",&rank,dims,&dtype,DimList,NULL); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_ZAinfo(ZAid_simple,\"Temperature\",&rank,dims,&dtype,DimList,NULL);\n");); MESSAGE(8,printf("\t\tstatus returned by ZAfieldinfo %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_ZAinfo(ZAid_simple,\"Temperature\",&rank,dims,&dtype,DimList,NULL);\n");); MESSAGE(11,fprintf(fp,"\t\tstatus returned by ZAfieldinfo %d\n",status);); MESSAGE(8,printf("\t\tRank: %d Data type: %d\n",rank, dtype);); MESSAGE(8,printf("\t\tDimension list: %s\n",DimList);); MESSAGE(11,fprintf(fp,"\t\tRank: %d Data type: %d\n",rank, dtype);); MESSAGE(11,fprintf(fp,"\t\tDimension list: %s\n",DimList);); MESSAGE(8,printf("\t\tDimension sizes:\n");); MESSAGE(11,fprintf(fp,"\t\tDimension sizes:\n");); for (i = 0; i < rank; i++) { MESSAGE(8,printf("\t\t %lu\n",(unsigned long)dims[i]);); MESSAGE(11,fprintf(fp,"\t\t %lu\n",(unsigned long)dims[i]);); } } /* ********************************************************************************* * Testing HE5_ZAinqattrs * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_ZAinqattrs... \n");); MESSAGE(4,printf("\t========================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAinqattrs... \n");); MESSAGE(11,fprintf(fp,"\t========================= \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve information about attributes defined in za INDEX \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve information about attributes defined in za INDEX \n");); number = HE5_ZAinqattrs(ZAid_simple, NULL, &strbufsize); if (number == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tnumber=HE5_ZAinqattrs(ZAid_simple, NULL, &strbufsize);\n");); MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_ZAinqattrs(ZAid_simple, NULL, &strbufsize);\n");); MESSAGE(8,printf("\t\tValue (number of attributes) returned by ZAinqattrs %li\n",number);); MESSAGE(11,fprintf(fp,"\t\tValue (number of attributes) returned by ZAinqattrs %li\n",number);); MESSAGE(8,printf("\t\tString length of attribute list: %li\n",strbufsize);); MESSAGE(11,fprintf(fp,"\t\tString length of attribute list: %li\n",strbufsize);); } MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve more information about attributes defined in za INDEX \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve more information about attributes defined in za INDEX \n");); ObjNamesPtr = (char *)calloc( BUFSIZE, sizeof(char)); number = HE5_ZAinqattrs(ZAid_simple, ObjNamesPtr, &strbufsize); if (number == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tnumber=HE5_ZAinqattrs(ZAid_simple, ObjNamesPtr, &strbufsize);\n");); MESSAGE(11,fprintf(fp,"\t\tnumber=HE5_ZAinqattrs(ZAid_simple, ObjNamesPtr,&strbufsize);\n");); MESSAGE(8,printf("\t\tNumber of attributes returned by ZAinqattr %li\n",number);); MESSAGE(11,fprintf(fp,"\t\tNumber of attributes returned by ZAinqattr %li\n",number);); MESSAGE(8,printf("\t\tAttribute list:\n");); MESSAGE(8,printf("\t\t %s\n", ObjNamesPtr);); MESSAGE(11,fprintf(fp,"\t\tAttribute list: \n");); MESSAGE(11,fprintf(fp,"\t\t %s\n", ObjNamesPtr);); MESSAGE(8,printf("\t\tString length of attribute list: %li\n",strbufsize);); MESSAGE(11,fprintf(fp,"\t\tString length of attribute list: %li\n",strbufsize);); } free(ObjNamesPtr); ObjNamesPtr = NULL; /* ********************************************************************************* * Testing HE5_ZAattrinfo * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_ZAattrinfo... \n");); MESSAGE(4,printf("\t=========================\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAattrinfo... \n");); MESSAGE(11,fprintf(fp,"\t=========================\n");); CountPtr = (hsize_t *)calloc(1, sizeof(hsize_t)); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve information about attribute \"Drift\" \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve information about attribute \"Drift\" \n");); status=HE5_ZAattrinfo(ZAid_simple,"Drift",&dtype,CountPtr); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_ZAattrinfo(ZAid_simple,\"Drift\",&dtype,CountPtr);\n");); MESSAGE(8,printf("\t\tstatus returned by ZAattrinfo %d\n",status);); MESSAGE(6,printf("\t\tData type Number of attribute elements:\n");); MESSAGE(6,printf("\t\t %d %d\n", dtype,(int)*CountPtr);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_ZAattrinfo(ZAid_simple,\"Drift\",&dtype,CountPtr);\n");); MESSAGE(11,fprintf(fp,"\t\tStaus returned by ZAattrinfo %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tData type Number of attribute elements:\n");); MESSAGE(11,fprintf(fp,"\t\t %d %d\n", dtype,(int)*CountPtr);); } free(CountPtr); /* ********************************************************************************* * Testing HE5_ZAcompinfo * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_ZAcompinfo... \n");); MESSAGE(4,printf("\t========================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAcompinfo... \n");); MESSAGE(11,fprintf(fp,"\t========================= \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve Compression information for field \"Temperature\"\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve Compression information for field \"Temperature\"\n");); status = HE5_ZAcompinfo(ZAid_simple,"Temperature",&code,level); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(8,printf("\t\tCompression scheme Compression level\n");); MESSAGE(8,printf("\t\t %d, %d\n", code, level[0]);); MESSAGE(11,fprintf(fp,"\t\tCompression scheme Compression level\n");); MESSAGE(11,fprintf(fp,"\t\t %d, %d\n", code, level[0]);); } code = - 8; level[ 0 ] = - 8; MESSAGE(4,printf("\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(6,printf("\t\tRetrieve Compression information for field \"Conduction\"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve Compression information for field \"Conduction\"\n");); status = HE5_ZAcompinfo(ZAid_simple,"Conduction",&code,level); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(8,printf("\t\tCompression scheme Compression level\n");); MESSAGE(8,printf("\t\t %d, %d\n", code, level[0]);); MESSAGE(11,fprintf(fp,"\t\tCompression scheme Compression level\n");); MESSAGE(11,fprintf(fp,"\t\t %d, %d\n", code, level[0]);); } /* ********************************************************************************* * Testing HE5_ZAgetfillvalue * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_ZAgetfillvalue... \n");); MESSAGE(4,printf("\t============================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAgetfillvalue... \n");); MESSAGE(11,fprintf(fp,"\t============================= \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tGet fill value for field \"Temperature\"\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tGet fill value for field \"Temperature\"\n");); status = HE5_ZAgetfillvalue(ZAid_simple,"Temperature",&InqDoubleFillValue); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_ZAgetfillvalue(ZAid_simple,\"Temperature\",&InqDoubleFillValue);\n");); MESSAGE(8,printf("\t\tstatus returned by ZAgetfillvalue %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_ZAgetfillvalue(ZAid_simple,\"Temperature\", &InqDoubleFillValue)\n");); MESSAGE(11,fprintf(fp,"\t\tstatus returned by ZAgetfillvalue %d\n",status);); MESSAGE(8,printf("\t\tFill value for field \"Temperature\":\n");); MESSAGE(8,printf("\n");); MESSAGE(8,printf("\t\t \"%lf\" \n", InqDoubleFillValue);); MESSAGE(11,fprintf(fp,"\t\tFill value for field \"Temperature\":\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t \"%lf\" \n",InqDoubleFillValue);); } /* ********************************************************************************* * Testing HE5_ZAdetach * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_ZAdetach... \n");); MESSAGE(4,printf("\t======================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAdetach... \n");); MESSAGE(11,fprintf(fp,"\t======================= \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tDetaching from za SIMPLE \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tDetaching from za SIMPLE \n");); status = HE5_ZAdetach(ZAid_simple); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_ZAdetach(ZAid_simple);\n");); MESSAGE(8,printf("\t\tstatus returned by ZAdetach() %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_ZAdetach(ZAid_simple);\n");); MESSAGE(11,fprintf(fp,"\t\tstatus returned by ZAdetach() %d\n",status);); } /* ********************************************************************************* * Testing HE5_ZAattach * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_ZAattach... \n");); MESSAGE(4,printf("\t=======================\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAattach... \n");); MESSAGE(11,fprintf(fp,"\t=======================\n");); ZAid_simple = HE5_ZAattach(zafidc_simple,"SIMPLE"); if (ZAid_simple == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\t\t*** Successfully attached to the za SIMPLE ****\n");); MESSAGE(11,fprintf(fp,"\t\t*** Successfully attached to the za SIMPLE ****\n");); } /* ********************************************************************************* * Testing Appending data to the field * ********************************************************************************* */ tstart[0] = 30; tedge[0] = 10; MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tWriting extended data to the field Count in za SIMPLE \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tWriting extended data to the field Count in za SIMPLE \n");); status = HE5_ZAwrite(ZAid_simple, "Count", tstart, NULL, tedge, inarray); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_ZAwrite(ZAid_simple, \"Count\",tstart, NULL, tedge, inarray);\n");); MESSAGE(8,printf("\t\tValue returned by ZAwrite for field Count in za SIMPLE %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_ZAwrite(ZAid_simple,\"Count\", tstart, stride, NULL, inarray);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by ZAwrite for field Conduction in za SIMPLE %d\n",status);); } /* ********************************************************************************* * Testing HE5_ZAinfo * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_ZAinfo... \n");); MESSAGE(4,printf("\t===================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAinfo... \n");); MESSAGE(11,fprintf(fp,"\t===================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieve information about field \"Count\" in za SIMPLE e\n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieve information about field \"Count\" in za SIMPLE \n");); status = HE5_ZAinfo(ZAid_simple,"Count",&rank,dims, &dtype,NULL,DimList); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus=HE5_ZAinfo(ZAid_simple,\"Count\",&rank,dims,&dtype,NULL,DimList);\n");); MESSAGE(8,printf("\t\tstatus returned by ZAfieldinfo %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus=HE5_ZAinfo(ZAid_simple,\"Count\",&rank,dims, &dtype,NULL,DimList);\n");); MESSAGE(11,fprintf(fp,"\t\tstatus returned by ZAfieldinfo %d\n",status);); MESSAGE(8,printf("\t\tRank: %d Data type: %d\n",rank, dtype);); MESSAGE(8,printf("\t\tMaximum Dimension list: %s\n",DimList);); MESSAGE(11,fprintf(fp,"\t\tRank: %d Data type: %d\n",rank, dtype);); MESSAGE(11,fprintf(fp,"\t\tMaximum Dimension list: %s\n",DimList);); MESSAGE(8,printf("\t\tDimension sizes:\n");); MESSAGE(11,fprintf(fp,"\t\tDimension sizes:\n");); for (i = 0; i < rank; i++) { MESSAGE(8,printf("\t\t %lu\n",(unsigned long)dims[i]);); MESSAGE(11,fprintf(fp,"\t\t %lu\n",(unsigned long)dims[i]);); } } /* ********************************************************************************* * Testing HE5_ZAdetach * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_ZAdetach... \n");); MESSAGE(4,printf("\t======================= \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAdetach... \n");); MESSAGE(11,fprintf(fp,"\t======================= \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tDetaching from za SIMPLE \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tDetaching from za SIMPLE \n");); status = HE5_ZAdetach(ZAid_simple); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tstatus = HE5_ZAdetach(ZAid_simple);\n");); MESSAGE(8,printf("\t\tstatus returned by ZAdetach for za SIMPLE %d\n",status);); MESSAGE(11,fprintf(fp,"\t\tstatus = HE5_ZAdetach(ZAid_simple);\n");); MESSAGE(11,fprintf(fp,"\t\tstatus returned by ZAdetach for za SIMPLE%d\n",status);); } /* ********************************************************************************* * Testing HE5_ZAclose * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting HE5_ZAclose... \n");); MESSAGE(4,printf("\t====================== \n");); MESSAGE(11,fprintf(fp,"\t\n");); MESSAGE(11,fprintf(fp,"\tTesting HE5_ZAclose... \n");); MESSAGE(11,fprintf(fp,"\t====================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tClosing the file SimpleZa.he5\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tClosing the file SimpleZa.he5\n");); status = HE5_ZAclose(zafidc_simple); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\t\t*** Successfully clossed the SimpleZa.he5 file ****\n");); MESSAGE(11,fprintf(fp,"\t\t*** Successfully clossed the SimpleZa.he5 file ****\n");); } /* ********************************************************************************* * Testing ZAopen * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting ZAopen... \n");); MESSAGE(4,printf("\t=================\n");); MESSAGE(11,fprintf(fp,"\tTesting ZAopen... \n");); MESSAGE(11,fprintf(fp,"\t=================\n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tOpening the file SimpleZa.he5\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tOpening the file SimpleZa.he5\n");); zafidc_simple = HE5_ZAopen("SimpleZa.he5",H5F_ACC_RDWR); if (zafidc_simple == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\t\t*** Successfully opened the za file ****\n");); MESSAGE(11,fprintf(fp,"\t\t*** Successfully opened the za file ****\n");); } /* ********************************************************************************* * Testing ZAinqza * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting ZAinqza... \n");); MESSAGE(4,printf("\t=================\n");); MESSAGE(11,fprintf(fp,"\tTesting ZAinqza... \n");); MESSAGE(11,fprintf(fp,"\t=================\n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tRetrieving general information about objects within the file\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tRetrieving general information about objects within the file\n");); number = HE5_ZAinqza("SimpleZa.he5",NULL,&strbufsize); if (number == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tnumber = HE5_ZAinqza(\"SimpleZa.he5\",NULL,&strbufsize);\n");); MESSAGE(8,printf("\t\tValue returned by ZAinqza %li\n", number);); MESSAGE(8,printf("\t\tString length returned by ZAinqza %li\n", strbufsize);); MESSAGE(11,fprintf(fp,"\t\tnumber = HE5_ZAinqza(\"SimpleZa.he5\",NULL,&strbufsize);\n");); MESSAGE(11,fprintf(fp,"\t\tValue returned by ZAinqza %li\n", number);); MESSAGE(11,fprintf(fp,"\t\tStringlength returned by ZAinqza %li\n", strbufsize);); } MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tContinue ...\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tContinue ...\n");); ObjNamesPtr = (char *)calloc(strbufsize+1, sizeof(char ) ); number = HE5_ZAinqza("SimpleZa.he5",ObjNamesPtr,&strbufsize); if (number == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t\t********Passed Test**********\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t********Passed Test**********\n");); MESSAGE(10,printf("\t\tnumber = HE5_ZAinqza(\"SimpleZa.he5\",ObjNamesPtr,&strbufsize);\n");); MESSAGE(8,printf("\t\tNumber of za objects: %li\n", number);); MESSAGE(8,printf("\t\tList of za objects: %s\n", ObjNamesPtr);); MESSAGE(11,fprintf(fp,"\t\tnumber = HE5_ZAinqza(\"SimpleZa.he5\",ObjNamesPtr,&strbufsize);\n");); MESSAGE(11,fprintf(fp,"\t\tNumber of za objecys: %li\n", number);); MESSAGE(11,fprintf(fp,"\t\tList of za objects: %s\n", ObjNamesPtr);); } free(ObjNamesPtr); /* ********************************************************************************* * Testing ZAclose * ********************************************************************************* */ MESSAGE(4,printf("\n");); MESSAGE(4,printf("\tTesting ZAclose... \n");); MESSAGE(4,printf("\t====================== \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\tTesting ZAclose... \n");); MESSAGE(11,fprintf(fp,"\t====================== \n");); MESSAGE(6,printf("\n");); MESSAGE(6,printf("\t\tClosing the file SimpleZa.he5\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\tClosing the file SimpleZa.he5\n");); status = HE5_ZAclose(zafidc_simple); if (status == FAIL) { MESSAGE(4,printf("\t\t********Error unexpected**********\n");); MESSAGE(11,fprintf(fp,"\t\t********Error unexpected**********\n");); errcnt++; } else { MESSAGE(4,printf("\t\tSuccessfully clossed the SimpleZa.he5 file \n");); MESSAGE(11,fprintf(fp,"\t\tSuccessfully clossed the SimpleZa.he5 file \n");); MESSAGE(4,printf("\n");); MESSAGE(4,printf("\t ........... End of Testing. \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t ............. End of Testing. \n");); } if (errcnt == 0) { MESSAGE(11,printf("\n");); MESSAGE(11,printf("\n");); MESSAGE(11,printf("\t\t A L L T E S T S P A S S E D \n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t A L L T E S T S P A S S E D \n");); return_val = 0; } else { MESSAGE(11,printf("\n");); MESSAGE(11,printf("\n");); MESSAGE(11,printf("\t\t%d T E S T S F A I L E D \n",errcnt);); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\n");); MESSAGE(11,fprintf(fp,"\t\t%d T E S T S F A I L E D \n",errcnt);); return_val = 1; } MESSAGE(11,fclose(fp);); return return_val; } hdf-eos5-2.0/testdrivers/za/hdfeos5.inc000066400000000000000000000351131507520047200200120ustar00rootroot00000000000000! * ========================================================== ! * File: hdfeos5.inc ! * Author: A. Muslimov, Emergent Technology Services, Inc. ! * Date: March 11, 2002 ! * Purpose: Fortran header file for HDFEOS5 routines ! * ========================================================== ! * Contents: ! * HDFEOS5 data type tags ! * HDFEOS5 logical constants ! * HDFEOS5 file access tags ! * HDFEOS5/GCTP library codes ! * ! * =========================================================== ! HDFEOS5 DATA TYPE TAGS ! ======================= integer HE5T_NATIVE_INT integer HE5T_NATIVE_UINT integer HE5T_NATIVE_SHORT integer HE5T_NATIVE_USHORT integer HE5T_NATIVE_SCHAR integer HE5T_NATIVE_UCHAR integer HE5T_NATIVE_LONG integer HE5T_NATIVE_ULONG integer HE5T_NATIVE_LLONG integer HE5T_NATIVE_ULLONG integer HE5T_NATIVE_FLOAT integer HE5T_NATIVE_REAL integer HE5T_NATIVE_DOUBLE integer HE5T_NATIVE_LDOUBLE integer HE5T_NATIVE_INT8 integer HE5T_NATIVE_UINT8 integer HE5T_NATIVE_INT16 integer HE5T_NATIVE_UINT16 integer HE5T_NATIVE_INT32 integer HE5T_NATIVE_UINT32 integer HE5T_NATIVE_INT64 integer HE5T_NATIVE_UINT64 integer HE5T_NATIVE_B8 integer HE5T_NATIVE_B16 integer HE5T_NATIVE_B32 integer HE5T_NATIVE_B64 integer HE5T_NATIVE_HSIZE integer HE5T_NATIVE_HERR integer HE5T_NATIVE_HBOOL integer HE5T_STD_I8BE integer HE5T_STD_I8LE integer HE5T_STD_I16BE integer HE5T_STD_I16LE integer HE5T_STD_I32BE integer HE5T_STD_I32LE integer HE5T_STD_I64BE integer HE5T_STD_I64LE integer HE5T_STD_U8BE integer HE5T_STD_U8LE integer HE5T_STD_U16BE integer HE5T_STD_U16LE integer HE5T_STD_U32BE integer HE5T_STD_U32LE integer HE5T_STD_U64BE integer HE5T_STD_U64LE integer HE5T_STD_B8BE integer HE5T_STD_B8LE integer HE5T_STD_B16BE integer HE5T_STD_B16LE integer HE5T_STD_B32BE integer HE5T_STD_B32LE integer HE5T_STD_B64BE integer HE5T_STD_B64LE integer HE5T_IEEE_F32BE integer HE5T_IEEE_F32LE integer HE5T_IEEE_F64BE integer HE5T_IEEE_F64LE integer HE5T_NATIVE_CHAR integer HE5T_CHARSTRING parameter(HE5T_NATIVE_INT = 0) parameter(HE5T_NATIVE_UINT = 1) parameter(HE5T_NATIVE_SHORT = 2) parameter(HE5T_NATIVE_USHORT = 3) parameter(HE5T_NATIVE_SCHAR = 4) parameter(HE5T_NATIVE_UCHAR = 5) parameter(HE5T_NATIVE_LONG = 6) parameter(HE5T_NATIVE_ULONG = 7) parameter(HE5T_NATIVE_LLONG = 8) parameter(HE5T_NATIVE_ULLONG = 9) parameter(HE5T_NATIVE_FLOAT =10) parameter(HE5T_NATIVE_REAL =10) parameter(HE5T_NATIVE_DOUBLE =11) parameter(HE5T_NATIVE_LDOUBLE =12) parameter(HE5T_NATIVE_INT8 =13) parameter(HE5T_NATIVE_UINT8 =14) parameter(HE5T_NATIVE_INT16 =15) parameter(HE5T_NATIVE_UINT16 =16) parameter(HE5T_NATIVE_INT32 =17) parameter(HE5T_NATIVE_UINT32 =18) parameter(HE5T_NATIVE_INT64 =19) parameter(HE5T_NATIVE_UINT64 =20) parameter(HE5T_NATIVE_B8 =21) parameter(HE5T_NATIVE_B16 =22) parameter(HE5T_NATIVE_B32 =23) parameter(HE5T_NATIVE_B64 =24) parameter(HE5T_NATIVE_HSIZE =25) parameter(HE5T_NATIVE_HERR =26) parameter(HE5T_NATIVE_HBOOL =27) parameter(HE5T_STD_I8BE =28) parameter(HE5T_STD_I8LE =29) parameter(HE5T_STD_I16BE =30) parameter(HE5T_STD_I16LE =31) parameter(HE5T_STD_I32BE =32) parameter(HE5T_STD_I32LE =33) parameter(HE5T_STD_I64BE =34) parameter(HE5T_STD_I64LE =35) parameter(HE5T_STD_U8BE =36) parameter(HE5T_STD_U8LE =37) parameter(HE5T_STD_U16BE =38) parameter(HE5T_STD_U16LE =39) parameter(HE5T_STD_U32BE =40) parameter(HE5T_STD_U32LE =41) parameter(HE5T_STD_U64BE =42) parameter(HE5T_STD_U64LE =43) parameter(HE5T_STD_B8BE =44) parameter(HE5T_STD_B8LE =45) parameter(HE5T_STD_B16BE =46) parameter(HE5T_STD_B16LE =47) parameter(HE5T_STD_B32BE =48) parameter(HE5T_STD_B32LE =49) parameter(HE5T_STD_B64BE =50) parameter(HE5T_STD_B64LE =51) parameter(HE5T_IEEE_F32BE =52) parameter(HE5T_IEEE_F32LE =53) parameter(HE5T_IEEE_F64BE =54) parameter(HE5T_IEEE_F64LE =55) parameter(HE5T_NATIVE_CHAR =56) parameter(HE5T_CHARSTRING =57) integer HE5S_UNLIMITED_F parameter(HE5S_UNLIMITED_F = -1) ! HDFEOS5 FILE ACCESS TAGS ! ======================== integer HE5F_ACC_RDWR integer HE5F_ACC_RDONLY integer HE5F_ACC_TRUNC parameter(HE5F_ACC_RDWR = 100) parameter(HE5F_ACC_RDONLY = 101) parameter(HE5F_ACC_TRUNC = 102) ! TOOLKIT FILE ACCESS TAGS ! ======================== integer HDF4_ACC_RDONLY integer HDF4_ACC_RDWR integer HDF4_ACC_CREATE integer HDF5_ACC_RDONLY integer HDF5_ACC_RDWR integer HDF5_ACC_CREATE parameter(HDF4_ACC_RDONLY = 1) parameter(HDF4_ACC_RDWR = 3) parameter(HDF4_ACC_CREATE = 4) parameter(HDF5_ACC_RDONLY = 11) parameter(HDF5_ACC_RDWR = 13) parameter(HDF5_ACC_CREATE = 14) ! HDFEOS5 MERGE CODES ! ==================== integer HE5_HDFE_NOMERGE integer HE5_HDFE_AUTOMERGE parameter(HE5_HDFE_NOMERGE =0) parameter(HE5_HDFE_AUTOMERGE =1) ! HDFEOS5 XXentries CODES ! ======================= integer HE5_HDFE_NENTDIM integer HE5_HDFE_NENTMAP integer HE5_HDFE_NENTIMAP integer HE5_HDFE_NENTGFLD integer HE5_HDFE_NENTDFLD parameter(HE5_HDFE_NENTDIM =0) parameter(HE5_HDFE_NENTMAP =1) parameter(HE5_HDFE_NENTIMAP =2) parameter(HE5_HDFE_NENTGFLD =3) parameter(HE5_HDFE_NENTDFLD =4) ! HDFEOS5 ANGLE CONVERSION CODES ! ============================== integer HE5_HDFE_RAD_DEG integer HE5_HDFE_DEG_RAD integer HE5_HDFE_DMS_DEG integer HE5_HDFE_DEG_DMS integer HE5_HDFE_RAD_DMS integer HE5_HDFE_DMS_RAD parameter(HE5_HDFE_RAD_DEG =0) parameter(HE5_HDFE_DEG_RAD =1) parameter(HE5_HDFE_DMS_DEG =2) parameter(HE5_HDFE_DEG_DMS =3) parameter(HE5_HDFE_RAD_DMS =4) parameter(HE5_HDFE_DMS_RAD =5) ! HDFEOS5 SWATH SUBSET CODES ! ========================== integer HE5_HDFE_MIDPOINT integer HE5_HDFE_ENDPOINT integer HE5_HDFE_ANYPOINT integer HE5_HDFE_INTERNAL integer HE5_HDFE_EXTERNAL integer HE5_HDFE_NOPREVSUB parameter(HE5_HDFE_MIDPOINT =0) parameter(HE5_HDFE_ENDPOINT =1) parameter(HE5_HDFE_ANYPOINT =2) parameter(HE5_HDFE_INTERNAL =0) parameter(HE5_HDFE_EXTERNAL =1) parameter(HE5_HDFE_NOPREVSUB =-1) ! HDFEOS5 GRID ORIGIN CODES ! ========================= integer HE5_HDFE_GD_UL integer HE5_HDFE_GD_UR integer HE5_HDFE_GD_LL integer HE5_HDFE_GD_LR parameter(HE5_HDFE_GD_UL =0) parameter(HE5_HDFE_GD_UR =1) parameter(HE5_HDFE_GD_LL =2) parameter(HE5_HDFE_GD_LR =3) ! HDFEOS5 PIXEL REGISTRATION CODES ! ================================ integer HE5_HDFE_CENTER integer HE5_HDFE_CORNER parameter(HE5_HDFE_CENTER =0) parameter(HE5_HDFE_CORNER =1) ! HDFEOS5 GCTP PROJECTION CODES ! ============================= integer HE5_GCTP_GEO integer HE5_GCTP_UTM integer HE5_GCTP_SPCS integer HE5_GCTP_ALBERS integer HE5_GCTP_LAMCC integer HE5_GCTP_MERCAT integer HE5_GCTP_PS integer HE5_GCTP_POLYC integer HE5_GCTP_EQUIDC integer HE5_GCTP_TM integer HE5_GCTP_STEREO integer HE5_GCTP_LAMAZ integer HE5_GCTP_AZMEQD integer HE5_GCTP_GNOMON integer HE5_GCTP_ORTHO integer HE5_GCTP_GVNSP integer HE5_GCTP_SNSOID integer HE5_GCTP_EQRECT integer HE5_GCTP_MILLER integer HE5_GCTP_VGRINT integer HE5_GCTP_HOM integer HE5_GCTP_ROBIN integer HE5_GCTP_SOM integer HE5_GCTP_ALASKA integer HE5_GCTP_GOOD integer HE5_GCTP_MOLL integer HE5_GCTP_IMOLL integer HE5_GCTP_HAMMER integer HE5_GCTP_WAGIV integer HE5_GCTP_WAGVII integer HE5_GCTP_OBLEQA integer HE5_GCTP_ISINUS parameter(HE5_GCTP_GEO =0) parameter(HE5_GCTP_UTM =1) parameter(HE5_GCTP_SPCS =2) parameter(HE5_GCTP_ALBERS =3) parameter(HE5_GCTP_LAMCC =4) parameter(HE5_GCTP_MERCAT =5) parameter(HE5_GCTP_PS =6) parameter(HE5_GCTP_POLYC =7) parameter(HE5_GCTP_EQUIDC =8) parameter(HE5_GCTP_TM =9) parameter(HE5_GCTP_STEREO =10) parameter(HE5_GCTP_LAMAZ =11) parameter(HE5_GCTP_AZMEQD =12) parameter(HE5_GCTP_GNOMON =13) parameter(HE5_GCTP_ORTHO =14) parameter(HE5_GCTP_GVNSP =15) parameter(HE5_GCTP_SNSOID =16) parameter(HE5_GCTP_EQRECT =17) parameter(HE5_GCTP_MILLER =18) parameter(HE5_GCTP_VGRINT =19) parameter(HE5_GCTP_HOM =20) parameter(HE5_GCTP_ROBIN =21) parameter(HE5_GCTP_SOM =22) parameter(HE5_GCTP_ALASKA =23) parameter(HE5_GCTP_GOOD =24) parameter(HE5_GCTP_MOLL =25) parameter(HE5_GCTP_IMOLL =26) parameter(HE5_GCTP_HAMMER =27) parameter(HE5_GCTP_WAGIV =28) parameter(HE5_GCTP_WAGVII =29) parameter(HE5_GCTP_OBLEQA =30) parameter(HE5_GCTP_ISINUS =99) ! HDFEOS5 TILIND/COMPRESSION CODES ! ================================ integer HE5_HDFE_NOTILE integer HE5_HDFE_TILE integer HE5_HDFE_COMP_NONE integer HE5_HDFE_COMP_RLE integer HE5_HDFE_COMP_NBIT integer HE5_HDFE_COMP_SKPHUFF integer HE5_HDFE_COMP_DEFLATE integer HE5_HDFE_COMP_SZIP_CHIP integer HE5_HDFE_COMP_SZIP_K13 integer HE5_HDFE_COMP_SZIP_EC integer HE5_HDFE_COMP_SZIP_NN integer HE5_HDFE_COMP_SZIP_K13orEC integer HE5_HDFE_COMP_SZIP_K13orNN integer HE5_HDFE_COMP_SHUF_DEFLATE integer HE5_HDFE_COMP_SHUF_SZIP_CHIP integer HE5_HDFE_COMP_SHUF_SZIP_K13 integer HE5_HDFE_COMP_SHUF_SZIP_EC integer HE5_HDFE_COMP_SHUF_SZIP_NN integer HE5_HDFE_COMP_SHUF_SZIP_K13orEC integer HE5_HDFE_COMP_SHUF_SZIP_K13orNN parameter(HE5_HDFE_NOTILE =0) parameter(HE5_HDFE_TILE =1) parameter(HE5_HDFE_COMP_NONE =0) parameter(HE5_HDFE_COMP_RLE =1) parameter(HE5_HDFE_COMP_NBIT =2) parameter(HE5_HDFE_COMP_SKPHUFF =3) parameter(HE5_HDFE_COMP_DEFLATE =4) parameter(HE5_HDFE_COMP_SZIP_CHIP =5) parameter(HE5_HDFE_COMP_SZIP_K13 =6) parameter(HE5_HDFE_COMP_SZIP_EC =7) parameter(HE5_HDFE_COMP_SZIP_NN =8) parameter(HE5_HDFE_COMP_SZIP_K13orEC =9) parameter(HE5_HDFE_COMP_SZIP_K13orNN =10) parameter(HE5_HDFE_COMP_SHUF_DEFLATE =11) parameter(HE5_HDFE_COMP_SHUF_SZIP_CHIP =12) parameter(HE5_HDFE_COMP_SHUF_SZIP_K13 =13) parameter(HE5_HDFE_COMP_SHUF_SZIP_EC =14) parameter(HE5_HDFE_COMP_SHUF_SZIP_NN =15) parameter(HE5_HDFE_COMP_SHUF_SZIP_K13orEC =16) parameter(HE5_HDFE_COMP_SHUF_SZIP_K13orNN =17) ! HDFEOS5 GROUP CODES ! =================== integer HE5_HDFE_GEOGROUP integer HE5_HDFE_DATAGROUP integer HE5_HDFE_ATTRGROUP integer HE5_HDFE_GRPATTRGROUP integer HE5_HDFE_LOCATTRGROUP integer HE5_HDFE_PROFGROUP integer HE5_HDFE_PROFGRPATTRGROUP integer HE5_HDFE_GEOGRPATTRGROUP parameter(HE5_HDFE_GEOGROUP =0) parameter(HE5_HDFE_DATAGROUP =1) parameter(HE5_HDFE_ATTRGROUP =2) parameter(HE5_HDFE_GRPATTRGROUP =3) parameter(HE5_HDFE_LOCATTRGROUP =4) parameter(HE5_HDFE_PROFGROUP =5) parameter(HE5_HDFE_PROFGRPATTRGROUP =6) parameter(HE5_HDFE_GEOGRPATTRGROUP =7) hdf-eos5-2.0/testdrivers/za/hdfeos5_64.inc000066400000000000000000000010151507520047200203150ustar00rootroot00000000000000! * ========================================================== ! * File: hdfeos5_64.inc ! * Author: A. Muslimov, Emergent Technology Services, Inc. ! * Date: March 19, 2002 ! * Purpose: Fortran header file for HDFEOS5 routines on 64 ! * bit platforms ! * ========================================================== ! * Contents: ! * ! * ! * =========================================================== integer*8 HE5S_UNLIMITED_F_64 parameter(HE5S_UNLIMITED_F_64 = -1) hdf-eos5-2.0/testdrivers/za/testza32.f000077500000000000000000001476511507520047200176260ustar00rootroot00000000000000!---------------------------------------------------------------------------- ! Copyright (C) 2002 Emergent IT Inc. and Raytheon Systems Company | !---------------------------------------------------------------------------- ! testza32.f | ! In this program we create, define and write a simple za hdfeos file | ! using the za interface | !---------------------------------------------------------------------------- program testza32 implicit none include 'hdfeos5.inc' integer index1, index2, status integer rank, n, dtype, classid, order integer rdattr(4), global_attr(4) integer compparm(5), cnkrank integer rdcompparm(5), compcode integer he5_zaopen, he5_zacreate integer zafid, zaid, zaid2 integer he5_zadefdim, he5_zadetach integer he5_zadefine integer he5_zaclose integer he5_zasetfill, he5_zawrlattr, he5_zawrattr integer he5_zawrite, he5_zawrgattr integer he5_zaread, he5_zainfo integer he5_zaattrinfo, he5_zardattr integer he5_zagattrinfo, he5_zardgattr, he5_zardlattr integer he5_zalattrinfo, he5_zagetfill, he5_zaidtype integer he5_zadefchunk, he5_zadefcomp, he5_zacompinfo integer rnkd(4), ntyped(4), nt integer he5_zaattach integer*4 he5_zainqza, he5_zanentries integer*4 he5_zainqdims, he5_zadiminfo integer*4 he5_zainqattrs, he5_zainqgattrs integer*4 he5_zainqlattrs, he5_zainquire integer*4 size, strbufsize, ndims, chunkdims(1) integer*4 start(2), stride(2), dataedge(2) integer*4 istart(2),iedge(2),dedge(2) integer*4 sd_start(2), sd_stride(2), sd_edge(2) integer*4 rd_start(2), rd_stride(2), rd_edge(2) integer*4 dimsize integer*4 nattr, nza, nmaps integer*4 strbufsz2, nflds integer*4 count(1) integer*4 dims(2),dims2(3),sddims(2) integer*4 dim1, dim2, dim3, dim4 real grpattr(3), locattr(3), rdgnlattr(3) real ray1(100,40), ray2(40,100) real ray4(40,100) real ray3(40,40), temp(40,100) real raycnt real fillvalue, rdfilval character*(256) dimname, fieldlist character*(256) attrlist, zalist character*(256) dimens, maxdims dim1 = 30 dim2 = 40 dim3 = 50 dim4 = 100 count(1) = 3 compparm(1) = 6 compparm(2) = 0 compparm(3) = 0 compparm(4) = 0 compparm(5) = 0 cnkrank = 1 chunkdims(1) = 10 rdcompparm(1) = 1 rdcompparm(2) = 1 rdcompparm(3) = 1 rdcompparm(4) = 1 rdcompparm(5) = 1 compcode = -1 raycnt = -799.0 global_attr(1)= 11 global_attr(2)= 33 global_attr(3)= 66 global_attr(4)= 99 grpattr(1) = 21.7 grpattr(2) = 24.3 grpattr(3) = 26.3 locattr(3) = 21.7 locattr(2) = 24.3 locattr(1) = 26.3 start(1) = 10 start(2) = 10 stride(1) = 1 stride(2) = 1 sd_start(1) = 0 sd_start(2) = 0 sd_stride(1) = 1 sd_stride(2) = 1 sd_edge(1) = 100 sd_edge(2) = 40 rd_start(1) = 0 rd_start(2) = 0 rd_stride(1) = 1 rd_stride(2) = 1 rd_edge(1) = 40 rd_edge(2) = 100 dataedge(1) = 20 dataedge(2) = 50 istart(1) = 0 istart(2) = 0 iedge(1) = 30 iedge(2) = 30 dedge(1) = 40 dedge(2) = 40 rank = 2 fillvalue = 16.0 ! ! This section of the program just fills some arrays with data that will be ! used later in the program ! do 110 index1=1,100 do 100 index2=1,40 ray1(index1, index2)=raycnt ray2(index2, index1)=raycnt + 1.0 ray4(index2,index1) = raycnt raycnt = raycnt +1. 100 continue 110 continue do 170 index1=1,40 do 160 index2=1,40 ray3(index1, index2)=raycnt raycnt = raycnt+1.25 160 continue 170 continue 230 format('********Error unexpected**********') 240 format('***********Passed Test*********') open(unit=1, file="testza32_f.txtout", status = "UNKNOWN") write(*,*)'Testing he5_za FORTRAN 77 interface' write(*,*)'======================================' write(1,*)'Testing he5_za FORTRAN 77 interface' write(1,*)'======================================' write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zaopen ! write(*,*)'Testing he5_zaopen ' write(*,*)'=====================' write(1,*)'Testing he5_zaopen ' write(1,*)'=====================' zafid=he5_zaopen('za.he5',HE5F_ACC_TRUNC) if (zafid .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'zafid= he5_zaopen("za.he5",HE5F_ACC_TRUNC)' write(*,*)'Value returned by he5_zaopen ', zafid write(1,*)'zafid= he5_zaopen("za.he5",HE5F_ACC_TRUNC)' write(1,*)'Value returned by he5_zaopen ', zafid endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zacreate ! write(1,27) write(*,*)'Testing he5_zacreate ' write(*,*)'=====================' write(1,*)'Testing he5_zacreate ' write(1,*)'=====================' zaid=he5_zacreate(zafid,'Simplef') if (zaid .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'zaid=he5_zacreate(zafid, "Simplef")' write(*,*)'Value returned by he5_zacreate ', zaid write(1,*)'zaid= he5_zacreate(zafid, "Simplef")' write(1,*)'Value returned by he5_zacreate ', zaid endif write(*,*)' ' write(1,*)' ' zaid2=he5_zacreate(zafid,'Indexedf') if (zaid2 .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' zaid2= he5_zacreate(zafid, "Indexedf")' write(*,*)' Value returned by he5_zacreate ', zaid2 write(1,*)' zaid2= he5_zacreate(zafid, "Indexedf")' write(1,*)' Value returned by he5_zacreate ', zaid2 endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zadefdim ! write(1,27) write(*,*)'Testing he5_zadefdim ' write(*,*)'=====================' write(1,*)'Testing he5_zadefdim ' write(1,*)'=====================' status=he5_zadefdim(zaid,'DataTrack',dim4) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status= he5_zadefdim(zaid, "DataTrack", 100)' write(*,*)' Value returned by he5_zadefdim ',status write(1,*)' status= he5_zadefdim(zaid, "DataTrack", 100)' write(1,*)' Value returned by he5_zadefdim ',status endif write(*,*)' ' write(1,*)' ' status=he5_zadefdim(zaid,'DataXtrack',dim2) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status= he5_zadefdim(zaid, "DataXtrack", 40)' write(*,*)' Value returned by he5_zadefdim ',status write(1,*)' status= he5_zadefdim(zaid, "DataXtrack", 40)' write(1,*)' Value returned by he5_zadefdim ',status endif write(*,*)' ' write(1,*)' ' status=he5_zadefdim(zaid2,'DataTrack',dim2) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status= he5_zadefdim(zaid2, "DataTrack", 40)' write(*,*)' Value returned by he5_zadefdim ', status write(1,*)' status= he5_zadefdim(zaid2, "DataTrack", 40)' write(1,*)' Value returned by he5_zadefdim ', status endif write(*,*)' ' write(1,*)' ' status=he5_zadefdim(zaid2,'DataXtrack',dim2) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status= he5_zadefdim(zaid2, "DataXtrack", 40)' write(*,*)' Value returned by he5_zadefdim ', status write(1,*)' status= he5_zadefdim(zaid2, "DataXtrack", 40)' write(1,*)' Value returned by he5_zadefdim ', status endif write(*,*)' ' write(1,*)' ' status=he5_zadefdim(zaid2,'Timedim',dim2) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Define dimension Timedim ' write(*,*)' Value returned by he5_zadefdim ', status write(1,*)'Define dimension Timedim ' write(1,*)' Value returned by he5_zadefdim ', status endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zadefine ! write(1,27) write(*,*)'Testing he5_zadefine ' write(*,*)'=====================' write(1,*)'Testing he5_zadefine ' write(1,*)'=====================' status=he5_zadefine(zaid,'SideA','DataXtrack,DataTrack', 1' ', HE5T_NATIVE_FLOAT) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Define data field SideA ' write(*,*)'Value returned by he5_zadefine ',status write(1,*)'Define data field SideA ' write(1,*)'Value returned by he5_zadefine ',status write(*,*)' ' write(1,*)' ' endif ! Test Case -- he5_zasetfill ! write(1,27) write(*,*)'Testing he5_zasetfill ' write(*,*)'=====================' write(1,*)'Testing he5_zasetfill ' write(1,*)'=====================' status= he5_zasetfill(zaid,'Temperature', 1HE5T_NATIVE_FLOAT, fillvalue) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_zasetfill(zaid,"Temperature", 1HE5T_NATIVE_FLOAT, fillvalue)' write(*,*)'Value returned by he5_zasetfill ',status write(1,*)'status=he5_zasetfill(zaid,"Temperature", 1HE5T_NATIVE_FLOAT, fillvalue)' write(1,*)'Value returned by he5_zasetfill ',status endif write(*,*)' ' write(1,*)' ' status=he5_zadefine(zaid,'Temperature', 1'DataXtrack,DataTrack',' ',HE5T_NATIVE_FLOAT) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Define data field Temperature ' write(*,*)'Value returned by he5_zadefine ',status write(1,*)'Define data field Temperature ' write(1,*)'Value returned by he5_zadefine ',status write(*,*)' ' write(1,*)' ' endif status= he5_zasetfill(zaid,'Conduction', 1HE5T_NATIVE_FLOAT,fillvalue) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_zasetfill(zaid,"Conduction", 1HE5T_NATIVE_FLOAT,fillvalue)' write(*,*)'Value returned by he5_zasetfill ',status write(1,*)'status=he5_zasetfill(zaid,"Conduction", 1HE5T_NATIVE_FLOAT,fillvalue)' write(1,*)'Value returned by he5_zasetfill ',status endif write(*,*)' ' write(1,*)' ' status=he5_zadefine(zaid,'Conduction', 1'DataXtrack,DataTrack',' ',HE5T_NATIVE_FLOAT) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_zadefine(zaid,"Conduction", 1"DataXtrack,DataTrack","",HE5T_NATIVE_FLOAT)' write(*,*)'Value returned by he5_zadefine ',status write(1,*)'status= he5_zadefine(zaid,"Conduction", 1"DataXtrack,DataTrack","",HE5T_NATIVE_FLOAT)' write(1,*)'Value returned by he5_zadefine ',status endif write(*,*)' ' write(1,*)' ' status=he5_zadefine(zaid2,'Sensor1', 1'DataXtrack,DataTrack',' ',HE5T_NATIVE_FLOAT) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_zadefine(zaid2, "Sensor1", 1"DataTrack,DataXtrack","",HE5T_NATIVE_FLOAT)' write(*,*)'Value returned by he5_zadefine ',status write(1,*)'status= he5_zadefine(zaid2, "Sensor1", 1"DataTrack,DataXtrack","",HE5T_NATIVE_FLOAT)' write(1,*)'Value returned by he5_zadefine ',status endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zadefchunk ! write(1,27) write(*,*)'Testing he5_zadefchunk' write(*,*)'======================' write(1,*)'Testing he5_zadefchunk' write(1,*)'======================' status=he5_zadefchunk(zaid,cnkrank,chunkdims) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_zadefchunk(zaid, cnkrank, chunkdims)' write(*,*)'Value returned by he5_zadefchunk ',status write(1,*)'status= he5_zadefchunk(zaid, cnkrank, chunkdims)' write(1,*)'Value returned by he5_zadefchunk ',status endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zadefcomp ! write(1,27) write(*,*)'Testing he5_zadefcomp' write(*,*)'=====================' write(1,*)'Testing he5_zadefcomp' write(1,*)'=====================' status=he5_zadefcomp(zaid,HE5_HDFE_COMP_DEFLATE,compparm) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_zadefcomp(zaid,HE5_HDFE_COMP_DEFLATE, 1compparm)' write(*,*)'Value returned by he5_zadefcomp ',status write(1,*)'status= he5_zadefcomp(zaid,HE5_HDFE_COMP_DEFLATE, 1compparm)' write(1,*)'Value returned by he5_zadefcomp ',status endif write(*,*)' ' write(1,*)' ' status=he5_zadefine(zaid,'CompChunk','DataTrack', 1' ',HE5T_NATIVE_FLOAT) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Define data field CompChunk ' write(*,*)'Value returned by he5_zadefine ',status write(1,*)'Define data field CompChunk ' write(1,*)'Value returned by he5_zadefine ',status write(*,*)' ' write(1,*)' ' endif ! Test Case -- he5_zadetach ! write(1,27) write(*,*)'Testing he5_zadetach ' write(*,*)'=====================' write(1,*)'Testing he5_zadetach ' write(1,*)'=====================' status=he5_zadetach(zaid) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_zadetach(zaid)' write(*,*)'Value returned by he5_zadetach ',status write(1,*)'status= he5_zadetach(zaid)' write(1,*)'Value returned by he5_zadetach ',status endif write(*,*)' ' write(1,*)' ' status=he5_zadetach(zaid2) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_zadetach(zaid2)' write(*,*)'Value returned by he5_zadetach ',status write(1,*)'status= he5_zadetach(zaid2)' write(1,*)'Value returned by he5_zadetach ',status endif write(*,*)' ' write(1,*)' ' zaid=he5_zaattach(zafid,'Simplef') if (zaid .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'zaid= he5_zaattach(zafid, "Simplef")' write(*,*)'Value returned by he5_zaattach ',zaid write(1,*)'zaid= he5_zaattach(zafid, "Simplef")' write(1,*)'Value returned by he5_zaattach ',zaid endif write(*,*)' ' write(1,*)' ' zaid2=he5_zaattach(zafid,'Indexedf') if (zaid2 .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'zaid2= he5_zaattach(zafid, "Indexedf")' write(*,*)'Value returned by he5_zaattach ',zaid2 write(1,*)'zaid2= he5_zaattach(zafid, "Indexedf")' write(1,*)'Value returned by he5_zaattach ',zaid2 endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zadetach ! write(1,27) write(*,*)'Testing he5_zadetach ' write(*,*)'=====================' write(1,*)'Testing he5_zadetach ' write(1,*)'=====================' status= he5_zadetach(zaid) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_zadetach(zaid)' write(*,*)'Value returned by he5_zadetach ',status write(1,*)'status= he5_zadetach(zaid)' write(1,*)'Value returned by he5_zadetach ',status endif write(*,*)' ' write(1,*)' ' status= he5_zadetach(zaid2) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_zadetach(zaid2)' write(*,*)'Value returned by he5_zadetach ',status write(1,*)'status= he5_zadetach(zaid2)' write(1,*)'Value returned by he5_zadetach ',status endif write(*,*)' ' write(1,*)' ' status=he5_zaclose(zafid) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_zaclose(zafid)' write(*,*)'Value returned by he5_zaclose ',status write(1,*)'status= he5_zaclose(zafid)' write(1,*)'Value returned by he5_zaclose ',status endif write(*,*)' ' write(1,*)' ' zafid=he5_zaopen('za.he5',HE5F_ACC_RDWR) if (zafid .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'zafid=he5_zaopen("za.he5",HE5F_ACC_RDWR)' write(*,*)'Value returned by he5_zaopen ',zafid write(1,*)'zafid=he5_zaopen("za.he5",HE5F_ACC_RDWR)' write(1,*)'Value returned by he5_zaopen ',zafid endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zaattach ! write(1,27) write(*,*)'Testing he5_zaattach ' write(*,*)'=====================' write(1,*)'Testing he5_zaattach ' write(1,*)'=====================' zaid=he5_zaattach(zafid,'Simplef') if (zaid .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'zaid= he5_zaattach(zafid, "Simplef")' write(*,*)'Value returned by he5_zaattach ',zaid write(1,*)'zaid= he5_zaattach(zafid, "Simplef")' write(1,*)'Value returned by he5_zaattach ',zaid endif write(*,*)' ' write(1,*)' ' zaid2=he5_zaattach(zafid,'Indexedf') if (zaid2 .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'zaid2= he5_zaattach(zafid, "Indexedf")' write(*,*)'Value returned by he5_zaattach ',zaid2 write(1,*)'zaid2= he5_zaattach(zafid, "Indexedf")' write(1,*)'Value returned by he5_zaattach ',zaid2 endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zawrite ! write(1,27) write(*,*)'Testing he5_zawrite ' write(*,*)'===================' write(1,*)'Testing he5_zawrite ' write(1,*)'===================' status=he5_zawrite(zaid,'SideA',sd_start,stride, 1rd_edge, ray4) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Write data field SideA ' write(*,*)'Value returned by he5_zawrite ',status write(1,*)'Write data field SideA ' write(1,*)'Value returned by he5_zawrite ',status endif write(*,*)' ' write(1,*)' ' status=he5_zawrite(zaid,'Temperature',start,stride, 1dataedge, ray4) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_zawrite(zaid,"Temperature",start, 1stride,dataedge, ray1)' write(*,*)'Value returned by he5_zawrite ',status write(1,*)'status=he5_zawrite(zaid,"Temperature",start, 1stride,dataedge, ray1)' write(1,*)'Value returned by he5_zawrite ',status endif write(*,*)' ' write(1,*)' ' status=he5_zawrite(zaid,'Conduction',start,stride, 1dataedge, ray2) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_zawrite(zaid,"Conduction",start, 1stride,dataedge, ray2)' write(*,*)'Value returned by he5_zawrite ',status write(1,*)'status=he5_zawrite(zaid,"Conduction",start, 1stride,dataedge, ray2)' write(1,*)'Value returned by he5_zawrite ',status endif write(*,*)' ' write(1,*)' ' iedge(1)=40 iedge(2)=40 status=he5_zawrite(zaid2,'Sensor1',istart,stride, 1iedge,ray3) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_zawrite(zaid2, "Sensor1", 1istart, stride, iedge, ray3)' write(*,*)'Value returned by he5_zawrite ',status write(1,*)'status= he5_zawrite(zaid2, "Sensor1", 1istart, stride, iedge, ray3)' write(1,*)'Value returned by he5_zawrite ',status endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zawrlattr ! write(1,27) write(*,*)'Testing he5_zawrlattr, Local Attribute ' write(*,*)'================================== ' write(1,*)'Testing he5_zawrlattr, Local Attribute ' write(1,*)'================================== ' status=he5_zawrlattr(zaid2,'Sensor1','local', 1HE5T_NATIVE_FLOAT,count,locattr) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_zawrlattr(zaid2,"Sensor1","local", 1HE5T_NATIVE_FLOAT,count,locattr)' write(*,*)'Value returned by he5_zawrlattr ',status write(1,*)'status=he5_zawrlattr(zaid2,"Sensor1", "local", 1HE5T_NATIVE_FLOAT,count,locattr)' write(1,*)'Value returned by he5_zawrlattr ',status endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zawrattr ! count(1) = 4 write(1,27) write(*,*)'Testing he5_zawrattr, Global Attribute ' write(*,*)'====================================== ' write(1,*)'Testing he5_zawrattr, Global Attribute ' write(1,*)'======================================= ' status=he5_zawrattr(zaid,'Drift',HE5T_NATIVE_INT,count, 1global_attr) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_zawrattr(zaid, "Drift", 1HE5T_NATIVE_INT, count, global_attr)' write(*,*)'Value returned by he5_zawrattr ',status write(1,*)'status=he5_zawrattr(zaid, "Drift", 1HE5T_NATIVE_INT, count, global_attr)' write(1,*)'Value returned by he5_zawrattr ',status endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zawrgattr ! count(1) = 3 write(1,27) write(*,*)'Testing he5_zawrgattr, Group Attribute ' write(*,*)'====================================== ' write(1,*)'Testing he5_zawrgattr, Group Attribute ' write(1,*)'====================================== ' status=he5_zawrgattr(zaid,'group',HE5T_NATIVE_FLOAT, 1count,grpattr) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_zawrgattr(zaid, "group", 1HE5T_NATIVE_FLOAT,count,grpgattr)' write(*,*)'Value returned by he5_zawrgattr ',status write(1,*)'status=he5_zawrgattr(zaid, "group", 1HE5T_NATIVE_FLOAT,count,grpattr)' write(1,*)'Value returned by he5_zawrgattr ',status endif write(*,*)' ' write(1,*)' ' status= he5_zadetach(zaid) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_zadetach(zaid)' write(*,*)'Value returned by he5_zadetach ',status write(1,*)'status= he5_zadetach(zaid)' write(1,*)'Value returned by he5_zadetach ',status endif write(*,*)' ' write(1,*)' ' status= he5_zadetach(zaid2) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_zadetach(zaid2)' write(*,*)'Value returned by he5_zadetach ',status write(1,*)'status= he5_zadetach(zaid2)' write(1,*)'Value returned by he5_zadetach ',status endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zaclose ! write(1,27) write(*,*)'Testing he5_zaclose ' write(*,*)'===================' write(1,*)'Testing he5_zaclose ' write(1,*)'===================' status= he5_zaclose(zafid) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Value returned by he5_zaclose ',status write(1,*)'status= he5_zaclose(zafid)' write(1,*)'Value returned by he5_zaclose ',status endif write(*,*)' ' write(1,*)' ' zafid= he5_zaopen('za.he5',HE5F_ACC_RDWR) if (zafid .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'zafid= he5_zaopen("za.he5",HE5F_ACC_RDWR)' write(*,*)'Value returned by he5_zaopen ', zafid write(1,*)'zafid= he5_zaopen("za.he5",HE5F_ACC_RDWR)' write(1,*)'Value returned by he5_zaopen ', zafid endif write(*,*)' ' write(1,*)' ' zaid= he5_zaattach(zafid,'Simplef') if (zaid .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'zaid= he5_zaattach(zafid, "Simplef")' write(*,*)'Value returned by he5_zaattach ',zaid write(1,*)'zaid= he5_zaattach(zafid, "Simplef")' write(1,*)'Value returned by he5_zaattach ',zaid endif write(*,*)' ' write(1,*)' ' status= he5_zadetach(zaid) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_zadetach(zaid)' write(*,*)'Value returned by he5_zadetach ',status write(1,*)'status= he5_zadetach(zaid)' write(1,*)'Value returned by he5_zadetach ',status endif write(*,*)' ' write(1,*)' ' status= he5_zaclose(zafid) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_zaclose(zafid)' write(*,*)'Value returned by he5_zaclose ',status write(1,*)'status= he5_zaclose(zafid)' write(1,*)'Value returned by he5_zaclose ',status endif write(*,*)' ' write(1,*)' ' zafid= he5_zaopen('za.he5',HE5F_ACC_RDWR) if (zafid .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'zafid= he5_zaopen("za.he5",HE5F_ACC_RDWR)' write(*,*)'Value returned by he5_zaopen ',zafid write(1,*)'zafid= he5_zaopen("za.he5",HE5F_ACC_RDWR)' write(1,*)'Value returned by he5_zaopen ',zafid endif write(*,*)' ' write(1,*)' ' zaid=he5_zaattach(zafid,'Simplef') if (zaid .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'zaid= he5_zaattach(zafid, "Simplef")' write(*,*)'Value returned by he5_zaattach ',zaid write(1,*)'zaid= he5_zaattach(zafid, "Simplef")' write(1,*)'Value returned by he5_zaattach ',zaid endif write(*,*)' ' write(1,*)' ' zaid2=he5_zaattach(zafid,'Indexedf') if (zaid2 .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'zaid2= he5_zaattach(zafid, "Indexedf")' write(*,*)'Value returned by he5_zaattach ',zaid2 write(1,*)'zaid2= he5_zaattach(zafid, "Indexedf")' write(1,*)'Value returned by he5_zaattach ',zaid2 endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zanentries ! write(1,27) write(*,*)'Testing he5_zanentries ' write(*,*)'=====================' write(1,*)'Testing he5_zanentries ' write(1,*)'=====================' nmaps=he5_zanentries(zaid,1,strbufsize) if (nmaps .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'nmaps= he5_zanentries(zaid, 1, strbufsize)' write(*,*)'Number of dimension mappings ',nmaps write(*,*)'Size of strbufsize ',strbufsize write(1,*)'nmaps= he5_zanentries(zaid, 1, strbufsize)' write(1,*)'Number of dimension mappings ',nmaps write(1,*)'Size of strbufsize ',strbufsize endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zainqdims ! write(1,27) write(*,*)'Testing he5_zainqdims ' write(*,*)'=====================' write(1,*)'Testing he5_zainqdims ' write(1,*)'=====================' ndims=he5_zainqdims(zaid,dimname,dims) if (ndims .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'ndims= he5_zainqdims(zaid, dimname, dims)' write(*,*)'Number of dimesions ',ndims write(*,*)'Names of dimensions ',dimname write(*,*)'Size of dimensions ',dims write(1,*)'ndims= he5_zainqdims(zaid, dimname, dims)' write(1,*)'Number of dimesions ',ndims write(1,*)'Names of dimensions ',dimname write(1,*)'Size of dimensions ',dims endif write(*,*)' ' write(1,*)' ' ndims= he5_zainqdims(zaid2, dimname, dims2) if (ndims .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'ndims=he5_zainqdims(zaid2,dimname,dims2)' write(*,*)'Number of dimesions ',ndims write(*,*)'Names of dimensions ',dimname write(*,*)'Size of dimensions ',dims2 write(1,*)'ndims=he5_zainqdims(zaid2,dimname,dims2)' write(1,*)'Number of dimesions ',ndims write(1,*)'Names of dimensions ',dimname write(1,*)'Size of dimensions ',dims2 endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zainquire ! write(1,27) write(*,*)'Testing he5_zainquire ' write(*,*)'======================' write(1,*)'Testing he5_zainquire ' write(1,*)'======================' nflds=he5_zainquire(zaid,fieldlist,rnkd,ntyped) if (nflds .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'nflds=he5_zainquire(zaid,fieldlist,rnkd,ntyped)' write(*,*)'Number of data fields in za ',nflds write(*,*)'Names of data fields ',fieldlist write(*,*)'Rank of fields ',rnkd write(*,*)'Number type of fields ',ntyped write(1,*)'nflds=he5_zainquire(zaid,fieldlist,rnkd,ntyped)' write(1,*)'Number of data fields in za ',nflds write(1,*)'Names of data fields ',fieldlist write(1,*)'Rank of fields ',rnkd write(1,*)'Number type of fields ',ntyped endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zadiminfo ! write(1,27) write(*,*)'Testing he5_zadiminfo ' write(*,*)'=====================' write(1,*)'Testing he5_zadiminfo ' write(1,*)'=====================' dimsize= he5_zadiminfo(zaid,'DataTrack') if (dimsize .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'dimsize= he5_zadiminfo(zaid, "DataTrack")' write(*,*)'Size of dimension DataTrack ',dimsize write(1,*)'dimsize= he5_zadiminfo(zaid, "DataTrack")' write(1,*)'Size of dimension DataTrack ',dimsize write(*,*)' ' write(1,*)' ' endif ! Test Case -- he5_zaread ! write(1,27) write(*,*)'Testing he5_zaread ' write(*,*)'===================' write(1,*)'Testing he5_zaread ' write(1,*)'===================' rd_start(1)=0 rd_start(2)=0 rd_stride(1)=1 rd_stride(2)=1 rd_edge(1)=40 rd_edge(2)=100 status= he5_zaread(zaid,'Conduction',rd_start, 1rd_stride,rd_edge,temp) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Value returned by he5_zaread ',status write(*,*)'status= he5_zaread(zaid, "Conduction", 1rd_start,rd_stride, rd_edge, temp)' write(1,*)'status= he5_zaread(zaid, "Conduction", 1rd_start,rd_stride, rd_edge, temp)' write(1,*)'Value returned by he5_zaread ',status do 190 index1=10,15 do 180 index2=10,15 write(*,*)'value of conduction ',temp(index1,index2) write(1,*)'value of conduction ',temp(index1,index2) 180 continue 190 continue endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zainfo ! write(1,27) write(*,*)'Testing he5_zainfo ' write(*,*)'=====================' write(1,*)'Testing he5_zainfo ' write(1,*)'=====================' status=he5_zainfo(zaid,'SideA',rank,sddims,nt, 1dimens,maxdims) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_zainfo(zaid, "SideA", 1rank, sddims, nt, dimens, maxdims)' write(*,*)'Value returned by he5_zainfo ',status write(*,*)'Rank of field sideA ',rank write(*,*)'dimension list of field sideA ',dimens write(*,*)'Size of sideA dimensions ',sddims write(*,*)'number type of field sideA ',nt write(1,*)'status= he5_zainfo(zaid, "SideA", 1rank, sddims, nt, dimens, maxdims)' write(1,*)'Value returned by he5_zainfo ',status write(1,*)'Rank of field sideA ',rank write(1,*)'dimension list of field sideA ',dimens write(1,*)'Size of sideA dimensions ',sddims write(1,*)'number type of field sideA ',nt endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zainqattrs ! write(1,27) write(*,*)'Testing he5_zainqattrs Global attributes ' write(*,*)'==================================== ' write(1,*)'Testing he5_zainqattrs Global attributes ' write(1,*)'==================================== ' nattr = he5_zainqattrs(zaid,attrlist,strbufsz2) if (nattr .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Number of global attributes in za ',nattr write(*,*)'Attribute list of za ',attrlist write(1,*)'Number of global attributes in za ',nattr write(1,*)'Attribute list of za ',attrlist write(*,*)' ' write(1,*)' ' endif ! Test Case -- he5_zaattrinfo ! write(1,27) write(*,*)'Testing he5_zaattrinfo Global attribute' write(*,*)'=======================================' write(1,*)'Testing he5_zaattrinfo Global attribute' write(1,*)'=======================================' status= he5_zaattrinfo(zaid, attrlist, n, size) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_zaattrinfo(zaid,attrlist,n,size)' write(*,*)'Value returned by he5_zaattrinfo ',status write(*,*)'Number type of attributes ',n,' Size ',size write(1,*)'status=he5_zaattrinfo(zaid,attrlist,n,size)' write(1,*)'Value returned by he5_zaattrinfo ',status write(1,*)'Number type of attributes ',n,' Size ',size endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zardattr ! write(1,27) write(*,*)'Testing he5_zardattr, Global attribute ' write(*,*)'======================================' write(1,*)'Testing he5_zardattr, Global attribute ' write(1,*)'======================================' status= he5_zardattr(zaid, attrlist, rdattr) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_zardattr(zaid,attrlist,rdattr)' write(*,*)'Value returned by he5_zardattr ',status write(*,*)'attribute ',rdattr write(1,*)'status=he5_zardattr(zaid,attrlist,rdattr)' write(1,*)'Value returned by he5_zardattr ',status write(1,*)'attribute ',rdattr endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zainqgattrs ! write(1,27) write(*,*)'Testing he5_zainqgattrs Group attributes ' write(*,*)'==================================== ' write(1,*)'Testing he5_zainqgattrs Group attributes ' write(1,*)'==================================== ' nattr = he5_zainqgattrs(zaid,attrlist,strbufsz2) if (nattr .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Number of group attributes in za ',nattr write(*,*)'Attribute list of za ',attrlist write(1,*)'Number of group attributes in za ',nattr write(1,*)'Attribute list of za ',attrlist write(*,*)' ' write(1,*)' ' endif ! Test Case -- he5_zagattrinfo ! write(1,27) write(*,*)'Testing he5_zagattrinfo Group attribute' write(*,*)'=======================================' write(1,*)'Testing he5_zagattrinfo Group attribute' write(1,*)'=======================================' status= he5_zagattrinfo(zaid, attrlist, n, size) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_zagattrinfo(zaid,attrlist,n,size)' write(*,*)'Value returned by he5_zagattrinfo ',status write(*,*)'Number type of attributes ',n,' Size ',size write(1,*)'status=he5_zagattrinfo(zaid,attrlist,n,size)' write(1,*)'Value returned by he5_zagattrinfo ',status write(1,*)'Number type of attributes ',n,' Size ',size endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zardgattr ! write(1,27) write(*,*)'Testing he5_zardgattr, Group attribute ' write(*,*)'======================================' write(1,*)'Testing he5_zardgattr, Group attribute ' write(1,*)'======================================' status= he5_zardgattr(zaid,'group',rdgnlattr) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_zardgattr(zaid,attrlist,rdgnlattr)' write(*,*)'Value returned by he5_zardgattr ',status write(*,*)'attribute ',rdgnlattr write(1,*)'status=he5_zardgattr(zaid,attrlist,rdgnlattr)' write(1,*)'Value returned by he5_zardgattr ',status write(1,*)'attribute ',rdgnlattr endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zainqlattrs ! write(1,27) write(*,*)'Testing he5_zainqlattrs Local attributes ' write(*,*)'==================================== ' write(1,*)'Testing he5_zainqlattrs Local attributes ' write(1,*)'==================================== ' nattr=he5_zainqlattrs(zaid2,'Sensor1',attrlist,strbufsz2) if (nattr .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'zainqlattrs(... "Sensor1" ...)' write(*,*)'Number of local attributes in field ',nattr write(*,*)'Attribute list of field ',attrlist write(1,*)'zainqlattrs(... "Sensor1" ...)' write(1,*)'Number of local attributes in field ',nattr write(1,*)'Attribute list of field ',attrlist write(*,*)' ' write(1,*)' ' endif ! Test Case -- he5_zalattrinfo ! write(1,27) write(*,*)'Testing he5_zalattrinfo Local attribute' write(*,*)'=======================================' write(1,*)'Testing he5_zalattrinfo Local attribute' write(1,*)'=======================================' status=he5_zalattrinfo(zaid2,'Sensor1','local',n,size) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'zalattrinfo(... "Sensor1" ...)' write(*,*)'Value returned by he5_zalattrinfo ',status write(*,*)'Number type of attributes ',n,' Size ',size write(1,*)'zalattrinfo(... "Sensor1" ...)' write(1,*)'Value returned by he5_zalattrinfo ',status write(1,*)'Number type of attributes ',n,' Size ',size endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zaidtype ! write(1,27) write(*,*)'Testing he5_zaidtype, Inquire Datatype ' write(*,*)'=======================================' write(1,*)'Testing he5_zaidtype, Inquire Datatype ' write(1,*)'=======================================' status= he5_zaidtype(zaid2,'Sensor1','local', 1HE5_HDFE_LOCATTRGROUP,dtype,classid, order, size) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_zaidtype(zaid2,"Sensor1","local", 1HE5_HDFE_LOCATTRGROUP,dtype, classid, order, size)' write(*,*)'Value returned by he5_zaidtype ',status write(*,*)'Datatype of local attribute ',dtype write(*,*)'Class id and order ',classid, order write(*,*)'Size of attribute ',size write(1,*)'status= he5_zaidtype(zaid2,"Sensor1","local", 1HE5_HDFE_LOCATTRGROUP,dtype, classid, order, size)' write(1,*)'Value returned by he5_zaidtype ',status write(1,*)'Datatype of local attribute ',dtype write(1,*)'Class id and order ',classid, order write(1,*)'Size of attribute ',size endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zardlattr ! write(1,27) write(*,*)'Testing he5_zardlattr, Local attribute ' write(*,*)'======================================' write(1,*)'Testing he5_zardlattr, Local attribute ' write(1,*)'======================================' status=he5_zardlattr(zaid2,'Sensor1','local',rdgnlattr) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_zardlattr(zaid2,"Sensor1","local", 1rdgnlattr)' write(*,*)'Value returned by he5_zardlattr ',status write(*,*)'attribute ',rdgnlattr write(1,*)'status=he5_zardlattr(zaid2,"Sensor1","local", 1rdgnlattr)' write(1,*)'Value returned by he5_zardlattr ',status write(1,*)'attribute ',rdgnlattr endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zagetfill ! write(1,27) write(*,*)'Testing he5_zagetfill ' write(*,*)'=====================' write(1,*)'Testing he5_zagetfill ' write(1,*)'=====================' status= he5_zagetfill(zaid,'Conduction', rdfilval) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_zagetfill(zaid,"Conduction",rdfilval)' write(*,*)'Value returned by he5_zagetfill ',status write(*,*)'Value of fill ',rdfilval write(1,*)'status=he5_zagetfill(zaid,"Conduction",rdfilval)' write(1,*)'Value returned by he5_zagetfill ',status write(1,*)'Value of fill ',rdfilval endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zacompinfo ! write(1,27) write(*,*)'Testing he5_zacompinfo ' write(*,*)'=======================' write(1,*)'Testing he5_zacompinfo ' write(1,*)'=======================' status=he5_zacompinfo(zaid,'CompChunk',compcode,rdcompparm) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_zacompinfo(zaid,"CompChunk",compcode, 1rdcompparm)' write(*,*)'Status returned by he5_zacompinfo ',status write(*,*)'Compression code ',compcode write(*,*)'Compression parameter ',rdcompparm(1) write(1,*)'status=he5_zacompinfo(zaid,"CompChunk",compcode, 1rdcompparm)' write(1,*)'Status returned by he5_zacompinfo ',status write(1,*)'Compression code ',compcode write(1,*)'Compression parameter ',rdcompparm(1) endif write(*,*)' ' write(1,*)' ' status= he5_zadetach(zaid) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_zadetach(zaid)' write(*,*)'Value returned by he5_zadetach ',status write(1,*)'status= he5_zadetach(zaid)' write(1,*)'Value returned by he5_zadetach ',status endif write(*,*)' ' write(1,*)' ' status= he5_zadetach(zaid2) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_zadetach(zaid2)' write(*,*)'Value returned by he5_zadetach ',status write(1,*)'status= he5_zadetach(zaid2)' write(1,*)'Value returned by he5_zadetach ',status endif write(*,*)' ' write(1,*)' ' status= he5_zaclose(zafid) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_zaclose(zafid)' write(*,*)'Value returned by he5_zaclose ',status write(1,*)'status= he5_zaclose(zafid)' write(1,*)'Value returned by he5_zaclose ',status endif write(*,*)' ' write(1,*)' ' zafid=he5_zaopen('za.he5',HE5F_ACC_RDWR) if (zafid .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'zafid=he5_zaopen("za.he5",HE5F_ACC_RDWR)' write(*,*)'Value returned by he5_zaopen ',zafid write(1,*)'zafid=he5_zaopen("za.he5",HE5F_ACC_RDWR)' write(1,*)'Value returned by he5_zaopen ',zafid endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zainqza ! write(1,27) write(*,*)'Testing he5_zainqza ' write(*,*)'======================' write(1,*)'Testing he5_zainqza ' write(1,*)'======================' nza=he5_zainqza('za.he5',zalist,strbufsz2) if (nza .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Retrieve information on zas in 1file za.he5' write(*,*)'Number of zas in file ', nza write(*,*)'List of zas ',zalist write(1,*)'Retrieve information on zas in 1file za.he5' write(1,*)'Number of zas in file ', nza write(1,*)'List of zas ',zalist endif write(*,*)' ' write(1,*)' ' status=he5_zaclose(zafid) if (status .lt. 0) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_zaclose(zafid)' write(*,*)'Value returned by he5_zaclose ',status write(1,*)'status= he5_zaclose(zafid)' write(1,*)'Value returned by he5_zaclose ',status endif write(*,*)' ' write(1,*)' ' close(unit=1) 27 format(' ') stop end hdf-eos5-2.0/testdrivers/za/testza64.f000077500000000000000000001520331507520047200176210ustar00rootroot00000000000000!---------------------------------------------------------------------------- ! Copyright (C) 2002 Emergent IT Inc. and Raytheon Systems Company | !---------------------------------------------------------------------------- ! testza64.f | ! In this program we create, define and write a simple za hdfeos file | ! using the za interface | !---------------------------------------------------------------------------- program testza64 implicit none include 'hdfeos5.inc' integer status integer index1 integer index2 integer zafid integer zaid integer zaid2 integer rank integer n, nt integer dtype integer classid integer order integer rdattr(4) integer global_attr(4) integer compparm(5) integer cnkrank integer rdcompparm(5) integer compcode integer ntyped(4) integer rnkd(4) integer he5_zaopen integer he5_zacreate integer he5_zaattach integer he5_zadefdim integer he5_zadefine integer he5_zadefchunk integer he5_zadefcomp integer he5_zasetfill integer he5_zawrattr integer he5_zawrlattr integer he5_zawrite integer he5_zaread integer he5_zawrgattr integer he5_zardattr integer he5_zardgattr integer he5_zardlattr integer he5_zainfo integer he5_zacompinfo integer he5_zaattrinfo integer he5_zagattrinfo integer he5_zalattrinfo integer he5_zagetfill integer he5_zaidtype integer he5_zadetach integer he5_zaclose integer*8 he5_zainqza integer*8 he5_zanentries integer*8 he5_zainqdims integer*8 he5_zadiminfo integer*8 he5_zainqattrs integer*8 he5_zainqgattrs integer*8 he5_zainqlattrs integer*8 he5_zainquire integer*8 size integer*8 strbufsize integer*8 ndims integer*8 chunkdims(1) integer*8 start(2) integer*8 stride(2) integer*8 dataedge(2) integer*8 istart(2) integer*8 iedge(2) integer*8 dedge(2) integer*8 sd_start(2) integer*8 sd_stride(2) integer*8 sd_edge(2) integer*8 rd_start(2) integer*8 rd_stride(2) integer*8 rd_edge(2) integer*8 dimsize integer*8 nattr integer*8 nza integer*8 nmaps integer*8 strbufsz2 integer*8 nflds integer*8 count(1) integer*8 zero integer*8 dims(2) integer*8 dims2(3) integer*8 sddims(2) integer*8 dim1 integer*8 dim2 integer*8 dim3 integer*8 dim4 real grpattr(3) real locattr(3) real rdgnlattr(3) real ray1(100,40) real ray2(40,100) real ray4(40,100) real ray3(40,40) real temp(40,100) real raycnt real fillvalue real rdfilval real tempbuf(4200) character*(256) dimname character*(256) fieldlist character*(256) attrlist character*(256) zalist character*(256) dimens character*(256) maxdims dim1 = 30 dim2 = 40 dim3 = 50 dim4 = 100 count(1) = 3 compparm(1) = 6 compparm(2) = 0 compparm(3) = 0 compparm(4) = 0 compparm(5) = 0 cnkrank = 1 chunkdims(1) = 10 rdcompparm(1) = 1 rdcompparm(2) = 1 rdcompparm(3) = 1 rdcompparm(4) = 1 rdcompparm(5) = 1 compcode = -1 raycnt = -799.0 global_attr(1)= 11 global_attr(2)= 33 global_attr(3)= 66 global_attr(4)= 99 grpattr(1) = 21.7 grpattr(2) = 24.3 grpattr(3) = 26.3 locattr(3) = 21.7 locattr(2) = 24.3 locattr(1) = 26.3 start(1) = 10 start(2) = 10 stride(1) = 1 stride(2) = 1 sd_start(1) = 0 sd_start(2) = 0 sd_stride(1) = 1 sd_stride(2) = 1 sd_edge(1) = 100 sd_edge(2) = 40 rd_start(1) = 0 rd_start(2) = 0 rd_stride(1) = 1 rd_stride(2) = 1 rd_edge(1) = 40 rd_edge(2) = 100 dataedge(1) = 20 dataedge(2) = 50 istart(1) = 0 istart(2) = 0 iedge(1) = 30 iedge(2) = 30 dedge(1) = 40 dedge(2) = 40 rank = 2 fillvalue = 16.0 zero = 0 ! ! This section of the program just fills some arrays with data that will be ! used later in the program ! do 110 index1=1,100 do 100 index2=1,40 ray1(index1, index2)=raycnt ray2(index2, index1)=raycnt + 1.0 ray4(index2,index1) = raycnt raycnt = raycnt +1. 100 continue 110 continue do 170 index1=1,40 do 160 index2=1,40 ray3(index1, index2)=raycnt raycnt = raycnt+1.25 160 continue 170 continue 230 format('********Error unexpected**********') 240 format('***********Passed Test*********') open(unit=1, file="testza64_f.txtout", status = "UNKNOWN") write(*,*)'Testing he5_za FORTRAN 77 interface' write(*,*)'======================================' write(1,*)'Testing he5_za FORTRAN 77 interface' write(1,*)'======================================' write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zaopen ! write(*,*)'Testing he5_zaopen ' write(*,*)'=====================' write(1,*)'Testing he5_zaopen ' write(1,*)'=====================' zafid=he5_zaopen('za.he5',HE5F_ACC_TRUNC) if (zafid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' zafid= he5_zaopen("za.he5",HE5F_ACC_TRUNC)' write(*,*)' Value returned by he5_zaopen ', zafid write(1,*)' zafid= he5_zaopen("za.he5",HE5F_ACC_TRUNC)' write(1,*)' Value returned by he5_zaopen ', zafid endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zacreate ! write(1,27) write(*,*)'Testing he5_zacreate ' write(*,*)'=====================' write(1,*)'Testing he5_zacreate ' write(1,*)'=====================' zaid=he5_zacreate(zafid,'Simplef') if (zaid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'zaid=he5_zacreate(zafid, "Simplef")' write(*,*)'Value returned by he5_zacreate ', zaid write(1,*)'zaid= he5_zacreate(zafid, "Simplef")' write(1,*)'Value returned by he5_zacreate ', zaid endif write(*,*)' ' write(1,*)' ' zaid2=he5_zacreate(zafid,'Indexedf') if (zaid2 .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'zaid2= he5_zacreate(zafid, "Indexedf")' write(*,*)'Value returned by he5_zacreate ', zaid2 write(1,*)'zaid2= he5_zacreate(zafid, "Indexedf")' write(1,*)'Value returned by he5_zacreate ', zaid2 endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zadefdim ! write(1,27) write(*,*)'Testing he5_zadefdim ' write(*,*)'=====================' write(1,*)'Testing he5_zadefdim ' write(1,*)'=====================' status=he5_zadefdim(zaid,'DataTrack',dim4) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status= he5_zadefdim(zaid, "DataTrack", 100)' write(*,*)' Value returned by he5_zadefdim ',status write(1,*)' status= he5_zadefdim(zaid, "DataTrack", 100)' write(1,*)' Value returned by he5_zadefdim ',status endif write(*,*)' ' write(1,*)' ' status=he5_zadefdim(zaid,'DataXtrack',dim2) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status= he5_zadefdim(zaid, "DataXtrack", 40)' write(*,*)' Value returned by he5_zadefdim ',status write(1,*)' status= he5_zadefdim(zaid, "DataXtrack", 40)' write(1,*)' Value returned by he5_zadefdim ',status endif write(*,*)' ' write(1,*)' ' status=he5_zadefdim(zaid2,'DataTrack',dim2) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status= he5_zadefdim(zaid2, "DataTrack", 40)' write(*,*)' Value returned by he5_zadefdim ', status write(1,*)' status= he5_zadefdim(zaid2, "DataTrack", 40)' write(1,*)' Value returned by he5_zadefdim ', status endif write(*,*)' ' write(1,*)' ' status=he5_zadefdim(zaid2,'DataXtrack',dim2) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)' status= he5_zadefdim(zaid2, "DataXtrack", 40)' write(*,*)' Value returned by he5_zadefdim ', status write(1,*)' status= he5_zadefdim(zaid2, "DataXtrack", 40)' write(1,*)' Value returned by he5_zadefdim ', status endif write(*,*)' ' write(1,*)' ' status=he5_zadefdim(zaid2,'Timedim',dim2) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Define dimension Timedim ' write(*,*)' Value returned by he5_zadefdim ', status write(1,*)'Define dimension Timedim ' write(1,*)' Value returned by he5_zadefdim ', status endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zadefine ! write(1,27) write(*,*)'Testing he5_zadefine ' write(*,*)'=====================' write(1,*)'Testing he5_zadefine ' write(1,*)'=====================' status=he5_zadefine(zaid,'SideA','DataXtrack,DataTrack', 1' ', HE5T_NATIVE_FLOAT) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Define data field SideA ' write(*,*)'Value returned by he5_zadefine ',status write(1,*)'Define data field SideA ' write(1,*)'Value returned by he5_zadefine ',status write(*,*)' ' write(1,*)' ' endif ! Test Case -- he5_zasetfill ! write(1,27) write(*,*)'Testing he5_zasetfill ' write(*,*)'=====================' write(1,*)'Testing he5_zasetfill ' write(1,*)'=====================' status= he5_zasetfill(zaid,'Temperature', 1HE5T_NATIVE_FLOAT, fillvalue) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_zasetfill(zaid,"Temperature", 1HE5T_NATIVE_FLOAT, fillvalue)' write(*,*)'Value returned by he5_zasetfill ',status write(1,*)'status=he5_zasetfill(zaid,"Temperature", 1HE5T_NATIVE_FLOAT, fillvalue)' write(1,*)'Value returned by he5_zasetfill ',status endif write(*,*)' ' write(1,*)' ' status=he5_zadefine(zaid,'Temperature', 1'DataXtrack,DataTrack',' ',HE5T_NATIVE_FLOAT) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Define data field Temperature ' write(*,*)'Value returned by he5_zadefine ',status write(1,*)'Define data field Temperature ' write(1,*)'Value returned by he5_zadefine ',status write(*,*)' ' write(1,*)' ' endif status= he5_zasetfill(zaid,'Conduction', 1HE5T_NATIVE_FLOAT,fillvalue) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_zasetfill(zaid,"Conduction", 1HE5T_NATIVE_FLOAT,fillvalue)' write(*,*)'Value returned by he5_zasetfill ',status write(1,*)'status=he5_zasetfill(zaid,"Conduction", 1HE5T_NATIVE_FLOAT,fillvalue)' write(1,*)'Value returned by he5_zasetfill ',status endif write(*,*)' ' write(1,*)' ' status=he5_zadefine(zaid,'Conduction', 1'DataXtrack,DataTrack',' ',HE5T_NATIVE_FLOAT) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_zadefine(zaid,"Conduction", 1"DataXtrack,DataTrack","",HE5T_NATIVE_FLOAT)' write(*,*)'Value returned by he5_zadefine ',status write(1,*)'status= he5_zadefine(zaid,"Conduction", 1"DataXtrack,DataTrack","",HE5T_NATIVE_FLOAT)' write(1,*)'Value returned by he5_zadefine ',status endif write(*,*)' ' write(1,*)' ' status=he5_zadefine(zaid2,'Sensor1', 1'DataXtrack,DataTrack',' ',HE5T_NATIVE_FLOAT) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_zadefine(zaid2, "Sensor1", 1"DataTrack,DataXtrack","",HE5T_NATIVE_FLOAT)' write(*,*)'Value returned by he5_zadefine ',status write(1,*)'status= he5_zadefine(zaid2, "Sensor1", 1"DataTrack,DataXtrack","",HE5T_NATIVE_FLOAT)' write(1,*)'Value returned by he5_zadefine ',status endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zadefchunk ! write(1,27) write(*,*)'Testing he5_zadefchunk' write(*,*)'======================' write(1,*)'Testing he5_zadefchunk' write(1,*)'======================' status=he5_zadefchunk(zaid,cnkrank,chunkdims) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_zadefchunk(zaid, cnkrank, chunkdims)' write(*,*)'Value returned by he5_zadefchunk ',status write(1,*)'status= he5_zadefchunk(zaid, cnkrank, chunkdims)' write(1,*)'Value returned by he5_zadefchunk ',status endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zadefcomp ! write(1,27) write(*,*)'Testing he5_zadefcomp' write(*,*)'=====================' write(1,*)'Testing he5_zadefcomp' write(1,*)'=====================' status=he5_zadefcomp(zaid,HE5_HDFE_COMP_DEFLATE,compparm) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_zadefcomp(zaid,HE5_HDFE_COMP_DEFLATE, 1compparm)' write(*,*)'Value returned by he5_zadefcomp ',status write(1,*)'status= he5_zadefcomp(zaid,HE5_HDFE_COMP_DEFLATE, 1compparm)' write(1,*)'Value returned by he5_zadefcomp ',status endif write(*,*)' ' write(1,*)' ' status=he5_zadefine(zaid,'CompChunk','DataTrack', 1' ',HE5T_NATIVE_FLOAT) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Define data field CompChunk ' write(*,*)'Value returned by he5_zadefine ',status write(1,*)'Define data field CompChunk ' write(1,*)'Value returned by he5_zadefine ',status write(*,*)' ' write(1,*)' ' endif ! Test Case -- he5_zadetach ! write(1,27) write(*,*)'Testing he5_zadetach ' write(*,*)'=====================' write(1,*)'Testing he5_zadetach ' write(1,*)'=====================' status=he5_zadetach(zaid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_zadetach(zaid)' write(*,*)'Value returned by he5_zadetach ',status write(1,*)'status= he5_zadetach(zaid)' write(1,*)'Value returned by he5_zadetach ',status endif write(*,*)' ' write(1,*)' ' status=he5_zadetach(zaid2) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_zadetach(zaid2)' write(*,*)'Value returned by he5_zadetach ',status write(1,*)'status= he5_zadetach(zaid2)' write(1,*)'Value returned by he5_zadetach ',status endif write(*,*)' ' write(1,*)' ' zaid=he5_zaattach(zafid,'Simplef') if (zaid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'zaid= he5_zaattach(zafid, "Simplef")' write(*,*)'Value returned by he5_zaattach ',zaid write(1,*)'zaid= he5_zaattach(zafid, "Simplef")' write(1,*)'Value returned by he5_zaattach ',zaid endif write(*,*)' ' write(1,*)' ' zaid2=he5_zaattach(zafid,'Indexedf') if (zaid2 .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'zaid2= he5_zaattach(zafid, "Indexedf")' write(*,*)'Value returned by he5_zaattach ',zaid2 write(1,*)'zaid2= he5_zaattach(zafid, "Indexedf")' write(1,*)'Value returned by he5_zaattach ',zaid2 endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zadetach ! write(1,27) write(*,*)'Testing he5_zadetach ' write(*,*)'=====================' write(1,*)'Testing he5_zadetach ' write(1,*)'=====================' status= he5_zadetach(zaid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_zadetach(zaid)' write(*,*)'Value returned by he5_zadetach ',status write(1,*)'status= he5_zadetach(zaid)' write(1,*)'Value returned by he5_zadetach ',status endif write(*,*)' ' write(1,*)' ' status= he5_zadetach(zaid2) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_zadetach(zaid2)' write(*,*)'Value returned by he5_zadetach ',status write(1,*)'status= he5_zadetach(zaid2)' write(1,*)'Value returned by he5_zadetach ',status endif write(*,*)' ' write(1,*)' ' status= he5_zaclose(zafid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_zaclose(zafid)' write(*,*)'Value returned by he5_zaclose ',status write(1,*)'status= he5_zaclose(zafid)' write(1,*)'Value returned by he5_zaclose ',status endif write(*,*)' ' write(1,*)' ' zafid=he5_zaopen('za.he5',HE5F_ACC_RDWR) if (zafid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'zafid=he5_zaopen("za.he5",HE5F_ACC_RDWR)' write(*,*)'Value returned by he5_zaopen ',zafid write(1,*)'zafid=he5_zaopen("za.he5",HE5F_ACC_RDWR)' write(1,*)'Value returned by he5_zaopen ',zafid endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zaattach ! write(1,27) write(*,*)'Testing he5_zaattach ' write(*,*)'=====================' write(1,*)'Testing he5_zaattach ' write(1,*)'=====================' zaid=he5_zaattach(zafid,'Simplef') if (zaid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'zaid= he5_zaattach(zafid, "Simplef")' write(*,*)'Value returned by he5_zaattach ',zaid write(1,*)'zaid= he5_zaattach(zafid, "Simplef")' write(1,*)'Value returned by he5_zaattach ',zaid endif write(*,*)' ' write(1,*)' ' zaid2=he5_zaattach(zafid,'Indexedf') if (zaid2 .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'zaid2= he5_zaattach(zafid, "Indexedf")' write(*,*)'Value returned by he5_zaattach ',zaid2 write(1,*)'zaid2= he5_zaattach(zafid, "Indexedf")' write(1,*)'Value returned by he5_zaattach ',zaid2 endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zawrite ! write(1,27) write(*,*)'Testing he5_zawrite ' write(*,*)'===================' write(1,*)'Testing he5_zawrite ' write(1,*)'===================' status=he5_zawrite(zaid,'SideA',sd_start,stride, 1rd_edge, ray4) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Write data field SideA ' write(*,*)'Value returned by he5_zawrite ',status write(1,*)'Write data field SideA ' write(1,*)'Value returned by he5_zawrite ',status endif write(*,*)' ' write(1,*)' ' status=he5_zawrite(zaid,'Temperature',start,stride, 1dataedge, ray4) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_zawrite(zaid,"Temperature",start, 1stride,dataedge, ray1)' write(*,*)'Value returned by he5_zawrite ',status write(1,*)'status=he5_zawrite(zaid,"Temperature",start, 1stride,dataedge, ray1)' write(1,*)'Value returned by he5_zawrite ',status endif write(*,*)' ' write(1,*)' ' status=he5_zawrite(zaid,'Conduction',start,stride, 1dataedge, ray2) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_zawrite(zaid,"Conduction",start, 1stride,dataedge, ray2)' write(*,*)'Value returned by he5_zawrite ',status write(1,*)'status=he5_zawrite(zaid,"Conduction",start, 1stride,dataedge, ray2)' write(1,*)'Value returned by he5_zawrite ',status endif write(*,*)' ' write(1,*)' ' iedge(1)=40 iedge(2)=40 status=he5_zawrite(zaid2,'Sensor1',istart,stride, 1iedge,ray3) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_zawrite(zaid2, "Sensor1", 1istart, stride, iedge, ray3)' write(*,*)'Value returned by he5_zawrite ',status write(1,*)'status= he5_zawrite(zaid2, "Sensor1", 1istart, stride, iedge, ray3)' write(1,*)'Value returned by he5_zawrite ',status endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zawrlattr ! write(1,27) write(*,*)'Testing he5_zawrlattr, Local Attribute ' write(*,*)'================================== ' write(1,*)'Testing he5_zawrlattr, Local Attribute ' write(1,*)'================================== ' status=he5_zawrlattr(zaid2,'Sensor1','local', 1HE5T_NATIVE_FLOAT,count,locattr) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_zawrlattr(zaid2,"Sensor1","local", 1HE5T_NATIVE_FLOAT,count,locattr)' write(*,*)'Value returned by he5_zawrlattr ',status write(1,*)'status=he5_zawrlattr(zaid2,"Sensor1", "local", 1HE5T_NATIVE_FLOAT,count,locattr)' write(1,*)'Value returned by he5_zawrlattr ',status endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zawrattr ! count(1) = 4 write(1,27) write(*,*)'Testing he5_zawrattr, Global Attribute ' write(*,*)'====================================== ' write(1,*)'Testing he5_zawrattr, Global Attribute ' write(1,*)'======================================= ' status=he5_zawrattr(zaid,'Drift',HE5T_NATIVE_INT,count, 1global_attr) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_zawrattr(zaid, "Drift", 1HE5T_NATIVE_INT, count, global_attr)' write(*,*)'Value returned by he5_zawrattr ',status write(1,*)'status=he5_zawrattr(zaid, "Drift", 1HE5T_NATIVE_INT, count, global_attr)' write(1,*)'Value returned by he5_zawrattr ',status endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zawrgattr ! count(1) = 3 write(1,27) write(*,*)'Testing he5_zawrgattr, Group Attribute ' write(*,*)'====================================== ' write(1,*)'Testing he5_zawrgattr, Group Attribute ' write(1,*)'====================================== ' status=he5_zawrgattr(zaid,'group',HE5T_NATIVE_FLOAT, 1count,grpattr) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_zawrgattr(zaid, "group", 1HE5T_NATIVE_FLOAT,count,grpgattr)' write(*,*)'Value returned by he5_zawrgattr ',status write(1,*)'status=he5_zawrgattr(zaid, "group", 1HE5T_NATIVE_FLOAT,count,grpattr)' write(1,*)'Value returned by he5_zawrgattr ',status endif write(*,*)' ' write(1,*)' ' status= he5_zadetach(zaid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_zadetach(zaid)' write(*,*)'Value returned by he5_zadetach ',status write(1,*)'status= he5_zadetach(zaid)' write(1,*)'Value returned by he5_zadetach ',status endif write(*,*)' ' write(1,*)' ' status= he5_zadetach(zaid2) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_zadetach(zaid2)' write(*,*)'Value returned by he5_zadetach ',status write(1,*)'status= he5_zadetach(zaid2)' write(1,*)'Value returned by he5_zadetach ',status endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zaclose ! write(1,27) write(*,*)'Testing he5_zaclose ' write(*,*)'===================' write(1,*)'Testing he5_zaclose ' write(1,*)'===================' status= he5_zaclose(zafid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Value returned by he5_zaclose ',status write(1,*)'status= he5_zaclose(zafid)' write(1,*)'Value returned by he5_zaclose ',status endif write(*,*)' ' write(1,*)' ' zafid= he5_zaopen('za.he5',HE5F_ACC_RDWR) if (zafid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'zafid= he5_zaopen("za.he5",HE5F_ACC_RDWR)' write(*,*)'Value returned by he5_zaopen ', zafid write(1,*)'zafid= he5_zaopen("za.he5",HE5F_ACC_RDWR)' write(1,*)'Value returned by he5_zaopen ', zafid endif write(*,*)' ' write(1,*)' ' zaid= he5_zaattach(zafid,'Simplef') if (zaid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'zaid= he5_zaattach(zafid, "Simplef")' write(*,*)'Value returned by he5_zaattach ',zaid write(1,*)'zaid= he5_zaattach(zafid, "Simplef")' write(1,*)'Value returned by he5_zaattach ',zaid endif write(*,*)' ' write(1,*)' ' status= he5_zadetach(zaid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_zadetach(zaid)' write(*,*)'Value returned by he5_zadetach ',status write(1,*)'status= he5_zadetach(zaid)' write(1,*)'Value returned by he5_zadetach ',status endif write(*,*)' ' write(1,*)' ' status= he5_zaclose(zafid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_zaclose(zafid)' write(*,*)'Value returned by he5_zaclose ',status write(1,*)'status= he5_zaclose(zafid)' write(1,*)'Value returned by he5_zaclose ',status endif write(*,*)' ' write(1,*)' ' zafid= he5_zaopen('za.he5',HE5F_ACC_RDWR) if (zafid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'zafid= he5_zaopen("za.he5",HE5F_ACC_RDWR)' write(*,*)'Value returned by he5_zaopen ',zafid write(1,*)'zafid= he5_zaopen("za.he5",HE5F_ACC_RDWR)' write(1,*)'Value returned by he5_zaopen ',zafid endif write(*,*)' ' write(1,*)' ' zaid=he5_zaattach(zafid,'Simplef') if (zaid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'zaid= he5_zaattach(zafid, "Simplef")' write(*,*)'Value returned by he5_zaattach ',zaid write(1,*)'zaid= he5_zaattach(zafid, "Simplef")' write(1,*)'Value returned by he5_zaattach ',zaid endif write(*,*)' ' write(1,*)' ' zaid2=he5_zaattach(zafid,'Indexedf') if (zaid2 .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'zaid2= he5_zaattach(zafid, "Indexedf")' write(*,*)'Value returned by he5_zaattach ',zaid2 write(1,*)'zaid2= he5_zaattach(zafid, "Indexedf")' write(1,*)'Value returned by he5_zaattach ',zaid2 endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zanentries ! write(1,27) write(*,*)'Testing he5_zanentries ' write(*,*)'=====================' write(1,*)'Testing he5_zanentries ' write(1,*)'=====================' nmaps=he5_zanentries(zaid,1,strbufsize) if (nmaps .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'nmaps= he5_zanentries(zaid, 1, strbufsize)' write(*,*)'Number of dimension mappings ',nmaps write(*,*)'Size of strbufsize ',strbufsize write(1,*)'nmaps= he5_zanentries(zaid, 1, strbufsize)' write(1,*)'Number of dimension mappings ',nmaps write(1,*)'Size of strbufsize ',strbufsize endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zainqdims ! write(1,27) write(*,*)'Testing he5_zainqdims ' write(*,*)'=====================' write(1,*)'Testing he5_zainqdims ' write(1,*)'=====================' ndims=he5_zainqdims(zaid,dimname,dims) if (ndims .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'ndims= he5_zainqdims(zaid, dimname, dims)' write(*,*)'Number of dimesions ',ndims write(*,*)'Names of dimensions ',dimname write(*,*)'Size of dimensions ',dims write(1,*)'ndims= he5_zainqdims(zaid, dimname, dims)' write(1,*)'Number of dimesions ',ndims write(1,*)'Names of dimensions ',dimname write(1,*)'Size of dimensions ',dims endif write(*,*)' ' write(1,*)' ' ndims= he5_zainqdims(zaid2, dimname, dims2) if (ndims .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'ndims=he5_zainqdims(zaid2,dimname,dims2)' write(*,*)'Number of dimesions ',ndims write(*,*)'Names of dimensions ',dimname write(*,*)'Size of dimensions ',dims2 write(1,*)'ndims=he5_zainqdims(zaid2,dimname,dims2)' write(1,*)'Number of dimesions ',ndims write(1,*)'Names of dimensions ',dimname write(1,*)'Size of dimensions ',dims2 endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zainquire ! write(1,27) write(*,*)'Testing he5_zainquire ' write(*,*)'======================' write(1,*)'Testing he5_zainquire ' write(1,*)'======================' nflds=he5_zainquire(zaid,fieldlist,rnkd,ntyped) if (nflds .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'nflds=he5_zainquire(zaid,fieldlist,rnkd,ntyped)' write(*,*)'Number of data fields in za ',nflds write(*,*)'Names of data fields ',fieldlist write(*,*)'Rank of fields ',rnkd write(*,*)'Number type of fields ',ntyped write(1,*)'nflds=he5_zainquire(zaid,fieldlist,rnkd,ntyped)' write(1,*)'Number of data fields in za ',nflds write(1,*)'Names of data fields ',fieldlist write(1,*)'Rank of fields ',rnkd write(1,*)'Number type of fields ',ntyped endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zadiminfo ! write(1,27) write(*,*)'Testing he5_zadiminfo ' write(*,*)'=====================' write(1,*)'Testing he5_zadiminfo ' write(1,*)'=====================' dimsize= he5_zadiminfo(zaid,'DataTrack') if (dimsize .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'dimsize= he5_zadiminfo(zaid, "DataTrack")' write(*,*)'Size of dimension DataTrack ',dimsize write(1,*)'dimsize= he5_zadiminfo(zaid, "DataTrack")' write(1,*)'Size of dimension DataTrack ',dimsize write(*,*)' ' write(1,*)' ' endif ! Test Case -- he5_zaread ! write(1,27) write(*,*)'Testing he5_zaread ' write(*,*)'===================' write(1,*)'Testing he5_zaread ' write(1,*)'===================' rd_start(1)=0 rd_start(2)=0 rd_stride(1)=1 rd_stride(2)=1 rd_edge(1)=40 rd_edge(2)=100 status= he5_zaread(zaid,'Conduction',rd_start, 1rd_stride,rd_edge,temp) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Value returned by he5_zaread ',status write(*,*)'status= he5_zaread(zaid, "Conduction", 1rd_start,rd_stride, rd_edge, temp)' write(1,*)'status= he5_zaread(zaid, "Conduction", 1rd_start,rd_stride, rd_edge, temp)' write(1,*)'Value returned by he5_zaread ',status do 190 index1=10,15 do 180 index2=10,15 write(*,*)'value of conduction ',temp(index1,index2) write(1,*)'value of conduction ',temp(index1,index2) 180 continue 190 continue endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zainfo ! write(1,27) write(*,*)'Testing he5_zainfo ' write(*,*)'=====================' write(1,*)'Testing he5_zainfo ' write(1,*)'=====================' status=he5_zainfo(zaid,'SideA',rank,sddims,nt, 1dimens,maxdims) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_zainfo(zaid, "SideA", 1rank, sddims, nt, dimens, maxdims)' write(*,*)'Value returned by he5_zainfo ',status write(*,*)'Rank of field sideA ',rank write(*,*)'dimension list of field sideA ',dimens write(*,*)'Size of sideA dimensions ',sddims write(*,*)'number type of field sideA ',nt write(1,*)'status= he5_zainfo(zaid, "SideA", 1rank, sddims, nt, dimens, maxdims)' write(1,*)'Value returned by he5_zainfo ',status write(1,*)'Rank of field sideA ',rank write(1,*)'dimension list of field sideA ',dimens write(1,*)'Size of sideA dimensions ',sddims write(1,*)'number type of field sideA ',nt endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zainqattrs ! write(1,27) write(*,*)'Testing he5_zainqattrs Global attributes ' write(*,*)'==================================== ' write(1,*)'Testing he5_zainqattrs Global attributes ' write(1,*)'==================================== ' nattr = he5_zainqattrs(zaid,attrlist,strbufsz2) if (nattr .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Number of global attributes in za ',nattr write(*,*)'Attribute list of za ',attrlist write(1,*)'Number of global attributes in za ',nattr write(1,*)'Attribute list of za ',attrlist write(*,*)' ' write(1,*)' ' endif ! Test Case -- he5_zaattrinfo ! write(1,27) write(*,*)'Testing he5_zaattrinfo Global attribute' write(*,*)'=======================================' write(1,*)'Testing he5_zaattrinfo Global attribute' write(1,*)'=======================================' status= he5_zaattrinfo(zaid, attrlist, n, size) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_zaattrinfo(zaid,attrlist,n,size)' write(*,*)'Value returned by he5_zaattrinfo ',status write(*,*)'Number type of attributes ',n,' Size ',size write(1,*)'status=he5_zaattrinfo(zaid,attrlist,n,size)' write(1,*)'Value returned by he5_zaattrinfo ',status write(1,*)'Number type of attributes ',n,' Size ',size endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zardattr ! write(1,27) write(*,*)'Testing he5_zardattr, Global attribute ' write(*,*)'======================================' write(1,*)'Testing he5_zardattr, Global attribute ' write(1,*)'======================================' status= he5_zardattr(zaid, attrlist, rdattr) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_zardattr(zaid,attrlist,rdattr)' write(*,*)'Value returned by he5_zardattr ',status write(*,*)'attribute ',rdattr write(1,*)'status=he5_zardattr(zaid,attrlist,rdattr)' write(1,*)'Value returned by he5_zardattr ',status write(1,*)'attribute ',rdattr endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zainqgattrs ! write(1,27) write(*,*)'Testing he5_zainqgattrs Group attributes ' write(*,*)'==================================== ' write(1,*)'Testing he5_zainqgattrs Group attributes ' write(1,*)'==================================== ' nattr = he5_zainqgattrs(zaid,attrlist,strbufsz2) if (nattr .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Number of group attributes in za ',nattr write(*,*)'Attribute list of za ',attrlist write(1,*)'Number of group attributes in za ',nattr write(1,*)'Attribute list of za ',attrlist write(*,*)' ' write(1,*)' ' endif ! Test Case -- he5_zagattrinfo ! write(1,27) write(*,*)'Testing he5_zagattrinfo Group attribute' write(*,*)'=======================================' write(1,*)'Testing he5_zagattrinfo Group attribute' write(1,*)'=======================================' status= he5_zagattrinfo(zaid, attrlist, n, size) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_zagattrinfo(zaid,attrlist,n,size)' write(*,*)'Value returned by he5_zagattrinfo ',status write(*,*)'Number type of attributes ',n,' Size ',size write(1,*)'status=he5_zagattrinfo(zaid,attrlist,n,size)' write(1,*)'Value returned by he5_zagattrinfo ',status write(1,*)'Number type of attributes ',n,' Size ',size endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zardgattr ! write(1,27) write(*,*)'Testing he5_zardgattr, Group attribute ' write(*,*)'======================================' write(1,*)'Testing he5_zardgattr, Group attribute ' write(1,*)'======================================' status= he5_zardgattr(zaid,'group',rdgnlattr) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_zardgattr(zaid,attrlist,rdgnlattr)' write(*,*)'Value returned by he5_zardgattr ',status write(*,*)'attribute ',rdgnlattr write(1,*)'status=he5_zardgattr(zaid,attrlist,rdgnlattr)' write(1,*)'Value returned by he5_zardgattr ',status write(1,*)'attribute ',rdgnlattr endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zainqlattrs ! write(1,27) write(*,*)'Testing he5_zainqlattrs Local attributes ' write(*,*)'==================================== ' write(1,*)'Testing he5_zainqlattrs Local attributes ' write(1,*)'==================================== ' nattr=he5_zainqlattrs(zaid2,'Sensor1',attrlist,strbufsz2) if (nattr .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'zainqlattrs(... "Sensor1" ...)' write(*,*)'Number of local attributes in field ',nattr write(*,*)'Attribute list of field ',attrlist write(1,*)'zainqlattrs(... "Sensor1" ...)' write(1,*)'Number of local attributes in field ',nattr write(1,*)'Attribute list of field ',attrlist write(*,*)' ' write(1,*)' ' endif ! Test Case -- he5_zalattrinfo ! write(1,27) write(*,*)'Testing he5_zalattrinfo Local attribute' write(*,*)'=======================================' write(1,*)'Testing he5_zalattrinfo Local attribute' write(1,*)'=======================================' status=he5_zalattrinfo(zaid2,'Sensor1','local',n,size) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'zalattrinfo(... "Sensor1" ...)' write(*,*)'Value returned by he5_zalattrinfo ',status write(*,*)'Number type of attributes ',n,' Size ',size write(1,*)'zalattrinfo(... "Sensor1" ...)' write(1,*)'Value returned by he5_zalattrinfo ',status write(1,*)'Number type of attributes ',n,' Size ',size endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zaidtype ! write(1,27) write(*,*)'Testing he5_zaidtype, Inquire Datatype ' write(*,*)'=======================================' write(1,*)'Testing he5_zaidtype, Inquire Datatype ' write(1,*)'=======================================' status= he5_zaidtype(zaid2,'Sensor1','local', 1HE5_HDFE_LOCATTRGROUP,dtype,classid, order, size) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_zaidtype(zaid2,"Sensor1","local", 1HE5_HDFE_LOCATTRGROUP,dtype, classid, order, size)' write(*,*)'Value returned by he5_zaidtype ',status write(*,*)'Datatype of local attribute ',dtype write(*,*)'Class id and order ',classid, order write(*,*)'Size of attribute ',size write(1,*)'status= he5_zaidtype(zaid2,"Sensor1","local", 1HE5_HDFE_LOCATTRGROUP,dtype, classid, order, size)' write(1,*)'Value returned by he5_zaidtype ',status write(1,*)'Datatype of local attribute ',dtype write(1,*)'Class id and order ',classid, order write(1,*)'Size of attribute ',size endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zardlattr ! write(1,27) write(*,*)'Testing he5_zardlattr, Local attribute ' write(*,*)'======================================' write(1,*)'Testing he5_zardlattr, Local attribute ' write(1,*)'======================================' status=he5_zardlattr(zaid2,'Sensor1','local',rdgnlattr) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_zardlattr(zaid2,"Sensor1","local", 1rdgnlattr)' write(*,*)'Value returned by he5_zardlattr ',status write(*,*)'attribute ',rdgnlattr write(1,*)'status=he5_zardlattr(zaid2,"Sensor1","local", 1rdgnlattr)' write(1,*)'Value returned by he5_zardlattr ',status write(1,*)'attribute ',rdgnlattr endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zagetfill ! write(1,27) write(*,*)'Testing he5_zagetfill ' write(*,*)'=====================' write(1,*)'Testing he5_zagetfill ' write(1,*)'=====================' status= he5_zagetfill(zaid,'Conduction', rdfilval) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_zagetfill(zaid,"Conduction",rdfilval)' write(*,*)'Value returned by he5_zagetfill ',status write(*,*)'Value of fill ',rdfilval write(1,*)'status=he5_zagetfill(zaid,"Conduction",rdfilval)' write(1,*)'Value returned by he5_zagetfill ',status write(1,*)'Value of fill ',rdfilval endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zacompinfo ! write(1,27) write(*,*)'Testing he5_zacompinfo ' write(*,*)'=======================' write(1,*)'Testing he5_zacompinfo ' write(1,*)'=======================' status=he5_zacompinfo(zaid,'CompChunk',compcode,rdcompparm) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status=he5_zacompinfo(zaid,"CompChunk",compcode, 1rdcompparm)' write(*,*)'Status returned by he5_zacompinfo ',status write(*,*)'Compression code ',compcode write(*,*)'Compression parameter ',rdcompparm(1) write(1,*)'status=he5_zacompinfo(zaid,"CompChunk",compcode, 1rdcompparm)' write(1,*)'Status returned by he5_zacompinfo ',status write(1,*)'Compression code ',compcode write(1,*)'Compression parameter ',rdcompparm(1) endif write(*,*)' ' write(1,*)' ' status= he5_zadetach(zaid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_zadetach(zaid)' write(*,*)'Value returned by he5_zadetach ',status write(1,*)'status= he5_zadetach(zaid)' write(1,*)'Value returned by he5_zadetach ',status endif write(*,*)' ' write(1,*)' ' status= he5_zadetach(zaid2) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_zadetach(zaid2)' write(*,*)'Value returned by he5_zadetach ',status write(1,*)'status= he5_zadetach(zaid2)' write(1,*)'Value returned by he5_zadetach ',status endif write(*,*)' ' write(1,*)' ' status= he5_zaclose(zafid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_zaclose(zafid)' write(*,*)'Value returned by he5_zaclose ',status write(1,*)'status= he5_zaclose(zafid)' write(1,*)'Value returned by he5_zaclose ',status endif write(*,*)' ' write(1,*)' ' zafid= he5_zaopen('za.he5',HE5F_ACC_RDWR) if (zafid .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'zafid= he5_zaopen("za.he5",HE5F_ACC_RDWR)' write(*,*)'Value returned by he5_zaopen ',zafid write(1,*)'zafid= he5_zaopen("za.he5",HE5F_ACC_RDWR)' write(1,*)'Value returned by he5_zaopen ',zafid endif write(*,*)' ' write(1,*)' ' ! Test Case -- he5_zainqza ! write(1,27) write(*,*)'Testing he5_zainqza ' write(*,*)'======================' write(1,*)'Testing he5_zainqza ' write(1,*)'======================' nza=he5_zainqza('za.he5',zalist,strbufsz2) if (nza .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'Retrieve information on zas in 1file za.he5' write(*,*)'Number of zas in file ', nza write(*,*)'List of zas ',zalist write(1,*)'Retrieve information on zas in 1file za.he5' write(1,*)'Number of zas in file ', nza write(1,*)'List of zas ',zalist endif write(*,*)' ' write(1,*)' ' status= he5_zaclose(zafid) if (status .lt. zero) then write(*,230) write(1,230) else write(*,*)' ' write(*,240) write(1,*)' ' write(1,240) write(*,*)'status= he5_zaclose(zafid)' write(*,*)'Value returned by he5_zaclose ',status write(1,*)'status= he5_zaclose(zafid)' write(1,*)'Value returned by he5_zaclose ',status endif write(*,*)' ' write(1,*)' ' close(unit=1) 27 format(' ') stop end